diff --git a/.htaccess b/.htaccess index 3a10dc4b3f..4bb57b8a5e 100644 --- a/.htaccess +++ b/.htaccess @@ -165,6 +165,24 @@ Options All -Indexes RewriteRule ^tag/([0-9-]+)(.*)?$ view/?tags_id=$1 [NC,L,QSA] + # Video URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/video/([0-9a-zA-Z_.-]+)(/.*|)$ view/modeYoutube.php?videos_id=$2&channelName=$1 [L,QSA,NC] + + # Audio Embed URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/audioEmbed/([0-9a-zA-Z_.-]+)(/.*|)$ view/videoEmbeded.php?videos_id=$2&channelName=$1&includeType=audio [L,QSA,NC] + + # Audio URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/audio/([0-9a-zA-Z_.-]+)(/.*|)$ view/modeYoutube.php?videos_id=$2&channelName=$1&includeType=audio [L,QSA,NC] + + # Video Embed URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/videoEmbed/([0-9a-zA-Z_.-]+)(/.*|)$ view/videoEmbeded.php?videos_id=$2&channelName=$1 [L,QSA,NC] + + # Article URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/article/([0-9a-zA-Z_.-]+)(/.*|)$ view/article.php?article_id=$2&channelName=$1 [L,QSA,NC] + + # Article Embed URLs with optional title or trailing slash + RewriteRule ^channel/([^/]+)/articleEmbed/([0-9a-zA-Z_.-]+)(/.*|)$ view/articleEmbed.php?article_id=$2&channelName=$1 [L,QSA,NC] + RewriteRule ^video/([0-9]+)/?$ view/modeYoutube.php?videos_id=$1 [QSA] RewriteRule ^video/([0-9]+)/poster.png$ view/videoGetPoster.php?videos_id=$1 [QSA] diff --git a/node_modules/@videojs/http-streaming/CHANGELOG.md b/node_modules/@videojs/http-streaming/CHANGELOG.md index 38373a6cc9..b379642adc 100644 --- a/node_modules/@videojs/http-streaming/CHANGELOG.md +++ b/node_modules/@videojs/http-streaming/CHANGELOG.md @@ -1,3 +1,19 @@ + +# [3.7.0](https://github.com/videojs/http-streaming/compare/v3.6.0...v3.7.0) (2023-10-12) + +### Features + +* content steering switching ([#1427](https://github.com/videojs/http-streaming/issues/1427)) ([dd5e2af](https://github.com/videojs/http-streaming/commit/dd5e2af)) + +### Bug Fixes + +* clamp seekable end ([#1433](https://github.com/videojs/http-streaming/issues/1433)) ([53edf72](https://github.com/videojs/http-streaming/commit/53edf72)) +* fmp4 captions regression ([#1434](https://github.com/videojs/http-streaming/issues/1434)) ([fcd2e8a](https://github.com/videojs/http-streaming/commit/fcd2e8a)) + +### Chores + +* update mux.js to v7.0.1 ([#1435](https://github.com/videojs/http-streaming/issues/1435)) ([2eedfba](https://github.com/videojs/http-streaming/commit/2eedfba)) + # [3.6.0](https://github.com/videojs/http-streaming/compare/v3.5.3...v3.6.0) (2023-09-25) diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js index e2c55e4d18..30003f82d5 100644 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js +++ b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming-sync-workers.js @@ -1,4 +1,4 @@ -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('video.js'), require('@xmldom/xmldom')) : typeof define === 'function' && define.amd ? define(['exports', 'video.js', '@xmldom/xmldom'], factory) : @@ -3083,10 +3083,15 @@ const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); @@ -9542,7 +9547,10 @@ }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -12611,19 +12619,33 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -20443,7 +20465,7 @@ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -28271,15 +28293,11 @@ */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -28320,15 +28338,11 @@ */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs__default["default"].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { @@ -28967,6 +28981,440 @@ return mediaTypes; }; + /** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + + class SteeringManifest { + constructor() { + this.priority_ = []; + } + + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + + get version() { + return this.version_; + } + + get ttl() { + return this.ttl_; + } + + get reloadUri() { + return this.reloadUri_; + } + + get priority() { + return this.priority_; + } + + } + /** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + + class ContentSteeringController extends videojs__default["default"].EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window.URL(steeringUrl); + const proxyServerUrlObject = new window.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + + setSteeringParams_(url) { + const urlObject = new window.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + + return [...this.availablePathways_][0]; + }; + + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + + const steeringURI = this.setSteeringParams_(reloadUri); + + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + + clearTTLTimeout_() { + window.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + + abort() { + if (this.request_) { + this.request_.abort(); + } + + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + + } + /** * @file playlist-controller.js */ @@ -29218,6 +29666,12 @@ tech.addWebVttScript_(); }) }), options); + + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { @@ -29319,6 +29773,34 @@ this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -29485,8 +29967,9 @@ let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; @@ -30138,10 +30621,23 @@ } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -30540,6 +31036,7 @@ this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); @@ -30930,6 +31427,129 @@ }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + + initContentSteeringController_() { + const initialMain = this.main(); + + if (!initialMain.contentSteering) { + return; + } + + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + + if (!currentPathway) { + return; + } + + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + + if (!shouldExclude) { + return; + } + + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + + this.switchMedia_(nextPlaylist, 'content-steering'); + } + } /** @@ -31767,9 +32387,9 @@ initPlugin(this, options); }; - var version$4 = "3.6.0"; + var version$4 = "3.7.0"; - var version$3 = "7.0.0"; + var version$3 = "7.0.1"; var version$2 = "1.2.2"; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js index 2605b19f00..7b8622f095 100644 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js +++ b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.cjs.js @@ -1,4 +1,4 @@ -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -834,10 +834,15 @@ const playlistEnd = function (playlist, expired, useSafeLiveEnd, liveEdgePadding const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); @@ -3587,7 +3592,10 @@ class DashPlaylistLoader extends EventTarget { }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -6606,19 +6614,33 @@ const workerCode$1 = transform(getWorkerString(function () { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -14438,7 +14460,7 @@ const handleSegmentBytes = ({ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -22206,15 +22228,11 @@ const onError = { */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -22255,15 +22273,11 @@ const onError = { */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs__default["default"].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { @@ -22902,6 +22916,440 @@ const createMediaTypes = () => { return mediaTypes; }; +/** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + +class SteeringManifest { + constructor() { + this.priority_ = []; + } + + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + + get version() { + return this.version_; + } + + get ttl() { + return this.ttl_; + } + + get reloadUri() { + return this.reloadUri_; + } + + get priority() { + return this.priority_; + } + +} +/** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + +class ContentSteeringController extends videojs__default["default"].EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window__default["default"].URL(steeringUrl); + const proxyServerUrlObject = new window__default["default"].URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window__default["default"].atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + + setSteeringParams_(url) { + const urlObject = new window__default["default"].URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + + return [...this.availablePathways_][0]; + }; + + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + + const steeringURI = this.setSteeringParams_(reloadUri); + + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window__default["default"].setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + + clearTTLTimeout_() { + window__default["default"].clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + + abort() { + if (this.request_) { + this.request_.abort(); + } + + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + +} + /** * @file playlist-controller.js */ @@ -23153,6 +23601,12 @@ class PlaylistController extends videojs__default["default"].EventTarget { tech.addWebVttScript_(); }) }), options); + + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { @@ -23254,6 +23708,34 @@ class PlaylistController extends videojs__default["default"].EventTarget { this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -23420,8 +23902,9 @@ class PlaylistController extends videojs__default["default"].EventTarget { let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; @@ -24073,10 +24556,23 @@ class PlaylistController extends videojs__default["default"].EventTarget { } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -24475,6 +24971,7 @@ class PlaylistController extends videojs__default["default"].EventTarget { this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); @@ -24865,6 +25362,129 @@ class PlaylistController extends videojs__default["default"].EventTarget { }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + + initContentSteeringController_() { + const initialMain = this.main(); + + if (!initialMain.contentSteering) { + return; + } + + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + + if (!currentPathway) { + return; + } + + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + + if (!shouldExclude) { + return; + } + + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + + this.switchMedia_(nextPlaylist, 'content-steering'); + } + } /** @@ -25702,9 +26322,9 @@ const reloadSourceOnError = function (options) { initPlugin(this, options); }; -var version$4 = "3.6.0"; +var version$4 = "3.7.0"; -var version$3 = "7.0.0"; +var version$3 = "7.0.1"; var version$2 = "1.2.2"; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js index 7a45d6159b..7787fd57e3 100644 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js +++ b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.es.js @@ -1,4 +1,4 @@ -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ import document from 'global/document'; import window$1 from 'global/window'; import _resolveUrl from '@videojs/vhs-utils/es/resolve-url.js'; @@ -822,10 +822,15 @@ const playlistEnd = function (playlist, expired, useSafeLiveEnd, liveEdgePadding const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); @@ -3575,7 +3580,10 @@ class DashPlaylistLoader extends EventTarget { }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -6594,19 +6602,33 @@ const workerCode$1 = transform(getWorkerString(function () { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -14426,7 +14448,7 @@ const handleSegmentBytes = ({ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -22194,15 +22216,11 @@ const onError = { */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -22243,15 +22261,11 @@ const onError = { */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { @@ -22890,6 +22904,440 @@ const createMediaTypes = () => { return mediaTypes; }; +/** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + +class SteeringManifest { + constructor() { + this.priority_ = []; + } + + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + + get version() { + return this.version_; + } + + get ttl() { + return this.ttl_; + } + + get reloadUri() { + return this.reloadUri_; + } + + get priority() { + return this.priority_; + } + +} +/** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + +class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window$1.URL(steeringUrl); + const proxyServerUrlObject = new window$1.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window$1.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + + setSteeringParams_(url) { + const urlObject = new window$1.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + + return [...this.availablePathways_][0]; + }; + + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + + const steeringURI = this.setSteeringParams_(reloadUri); + + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window$1.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + + clearTTLTimeout_() { + window$1.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + + abort() { + if (this.request_) { + this.request_.abort(); + } + + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + +} + /** * @file playlist-controller.js */ @@ -23141,6 +23589,12 @@ class PlaylistController extends videojs.EventTarget { tech.addWebVttScript_(); }) }), options); + + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { @@ -23242,6 +23696,34 @@ class PlaylistController extends videojs.EventTarget { this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -23408,8 +23890,9 @@ class PlaylistController extends videojs.EventTarget { let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; @@ -24061,10 +24544,23 @@ class PlaylistController extends videojs.EventTarget { } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -24463,6 +24959,7 @@ class PlaylistController extends videojs.EventTarget { this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); @@ -24853,6 +25350,129 @@ class PlaylistController extends videojs.EventTarget { }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + + initContentSteeringController_() { + const initialMain = this.main(); + + if (!initialMain.contentSteering) { + return; + } + + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + + if (!currentPathway) { + return; + } + + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + + if (!shouldExclude) { + return; + } + + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + + this.switchMedia_(nextPlaylist, 'content-steering'); + } + } /** @@ -25690,9 +26310,9 @@ const reloadSourceOnError = function (options) { initPlugin(this, options); }; -var version$4 = "3.6.0"; +var version$4 = "3.7.0"; -var version$3 = "7.0.0"; +var version$3 = "7.0.1"; var version$2 = "1.2.2"; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js index 306cd4ec54..1ce539a3b0 100644 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js +++ b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.js @@ -1,4 +1,4 @@ -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('video.js'), require('@xmldom/xmldom')) : typeof define === 'function' && define.amd ? define(['exports', 'video.js', '@xmldom/xmldom'], factory) : @@ -3083,10 +3083,15 @@ const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); @@ -9542,7 +9547,10 @@ }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -12561,19 +12569,33 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -20393,7 +20415,7 @@ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -28221,15 +28243,11 @@ */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -28270,15 +28288,11 @@ */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs__default["default"].log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { @@ -28917,6 +28931,440 @@ return mediaTypes; }; + /** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + + class SteeringManifest { + constructor() { + this.priority_ = []; + } + + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + + get version() { + return this.version_; + } + + get ttl() { + return this.ttl_; + } + + get reloadUri() { + return this.reloadUri_; + } + + get priority() { + return this.priority_; + } + + } + /** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + + class ContentSteeringController extends videojs__default["default"].EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window.URL(steeringUrl); + const proxyServerUrlObject = new window.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + + setSteeringParams_(url) { + const urlObject = new window.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + + return [...this.availablePathways_][0]; + }; + + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + + const steeringURI = this.setSteeringParams_(reloadUri); + + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + + clearTTLTimeout_() { + window.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + + abort() { + if (this.request_) { + this.request_.abort(); + } + + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + + } + /** * @file playlist-controller.js */ @@ -29168,6 +29616,12 @@ tech.addWebVttScript_(); }) }), options); + + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { @@ -29269,6 +29723,34 @@ this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -29435,8 +29917,9 @@ let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; @@ -30088,10 +30571,23 @@ } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -30490,6 +30986,7 @@ this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); @@ -30880,6 +31377,129 @@ }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + + initContentSteeringController_() { + const initialMain = this.main(); + + if (!initialMain.contentSteering) { + return; + } + + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + + if (!currentPathway) { + return; + } + + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + + if (!shouldExclude) { + return; + } + + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + + this.switchMedia_(nextPlaylist, 'content-steering'); + } + } /** @@ -31717,9 +32337,9 @@ initPlugin(this, options); }; - var version$4 = "3.6.0"; + var version$4 = "3.7.0"; - var version$3 = "7.0.0"; + var version$3 = "7.0.1"; var version$2 = "1.2.2"; diff --git a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js index b6b2b5aebb..a000a90708 100644 --- a/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js +++ b/node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js @@ -1,5 +1,5 @@ -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("video.js"),require("@xmldom/xmldom")):"function"==typeof define&&define.amd?define(["exports","video.js","@xmldom/xmldom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).httpStreaming={},e.videojs,e.window)}(this,(function(e,t,i){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(t),a={exports:{}};!function(e,t){!function(t){var i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,n=/^([^\/?#]*)([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,r={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var s=r.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");return s.path=r.normalizePath(s.path),r.buildURLFromParts(s)}var a=r.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=r.normalizePath(a.path),r.buildURLFromParts(a)):t;var o=r.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var d=n.exec(o.path);o.netLoc=d[1],o.path=d[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var l=o.path,h=l.substring(0,l.lastIndexOf("/")+1)+a.path;u.path=r.normalizePath(h)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=i.alwaysNormalize?r.normalizePath(a.path):a.path),r.buildURLFromParts(u)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=r}()}(a);var r=a.exports,o="http://example.com",d=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,n=/^\/\//.test(e),s=!window.location&&!/\/\//i.test(e);if(i?e=new window.URL(e,window.location||o):/\/\//i.test(e)||(e=r.buildAbsoluteURL(window.location&&window.location.href||"",e)),i){var a=new URL(t,e);return s?a.href.slice(o.length):n?a.href.slice(a.protocol.length):a.href}return r.buildAbsoluteURL(e,t)};const u=d,l=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,h=e=>s.default.log.debug?s.default.log.debug.bind(s.default,"VHS:",`${e} >`):function(){};function c(){return c=Object.assign||function(e){for(var t=1;t-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const f=String.fromCharCode(9),y=function(e){const t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},_=function(e){const t={};if(!e)return t;const i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let n,s=i.length;for(;s--;)""!==i[s]&&(n=/([^=]*)=(.*)/.exec(i[s]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),t[n[0]]=n[1]);return t};class T extends p{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(((t,i)=>{const n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((e=>{for(let t=0;te),this.customParsers.push((s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:i(s),customType:t,segment:n}),!0}))}addTagMapper({expression:e,map:t}){this.tagMappers.push((i=>e.test(i)?t(i):i))}}const b=function(e){const t={};return Object.keys(e).forEach((function(i){var n;t[(n=i,n.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase())))]=e[i]})),t},S=function(e){const{serverControl:t,targetDuration:i,partTargetDuration:n}=e;if(!t)return;const s="#EXT-X-SERVER-CONTROL",a="holdBack",r="partHoldBack",o=i&&3*i,d=n&&2*n;i&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[a]{s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof d||(s.timeline=d),this.manifest.preloadSegment=s)})),this.parseStream.on("data",(function(p){let g,f;({tag(){({version(){p.version&&(this.manifest.version=p.version)},"allow-cache"(){this.manifest.allowCache=p.allowed,"allowed"in p||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const e={};"length"in p&&(s.byterange=e,e.length=p.length,"offset"in p||(p.offset=u)),"offset"in p&&(s.byterange=e,e.offset=p.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),p.title&&(s.title=p.title),p.duration>0&&(s.duration=p.duration),0===p.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(p.attributes)if("NONE"!==p.attributes.METHOD)if(p.attributes.URI){if("com.apple.streamingkeydelivery"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:p.attributes});if("com.microsoft.playready"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:p.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===p.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(p.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===p.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==p.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):p.attributes.KEYID&&"0x"===p.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:p.attributes.KEYFORMAT,keyId:p.attributes.KEYID.substring(2)},pssh:m(p.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));p.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:p.attributes.METHOD||"AES-128",uri:p.attributes.URI},void 0!==p.attributes.IV&&(n.iv=p.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(p.number)?this.manifest.mediaSequence=p.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+p.number})},"discontinuity-sequence"(){isFinite(p.number)?(this.manifest.discontinuitySequence=p.number,d=p.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+p.number})},"playlist-type"(){/VOD|EVENT/.test(p.playlistType)?this.manifest.playlistType=p.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+p.playlist})},map(){i={},p.uri&&(i.uri=p.uri),p.byterange&&(i.byterange=p.byterange),n&&(i.key=n)},"stream-inf"(){this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||o,p.attributes?(s.attributes||(s.attributes={}),c(s.attributes,p.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,!(p.attributes&&p.attributes.TYPE&&p.attributes["GROUP-ID"]&&p.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const e=this.manifest.mediaGroups[p.attributes.TYPE];e[p.attributes["GROUP-ID"]]=e[p.attributes["GROUP-ID"]]||{},g=e[p.attributes["GROUP-ID"]],f={default:/yes/i.test(p.attributes.DEFAULT)},f.default?f.autoselect=!0:f.autoselect=/yes/i.test(p.attributes.AUTOSELECT),p.attributes.LANGUAGE&&(f.language=p.attributes.LANGUAGE),p.attributes.URI&&(f.uri=p.attributes.URI),p.attributes["INSTREAM-ID"]&&(f.instreamId=p.attributes["INSTREAM-ID"]),p.attributes.CHARACTERISTICS&&(f.characteristics=p.attributes.CHARACTERISTICS),p.attributes.FORCED&&(f.forced=/yes/i.test(p.attributes.FORCED)),g[p.attributes.NAME]=f},discontinuity(){d+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=p.dateTimeString,this.manifest.dateTimeObject=p.dateTimeObject),s.dateTimeString=p.dateTimeString,s.dateTimeObject=p.dateTimeObject;const{lastProgramDateTime:e}=this;this.lastProgramDateTime=new Date(p.dateTimeString).getTime(),null===e&&this.manifest.segments.reduceRight(((e,t)=>(t.programDateTime=e-1e3*t.duration,t.programDateTime)),this.lastProgramDateTime)},targetduration(){!isFinite(p.duration)||p.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+p.duration}):(this.manifest.targetDuration=p.duration,S.call(this,this.manifest))},start(){p.attributes&&!isNaN(p.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:p.attributes["TIME-OFFSET"],precise:p.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){s.cueOut=p.data},"cue-out-cont"(){s.cueOutCont=p.data},"cue-in"(){s.cueIn=p.data},skip(){this.manifest.skip=b(p.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",p.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const e=this.manifest.segments.length,t=b(p.attributes);s.parts=s.parts||[],s.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=l),l=t.byterange.offset+t.byterange.length);const i=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${e}`,p.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const e=this.manifest.serverControl=b(p.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),S.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const e=this.manifest.segments.length,t=b(p.attributes),i=t.type&&"PART"===t.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?l:0,i&&(l=t.byterange.offset+t.byterange.length)));const n=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${n} for segment #${e}`,p.attributes,["TYPE","URI"]),t.type)for(let i=0;ie.id===t.id));this.manifest.dateRanges[e]=c(this.manifest.dateRanges[e],t),h[t.id]=c(h[t.id],t),this.manifest.dateRanges.pop()}else h[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=b(p.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",p.attributes,["SERVER-URI"])}}[p.tagType]||r).call(e)},uri(){s.uri=p.uri,t.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=d,i&&(s.map=i),l=0,null!==this.lastProgramDateTime&&(s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*s.duration),s={}},comment(){},custom(){p.segment?(s.custom=s.custom||{},s.custom[p.customType]=p.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[p.customType]=p.data)}})[p.type].call(e)}))}warnOnMissingAttributes_(e,t,i){const n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var w={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},E=["video","audio","text"],I=["Video","Audio","Text"],A=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},D=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),E.forEach((function(n){var s=w[n].exec(e.toLowerCase());if(s&&!(s.length<=1)){t=n;var a=e.substring(0,s[1].length),r=e.replace(a,"");i.push({type:a,details:r,mediaType:n})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},L=function(e){return void 0===e&&(e=""),w.audio.test(e.trim().toLowerCase())},x=function(e){if(e&&"string"==typeof e){var t,i=e.toLowerCase().split(",").map((function(e){return A(e.trim())})),n="video";1===i.length&&L(i[0])?n="audio":1===i.length&&(void 0===(t=i[0])&&(t=""),w.text.test(t.trim().toLowerCase()))&&(n="application");var s="mp4";return i.every((function(e){return w.mp4.test(e)}))?s="mp4":i.every((function(e){return w.webm.test(e)}))?s="webm":i.every((function(e){return w.ogg.test(e)}))&&(s="ogg"),n+"/"+s+';codecs="'+e+'"'}},k=function(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(x(e))||!1},O=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t=t}))},F=function(e,t){return N(e,(function(e){return e-R>=t}))},$=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},q=e=>{const t=[];for(let i=0;ia||(i+=t>s&&t<=a?a-t:a-s)}return i},V=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},H=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(n,s){e.push({duration:n.duration,segmentIndex:i,partIndex:s,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),X=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},j=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:i}=e;let n=(i||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return n+=t&&t.length?t.length:0,n},z=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;const i=X(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Y=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),tn&&([i,n]=[n,i]),i<0){for(let t=i;tDate.now()},ee=function(e){return e.excludeUntil&&e.excludeUntil===1/0},te=function(e){const t=Z(e);return!e.disabled&&!t},ie=function(e,t){return t.attributes&&t.attributes[e]},ne=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!te(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),ae=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let n=!1;for(const e in i){for(const s in i[e])if(n=t(i[e][s]),n)break;if(n)break}return!!n},re=e=>{if(!e||!e.playlists||!e.playlists.length)return ae(e,(e=>e.playlists&&e.playlists.length||e.uri));for(let t=0;tL(e))))&&!ae(e,(e=>se(i,e))))return!1}return!0};var oe={liveEdgeDelay:z,duration:Q,seekable:function(e,t,i){const n=t||0,s=J(e,t,!0,i);return null===s?C():C(n,s)},getMediaInfoForTime:function({playlist:e,currentTime:t,startingSegmentIndex:i,startingPartIndex:n,startTime:s,exactManifestTimings:a}){let r=t-s;const o=H(e);let d=0;for(let e=0;e0)for(let t=d-1;t>=0;t--){const i=o[t];if(r+=i.duration,a){if(r<0)continue}else if(r+R<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s-K({defaultDuration:e.targetDuration,durationList:o,startIndex:d,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(d<0){for(let i=d;i<0;i++)if(r-=e.targetDuration,r<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};d=0}for(let t=d;t0)continue}else if(r-R>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s+K({defaultDuration:e.targetDuration,durationList:o,startIndex:d,endIndex:t})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:te,isDisabled:function(e){return e.disabled},isExcluded:Z,isIncompatible:ee,playlistEnd:J,isAes:function(e){for(let t=0;t`${e}-${t}`,le=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,he=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const n in e.mediaGroups[i])for(const s in e.mediaGroups[i][n]){const a=e.mediaGroups[i][n][s];t(a,i,n,s)}}))},ce=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},pe=(e,t,i=le)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(n&&"AUDIO"===s&&!t.uri)for(let t=0;t{let t=e.playlists.length;for(;t--;){const i=e.playlists[t];ce({playlist:i,id:ue(t,i.uri)}),i.resolvedUri=u(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||de.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(e),(e=>{he(e,(t=>{t.uri&&(t.resolvedUri=u(e.uri,t.uri))}))})(e)};class me{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(null!==this.offset_)return;if(!e.length)return;const[t]=e;void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce(((e,t)=>(e.set(t.id,t),e)),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const e={},t=[];this.pendingDateRanges_.forEach(((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),i.class))if(e[i.class]){const t=e[i.class].push(i);i.classListIndex=t-1}else e[i.class]=[i],i.classListIndex=0}));for(const i of t){const t=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&t[i.classListIndex+1]?i.endTime=t[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach(((t,i)=>{t.startDate.getTime(){if(!e)return t;const i=U(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let n=0;n{!e.resolvedUri&&e.uri&&(e.resolvedUri=u(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=u(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=u(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=u(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=u(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=u(t,e.uri))}))},_e=function(e){const t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;ee===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,be=(e,t,i=Te)=>{const n=U(e,{}),s=n.playlists[t.id];if(!s)return null;if(i(s,t))return null;t.segments=_e(t);const a=U(s,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,s.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{const n=e.slice(),s=t.slice();i=i||0;const a=[];let r;for(let e=0;e{ye(e,a.resolvedUri)}));for(let e=0;e{if(e.playlists)for(let i=0;i{const i=e.segments||[],n=i[i.length-1],s=n&&n.parts&&n.parts[n.parts.length-1],a=s&&s.duration||n&&n.duration;return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)};class ve extends ge{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=h("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new me,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=u(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(t.endList||!t.serverControl)return e;const i={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let n=t.mediaSequence+t.segments.length;if(e){const s=e.parts||[],a=j(t)-1;a>-1&&a!==s.length-1&&(i._HLS_part=a),(a>-1||s.length)&&n--}i._HLS_msn=n}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const t=new window.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])})),e=t.toString()}return e})(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,i){const{uri:n,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return(({onwarn:e,oninfo:t,manifestString:i,customTagParsers:n=[],customTagMappers:s=[],llhls:a})=>{const r=new v;e&&r.on("warn",e),t&&r.on("info",t),n.forEach((e=>r.addParser(e))),s.forEach((e=>r.addTagMapper(e))),r.push(i),r.end();const o=r.manifest;if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),e&&e(`manifest has no targetDuration defaulting to ${t}`),o.targetDuration=t}const d=X(o);if(d.length&&!o.partTargetDuration){const t=d.reduce(((e,t)=>Math.max(e,t.duration)),0);e&&(e(`manifest has no partTargetDuration defaulting to ${t}`),de.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=t}return o})({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const s=t||this.parseManifest_({url:i,manifestString:e});s.lastRequest=Date.now(),ce({playlist:s,uri:i,id:n});const a=be(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Se(this.media(),!!a)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new me,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(window.clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,e,!1),t))}const i=this.state,n=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Se(e,!0)),n){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},((t,n)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=l(e.resolvedUri,n),t)return this.playlistRequestError(this.request,e,i);this.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=l(this.src,t);const i=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(i)}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,pe(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=_e(e),e.segments.forEach((t=>{ye(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||window.location.href;this.main=((e,t)=>{const i=ue(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n})(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:we}=s.default,Ee=function(e,t,i,n){const s="arraybuffer"===e.responseType?e.response:e.responseText;!t&&s&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=s.byteLength||s.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(s||e.responseText)))),n(t,e)},Ie=function(){const e=function e(t,i){t=U({timeout:45e3},t);const n=e.beforeRequest||s.default.Vhs.xhr.beforeRequest,a=e._requestCallbackSet||s.default.Vhs.xhr._requestCallbackSet||new Set,r=e._responseCallbackSet||s.default.Vhs.xhr._responseCallbackSet;n&&"function"==typeof n&&(s.default.log.warn("beforeRequest is deprecated, use onRequest instead."),a.add(n));const o=!0===s.default.Vhs.xhr.original?we:s.default.Vhs.xhr,d=((e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach((e=>{i=e(i)})),i})(a,t);a.delete(n);const u=o(d||t,(function(e,t){return((e,t,i,n)=>{e&&e.size&&e.forEach((e=>{e(t,i,n)}))})(r,u,e,t),Ee(u,e,t,i)})),l=u.abort;return u.abort=function(){return u.aborted=!0,l.apply(u,arguments)},u.uri=t.uri,u.requestTime=Date.now(),u};return e.original=!0,e},Ae=function(e){const t={};return e.byterange&&(t.Range=function(e){let t;const i=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t}(e.byterange)),t};var De,Le,xe=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,ke=/^application\/dash\+xml/i,Oe=function(e){return xe.test(e)?"hls":ke.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Pe=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Ue=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Pe(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ce=window.BigInt||Number,Re=[Ce("0x1"),Ce("0x100"),Ce("0x10000"),Ce("0x1000000"),Ce("0x100000000"),Ce("0x10000000000"),Ce("0x1000000000000"),Ce("0x100000000000000"),Ce("0x10000000000000000")];De=new Uint16Array([65484]),255===(Le=new Uint8Array(De.buffer,De.byteOffset,De.byteLength))[0]||Le[0];var Me=function(e,t){var i=void 0===t?{}:t,n=i.signed,s=void 0!==n&&n,a=i.le,r=void 0!==a&&a;e=Ue(e);var o=r?"reduce":"reduceRight",d=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var s=r?n:Math.abs(n+1-e.length);return t+Ce(i)*Re[s]}),Ce(0));if(s){var u=Re[e.length]/Ce(2)-Ce(1);(d=Ce(d))>u&&(d-=u,d-=u,d-=Ce(2))}return Number(d)},Ne=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n=t.length&&d.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))};const Fe=function(e,t){return e.start(t)+"-"+e.end(t)},$e=function(e,t){const i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},qe=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Ge=function(e){const t={};return Object.keys(e).forEach((i=>{const n=e[i];Pe(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},We=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Ve=function(e){return e.resolvedUri},He=e=>{const t=Array.prototype.slice.call(e),i=16;let n,s,a="";for(let e=0;eHe(e),textRanges:e=>{let t,i="";for(t=0;t{if(!r)throw new Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!n)return r({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!a.hasStarted_)return r({message:"player must be playing a live stream to start buffering"});if(!(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let n=t.segments[0];if(inew Date(a.getTime()+1e3*r)?null:(i>new Date(a)&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:oe.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})})(e,t);if(!o)return r({message:`${e} was not found in the stream`});const d=o.segment,u=((e,t)=>{let i,n;try{i=new Date(e),n=new Date(t)}catch(e){}const s=i.getTime();return(n.getTime()-s)/1e3})(d.dateTimeObject,e);if("estimate"===o.type)return 0===i?r({message:`${e} is not buffered yet. Try again`}):(n(o.estimatedStart+u),void a.one("seeked",(()=>{je({programTime:e,playlist:t,retryCount:i-1,seekTo:n,pauseAfterSeek:s,tech:a,callback:r})})));const l=d.start+u;a.one("seeked",(()=>r(null,a.currentTime()))),s&&a.pause(),n(l)},ze=e=>!!e&&"object"==typeof e,Ye=(...e)=>e.reduce(((e,t)=>("object"!=typeof t||Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ze(e[i])&&ze(t[i])?e[i]=Ye(e[i],t[i]):e[i]=t[i]})),e)),{}),Qe=e=>Object.keys(e).map((t=>e[t])),Ke=e=>e.reduce(((e,t)=>e.concat(t)),[]),Je=e=>{if(!e.length)return[];const t=[];for(let i=0;i{const s={uri:t,resolvedUri:d(e||"",t)};if(i||n){const e=(i||n).split("-");let t,a=window.BigInt?window.BigInt(e[0]):parseInt(e[0],10),r=window.BigInt?window.BigInt(e[1]):parseInt(e[1],10);a(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),tt={static(e){const{duration:t,timescale:i=1,sourceDuration:n,periodDuration:s}=e,a=et(e.endNumber),r=t/i;return"number"==typeof a?{start:0,end:a}:"number"==typeof s?{start:0,end:s/r}:{start:0,end:n/r}},dynamic(e){const{NOW:t,clientOffset:i,availabilityStartTime:n,timescale:s=1,duration:a,periodStart:r=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:d=1/0}=e,u=et(e.endNumber),l=(t+i)/1e3,h=n+r,c=l+o-h,p=Math.ceil(c*s/a),m=Math.floor((l-h-d)*s/a),g=Math.floor((l-h)*s/a);return{start:Math.max(0,m),end:"number"==typeof u?u:Math.min(p,g)}}},it=e=>{const{type:t,duration:i,timescale:n=1,periodDuration:s,sourceDuration:a}=e,{start:r,end:o}=tt[t](e),d=((e,t)=>{const i=[];for(let n=e;nt=>{const{duration:i,timescale:n=1,periodStart:s,startNumber:a=1}=e;return{number:a+t,duration:i/n,timeline:s,time:t*i}})(e));if("static"===t){const e=d.length-1,t="number"==typeof s?s:a;d[e].duration=t-i/n*e}return d},nt=e=>{const{baseUrl:t,initialization:i={},sourceDuration:n,indexRange:s="",periodStart:a,presentationTime:r,number:o=0,duration:d}=e;if(!t)throw new Error("NO_BASE_URL");const u=Ze({baseUrl:t,source:i.sourceURL,range:i.range}),l=Ze({baseUrl:t,source:t,indexRange:s});if(l.map=u,d){const t=it(e);t.length&&(l.duration=t[0].duration,l.timeline=t[0].timeline)}else n&&(l.duration=n,l.timeline=a);return l.presentationTime=r||a,l.number=o,[l]},st=(e,t,i)=>{const n=e.sidx.map?e.sidx.map:null,s=e.sidx.duration,a=e.timeline||0,r=e.sidx.byterange,o=r.offset+r.length,d=t.timescale,u=t.references.filter((e=>1!==e.referenceType)),l=[],h=e.endList?"static":"dynamic",c=e.sidx.timeline;let p,m=c,g=e.mediaSequence||0;p="bigint"==typeof t.firstOffset?window.BigInt(o)+t.firstOffset:o+t.firstOffset;for(let e=0;e{return(t=e,i=({timeline:e})=>e,Qe(t.reduce(((e,t)=>(t.forEach((t=>{e[i(t)]=t})),e)),{}))).sort(((e,t)=>e.timeline>t.timeline?1:-1));var t,i},ot=e=>{let t=[];var i,n;return i=e,n=(e,i,n,s)=>{t=t.concat(e.playlists||[])},at.forEach((function(e){for(var t in i.mediaGroups[e])for(var s in i.mediaGroups[e][t]){var a=i.mediaGroups[e][t][s];n(a)}})),t},dt=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},ut=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`})(e.byterange),lt=e=>{const t=e.reduce((function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e}),{});let i=[];return Object.values(t).forEach((e=>{const t=Qe(e.reduce(((e,t)=>{const i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{}));i=i.concat(t)})),i.map((e=>{var t;return e.discontinuityStarts=(t=e.segments||[],"discontinuity",t.reduce(((e,t,i)=>(t.discontinuity&&e.push(i),e)),[])),e}))},ht=(e,t)=>{const i=ut(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&st(e,n,e.sidx.resolvedUri),e},ct=(e,t={})=>{if(!Object.keys(t).length)return e;for(const i in e)e[i]=ht(e[i],t);return e},pt=({attributes:e,segments:t,sidx:i,discontinuityStarts:n})=>{const s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:n,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},mt=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,gt=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,ft=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,yt=e=>e?Object.keys(e).reduce(((t,i)=>{const n=e[i];return t.concat(n.playlists)}),[]):[],_t=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:n={},previousManifest:s,eventStream:a})=>{if(!e.length)return{};const{sourceDuration:r,type:o,suggestedPresentationDelay:d,minimumUpdatePeriod:u}=e[0].attributes,l=lt(e.filter(mt)).map(pt),h=lt(e.filter(gt)),c=lt(e.filter(ft)),p=e.map((e=>e.attributes.captionServices)).filter(Boolean),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:r,playlists:ct(l,n)};u>=0&&(m.minimumUpdatePeriod=1e3*u),t&&(m.locations=t),i&&(m.contentSteering=i),"dynamic"===o&&(m.suggestedPresentationDelay=d),a&&a.length>0&&(m.eventStream=a);const g=0===m.playlists.length,f=h.length?((e,t={},i=!1)=>{let n;const s=e.reduce(((e,s)=>{const a=s.attributes.role&&s.attributes.role.value||"",r=s.attributes.lang||"";let o=s.attributes.label||"main";if(r&&!s.attributes.label){const e=a?` (${a})`:"";o=`${s.attributes.lang}${e}`}e[o]||(e[o]={language:r,autoselect:!0,default:"main"===a,playlists:[],uri:""});const d=ht((({attributes:e,segments:t,sidx:i,mediaSequence:n,discontinuitySequence:s,discontinuityStarts:a},r)=>{const o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:s,discontinuityStarts:a,timelineStarts:e.timelineStarts,mediaSequence:n,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),e.serviceLocation&&(o.attributes.serviceLocation=e.serviceLocation),i&&(o.sidx=i),r&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o})(s,i),t);return e[o].playlists.push(d),void 0===n&&"main"===a&&(n=s,n.default=!0),e}),{});return n||(s[Object.keys(s)[0]].default=!0),s})(h,n,g):null,y=c.length?((e,t={})=>e.reduce(((e,i)=>{const n=i.attributes.label||i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(ht((({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:n,discontinuitySequence:s})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);const a={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};e.codecs&&(a.CODECS=e.codecs);const r={attributes:a,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:n,discontinuitySequence:s,mediaSequence:i,segments:t};return e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),r})(i),t)),e}),{}))(c,n):null,_=l.concat(yt(f),yt(y)),T=_.map((({timelineStarts:e})=>e));var b,S;return m.timelineStarts=rt(T),b=_,S=m.timelineStarts,b.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=S.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))})),f&&(m.mediaGroups.AUDIO.audio=f),y&&(m.mediaGroups.SUBTITLES.subs=y),p.length&&(m.mediaGroups["CLOSED-CAPTIONS"].cc=p.reduce(((e,t)=>t?(t.forEach((t=>{const{channel:i,language:n}=t;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e),{})),s?(({oldManifest:e,newManifest:t})=>{const i=e.playlists.concat(ot(e)),n=t.playlists.concat(ot(t));return t.timelineStarts=rt([e.timelineStarts,t.timelineStarts]),(({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));const n=((e,t)=>{for(let i=0;in.timeline||n.segments.length&&t.timeline>n.segments[n.segments.length-1].timeline)&&t.discontinuitySequence--);n.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),dt({playlist:t,mediaSequence:n.segments[a].number})}))})({oldPlaylists:i,newPlaylists:n,timelineStarts:t.timelineStarts}),t})({oldManifest:s,newManifest:m}):m},Tt=(e,t,i)=>{const{NOW:n,clientOffset:s,availabilityStartTime:a,timescale:r=1,periodStart:o=0,minimumUpdatePeriod:d=0}=e,u=(n+s)/1e3+d-(a+o);return Math.ceil((u*r-t)/i)},bt=(e,t)=>{const{type:i,minimumUpdatePeriod:n=0,media:s="",sourceDuration:a,timescale:r=1,startNumber:o=1,periodStart:d}=e,u=[];let l=-1;for(let h=0;hl&&(l=g),m<0){const o=h+1;f=o===t.length?"dynamic"===i&&n>0&&s.indexOf("$Number$")>0?Tt(e,l,p):(a*r-l)/p:(t[o].t-l)/p}else f=m+1;const y=o+u.length+f;let _=o+u.length;for(;_e.replace(St,(e=>(t,i,n,s)=>{if("$$"===t)return"$";if(void 0===e[i])return t;const a=""+e[i];return"RepresentationID"===i?a:(s=n?parseInt(s,10):1,a.length>=s?a:`${new Array(s-a.length+1).join("0")}${a}`)})(t)),wt=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=e,s=Ze({baseUrl:e.baseUrl,source:vt(n.sourceURL,i),range:n.range}),a=((e,t)=>e.duration||t?e.duration?it(e):bt(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}])(e,t);return a.map((t=>{i.Number=t.number,i.Time=t.time;const n=vt(e.media||"",i),a=e.timescale||1,r=e.presentationTimeOffset||0,o=e.periodStart+(t.time-r)/a;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:d(e.baseUrl||"",n),map:s,number:t.number,presentationTime:o}}))},Et=(e,t)=>{const{duration:i,segmentUrls:n=[],periodStart:s}=e;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");const a=n.map((t=>((e,t)=>{const{baseUrl:i,initialization:n={}}=e,s=Ze({baseUrl:i,source:n.sourceURL,range:n.range}),a=Ze({baseUrl:i,source:t.media,range:t.mediaRange});return a.map=s,a})(e,t)));let r;return i&&(r=it(e)),t&&(r=bt(e,t)),r.map(((t,i)=>{if(a[i]){const n=a[i],r=e.timescale||1,o=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=s+(t.time-o)/r,n}})).filter((e=>e))},It=({attributes:e,segmentInfo:t})=>{let i,n;t.template?(n=wt,i=Ye(e,t.template)):t.base?(n=nt,i=Ye(e,t.base)):t.list&&(n=Et,i=Ye(e,t.list));const s={attributes:e};if(!n)return s;const a=n(i,t.segmentTimeline);if(i.duration){const{duration:e,timescale:t=1}=i;i.duration=e/t}else a.length?i.duration=a.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0;return s.attributes=i,s.segments=a,t.base&&i.indexRange&&(s.sidx=a[0],s.segments=[]),s},At=(e,t)=>Je(e.childNodes).filter((({tagName:e})=>e===t)),Dt=e=>e.textContent.trim(),Lt=e=>{const t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;const[i,n,s,a,r,o]=t.slice(1);return 31536e3*parseFloat(i||0)+2592e3*parseFloat(n||0)+86400*parseFloat(s||0)+3600*parseFloat(a||0)+60*parseFloat(r||0)+parseFloat(o||0)},xt={mediaPresentationDuration:e=>Lt(e),availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:e=>Lt(e),suggestedPresentationDelay:e=>Lt(e),type:e=>e,timeShiftBufferDepth:e=>Lt(e),start:e=>Lt(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>(e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))))(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){const t=parseInt(e,10);return isNaN(t)?Lt(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},kt=e=>e&&e.attributes?Je(e.attributes).reduce(((e,t)=>{const i=xt[t.name]||xt.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},Ot={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Pt=(e,t)=>t.length?Ke(e.map((function(e){return t.map((function(t){const i=Dt(t),n=d(e.baseUrl,i),s=Ye(kt(t),{baseUrl:n});return n!==i&&!s.serviceLocation&&e.serviceLocation&&(s.serviceLocation=e.serviceLocation),s}))}))):e,Ut=e=>{const t=At(e,"SegmentTemplate")[0],i=At(e,"SegmentList")[0],n=i&&At(i,"SegmentURL").map((e=>Ye({tag:"SegmentURL"},kt(e)))),s=At(e,"SegmentBase")[0],a=i||t,r=a&&At(a,"SegmentTimeline")[0],o=i||s||t,d=o&&At(o,"Initialization")[0],u=t&&kt(t);u&&d?u.initialization=d&&kt(d):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});const l={template:u,segmentTimeline:r&&At(r,"S").map((e=>kt(e))),list:i&&Ye(kt(i),{segmentUrls:n,initialization:kt(d)}),base:s&&Ye(kt(s),{initialization:kt(d)})};return Object.keys(l).forEach((e=>{l[e]||delete l[e]})),l},Ct=e=>Ke(At(e.node,"EventStream").map((t=>{const i=kt(t),n=i.schemeIdUri;return At(t,"Event").map((t=>{const s=kt(t),a=s.presentationTime||0,r=i.timescale||1,o=s.duration||0,d=a/r+e.attributes.start;return{schemeIdUri:n,value:i.value,id:s.id,start:d,end:d+o/r,messageData:Dt(t)||s.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),Rt=(e,t)=>(i,n)=>{const s=Pt(t,At(i.node,"BaseURL")),a=Ye(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(a.periodDuration=i.attributes.duration);const r=At(i.node,"AdaptationSet"),o=Ut(i.node);return Ke(r.map(((e,t,i)=>n=>{const s=kt(n),a=Pt(t,At(n,"BaseURL")),r=At(n,"Role")[0],o={role:kt(r)};let d=Ye(e,s,o);const u=At(n,"Accessibility")[0],l="urn:scte:dash:cc:cea-608:2015"===(h=kt(u)).schemeIdUri?("string"!=typeof h.value?[]:h.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===h.schemeIdUri?("string"!=typeof h.value?[]:h.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[i,n=""]=e.split("=");t.channel=i,t.language=e,n.split(",").forEach((e=>{const[i,n]=e.split(":");"lang"===i?t.language=n:"er"===i?t.easyReader=Number(n):"war"===i?t.aspectRatio=Number(n):"3D"===i&&(t["3D"]=Number(n))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;var h;l&&(d=Ye(d,{captionServices:l}));const c=At(n,"Label")[0];if(c&&c.childNodes.length){const e=c.childNodes[0].nodeValue.trim();d=Ye(d,{label:e})}const p=At(n,"ContentProtection").reduce(((e,t)=>{const i=kt(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const n=Ot[i.schemeIdUri];if(n){e[n]={attributes:i};const s=At(t,"cenc:pssh")[0];if(s){const t=Dt(s);e[n].pssh=t&&m(t)}}return e}),{});Object.keys(p).length&&(d=Ye(d,{contentProtection:p}));const g=Ut(n),f=At(n,"Representation"),y=Ye(i,g);return Ke(f.map(((e,t,i)=>n=>{const s=At(n,"BaseURL"),a=Pt(t,s),r=Ye(e,kt(n)),o=Ut(n);return a.map((e=>({segmentInfo:Ye(i,o),attributes:Ye(r,e)})))})(d,a,y)))})(a,s,o)))},Mt=(e,t)=>{if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;const i=Ye({serverURL:Dt(e[0])},kt(e[0]));return i.queryBeforeStart="true"===i.queryBeforeStart,i},Nt=e=>{if(""===e)throw new Error("DASH_EMPTY_MANIFEST");const t=new i.DOMParser;let n,s;try{n=t.parseFromString(e,"application/xml"),s=n&&"MPD"===n.documentElement.tagName?n.documentElement:null}catch(e){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return s};var Bt=Math.pow(2,32),Ft=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))>4?n+20:n+10}(t,i),e(t,i))},Gt=function(e){return"string"==typeof e?Ne(e):e},Wt=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return Gt(e)})):[Gt(e)]}(i),t=Ue(t);var s=[];if(!i.length)return s;for(var a=0;a>>0,o=t.subarray(a+4,a+8);if(0===r)break;var d=a+r;if(d>t.length){if(n)break;d=t.length}var u=t.subarray(a+8,d);Be(o,i[0])&&(1===i.length?s.push(u):s.push.apply(s,e(u,i.slice(1),n))),a=d}return s},Vt={EBML:Ue([26,69,223,163]),DocType:Ue([66,130]),Segment:Ue([24,83,128,103]),SegmentInfo:Ue([21,73,169,102]),Tracks:Ue([22,84,174,107]),Track:Ue([174]),TrackNumber:Ue([215]),DefaultDuration:Ue([35,227,131]),TrackEntry:Ue([174]),TrackType:Ue([131]),FlagDefault:Ue([136]),CodecID:Ue([134]),CodecPrivate:Ue([99,162]),VideoTrack:Ue([224]),AudioTrack:Ue([225]),Cluster:Ue([31,67,182,117]),Timestamp:Ue([231]),TimestampScale:Ue([42,215,177]),BlockGroup:Ue([160]),BlockDuration:Ue([155]),Block:Ue([161]),SimpleBlock:Ue([163])},Ht=[128,64,32,16,8,4,2,1],Xt=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var s=function(e){for(var t=1,i=0;i=i.length)return i.length;var s=Xt(i,n,!1);if(Be(t.bytes,s.bytes))return n;var a=Xt(i,n+s.length);return e(t,i,n+a.length+a.value+s.length)},Yt=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return jt(e)})):[jt(e)]}(i),t=Ue(t);var n=[];if(!i.length)return n;for(var s=0;st.length?t.length:o+r.value,u=t.subarray(o,d);Be(i[0],a.bytes)&&(1===i.length?n.push(u):n=n.concat(e(u,i.slice(1)))),s+=a.length+r.length+u.length}return n},Qt=Ue([0,0,0,1]),Kt=Ue([0,0,1]),Jt=Ue([0,0,3]),Zt=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(d)&&(s=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},ti={webm:Ue([119,101,98,109]),matroska:Ue([109,97,116,114,111,115,107,97]),flac:Ue([102,76,97,67]),ogg:Ue([79,103,103,83]),ac3:Ue([11,119]),riff:Ue([82,73,70,70]),avi:Ue([65,86,73]),wav:Ue([87,65,86,69]),"3gp":Ue([102,116,121,112,51,103]),mp4:Ue([102,116,121,112]),fmp4:Ue([115,116,121,112]),mov:Ue([102,116,121,112,113,116]),moov:Ue([109,111,111,118]),moof:Ue([109,111,111,102])},ii={aac:function(e){var t=qt(e);return Be(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=qt(e);return Be(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Yt(e,[Vt.EBML,Vt.DocType])[0];return Be(t,ti.webm)},mkv:function(e){var t=Yt(e,[Vt.EBML,Vt.DocType])[0];return Be(t,ti.matroska)},mp4:function(e){return!ii["3gp"](e)&&!ii.mov(e)&&(!(!Be(e,ti.mp4,{offset:4})&&!Be(e,ti.fmp4,{offset:4}))||!(!Be(e,ti.moof,{offset:4})&&!Be(e,ti.moov,{offset:4}))||void 0)},mov:function(e){return Be(e,ti.mov,{offset:4})},"3gp":function(e){return Be(e,ti["3gp"],{offset:4})},ac3:function(e){var t=qt(e);return Be(e,ti.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188{if(4===e.readyState)return t()},{EventTarget:oi}=s.default,di=function(e,t){if(!Te(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i`placeholder-uri-${e}-${t}-${n.attributes.NAME||i}`,li=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,hi=(e,t)=>{const i={};for(const n in e){const s=e[n].sidx;if(s){const e=ut(s);if(!t[e])break;const n=t[e].sidxInfo;li(n,s)&&(i[e]=t[e])}}return i};class ci extends oi{constructor(e,t,i={},n){super(),this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",(()=>{this.refreshXml_()})),this.on("mediaupdatetimeout",(()=>{this.refreshMedia_(this.media().id)})),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=h("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){const n=e.sidx&&ut(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n])return void(this.mediaRequest_=window.setTimeout((()=>i(!1)),0));const s=l(e.sidx.resolvedUri),a=(s,a)=>{if(this.requestErrored_(s,a,t))return;const r=this.mainPlaylistLoader_.sidxMapping_;let o;try{o=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Ft(e.subarray(n)),i.firstOffset=Ft(e.subarray(n+8)),n+=16),n+=2;var s=t.getUint16(n);for(n+=2;s>0;n+=12,s--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}(Ue(a.response).subarray(8))}catch(e){return void this.requestErrored_(e,a,t)}return r[n]={sidxInfo:e.sidx,sidx:o},st(e,o,e.sidx.resolvedUri),i(!0)};this.request=((e,t,i)=>{let n,s=[],a=!1;const r=function(e,t,n,s){return t.abort(),a=!0,i(e,t,n,s)},o=function(e,t){if(a)return;if(e)return r(e,t,"",s);const i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length);if(s=function(){for(var e=arguments.length,t=new Array(e),i=0;ir(e,t,"",s)));const o=ai(s);return"ts"===o&&s.length<188||!o&&s.length<376?ri(t,(()=>r(e,t,"",s))):r(null,t,o,s)},d={uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:i}){return Ee(e,null,{statusCode:e.status},o)}))}},u=t(d,(function(e,t){return Ee(u,e,t,o)}));return u})(s,this.vhs_.xhr,((t,i,n,r)=>{if(t)return a(t,i);if(!n||"mp4"!==n)return a({status:i.status,message:`Unsupported ${n||"unknown"} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);const{offset:o,length:d}=e.sidx.byterange;if(r.length>=d+o)return a(t,{response:r.subarray(o,o+d),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:Ae({byterange:e.sidx.byterange})},a)}))}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(i=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=window.setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=window.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,i)=>{if(this.requestErrored_(t,i))return void("HAVE_NOTHING"===this.state&&(this.started=!1));const n=i.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=l(this.mainPlaylistLoader_.srcUrl,i),n?(this.handleMain_(),void this.syncClientServerClock_((()=>e(i,n)))):e(i,n)}))}syncClientServerClock_(e){const t=(i=this.mainPlaylistLoader_.mainXml_,(e=>{const t=At(e,"UTCTiming")[0];if(!t)return null;const i=kt(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i})(Nt(i)));var i;return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:u(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((i,n)=>{if(!this.request)return;if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let s;s="HEAD"===t.method?n.responseHeaders&&n.responseHeaders.date?Date.parse(n.responseHeaders.date):this.mainLoaded_:Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let t=(({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:n,previousManifest:s})=>{const a=((e,t={})=>{const i=((e,t={})=>{const{manifestUri:i="",NOW:n=Date.now(),clientOffset:s=0,eventHandler:a=function(){}}=t,r=At(e,"Period");if(!r.length)throw new Error("INVALID_NUMBER_OF_PERIOD");const o=At(e,"Location"),d=kt(e),u=Pt([{baseUrl:i}],At(e,"BaseURL")),l=At(e,"ContentSteering");d.type=d.type||"static",d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=n,d.clientOffset=s,o.length&&(d.locations=o.map(Dt));const h=[];return r.forEach(((e,t)=>{const i=kt(e),n=h[t-1];i.start=(({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0)({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:d.type}),h.push({node:e,attributes:i})})),{locations:d.locations,contentSteeringInfo:Mt(l,a),representationInfo:Ke(h.map(Rt(d,u))),eventStream:Ke(h.map(Ct))}})(Nt(e),t),n=i.representationInfo.map(It);return _t({dashPlaylists:n,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})})(e,{manifestUri:t,clientOffset:i,sidxMapping:n,previousManifest:s});return pe(a,t,ui),a})({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=((e,t,i)=>{let n=!0,s=U(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{if(e.playlists&&e.playlists.length){const r=e.playlists[0].id,o=be(s,e.playlists[0],di);o&&(s=o,a in s.mediaGroups[t][i]||(s.mediaGroups[t][i][a]=e),s.mediaGroups[t][i][a].playlists[0]=s.playlists[r],n=!1)}})),((e,t)=>{he(e,((i,n,s,a)=>{a in t.mediaGroups[n][s]||delete e.mediaGroups[n][s][a]}))})(s,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1),n?null:s})(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,t)=>{let i=hi(e.playlists,t);return he(e,((e,n,s,a)=>{if(e.playlists&&e.playlists.length){const n=e.playlists;i=U(i,hi(n,t))}})),i})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),Se(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const e=this.mainPlaylistLoader_.main.eventStream.map((e=>({cueTime:e.start,frames:[{data:e.messageData}]})));this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration)}}}var pi={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const mi=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},gi=function(e){return function(){const t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(t){const i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}}(e),i=mi(new Worker(t));i.objURL=t;const n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}},fi=function(e){return`var browserWorkerPolyFill = ${mi.toString()};\nbrowserWorkerPolyFill(self);\n`+e},yi=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},_i=fi(yi((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,s,a;if(i=e[t])if(2===arguments.length)for(s=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},f=function(e){return i(w.hdlr,x[e])},g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),i(w.mdhd,t)},m=function(e){return i(w.mdia,g(e),f(e.type),o(e))},r=function(e){return i(w.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return i(w.minf,"video"===e.type?i(w.vmhd,k):i(w.smhd,O),n(),_(e))},d=function(e,t){for(var n=[],s=t.length;s--;)n[s]=b(t[s]);return i.apply(null,[w.moof,r(e)].concat(n))},u=function(e){for(var t=e.length,n=[];t--;)n[t]=c(e[t]);return i.apply(null,[w.moov,h(4294967295)].concat(n).concat(l(e)))},l=function(e){for(var t=e.length,n=[];t--;)n[t]=S(e[t]);return i.apply(null,[w.mvex].concat(n))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(w.mvhd,t)},y=function(e){var t,n,s=e.samples||[],a=new Uint8Array(4+s.length);for(n=0;n>>8),r.push(255&s[t].byteLength),r=r.concat(Array.prototype.slice.call(s[t]));for(t=0;t>>8),o.push(255&a[t].byteLength),o=o.concat(Array.prototype.slice.call(a[t]));if(n=[w.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(w.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],r,[a.length],o))),i(w.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var d=e.sarRatio[0],u=e.sarRatio[1];n.push(i(w.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return i.apply(null,n)},B=function(e){return i(w.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),s(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return i(w.tkhd,t)},b=function(e){var t,n,s,a,r,o;return t=i(w.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(e.baseMediaDecodeTime/H),o=Math.floor(e.baseMediaDecodeTime%H),n=i(w.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(s=v(e,92),i(w.traf,t,n,s)):(a=y(e),s=v(e,a.length+92),i(w.traf,t,n,s,a))},c=function(e){return e.duration=e.duration||4294967295,i(w.trak,p(e),m(e))},S=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),i(w.trex,t)},q=function(e,t){var i=0,n=0,s=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(s=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|s|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},$=function(e,t){var n,s,a,r,o,d;for(t+=20+16*(r=e.samples||[]).length,a=q(r,t),(s=new Uint8Array(a.length+16*r.length)).set(a),n=a.length,d=0;d>>24,s[n++]=(16711680&o.duration)>>>16,s[n++]=(65280&o.duration)>>>8,s[n++]=255&o.duration,s[n++]=(4278190080&o.size)>>>24,s[n++]=(16711680&o.size)>>>16,s[n++]=(65280&o.size)>>>8,s[n++]=255&o.size,s[n++]=o.flags.isLeading<<2|o.flags.dependsOn,s[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,s[n++]=61440&o.flags.degradationPriority,s[n++]=15&o.flags.degradationPriority,s[n++]=(4278190080&o.compositionTimeOffset)>>>24,s[n++]=(16711680&o.compositionTimeOffset)>>>16,s[n++]=(65280&o.compositionTimeOffset)>>>8,s[n++]=255&o.compositionTimeOffset;return i(w.trun,s)},F=function(e,t){var n,s,a,r,o,d;for(t+=20+8*(r=e.samples||[]).length,a=q(r,t),(n=new Uint8Array(a.length+8*r.length)).set(a),s=a.length,d=0;d>>24,n[s++]=(16711680&o.duration)>>>16,n[s++]=(65280&o.duration)>>>8,n[s++]=255&o.duration,n[s++]=(4278190080&o.size)>>>24,n[s++]=(16711680&o.size)>>>16,n[s++]=(65280&o.size)>>>8,n[s++]=255&o.size;return i(w.trun,n)},v=function(e,t){return"audio"===e.type?F(e,t):$(e,t)};var X,j,z,Y,Q,K,J,Z,ee={ftyp:a=function(){return i(w.ftyp,E,I,E,A)},mdat:function(e){return i(w.mdat,e)},moof:d,moov:u,initSegment:function(e){var t,i=a(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t}},te=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie={groupNalsIntoFrames:function(e){var t,i,n=[],s=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,n.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,n,s,a,r,o=t||0,d=[];for(i=0;ide.ONE_SECOND_IN_TS/2))){for((r=function(){if(!X){var e={96e3:[ne,[227,64],ae(154),[56]],88200:[ne,[231],ae(170),[56]],64e3:[ne,[248,192],ae(240),[56]],48e3:[ne,[255,192],ae(268),[55,148,128],ae(54),[112]],44100:[ne,[255,192],ae(268),[55,163,128],ae(84),[112]],32e3:[ne,[255,192],ae(268),[55,234],ae(226),[112]],24e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,112],ae(126),[224]],16e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,255],ae(269),[223,108],ae(195),[1,192]],12e3:[se,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,253,128],ae(259),[56]],11025:[se,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,255,192],ae(268),[55,175,128],ae(108),[112]],8e3:[se,ae(268),[3,121,16],ae(47),[7]]};t=e,X=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return X}()[e.samplerate])||(r=t[0].data),o=0;o=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},generateSampleTable:function(e){var t,i,n=[];for(t=0;t=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},_e.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},_e.prototype.addText=function(e){this.rows[this.rowIdx]+=e},_e.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Te=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new _e(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new _e(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var be=function(e){e=e||{},be.prototype.init.call(this);var t,i=this,n=e.captionServices||{},s={};Object.keys(n).forEach((e=>{t=n[e],/^SERVICE/.test(e)&&(s[e]=t.encoding)})),this.serviceEncodings=s,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(i.new708Packet(),i.add708Bytes(e)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e))}};be.prototype=new pe,be.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},be.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},be.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,s=0,a=t[s++];for(e.seq=a>>6,e.sizeCode=63&a;s>5)&&n>0&&(i=a=t[s++]),this.pushServiceBlock(i,s,n),n>0&&(s+=n-1)},be.prototype.pushServiceBlock=function(e,t,i){var n,s=t,a=this.current708Packet.data,r=this.services[e];for(r||(r=this.initService(e,s));s>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},be.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.winAttr;return n=i[++e],s.fillOpacity=(192&n)>>6,s.fillRed=(48&n)>>4,s.fillGreen=(12&n)>>2,s.fillBlue=3&n,n=i[++e],s.borderType=(192&n)>>6,s.borderRed=(48&n)>>4,s.borderGreen=(12&n)>>2,s.borderBlue=3&n,n=i[++e],s.borderType+=(128&n)>>5,s.wordWrap=(64&n)>>6,s.printDirection=(48&n)>>4,s.scrollDirection=(12&n)>>2,s.justify=3&n,n=i[++e],s.effectSpeed=(240&n)>>4,s.effectDirection=(12&n)>>2,s.displayEffect=3&n,e},be.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},be.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},be.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var s=0;s<8;s++)i&1<>4,s.offset=(12&n)>>2,s.penSize=3&n,n=i[++e],s.italics=(128&n)>>7,s.underline=(64&n)>>6,s.edgeType=(56&n)>>3,s.fontStyle=7&n,e},be.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.penColor;return n=i[++e],s.fgOpacity=(192&n)>>6,s.fgRed=(48&n)>>4,s.fgGreen=(12&n)>>2,s.fgBlue=3&n,n=i[++e],s.bgOpacity=(192&n)>>6,s.bgRed=(48&n)>>4,s.bgGreen=(12&n)>>2,s.bgBlue=3&n,n=i[++e],s.edgeRed=(48&n)>>4,s.edgeGreen=(12&n)>>2,s.edgeBlue=3&n,e},be.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],s.row=15&n,n=i[++e],s.column=63&n,e},be.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Se={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},ve=function(e){return null===e?"":(e=Se[e]||e,String.fromCharCode(e))},we=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ee=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},Ie=function(e,t){Ie.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,s,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,s=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ee();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ee();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ee()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,s))a=ve((n=(3&n)<<8)|s),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,s))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),a=ve((n=(3&n)<<8)|s),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,s))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&s)&&this.addFormatting(e.pts,["i"]),1==(1&s)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,s)){const e=3&s;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(n,s)){var r=we.indexOf(7968&t);if("rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&s&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)){const e=(14&t)>>1;this.column_=4*e,this.nonDisplayed_[this.row_].indent+=e}this.isColorPAC(s)&&14==(14&s)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===s&&(s=null),a=ve(n),a+=ve(s),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ie.prototype=new pe,Ie.prototype.flushDisplayed=function(e){const t=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach(((e,n)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(n)}e.text.length&&i.push({text:e.text,line:n+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(n)})),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},Ie.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ee(),this.nonDisplayed_=Ee(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ie.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ie.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ie.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ie.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ie.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ie.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Ie.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ie.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ie.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ee(),this.displayed_=Ee()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Ie.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Ie.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},Ie.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},Ie.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Oe=function(e){var t,i;Oe.prototype.init.call(this),this.type_=e||xe,this.push=function(e){this.type_!==xe&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=ke(e.dts,i),e.pts=ke(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Oe.prototype=new Le;var Pe,Ue={TimestampRolloverStream:Oe,handleRollover:ke},Ce=(e,t,i)=>{if(!e)return-1;for(var n=i;n>>2;l*=4,l+=3&u[7],o.timeStamp=l,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=r}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ye.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ye.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new je,Ve.STREAM_TYPES={h264:27,adts:15},He=function(){var e,t=this,i=!1,n={data:[],size:0},s={data:[],size:0},a={data:[],size:0},r=function(e,i,n){var s,a,r=new Uint8Array(e.size),o={type:i},d=0,u=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,d=0;d>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))}(r,o),s="video"===i||o.packetLength<=e.size,(n||s)&&(e.size=0,e.data.length=0),s&&t.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ye.H264_STREAM_TYPE:e=n,t="video";break;case Ye.ADTS_STREAM_TYPE:e=s,t="audio";break;case Ye.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(n,"video"),r(s,"audio"),r(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}},He.prototype=new je;var Je={PAT_PID:0,MP2T_PACKET_LENGTH:Ke,TransportPacketStream:We,TransportParseStream:Ve,ElementaryStream:He,TimestampRolloverStream:Qe,CaptionStream:ze.CaptionStream,Cea608Stream:ze.Cea608Stream,Cea708Stream:ze.Cea708Stream,MetadataStream:Xe};for(var Ze in Ye)Ye.hasOwnProperty(Ze)&&(Je[Ze]=Ye[Ze]);var et,tt=Je,it=oe.ONE_SECOND_IN_TS,nt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(et=function(e){var t,i=0;et.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${i} outside syncword`})},this.push=function(n){var s,a,r,o,d,u=0;if(e||(i=0),"audio"===n.type){var l;for(t&&t.length?(r=t,(t=new Uint8Array(r.byteLength+n.data.byteLength)).set(r),t.set(n.data,r.byteLength)):t=n.data;u+7>5,d=(o=1024*(1+(3&t[u+6])))*it/nt[(60&t[u+2])>>>2],t.byteLength-u>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:nt[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+a,u+s)}),i++,u+=s}else"number"!=typeof l&&(l=u),u++;"number"==typeof l&&(this.skipWarn_(l,u),l=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new G;var st,at,rt,ot=et,dt=G,ut=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var s=e.byteLength-t,a=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");a.set(e.subarray(s,s+r)),i=new DataView(a.buffer).getUint32(0),n=8*r,t-=r},this.skipBits=function(e){var s;n>e?(i<<=e,n-=e):(e-=n,e-=8*(s=Math.floor(e/8)),t-=s,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var s=Math.min(n,e),a=i>>>32-s;return(n-=s)>0?i<<=s:t>0&&this.loadWord(),(s=e-s)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(at=function(){var e,t,i=0;at.prototype.init.call(this),this.push=function(n){var s;t?((s=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),s.set(n.data,t.byteLength),t=s):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new dt,rt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},st=function(){var e,t,i,n,s,a,r,o=new at;st.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(r){var o={trackId:t,pts:i,dts:n,data:r,nalUnitTypeCode:31&r[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=s(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=s(r.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(e,t){var i,n=8,s=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},mt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=pt(e,t),mt(e,t))},gt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ft={isLikelyAacData:function(e){var t=mt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:pt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=gt(e.subarray(10,14)));do{if((i=gt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var s=0;s>>2;return(o*=4)+(3&r[7])}break}}t+=10,t+=i}while(t=3;)if(e[d]!=="I".charCodeAt(0)||e[d+1]!=="D".charCodeAt(0)||e[d+2]!=="3".charCodeAt(0))if(255!=(255&e[d])||240!=(240&e[d+1]))d++;else{if(e.length-d<7)break;if(d+(o=yt.parseAdtsSize(e,d))>e.length)break;a={type:"audio",data:e.subarray(d,d+o),pts:t,dts:t},this.trigger("data",a),d+=o}else{if(e.length-d<10)break;if(d+(o=yt.parseId3TagSize(e,d))>e.length)break;s={type:"timed-metadata",data:e.subarray(d,d+o)},this.trigger("data",s),d+=o}n=e.length-d,e=n>0?e.subarray(d):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new G;var _t,Tt,bt,St,vt=G,wt=ee,Et=ie,It=ue,At=he,Dt=tt,Lt=oe,xt=ot,kt=ht.H264Stream,Ot=lt,Pt=ft.isLikelyAacData,Ut=oe.ONE_SECOND_IN_TS,Ct=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Rt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Mt=function(e,t){t.stream=e,this.trigger("log",t)},Nt=function(e,t){for(var i=Object.keys(t),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,s,a,o,d,u;for(a=e.byteLength,o=e.nalCount,d=e.duration,t=i=0;tn.pts?t++:(i++,a-=s.byteLength,o-=s.nalCount,d-=s.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=d,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,n,s,a,o,d;for(t=r.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=r[t],s=e[i],n.pts===s.pts){o=!0;break}n.pts>s.pts?t--:(t===r.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(d=o?i:a))return e;var u=e.slice(d),l=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=l.byteLength,u.duration=l.duration,u.nalCount=l.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){r=e}},_t.prototype=new vt,St=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,St.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},St.prototype=new vt,St.prototype.flush=function(e){var t,i,n,s,a=0,r={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Rt.forEach((function(e){r.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Ct.forEach((function(e){r.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?r.type=this.pendingTracks[0].type:r.type="combined",this.emittedTracks+=this.pendingTracks.length,n=wt.initSegment(this.pendingTracks),r.initSegment=new Uint8Array(n.byteLength),r.initSegment.set(n),r.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},St.prototype.setRemux=function(e){this.remuxTracks=e},(bt=function(e){var t,i,n=this,s=!0;bt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="aac",s.metadataStream=new Dt.MetadataStream,s.aacStream=new Ot,s.audioTimestampRolloverStream=new Dt.TimestampRolloverStream("audio"),s.timedMetadataTimestampRolloverStream=new Dt.TimestampRolloverStream("timed-metadata"),s.adtsStream=new xt,s.coalesceStream=new St(e,s.metadataStream),s.headOfPipeline=s.aacStream,s.aacStream.pipe(s.audioTimestampRolloverStream).pipe(s.adtsStream),s.aacStream.pipe(s.timedMetadataTimestampRolloverStream).pipe(s.metadataStream).pipe(s.coalesceStream),s.metadataStream.on("timestamp",(function(e){s.aacStream.setTimestamp(e.timeStamp)})),s.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||s.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new Tt(i,e),s.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),Nt(this,s)},this.setupTsPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="ts",s.metadataStream=new Dt.MetadataStream,s.packetStream=new Dt.TransportPacketStream,s.parseStream=new Dt.TransportParseStream,s.elementaryStream=new Dt.ElementaryStream,s.timestampRolloverStream=new Dt.TimestampRolloverStream,s.adtsStream=new xt,s.h264Stream=new kt,s.captionStream=new Dt.CaptionStream(e),s.coalesceStream=new St(e,s.metadataStream),s.headOfPipeline=s.packetStream,s.packetStream.pipe(s.parseStream).pipe(s.elementaryStream).pipe(s.timestampRolloverStream),s.timestampRolloverStream.pipe(s.h264Stream),s.timestampRolloverStream.pipe(s.adtsStream),s.timestampRolloverStream.pipe(s.metadataStream).pipe(s.coalesceStream),s.h264Stream.pipe(s.captionStream).pipe(s.coalesceStream),s.elementaryStream.on("data",(function(a){var r;if("metadata"===a.type){for(r=a.tracks.length;r--;)t||"video"!==a.tracks[r].type?i||"audio"!==a.tracks[r].type||((i=a.tracks[r]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[r]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!s.videoSegmentStream&&(s.coalesceStream.numberOfTracks++,s.videoSegmentStream=new _t(t,e),s.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),s.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,s.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),s.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),s.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),s.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&s.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),s.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),s.h264Stream.pipe(s.videoSegmentStream).pipe(s.coalesceStream)),i&&!s.audioSegmentStream&&(s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new Tt(i,e),s.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),s.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("id3Frame",(function(e){e.dispatchType=s.metadataStream.dispatchType,n.trigger("id3Frame",e)})),s.coalesceStream.on("caption",this.trigger.bind(this,"caption")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),Nt(this,s)},this.setBaseMediaDecodeTime=function(n){var s=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,At.clearDtsInfo(i),s.audioTimestampRolloverStream&&s.audioTimestampRolloverStream.discontinuity()),t&&(s.videoSegmentStream&&(s.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,At.clearDtsInfo(t),s.captionStream.reset()),s.timestampRolloverStream&&s.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(s){var t=Pt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),s=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){s=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new vt;var $t,qt,Gt,Wt,Vt={Transmuxer:bt,VideoSegmentStream:_t,AudioSegmentStream:Tt,AUDIO_PROPERTIES:Ct,VIDEO_PROPERTIES:Rt,generateSegmentTimingInfo:Ft},Ht=function(e){return e>>>0},Xt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},jt=Ht,zt=Xt,Yt=function(e,t){var i,n,s,a,r,o=[];if(!t.length)return null;for(i=0;i1?i+n:e.byteLength,s===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(r=Yt(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(r))),i=a;return o},Qt=Ht,Kt=V.getUint64,Jt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Kt(e.subarray(4)):t.baseMediaDecodeTime=Qt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Zt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ei=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=1&i.flags[2],a=4&i.flags[2],r=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],u=8&i.flags[1],l=n.getUint32(4),h=8;for(s&&(i.dataOffset=n.getInt32(h),h+=4),a&&l&&(t={flags:Zt(e.subarray(h,h+4))},h+=4,r&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),l--);l--;)t={},r&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),d&&(t.flags=Zt(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i},ti=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},s=1&n.flags[2],a=2&n.flags[2],r=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],u=65536&n.flags[0],l=131072&n.flags[0];return t=8,s&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),r&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),d&&(n.defaultSampleFlags=i.getUint32(t)),u&&(n.durationIsEmpty=!0),!s&&l&&(n.baseDataOffsetIsMoof=!0),n},ii=($t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},ce.discardEmulationPreventionBytes),ni=Ae.CaptionStream,si=Yt,ai=Jt,ri=ei,oi=ti,di=$t,ui=function(e,t){for(var i=e,n=0;n0;){var d=t.shift();this.parse(d,a,r)}return o=function(e,t,i){if(null===t)return null;var n=function(e,t){var i=si(e,["moof","traf"]),n=si(e,["mdat"]),s={},a=[];return n.forEach((function(e,t){var n=i[t];a.push({mdat:e,traf:n})})),a.forEach((function(e){var i,n,a=e.mdat,r=e.traf,o=si(r,["tfhd"]),d=oi(o[0]),u=d.trackId,l=si(r,["tfdt"]),h=l.length>0?ai(l[0]).baseMediaDecodeTime:0,c=si(r,["trun"]);t===u&&c.length>0&&(i=function(e,t,i){var n=t,s=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,r=i.trackId,o=[];return e.forEach((function(e){var t=ri(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=s),void 0===e.size&&(e.size=a),e.trackId=r,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof n?(e.pts=n+di.BigInt(e.compositionTimeOffset),n+=di.BigInt(e.duration)):(e.pts=n+e.compositionTimeOffset,n+=e.duration)})),o=o.concat(t)})),o}(c,h,d),n=function(e,t,i){var n,s,a,r,o=new DataView(e.buffer,e.byteOffset,e.byteLength),d={logs:[],seiNals:[]};for(s=0;s+41)&&n||s}(u,h)?h:void 0},scaleTime:function(e,t,i,n){return e||0===e?e/t:n+i/t}},gi=Ht,fi=function(e){return("00"+e.toString(16)).slice(-2)},yi=Yt,_i=Xt,Ti=mi,bi=V.getUint64,Si=$t,vi=$e.parseId3Frames;qt=function(e,t){var i=yi(t,["moof","traf"]).reduce((function(t,i){var n,s=yi(i,["tfhd"])[0],a=gi(s[4]<<24|s[5]<<16|s[6]<<8|s[7]),r=e[a]||9e4,o=yi(i,["tfdt"])[0],d=new DataView(o.buffer,o.byteOffset,o.byteLength);let u;return"bigint"==typeof(n=1===o[0]?bi(o.subarray(4,12)):d.getUint32(4))?u=n/Si.BigInt(r):"number"!=typeof n||isNaN(n)||(u=n/r),u11?(s.codec+=".",s.codec+=fi(l[9]),s.codec+=fi(l[10]),s.codec+=fi(l[11])):s.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(s.codec)?(l=h.subarray(28),"esds"===_i(l.subarray(4,8))&&l.length>20&&0!==l[19]?(s.codec+="."+fi(l[19]),s.codec+="."+fi(l[20]>>>2&63).replace(/^0/,"")):s.codec="mp4a.40.2"):s.codec=s.codec.toLowerCase())}var c=yi(e,["mdia","mdhd"])[0];c&&(s.timescale=Wt(c)),i.push(s)})),i};var wi=qt,Ei=Gt,Ii=function(e,t=0){return yi(e,["emsg"]).map((e=>{var i=Ti.parseEmsgBox(new Uint8Array(e)),n=vi(i.message_data);return{cueTime:Ti.scaleTime(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:Ti.scaleTime(i.event_duration,i.timescale),frames:n}}))},Ai=De,Di=function(e){var t=31&e[1];return(t<<=8)|e[2]},Li=function(e){return!!(64&e[1])},xi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},ki=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Oi={parseType:function(e,t){var i=Di(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Li(e),i=4+xi(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Li(e),n=4+xi(e);if(i&&(n+=e[n]+1),1&e[n+5]){var s;s=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+xi(e),i=e.subarray(t),n=0,s=0,a=!1;s3&&"slice_layer_without_partitioning_rbsp_idr"===ki(31&i[s+3])&&(a=!0),a}},Pi=De,Ui=Ue.handleRollover,Ci={};Ci.ts=Oi,Ci.aac=ft;var Ri=oe.ONE_SECOND_IN_TS,Mi=188,Ni=71,Bi=function(e,t,i){for(var n,s,a,r,o=0,d=Mi,u=!1;d<=e.byteLength;)if(e[o]!==Ni||e[d]!==Ni&&d!==e.byteLength)o++,d++;else{if(n=e.subarray(o,d),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"audio"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="audio",i.audio.push(r),u=!0)),u)break;o+=Mi,d+=Mi}for(o=(d=e.byteLength)-Mi,u=!1;o>=0;)if(e[o]!==Ni||e[d]!==Ni&&d!==e.byteLength)o--,d--;else{if(n=e.subarray(o,d),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"audio"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="audio",i.audio.push(r),u=!0)),u)break;o-=Mi,d-=Mi}},Fi=function(e,t,i){for(var n,s,a,r,o,d,u,l=0,h=Mi,c=!1,p={data:[],size:0};h=0;)if(e[l]!==Ni||e[h]!==Ni)l--,h--;else{if(n=e.subarray(l,h),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"video"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="video",i.video.push(r),c=!0)),c)break;l-=Mi,h-=Mi}},$i=function(e,t){var i;return i=Ci.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,s=null,a=null,r=0,o=0;e.length-o>=3;){switch(Ci.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((r=Ci.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+r),a=Ci.aac.parseAacTimestamp(t)),o+=r;break;case"audio":if(e.length-o<7){i=!0;break}if((r=Ci.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+r),s=Ci.aac.parseSampleRate(t)),n++,o+=r;break;default:o++}if(i)return null}if(null===s||null===a)return null;var d=Ri/s;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*d,pts:a+1024*n*d}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,s=Mi;s{const{transmuxer:t,bytes:i,audioAppendStart:n,gopsToAlignWith:s,remux:a,onData:r,onTrackInfo:o,onAudioTimingInfo:d,onVideoTimingInfo:u,onVideoSegmentTimingInfo:l,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=e,_={buffer:[]};let T=y;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&((e,t,i)=>{const{type:n,initSegment:s,captions:a,captionStreams:r,metadata:o,videoFrameDtsTime:d,videoFramePtsTime:u}=e.data.segment;t.buffer.push({captions:a,captionStreams:r,metadata:o});const l=e.data.segment.boxes||{data:e.data.segment.data},h={type:n,data:new Uint8Array(l.data,l.data.byteOffset,l.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};void 0!==d&&(h.videoFrameDtsTime=d),void 0!==u&&(h.videoFramePtsTime=u),i(h)})(i,_,r),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(i,_),"audioTimingInfo"===i.data.action&&d(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&l(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(T=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(T||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:_,callback:m}),Si(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(s)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){const e=i instanceof ArrayBuffer?i:i.buffer,n=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:e,byteOffset:n,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Si=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():bi(e.currentTransmux))},vi=(e,t)=>{e.postMessage({action:t}),Si(e)};var wi=e=>{((e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void vi(t,e);t.transmuxQueue.push(vi.bind(null,t,e))})("reset",e)};const Ei=function(e){const t=e.transmuxer,i=e.endAction||e.action,n=e.callback,s=c({},e,{endAction:null,transmuxer:null,callback:null}),a=s=>{s.data.action===i&&(t.removeEventListener("message",a),s.data.data&&(s.data.data=new Uint8Array(s.data.data,e.byteOffset||0,e.byteLength||s.data.data.byteLength),e.data&&(e.data=s.data.data)),n(s.data))};if(t.addEventListener("message",a),e.data){const i=e.data instanceof ArrayBuffer;s.byteOffset=i?0:e.data.byteOffset,s.byteLength=e.data.byteLength;const n=[i?e.data:e.data.buffer];t.postMessage(s,n)}else t.postMessage(s)},Ii=-101,Ai=-102,Di=e=>{e.forEach((e=>{e.abort()}))},Li=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Ii,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Ai,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t}:null,xi=(e,t,i)=>(n,s)=>{const a=s.response,r=Li(n,s);if(r)return i(r,e);if(16!==a.byteLength)return i({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:2,xhr:s},e);const o=new DataView(a),d=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let e=0;e{const i=ai(e.map.bytes);if("mp4"!==i){const n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${n}`,code:2})}Ei({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:n})=>(e.map.bytes=n,i.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null))})},Oi=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{const p=e.map&&e.map.tracks||{},m=Boolean(p.audio&&p.video);let g=n.bind(null,e,"audio","start");const f=n.bind(null,e,"audio","end");let y=n.bind(null,e,"video","start");const _=n.bind(null,e,"video","end");Ei({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:n=>{e.bytes=t=n.data;const p=n.result;p&&(i(e,{hasAudio:p.hasAudio,hasVideo:p.hasVideo,isMuxed:m}),i=null),(e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void bi(e);e.transmuxer.transmuxQueue.push(e)})({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,l(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{g&&void 0!==e.start&&(g(e.start),g=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{s(e)},onAudioSegmentTimingInfo:e=>{a(e)},onId3:(t,i)=>{r(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:d,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}})}})},Pi=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(function(e){return Wt(e,["moof"]).length>0}(p)){e.isFmp4=!0;const{tracks:s}=e.map,a={isFmp4:!0,hasVideo:!!s.video,hasAudio:!!s.audio};s.audio&&s.audio.codec&&"enca"!==s.audio.codec&&(a.audioCodec=s.audio.codec),s.video&&s.video.codec&&"encv"!==s.video.codec&&(a.videoCodec=s.video.codec),s.video&&s.audio&&(a.isMuxed=!0),i(e,a);const d=(t,i)=>{l(e,{data:p,type:a.hasAudio&&!a.isMuxed?"audio":"video"}),i&&i.length&&r(e,i),t&&t.length&&o(e,t),h(null,e,{})};Ei({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:r})=>{t=i.buffer,e.bytes=p=i,a.hasAudio&&!a.isMuxed&&n(e,"audio","start",r),a.hasVideo&&n(e,"video","start",r),Ei({action:"probeEmsgID3",data:p,transmuxer:e.transmuxer,offset:r,callback:({emsgData:n,id3Frames:a})=>{t=n.buffer,e.bytes=p=n,s.video&&i.byteLength&&e.transmuxer?Ei({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[s.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach((function(e){c(U(e,{stream:"mp4CaptionParser"}))})),d(i.captions,a)}}):d(void 0,a)}})}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=ai(p)),"ts"!==e.container&&"aac"!==e.container)return i(e,{hasAudio:!1,hasVideo:!1}),void h(null,e,{});Oi({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})}else h(null,e,{})},Ui=function({id:e,key:t,encryptedBytes:i,decryptionWorker:n},s){const a=t=>{if(t.data.source===e){n.removeEventListener("message",a);const e=t.data.decrypted;s(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let r;n.addEventListener("message",a),r=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),n.postMessage(Ge({source:e,encrypted:i,key:r,iv:t.iv}),[i.buffer,r.buffer])},Ci=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:n,abortFn:s,progressFn:a,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[],_=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(g,f)=>{if(!m){if(g)return m=!0,Di(e),h(g,f);if(p+=1,p===e.length){const p=function(){if(f.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{Ui({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,Pi({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})}))})({decryptionWorker:t,segment:f,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c});Pi({segment:f,bytes:f.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return Ui({decryptionWorker:t,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},(t=>{f.map.bytes=t,ki(f,(t=>{if(t)return Di(e),h(t,f);p()}))}));p()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f});if(n.key&&!n.key.bytes){const i=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&i.push(n.map.key);const s=e(U(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),xi(n,i,_));y.push(s)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const i=e(U(t,{uri:n.map.key.resolvedUri,responseType:"arraybuffer"}),xi(n,[n.map.key],_));y.push(i)}const i=U(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Ae(n.map)}),s=(({segment:e,finishProcessingFn:t})=>(i,n)=>{const s=Li(i,n);if(s)return t(s,e);const a=new Uint8Array(n.response);if(e.map.key)return e.map.encryptedBytes=a,t(null,e);e.map.bytes=a,ki(e,(function(i){if(i)return i.xhr=n,i.status=n.status,t(i,e);t(null,e)}))})({segment:n,finishProcessingFn:_}),a=e(i,s);y.push(a)}const T=U(t,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Ae(n)}),b=e(T,(({segment:e,finishProcessingFn:t,responseType:i})=>(n,s)=>{const a=Li(n,s);if(a)return t(a,e);const r="arraybuffer"!==i&&s.responseText?(e=>{const t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(s),e.key?e.encryptedBytes=new Uint8Array(r):e.bytes=new Uint8Array(r),t(null,e)})({segment:n,finishProcessingFn:_,responseType:T.responseType}));b.addEventListener("progress",(({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l})=>i=>{if(!i.target.aborted)return e.stats=U(e.stats,(e=>{const t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i})(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)})({segment:n,progressFn:a,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(b);const S={};return y.forEach((e=>{e.addEventListener("loadend",(({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)})({loadendState:S,abortFn:s}))})),()=>Di(y)},Ri=h("CodecUtils"),Mi=(e,t)=>{const i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Ni=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:n})=>{t[e]=t[e]||[],t[e].push(A(`${i}${n}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return Ri(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),void(t[e]=null);t[e]=t[e][0]})),t},Bi=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},Fi=function(e,t){const i=t.attributes||{},n=Ni(function(e){const t=e.attributes||{};if(t.CODECS)return D(t.CODECS)}(t)||[]);if(Mi(e,t)&&!n.audio&&!((e,t)=>{if(!Mi(e,t))return!0;const i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(const e in n)if(!n[e].uri&&!n[e].playlists)return!0;return!1})(e,t)){const t=Ni(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var s=i[n];if(s.default&&s.playlists)return D(s.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);t.audio&&(n.audio=t.audio)}return n},$i=h("PlaylistSelector"),qi=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Gi=function(e,t){if(!e)return"";const i=window.getComputedStyle(e);return i?i[t]:""},Wi=function(e,t){const i=e.slice();e.sort((function(e,n){const s=t(e,n);return 0===s?i.indexOf(e)-i.indexOf(n):s}))},Vi=function(e,t){let i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||window.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||window.Number.MAX_VALUE,i-n};let Hi=function(e,t,i,n,s,a){if(!e)return;const r={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:s};let o=e.playlists;oe.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),r.audioOnly=!0);let d=o.map((e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||window.Number.MAX_VALUE,{bandwidth:t,width:i,height:n,playlist:e}}));Wi(d,((e,t)=>e.bandwidth-t.bandwidth)),d=d.filter((e=>!oe.isIncompatible(e.playlist)));let u=d.filter((e=>oe.isEnabled(e.playlist)));u.length||(u=d.filter((e=>!oe.isDisabled(e.playlist))));const l=u.filter((e=>e.bandwidth*pi.BANDWIDTH_VARIANCEe.bandwidth===h.bandwidth))[0];if(!1===s){const e=c||u[0]||d[0];if(e&&e.playlist){let t="sortedPlaylistReps";return c&&(t="bandwidthBestRep"),u[0]&&(t="enabledPlaylistReps"),$i(`choosing ${qi(e)} using ${t} with options`,r),e.playlist}return $i("could not choose a playlist with options",r),null}const p=l.filter((e=>e.width&&e.height));Wi(p,((e,t)=>e.width-t.width));const m=p.filter((e=>e.width===i&&e.height===n));h=m[m.length-1];const g=m.filter((e=>e.bandwidth===h.bandwidth))[0];let f,y,_,T;if(g||(f=p.filter((e=>e.width>i||e.height>n)),y=f.filter((e=>e.width===f[0].width&&e.height===f[0].height)),h=y[y.length-1],_=y.filter((e=>e.bandwidth===h.bandwidth))[0]),a.leastPixelDiffSelector){const e=p.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e)));Wi(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),T=e[0]}const b=T||_||g||c||u[0]||d[0];if(b&&b.playlist){let e="sortedPlaylistReps";return T?e="leastPixelDiffRep":_?e="resolutionPlusOneRep":g?e="resolutionBestRep":c?e="bandwidthBestRep":u[0]&&(e="enabledPlaylistReps"),$i(`choosing ${qi(b)} using ${e} with options`,r),b.playlist}return $i("could not choose a playlist with options",r),null};const Xi=function(){const e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return Hi(this.playlists.main,this.systemBandwidth,parseInt(Gi(this.tech_.el(),"width"),10)*e,parseInt(Gi(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},ji={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},zi=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Yi=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,s.default.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},Qi=function(e,t,i){let n,s;if(i&&i.cues)for(n=i.cues.length;n--;)s=i.cues[n],s.startTime>=e&&s.endTime<=t&&i.removeCue(s)};var Ki=9e4,Ji=Ki;const Zi=e=>"number"==typeof e&&isFinite(e),en=1/60,tn=e=>{const{startOfSegment:t,duration:i,segment:n,part:s,playlist:{mediaSequence:a,id:r,segments:o=[]},mediaIndex:d,partIndex:u,timeline:l}=e,h=o.length-1;let c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);const p="number"==typeof u,m=e.segment.uri?"segment":"pre-segment",g=p?j({preloadSegment:n})-1:0;return`${m} [${a+d}/${a+h}]`+(p?` part [${u}/${g}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(p?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${l}]`+` selected by [${c}]`+` playlist [${r}]`},nn=e=>`${e}TimingInfo`,sn=(e,t)=>e.length?e.end(e.length-1):t,an=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:n,audioDisabled:s})=>{if(t===i)return!1;if("audio"===n){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===n&&s){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},rn=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+R;class on extends s.default.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.calculateTimestampOffsetForEachSegment_=e.calculateTimestampOffsetForEachSegment,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",(()=>{this.isEndOfStream_()||(this.ended_=!1)})),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=h(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return(e=>{const t=new Ti;t.currentTransmux=null,t.transmuxQueue=[];const i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t})({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&wi(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return C();if("main"===this.loaderType_){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=We(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=Ve(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(n||e).resolvedUri};return n&&(s.bytes=n.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(i&&(i.id?s=i.id:i.uri&&(s=i.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&wi(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=(()=>{}),n=!1){if(t===1/0&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let s=1;const a=()=>{s--,0===s&&i()};!n&&this.audioDisabled_||(s++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=((e,t,i,n)=>{const s=Math.ceil((t-n)*Ji),a=Math.ceil((i-n)*Ji),r=e.slice();let o=e.length;for(;o--&&!(e[o].pts<=a););if(-1===o)return r;let d=o+1;for(;d--&&!(e[d].pts<=s););return d=Math.max(d,0),r.splice(d,o-d+1),r})(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,a));for(const i in this.inbandTextTracks_)Qi(e,t,this.inbandTextTracks_[i]);Qi(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const n="number"==typeof e&&t.segments[e],s=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&s&&a}chooseNextRequest_(){const e=this.buffered_(),t=G(e)||0,i=W(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,s=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const r={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(r.isSyncRequest)r.mediaIndex=function(e,t,i){t=t||[];const n=[];let s=0;for(let a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){const e=a[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;r.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(r.mediaIndex=this.mediaIndex,r.partIndex=i+1):r.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:e,startTime:i,partIndex:n}=oe.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});r.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,r.mediaIndex=e,r.startOfSegment=i,r.partIndex=n}const o=a[r.mediaIndex];let d=o&&"number"==typeof r.partIndex&&o.parts&&o.parts[r.partIndex];if(!o||"number"==typeof r.partIndex&&!d)return null;"number"!=typeof r.partIndex&&o.parts&&(r.partIndex=0,d=o.parts[0]);const u=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!u&&!d.independent)if(0===r.partIndex){const e=a[r.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(r.mediaIndex-=1,r.partIndex=e.parts.length-1,r.independent="previous segment")}else o.parts[r.partIndex-1].independent&&(r.partIndex-=1,r.independent="previous part");const l=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return r.mediaIndex>=a.length-1&&l&&!this.seeking_()?null:this.generateSegmentInfo_(r)}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:s,isSyncRequest:a,partIndex:r,forceTimestampOffset:o,getMediaInfoForTime:d}=e,u=i.segments[n],l="number"==typeof r&&u.parts[r],h={requestId:"segment-loader-"+Math.random(),uri:l&&l.resolvedUri||u.resolvedUri,mediaIndex:n,partIndex:l?r:null,isSyncRequest:a,startOfSegment:s,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:l&&l.duration||u.duration,segment:u,part:l,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:c});const p=G(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=((e,t,i)=>{if(null==t||!e.length)return[];const n=Math.ceil((t-i+3)*Ji);let s;for(s=0;sn);s++);return e.slice(s)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h}timestampOffsetForSegment_(e){return(({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:n,calculateTimestampOffsetForEachSegment:s,overrideCheck:a})=>s?sn(n,i):a||e!==t?e!oe.isIncompatible(e)));let l=u.filter(oe.isEnabled);l.length||(l=u.filter((e=>!oe.isDisabled(e))));const h=l.filter(oe.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const t=d.getSyncPoint(e,s,o,i)?1:2;return{playlist:e,rebufferingImpact:oe.estimateSegmentRequestTime(a,n,e)*t-r}})),c=h.filter((e=>e.rebufferingImpact<=0));return Wi(c,((e,t)=>Vi(t.playlist,e.playlist))),c.length?c[0]:(Wi(h,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),h[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!r)return;const o=s-a-r.rebufferingImpact;let d=.5;a<=R&&(d=1),!r.playlist||r.playlist.uri===this.playlist_.uri||o{n[e.stream]=n[e.stream]||{startTime:1/0,captions:[],endTime:0};const t=n[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)})),Object.keys(n).forEach((e=>{const{startTime:t,endTime:s,captions:a}=n[e],r=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${s} for ${e}`),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);const s=t.textTracks().getTrackById(n);if(s)e[i]=s;else{let s=i,a=i,r=!1;const o=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];o&&(s=o.label,a=o.language,r=o.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:r,label:s,language:a},!1).track}}}(r,this.vhs_.tech_,e),Qi(t,s,r[e]),function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;const n=window.WebKitDataCue||window.VTTCue;t.forEach((t=>{const s=t.stream;t.content?t.content.forEach((a=>{const r=new n(t.startTime+i,t.endTime+i,a.text);r.line=a.line,r.align="left",r.position=a.position,r.positionAlign="line-left",e[s].addCue(r)})):e[s].addCue(new n(t.startTime+i,t.endTime+i,t.text))}))}({captionArray:a,inbandTextTracks:r,timestampOffset:i})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e=>e())),this.metadataQueue_.caption.forEach((e=>e())),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!(!e||this.getCurrentMediaInfo_()&&an({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:s}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||an({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return void this.callQueue_.push(this.handleData_.bind(this,e,t));const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[nn(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let n;t&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});const e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const e=We(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+q(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+q(a).join(", "));const r=s.length?s.start(0):0,o=s.length?s.end(s.length-1):0,d=a.length?a.start(0):0,u=a.length?a.end(a.length-1):0;if(o-r<=1&&u-d<=1)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${q(s).join(", ")}, video buffer: ${q(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const l=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${l}`),this.remove(0,l,(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3)}),!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){n&&(22!==n.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error(`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:s}){if(!s){const e=[n];let t=n.byteLength;i&&(e.unshift(i),t+=i.byteLength),s=(e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,i),i+=e.byteLength}))),t})({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,s=`${e}TimingInfo`;n[s]||(n[s]={}),n[s].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[s].transmuxedPresentationStart=i.start.presentation,n[s].transmuxedDecodeStart=i.start.decode,n[s].transmuxedPresentationEnd=i.end.presentation,n[s].transmuxedDecodeEnd=i.end.decode,n[s].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength)return;if("audio"===i&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:s,data:n})}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{const t=c({},e,{forceTimestampOffset:!0});c(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}))}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=null!==this.mediaIndex,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&s;this.logger_(`Requesting ${tn(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ci({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:n})=>{this.logger_(`${tn(e)} logged from transmuxer stream ${n} as a ${i}: ${t}`)}})}trimBackBuffer_(e){const t=((e,t,i)=>{let n=t-pi.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));const s=t-i;return Math.min(s,n)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?n.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(n.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){const i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=i}return t.map&&(n.map=this.initSegmentForMap(t.map)),n}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e{if(!t.length)return e;if(i)return t.slice();const n=t[0].pts;let s=0;for(;s=n);s++);return e.slice(0,s).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:s,useVideoTimingInfo:a,videoTimingInfo:r,audioTimingInfo:o}){if(void 0!==e)return e;if(!a)return o.start;const d=t.segments[i-1];return 0!==i&&d&&void 0!==d.start&&d.end===n+s?r.start:n}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:i,hasVideo:n,isMuxed:s}=t,a="main"===this.loaderType_&&n,r=!this.audioDisabled_&&i&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,r&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),r&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=((e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null)(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=((e,t)=>{if("hls"!==t)return null;const i=(e=>{let t=0;return["video","audio"].forEach((function(i){const n=e[`${i}TimingInfo`];if(!n)return;const{start:s,end:a}=n;let r;"bigint"==typeof s||"bigint"==typeof a?r=window.BigInt(a)-window.BigInt(s):"number"==typeof s&&"number"==typeof a&&(r=a-s),void 0!==r&&r>t&&(t=r)})),"bigint"==typeof t&&t=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,a=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,r=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(a||r)return this.logger_(`bad ${a?"segment":"part"} ${tn(e)}`),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase()))},ln=["video","audio"],hn=(e,t)=>{const i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},cn=(e,t)=>{if(0===t.queue.length)return;let i=0,n=t.queue[i];if("mediaSource"!==n.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!hn(e,t)){if(n.type!==e){if(i=((e,t)=>{for(let i=0;i{const i=t[`${e}Buffer`],n=un(e);i&&(i.removeEventListener("updateend",t[`on${n}UpdateEnd_`]),i.removeEventListener("error",t[`on${n}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},mn=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),gn=(e,t,i)=>(n,s)=>{const a=s[`${n}Buffer`];if(mn(s.mediaSource,a)){s.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${n}Buffer`);try{a.appendBuffer(e)}catch(e){s.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${n}Buffer`),s.queuePending[n]=null,i(e)}}},fn=(e,t)=>(i,n)=>{const s=n[`${i}Buffer`];if(mn(n.mediaSource,s)){n.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{s.remove(e,t)}catch(s){n.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},yn=e=>(t,i)=>{const n=i[`${t}Buffer`];mn(i.mediaSource,n)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),n.timestampOffset=e)},_n=e=>(t,i)=>{e()},Tn=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){s.default.log.warn("Failed to call media source endOfStream",e)}}},bn=e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){s.default.log.warn("Failed to set media source duration",e)}},Sn=(e,t)=>i=>{const n=un(e),s=x(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const a=i.mediaSource.addSourceBuffer(s);a.addEventListener("updateend",i[`on${n}UpdateEnd_`]),a.addEventListener("error",i[`on${n}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=a},vn=e=>t=>{const i=t[`${e}Buffer`];if(pn(e,t),mn(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){s.default.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},wn=e=>(t,i)=>{const n=i[`${t}Buffer`],s=x(e);mn(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`),n.changeType(s),i.codecs[t]=e)},En=({type:e,sourceUpdater:t,action:i,doneFn:n,name:s})=>{t.queue.push({type:e,action:i,doneFn:n,name:s}),cn(e,t)},In=(e,t)=>i=>{const n=function(e){let t="";for(let i=0;i ${s})`}return t||"empty"}(t[`${e}Buffered`]());if(t.logger_(`${e} source buffer update end. Buffered: \n`,n),t.queuePending[e]){const i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}cn(e,t)};class An extends s.default.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>cn("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=h("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=In("video",this),this.onAudioUpdateEnd_=In("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){En({type:"mediaSource",sourceUpdater:this,action:Sn(e,t),name:"addSourceBuffer"})}abort(e){En({type:e,sourceUpdater:this,action:(e,t)=>{if("open"!==t.mediaSource.readyState)return;const i=t[`${e}Buffer`];if(mn(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){s.default.log.warn(`Failed to abort on ${e}Buffer`,t)}}},name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?En({type:"mediaSource",sourceUpdater:this,action:vn(e),name:"removeSourceBuffer"}):s.default.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!s.default.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?En({type:e,sourceUpdater:this,action:wn(t),name:"changeType"}):s.default.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:s}=e;if(this.processedAppend_=!0,"audio"===n&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${s.length} until video append`);if(En({type:n,sourceUpdater:this,action:gn(s,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===n){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach((e=>{this.appendBuffer.apply(this,e)}))}}audioBuffered(){return mn(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:C()}videoBuffered(){return mn(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:C()}buffered(){const e=mn(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=mn(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,n=null,s=0;const a=[],r=[];if(!(e&&e.length&&t&&t.length))return C();let o=e.length;for(;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>pn(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Dn=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Ln=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class xn extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class kn extends on{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return C();const e=this.subtitlesTrack_.cues;return C([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=We(e);let n=this.initSegments_[i];if(t&&!n&&e.bytes){const t=Ln.byteLength+e.bytes.byteLength,s=new Uint8Array(t);s.set(e.bytes),s.set(Ln,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){Qi(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Ii&&this.handleTimeout_(),e.code===Ai?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const s=n.segment;if(s.map&&(s.map.bytes=t.map.bytes),n.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));s.requested=!0;try{this.parseVTTCues_(n)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,n.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){const t=e.cues;if(!t)return;const i={};for(let n=t.length-1;n>=0;n--){const s=t[n],a=`${s.startTime}-${s.endTime}-${s.text}`;i[a]?e.removeCue(s):i[a]=s}}(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof window.WebVTT)throw new xn;"function"==typeof window.TextDecoder?t=new window.TextDecoder("utf8"):(t=window.WebVTT.StringDecoder(),i=!0);const n=new window.WebVTT.Parser(window,window.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=t=>{e.timestampmap=t},n.onparsingerror=e=>{s.default.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=Dn(t)),n.parse(t)}let a=e.bytes;i&&(a=Dn(a)),n.parse(a),n.flush()}updateTimeMapping_(e,t,i){const n=e.segment;if(!t)return;if(!e.cues.length)return void(n.empty=!0);const s=e.timestampmap,a=s.MPEGTS/Ji-s.LOCAL+t.mapping;if(e.cues.forEach((e=>{e.startTime+=a,e.endTime+=a})),!i.syncInfo){const t=e.cues[0].startTime,s=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,s-n.duration)}}}}const On=function(e,t){const i=e.cues;for(let e=0;e=n.adStartTime&&t<=n.adEndTime)return n}return null},Pn=[{name:"VOD",run:(e,t,i,n,s)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(e,t,i,n,s)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let a=null,r=null;const o=H(t);s=s||0;for(let i=0;i{let a=null,r=null;s=s||0;const o=H(t);for(let e=0;e=e)&&(r=e,a={time:u,segmentIndex:i.segmentIndex,partIndex:i.partIndex})}}return a}},{name:"Discontinuity",run:(e,t,i,n,s)=>{let a=null;if(s=s||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let n=0;n=e)&&(i=e,a={time:d.time,segmentIndex:r,partIndex:null})}}}return a}},{name:"Playlist",run:(e,t,i,n,s)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class Un extends s.default.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=h("SyncController")}getSyncPoint(e,t,i,n){const s=this.runStrategies_(e,t,i,n);return s.length?this.selectSyncPoint_(s,{key:"time",value:n}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+K({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n){const s=[];for(let a=0;a86400)s.default.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let n=i-1;n>=0;n--){const i=e.segments[n];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-s.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,s=e.part;let a,r,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),a=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;a=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=a,s.end=r),(!n.start||ao){let n;n=r<0?i.start-K({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+K({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:n,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class Cn extends s.default.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Rn=fi(yi((function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const f=String.fromCharCode(9),y=function(e){const t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},_=function(e){const t={};if(!e)return t;const i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let n,s=i.length;for(;s--;)""!==i[s]&&(n=/([^=]*)=(.*)/.exec(i[s]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),t[n[0]]=n[1]);return t};class T extends p{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(((t,i)=>{const n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((e=>{for(let t=0;te),this.customParsers.push((s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:i(s),customType:t,segment:n}),!0}))}addTagMapper({expression:e,map:t}){this.tagMappers.push((i=>e.test(i)?t(i):i))}}const b=function(e){const t={};return Object.keys(e).forEach((function(i){var n;t[(n=i,n.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase())))]=e[i]})),t},S=function(e){const{serverControl:t,targetDuration:i,partTargetDuration:n}=e;if(!t)return;const s="#EXT-X-SERVER-CONTROL",a="holdBack",r="partHoldBack",o=i&&3*i,d=n&&2*n;i&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[a]{s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof d||(s.timeline=d),this.manifest.preloadSegment=s)})),this.parseStream.on("data",(function(p){let g,f;({tag(){({version(){p.version&&(this.manifest.version=p.version)},"allow-cache"(){this.manifest.allowCache=p.allowed,"allowed"in p||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const e={};"length"in p&&(s.byterange=e,e.length=p.length,"offset"in p||(p.offset=u)),"offset"in p&&(s.byterange=e,e.offset=p.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),p.title&&(s.title=p.title),p.duration>0&&(s.duration=p.duration),0===p.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(p.attributes)if("NONE"!==p.attributes.METHOD)if(p.attributes.URI){if("com.apple.streamingkeydelivery"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:p.attributes});if("com.microsoft.playready"===p.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:p.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===p.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(p.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===p.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==p.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):p.attributes.KEYID&&"0x"===p.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:p.attributes.KEYFORMAT,keyId:p.attributes.KEYID.substring(2)},pssh:m(p.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));p.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:p.attributes.METHOD||"AES-128",uri:p.attributes.URI},void 0!==p.attributes.IV&&(n.iv=p.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(p.number)?this.manifest.mediaSequence=p.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+p.number})},"discontinuity-sequence"(){isFinite(p.number)?(this.manifest.discontinuitySequence=p.number,d=p.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+p.number})},"playlist-type"(){/VOD|EVENT/.test(p.playlistType)?this.manifest.playlistType=p.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+p.playlist})},map(){i={},p.uri&&(i.uri=p.uri),p.byterange&&(i.byterange=p.byterange),n&&(i.key=n)},"stream-inf"(){this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||o,p.attributes?(s.attributes||(s.attributes={}),c(s.attributes,p.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||o,!(p.attributes&&p.attributes.TYPE&&p.attributes["GROUP-ID"]&&p.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const e=this.manifest.mediaGroups[p.attributes.TYPE];e[p.attributes["GROUP-ID"]]=e[p.attributes["GROUP-ID"]]||{},g=e[p.attributes["GROUP-ID"]],f={default:/yes/i.test(p.attributes.DEFAULT)},f.default?f.autoselect=!0:f.autoselect=/yes/i.test(p.attributes.AUTOSELECT),p.attributes.LANGUAGE&&(f.language=p.attributes.LANGUAGE),p.attributes.URI&&(f.uri=p.attributes.URI),p.attributes["INSTREAM-ID"]&&(f.instreamId=p.attributes["INSTREAM-ID"]),p.attributes.CHARACTERISTICS&&(f.characteristics=p.attributes.CHARACTERISTICS),p.attributes.FORCED&&(f.forced=/yes/i.test(p.attributes.FORCED)),g[p.attributes.NAME]=f},discontinuity(){d+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=p.dateTimeString,this.manifest.dateTimeObject=p.dateTimeObject),s.dateTimeString=p.dateTimeString,s.dateTimeObject=p.dateTimeObject;const{lastProgramDateTime:e}=this;this.lastProgramDateTime=new Date(p.dateTimeString).getTime(),null===e&&this.manifest.segments.reduceRight(((e,t)=>(t.programDateTime=e-1e3*t.duration,t.programDateTime)),this.lastProgramDateTime)},targetduration(){!isFinite(p.duration)||p.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+p.duration}):(this.manifest.targetDuration=p.duration,S.call(this,this.manifest))},start(){p.attributes&&!isNaN(p.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:p.attributes["TIME-OFFSET"],precise:p.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){s.cueOut=p.data},"cue-out-cont"(){s.cueOutCont=p.data},"cue-in"(){s.cueIn=p.data},skip(){this.manifest.skip=b(p.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",p.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const e=this.manifest.segments.length,t=b(p.attributes);s.parts=s.parts||[],s.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=l),l=t.byterange.offset+t.byterange.length);const i=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${e}`,p.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const e=this.manifest.serverControl=b(p.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),S.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const e=this.manifest.segments.length,t=b(p.attributes),i=t.type&&"PART"===t.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?l:0,i&&(l=t.byterange.offset+t.byterange.length)));const n=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${n} for segment #${e}`,p.attributes,["TYPE","URI"]),t.type)for(let i=0;ie.id===t.id));this.manifest.dateRanges[e]=c(this.manifest.dateRanges[e],t),h[t.id]=c(h[t.id],t),this.manifest.dateRanges.pop()}else h[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=b(p.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",p.attributes,["SERVER-URI"])}}[p.tagType]||r).call(e)},uri(){s.uri=p.uri,t.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=d,i&&(s.map=i),l=0,null!==this.lastProgramDateTime&&(s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*s.duration),s={}},comment(){},custom(){p.segment?(s.custom=s.custom||{},s.custom[p.customType]=p.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[p.customType]=p.data)}})[p.type].call(e)}))}warnOnMissingAttributes_(e,t,i){const n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var w={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},E=["video","audio","text"],I=["Video","Audio","Text"],A=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},D=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),E.forEach((function(n){var s=w[n].exec(e.toLowerCase());if(s&&!(s.length<=1)){t=n;var a=e.substring(0,s[1].length),r=e.replace(a,"");i.push({type:a,details:r,mediaType:n})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},L=function(e){return void 0===e&&(e=""),w.audio.test(e.trim().toLowerCase())},x=function(e){if(e&&"string"==typeof e){var t,i=e.toLowerCase().split(",").map((function(e){return A(e.trim())})),n="video";1===i.length&&L(i[0])?n="audio":1===i.length&&(void 0===(t=i[0])&&(t=""),w.text.test(t.trim().toLowerCase()))&&(n="application");var s="mp4";return i.every((function(e){return w.mp4.test(e)}))?s="mp4":i.every((function(e){return w.webm.test(e)}))?s="webm":i.every((function(e){return w.ogg.test(e)}))&&(s="ogg"),n+"/"+s+';codecs="'+e+'"'}},P=function(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(x(e))||!1},k=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t=t}))},F=function(e,t){return N(e,(function(e){return e-R>=t}))},q=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},$=e=>{const t=[];for(let i=0;ia||(i+=t>s&&t<=a?a-t:a-s)}return i},V=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},H=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(n,s){e.push({duration:n.duration,segmentIndex:i,partIndex:s,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),X=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},j=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:i}=e;let n=(i||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return n+=t&&t.length?t.length:0,n},z=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;const i=X(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Y=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),tn&&([i,n]=[n,i]),i<0){for(let t=i;tDate.now()},ee=function(e){return e.excludeUntil&&e.excludeUntil===1/0},te=function(e){const t=Z(e);return!e.disabled&&!t},ie=function(e,t){return t.attributes&&t.attributes[e]},ne=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!te(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),ae=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let n=!1;for(const e in i){for(const s in i[e])if(n=t(i[e][s]),n)break;if(n)break}return!!n},re=e=>{if(!e||!e.playlists||!e.playlists.length)return ae(e,(e=>e.playlists&&e.playlists.length||e.uri));for(let t=0;tL(e))))&&!ae(e,(e=>se(i,e))))return!1}return!0};var oe={liveEdgeDelay:z,duration:Q,seekable:function(e,t,i){const n=t||0;let s=J(e,t,!0,i);return null===s?C():(s0)for(let t=d-1;t>=0;t--){const i=o[t];if(r+=i.duration,a){if(r<0)continue}else if(r+R<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s-K({defaultDuration:e.targetDuration,durationList:o,startIndex:d,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(d<0){for(let i=d;i<0;i++)if(r-=e.targetDuration,r<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};d=0}for(let t=d;t0)continue}else if(r-R>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s+K({defaultDuration:e.targetDuration,durationList:o,startIndex:d,endIndex:t})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:te,isDisabled:function(e){return e.disabled},isExcluded:Z,isIncompatible:ee,playlistEnd:J,isAes:function(e){for(let t=0;t`${e}-${t}`,le=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,he=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const n in e.mediaGroups[i])for(const s in e.mediaGroups[i][n]){const a=e.mediaGroups[i][n][s];t(a,i,n,s)}}))},ce=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},pe=(e,t,i=le)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(n&&"AUDIO"===s&&!t.uri)for(let t=0;t{let t=e.playlists.length;for(;t--;){const i=e.playlists[t];ce({playlist:i,id:ue(t,i.uri)}),i.resolvedUri=u(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||de.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(e),(e=>{he(e,(t=>{t.uri&&(t.resolvedUri=u(e.uri,t.uri))}))})(e)};class me{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(null!==this.offset_)return;if(!e.length)return;const[t]=e;void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce(((e,t)=>(e.set(t.id,t),e)),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const e={},t=[];this.pendingDateRanges_.forEach(((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),i.class))if(e[i.class]){const t=e[i.class].push(i);i.classListIndex=t-1}else e[i.class]=[i],i.classListIndex=0}));for(const i of t){const t=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&t[i.classListIndex+1]?i.endTime=t[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach(((t,i)=>{t.startDate.getTime(){if(!e)return t;const i=U(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let n=0;n{!e.resolvedUri&&e.uri&&(e.resolvedUri=u(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=u(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=u(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=u(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=u(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=u(t,e.uri))}))},_e=function(e){const t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;ee===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,be=(e,t,i=Te)=>{const n=U(e,{}),s=n.playlists[t.id];if(!s)return null;if(i(s,t))return null;t.segments=_e(t);const a=U(s,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,s.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{const n=e.slice(),s=t.slice();i=i||0;const a=[];let r;for(let e=0;e{ye(e,a.resolvedUri)}));for(let e=0;e{if(e.playlists)for(let i=0;i{const i=e.segments||[],n=i[i.length-1],s=n&&n.parts&&n.parts[n.parts.length-1],a=s&&s.duration||n&&n.duration;return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)};class ve extends ge{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=h("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new me,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=u(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(t.endList||!t.serverControl)return e;const i={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let n=t.mediaSequence+t.segments.length;if(e){const s=e.parts||[],a=j(t)-1;a>-1&&a!==s.length-1&&(i._HLS_part=a),(a>-1||s.length)&&n--}i._HLS_msn=n}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const t=new window.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])})),e=t.toString()}return e})(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,i){const{uri:n,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return(({onwarn:e,oninfo:t,manifestString:i,customTagParsers:n=[],customTagMappers:s=[],llhls:a})=>{const r=new v;e&&r.on("warn",e),t&&r.on("info",t),n.forEach((e=>r.addParser(e))),s.forEach((e=>r.addTagMapper(e))),r.push(i),r.end();const o=r.manifest;if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),e&&e(`manifest has no targetDuration defaulting to ${t}`),o.targetDuration=t}const d=X(o);if(d.length&&!o.partTargetDuration){const t=d.reduce(((e,t)=>Math.max(e,t.duration)),0);e&&(e(`manifest has no partTargetDuration defaulting to ${t}`),de.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=t}return o})({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const s=t||this.parseManifest_({url:i,manifestString:e});s.lastRequest=Date.now(),ce({playlist:s,uri:i,id:n});const a=be(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Se(this.media(),!!a)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new me,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(window.clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,e,!1),t))}const i=this.state,n=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Se(e,!0)),n){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},((t,n)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=l(e.resolvedUri,n),t)return this.playlistRequestError(this.request,e,i);this.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=l(this.src,t);const i=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(i)}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,pe(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=_e(e),e.segments.forEach((t=>{ye(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||window.location.href;this.main=((e,t)=>{const i=ue(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n})(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:we}=s.default,Ee=function(e,t,i,n){const s="arraybuffer"===e.responseType?e.response:e.responseText;!t&&s&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=s.byteLength||s.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(s||e.responseText)))),n(t,e)},Ie=function(){const e=function e(t,i){t=U({timeout:45e3},t);const n=e.beforeRequest||s.default.Vhs.xhr.beforeRequest,a=e._requestCallbackSet||s.default.Vhs.xhr._requestCallbackSet||new Set,r=e._responseCallbackSet||s.default.Vhs.xhr._responseCallbackSet;n&&"function"==typeof n&&(s.default.log.warn("beforeRequest is deprecated, use onRequest instead."),a.add(n));const o=!0===s.default.Vhs.xhr.original?we:s.default.Vhs.xhr,d=((e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach((e=>{i=e(i)})),i})(a,t);a.delete(n);const u=o(d||t,(function(e,t){return((e,t,i,n)=>{e&&e.size&&e.forEach((e=>{e(t,i,n)}))})(r,u,e,t),Ee(u,e,t,i)})),l=u.abort;return u.abort=function(){return u.aborted=!0,l.apply(u,arguments)},u.uri=t.uri,u.requestTime=Date.now(),u};return e.original=!0,e},Ae=function(e){const t={};return e.byterange&&(t.Range=function(e){let t;const i=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t}(e.byterange)),t};var De,Le,xe=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Pe=/^application\/dash\+xml/i,ke=function(e){return xe.test(e)?"hls":Pe.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Oe=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Ue=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Oe(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ce=window.BigInt||Number,Re=[Ce("0x1"),Ce("0x100"),Ce("0x10000"),Ce("0x1000000"),Ce("0x100000000"),Ce("0x10000000000"),Ce("0x1000000000000"),Ce("0x100000000000000"),Ce("0x10000000000000000")];De=new Uint16Array([65484]),255===(Le=new Uint8Array(De.buffer,De.byteOffset,De.byteLength))[0]||Le[0];var Me=function(e,t){var i=void 0===t?{}:t,n=i.signed,s=void 0!==n&&n,a=i.le,r=void 0!==a&&a;e=Ue(e);var o=r?"reduce":"reduceRight",d=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var s=r?n:Math.abs(n+1-e.length);return t+Ce(i)*Re[s]}),Ce(0));if(s){var u=Re[e.length]/Ce(2)-Ce(1);(d=Ce(d))>u&&(d-=u,d-=u,d-=Ce(2))}return Number(d)},Ne=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n=t.length&&d.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))};const Fe=function(e,t){return e.start(t)+"-"+e.end(t)},qe=function(e,t){const i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},$e=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Ge=function(e){const t={};return Object.keys(e).forEach((i=>{const n=e[i];Oe(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},We=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Ve=function(e){return e.resolvedUri},He=e=>{const t=Array.prototype.slice.call(e),i=16;let n,s,a="";for(let e=0;eHe(e),textRanges:e=>{let t,i="";for(t=0;t{if(!r)throw new Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!n)return r({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!a.hasStarted_)return r({message:"player must be playing a live stream to start buffering"});if(!(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let n=t.segments[0];if(inew Date(a.getTime()+1e3*r)?null:(i>new Date(a)&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:oe.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})})(e,t);if(!o)return r({message:`${e} was not found in the stream`});const d=o.segment,u=((e,t)=>{let i,n;try{i=new Date(e),n=new Date(t)}catch(e){}const s=i.getTime();return(n.getTime()-s)/1e3})(d.dateTimeObject,e);if("estimate"===o.type)return 0===i?r({message:`${e} is not buffered yet. Try again`}):(n(o.estimatedStart+u),void a.one("seeked",(()=>{je({programTime:e,playlist:t,retryCount:i-1,seekTo:n,pauseAfterSeek:s,tech:a,callback:r})})));const l=d.start+u;a.one("seeked",(()=>r(null,a.currentTime()))),s&&a.pause(),n(l)},ze=e=>!!e&&"object"==typeof e,Ye=(...e)=>e.reduce(((e,t)=>("object"!=typeof t||Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ze(e[i])&&ze(t[i])?e[i]=Ye(e[i],t[i]):e[i]=t[i]})),e)),{}),Qe=e=>Object.keys(e).map((t=>e[t])),Ke=e=>e.reduce(((e,t)=>e.concat(t)),[]),Je=e=>{if(!e.length)return[];const t=[];for(let i=0;i{const s={uri:t,resolvedUri:d(e||"",t)};if(i||n){const e=(i||n).split("-");let t,a=window.BigInt?window.BigInt(e[0]):parseInt(e[0],10),r=window.BigInt?window.BigInt(e[1]):parseInt(e[1],10);a(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),tt={static(e){const{duration:t,timescale:i=1,sourceDuration:n,periodDuration:s}=e,a=et(e.endNumber),r=t/i;return"number"==typeof a?{start:0,end:a}:"number"==typeof s?{start:0,end:s/r}:{start:0,end:n/r}},dynamic(e){const{NOW:t,clientOffset:i,availabilityStartTime:n,timescale:s=1,duration:a,periodStart:r=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:d=1/0}=e,u=et(e.endNumber),l=(t+i)/1e3,h=n+r,c=l+o-h,p=Math.ceil(c*s/a),m=Math.floor((l-h-d)*s/a),g=Math.floor((l-h)*s/a);return{start:Math.max(0,m),end:"number"==typeof u?u:Math.min(p,g)}}},it=e=>{const{type:t,duration:i,timescale:n=1,periodDuration:s,sourceDuration:a}=e,{start:r,end:o}=tt[t](e),d=((e,t)=>{const i=[];for(let n=e;nt=>{const{duration:i,timescale:n=1,periodStart:s,startNumber:a=1}=e;return{number:a+t,duration:i/n,timeline:s,time:t*i}})(e));if("static"===t){const e=d.length-1,t="number"==typeof s?s:a;d[e].duration=t-i/n*e}return d},nt=e=>{const{baseUrl:t,initialization:i={},sourceDuration:n,indexRange:s="",periodStart:a,presentationTime:r,number:o=0,duration:d}=e;if(!t)throw new Error("NO_BASE_URL");const u=Ze({baseUrl:t,source:i.sourceURL,range:i.range}),l=Ze({baseUrl:t,source:t,indexRange:s});if(l.map=u,d){const t=it(e);t.length&&(l.duration=t[0].duration,l.timeline=t[0].timeline)}else n&&(l.duration=n,l.timeline=a);return l.presentationTime=r||a,l.number=o,[l]},st=(e,t,i)=>{const n=e.sidx.map?e.sidx.map:null,s=e.sidx.duration,a=e.timeline||0,r=e.sidx.byterange,o=r.offset+r.length,d=t.timescale,u=t.references.filter((e=>1!==e.referenceType)),l=[],h=e.endList?"static":"dynamic",c=e.sidx.timeline;let p,m=c,g=e.mediaSequence||0;p="bigint"==typeof t.firstOffset?window.BigInt(o)+t.firstOffset:o+t.firstOffset;for(let e=0;e{return(t=e,i=({timeline:e})=>e,Qe(t.reduce(((e,t)=>(t.forEach((t=>{e[i(t)]=t})),e)),{}))).sort(((e,t)=>e.timeline>t.timeline?1:-1));var t,i},ot=e=>{let t=[];var i,n;return i=e,n=(e,i,n,s)=>{t=t.concat(e.playlists||[])},at.forEach((function(e){for(var t in i.mediaGroups[e])for(var s in i.mediaGroups[e][t]){var a=i.mediaGroups[e][t][s];n(a)}})),t},dt=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},ut=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`})(e.byterange),lt=e=>{const t=e.reduce((function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e}),{});let i=[];return Object.values(t).forEach((e=>{const t=Qe(e.reduce(((e,t)=>{const i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{}));i=i.concat(t)})),i.map((e=>{var t;return e.discontinuityStarts=(t=e.segments||[],"discontinuity",t.reduce(((e,t,i)=>(t.discontinuity&&e.push(i),e)),[])),e}))},ht=(e,t)=>{const i=ut(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&st(e,n,e.sidx.resolvedUri),e},ct=(e,t={})=>{if(!Object.keys(t).length)return e;for(const i in e)e[i]=ht(e[i],t);return e},pt=({attributes:e,segments:t,sidx:i,discontinuityStarts:n})=>{const s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:n,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},mt=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,gt=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,ft=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,yt=e=>e?Object.keys(e).reduce(((t,i)=>{const n=e[i];return t.concat(n.playlists)}),[]):[],_t=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:n={},previousManifest:s,eventStream:a})=>{if(!e.length)return{};const{sourceDuration:r,type:o,suggestedPresentationDelay:d,minimumUpdatePeriod:u}=e[0].attributes,l=lt(e.filter(mt)).map(pt),h=lt(e.filter(gt)),c=lt(e.filter(ft)),p=e.map((e=>e.attributes.captionServices)).filter(Boolean),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:r,playlists:ct(l,n)};u>=0&&(m.minimumUpdatePeriod=1e3*u),t&&(m.locations=t),i&&(m.contentSteering=i),"dynamic"===o&&(m.suggestedPresentationDelay=d),a&&a.length>0&&(m.eventStream=a);const g=0===m.playlists.length,f=h.length?((e,t={},i=!1)=>{let n;const s=e.reduce(((e,s)=>{const a=s.attributes.role&&s.attributes.role.value||"",r=s.attributes.lang||"";let o=s.attributes.label||"main";if(r&&!s.attributes.label){const e=a?` (${a})`:"";o=`${s.attributes.lang}${e}`}e[o]||(e[o]={language:r,autoselect:!0,default:"main"===a,playlists:[],uri:""});const d=ht((({attributes:e,segments:t,sidx:i,mediaSequence:n,discontinuitySequence:s,discontinuityStarts:a},r)=>{const o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:s,discontinuityStarts:a,timelineStarts:e.timelineStarts,mediaSequence:n,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),e.serviceLocation&&(o.attributes.serviceLocation=e.serviceLocation),i&&(o.sidx=i),r&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o})(s,i),t);return e[o].playlists.push(d),void 0===n&&"main"===a&&(n=s,n.default=!0),e}),{});return n||(s[Object.keys(s)[0]].default=!0),s})(h,n,g):null,y=c.length?((e,t={})=>e.reduce(((e,i)=>{const n=i.attributes.label||i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(ht((({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:n,discontinuitySequence:s})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);const a={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};e.codecs&&(a.CODECS=e.codecs);const r={attributes:a,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:n,discontinuitySequence:s,mediaSequence:i,segments:t};return e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),r})(i),t)),e}),{}))(c,n):null,_=l.concat(yt(f),yt(y)),T=_.map((({timelineStarts:e})=>e));var b,S;return m.timelineStarts=rt(T),b=_,S=m.timelineStarts,b.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=S.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))})),f&&(m.mediaGroups.AUDIO.audio=f),y&&(m.mediaGroups.SUBTITLES.subs=y),p.length&&(m.mediaGroups["CLOSED-CAPTIONS"].cc=p.reduce(((e,t)=>t?(t.forEach((t=>{const{channel:i,language:n}=t;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e),{})),s?(({oldManifest:e,newManifest:t})=>{const i=e.playlists.concat(ot(e)),n=t.playlists.concat(ot(t));return t.timelineStarts=rt([e.timelineStarts,t.timelineStarts]),(({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));const n=((e,t)=>{for(let i=0;in.timeline||n.segments.length&&t.timeline>n.segments[n.segments.length-1].timeline)&&t.discontinuitySequence--);n.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),dt({playlist:t,mediaSequence:n.segments[a].number})}))})({oldPlaylists:i,newPlaylists:n,timelineStarts:t.timelineStarts}),t})({oldManifest:s,newManifest:m}):m},Tt=(e,t,i)=>{const{NOW:n,clientOffset:s,availabilityStartTime:a,timescale:r=1,periodStart:o=0,minimumUpdatePeriod:d=0}=e,u=(n+s)/1e3+d-(a+o);return Math.ceil((u*r-t)/i)},bt=(e,t)=>{const{type:i,minimumUpdatePeriod:n=0,media:s="",sourceDuration:a,timescale:r=1,startNumber:o=1,periodStart:d}=e,u=[];let l=-1;for(let h=0;hl&&(l=g),m<0){const o=h+1;f=o===t.length?"dynamic"===i&&n>0&&s.indexOf("$Number$")>0?Tt(e,l,p):(a*r-l)/p:(t[o].t-l)/p}else f=m+1;const y=o+u.length+f;let _=o+u.length;for(;_e.replace(St,(e=>(t,i,n,s)=>{if("$$"===t)return"$";if(void 0===e[i])return t;const a=""+e[i];return"RepresentationID"===i?a:(s=n?parseInt(s,10):1,a.length>=s?a:`${new Array(s-a.length+1).join("0")}${a}`)})(t)),wt=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=e,s=Ze({baseUrl:e.baseUrl,source:vt(n.sourceURL,i),range:n.range}),a=((e,t)=>e.duration||t?e.duration?it(e):bt(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}])(e,t);return a.map((t=>{i.Number=t.number,i.Time=t.time;const n=vt(e.media||"",i),a=e.timescale||1,r=e.presentationTimeOffset||0,o=e.periodStart+(t.time-r)/a;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:d(e.baseUrl||"",n),map:s,number:t.number,presentationTime:o}}))},Et=(e,t)=>{const{duration:i,segmentUrls:n=[],periodStart:s}=e;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");const a=n.map((t=>((e,t)=>{const{baseUrl:i,initialization:n={}}=e,s=Ze({baseUrl:i,source:n.sourceURL,range:n.range}),a=Ze({baseUrl:i,source:t.media,range:t.mediaRange});return a.map=s,a})(e,t)));let r;return i&&(r=it(e)),t&&(r=bt(e,t)),r.map(((t,i)=>{if(a[i]){const n=a[i],r=e.timescale||1,o=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=s+(t.time-o)/r,n}})).filter((e=>e))},It=({attributes:e,segmentInfo:t})=>{let i,n;t.template?(n=wt,i=Ye(e,t.template)):t.base?(n=nt,i=Ye(e,t.base)):t.list&&(n=Et,i=Ye(e,t.list));const s={attributes:e};if(!n)return s;const a=n(i,t.segmentTimeline);if(i.duration){const{duration:e,timescale:t=1}=i;i.duration=e/t}else a.length?i.duration=a.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0;return s.attributes=i,s.segments=a,t.base&&i.indexRange&&(s.sidx=a[0],s.segments=[]),s},At=(e,t)=>Je(e.childNodes).filter((({tagName:e})=>e===t)),Dt=e=>e.textContent.trim(),Lt=e=>{const t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;const[i,n,s,a,r,o]=t.slice(1);return 31536e3*parseFloat(i||0)+2592e3*parseFloat(n||0)+86400*parseFloat(s||0)+3600*parseFloat(a||0)+60*parseFloat(r||0)+parseFloat(o||0)},xt={mediaPresentationDuration:e=>Lt(e),availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:e=>Lt(e),suggestedPresentationDelay:e=>Lt(e),type:e=>e,timeShiftBufferDepth:e=>Lt(e),start:e=>Lt(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>(e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))))(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){const t=parseInt(e,10);return isNaN(t)?Lt(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},Pt=e=>e&&e.attributes?Je(e.attributes).reduce(((e,t)=>{const i=xt[t.name]||xt.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},kt={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Ot=(e,t)=>t.length?Ke(e.map((function(e){return t.map((function(t){const i=Dt(t),n=d(e.baseUrl,i),s=Ye(Pt(t),{baseUrl:n});return n!==i&&!s.serviceLocation&&e.serviceLocation&&(s.serviceLocation=e.serviceLocation),s}))}))):e,Ut=e=>{const t=At(e,"SegmentTemplate")[0],i=At(e,"SegmentList")[0],n=i&&At(i,"SegmentURL").map((e=>Ye({tag:"SegmentURL"},Pt(e)))),s=At(e,"SegmentBase")[0],a=i||t,r=a&&At(a,"SegmentTimeline")[0],o=i||s||t,d=o&&At(o,"Initialization")[0],u=t&&Pt(t);u&&d?u.initialization=d&&Pt(d):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});const l={template:u,segmentTimeline:r&&At(r,"S").map((e=>Pt(e))),list:i&&Ye(Pt(i),{segmentUrls:n,initialization:Pt(d)}),base:s&&Ye(Pt(s),{initialization:Pt(d)})};return Object.keys(l).forEach((e=>{l[e]||delete l[e]})),l},Ct=e=>Ke(At(e.node,"EventStream").map((t=>{const i=Pt(t),n=i.schemeIdUri;return At(t,"Event").map((t=>{const s=Pt(t),a=s.presentationTime||0,r=i.timescale||1,o=s.duration||0,d=a/r+e.attributes.start;return{schemeIdUri:n,value:i.value,id:s.id,start:d,end:d+o/r,messageData:Dt(t)||s.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),Rt=(e,t)=>(i,n)=>{const s=Ot(t,At(i.node,"BaseURL")),a=Ye(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(a.periodDuration=i.attributes.duration);const r=At(i.node,"AdaptationSet"),o=Ut(i.node);return Ke(r.map(((e,t,i)=>n=>{const s=Pt(n),a=Ot(t,At(n,"BaseURL")),r=At(n,"Role")[0],o={role:Pt(r)};let d=Ye(e,s,o);const u=At(n,"Accessibility")[0],l="urn:scte:dash:cc:cea-608:2015"===(h=Pt(u)).schemeIdUri?("string"!=typeof h.value?[]:h.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===h.schemeIdUri?("string"!=typeof h.value?[]:h.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[i,n=""]=e.split("=");t.channel=i,t.language=e,n.split(",").forEach((e=>{const[i,n]=e.split(":");"lang"===i?t.language=n:"er"===i?t.easyReader=Number(n):"war"===i?t.aspectRatio=Number(n):"3D"===i&&(t["3D"]=Number(n))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;var h;l&&(d=Ye(d,{captionServices:l}));const c=At(n,"Label")[0];if(c&&c.childNodes.length){const e=c.childNodes[0].nodeValue.trim();d=Ye(d,{label:e})}const p=At(n,"ContentProtection").reduce(((e,t)=>{const i=Pt(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const n=kt[i.schemeIdUri];if(n){e[n]={attributes:i};const s=At(t,"cenc:pssh")[0];if(s){const t=Dt(s);e[n].pssh=t&&m(t)}}return e}),{});Object.keys(p).length&&(d=Ye(d,{contentProtection:p}));const g=Ut(n),f=At(n,"Representation"),y=Ye(i,g);return Ke(f.map(((e,t,i)=>n=>{const s=At(n,"BaseURL"),a=Ot(t,s),r=Ye(e,Pt(n)),o=Ut(n);return a.map((e=>({segmentInfo:Ye(i,o),attributes:Ye(r,e)})))})(d,a,y)))})(a,s,o)))},Mt=(e,t)=>{if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;const i=Ye({serverURL:Dt(e[0])},Pt(e[0]));return i.queryBeforeStart="true"===i.queryBeforeStart,i},Nt=e=>{if(""===e)throw new Error("DASH_EMPTY_MANIFEST");const t=new i.DOMParser;let n,s;try{n=t.parseFromString(e,"application/xml"),s=n&&"MPD"===n.documentElement.tagName?n.documentElement:null}catch(e){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return s};var Bt=Math.pow(2,32),Ft=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))>4?n+20:n+10}(t,i),e(t,i))},Gt=function(e){return"string"==typeof e?Ne(e):e},Wt=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return Gt(e)})):[Gt(e)]}(i),t=Ue(t);var s=[];if(!i.length)return s;for(var a=0;a>>0,o=t.subarray(a+4,a+8);if(0===r)break;var d=a+r;if(d>t.length){if(n)break;d=t.length}var u=t.subarray(a+8,d);Be(o,i[0])&&(1===i.length?s.push(u):s.push.apply(s,e(u,i.slice(1),n))),a=d}return s},Vt={EBML:Ue([26,69,223,163]),DocType:Ue([66,130]),Segment:Ue([24,83,128,103]),SegmentInfo:Ue([21,73,169,102]),Tracks:Ue([22,84,174,107]),Track:Ue([174]),TrackNumber:Ue([215]),DefaultDuration:Ue([35,227,131]),TrackEntry:Ue([174]),TrackType:Ue([131]),FlagDefault:Ue([136]),CodecID:Ue([134]),CodecPrivate:Ue([99,162]),VideoTrack:Ue([224]),AudioTrack:Ue([225]),Cluster:Ue([31,67,182,117]),Timestamp:Ue([231]),TimestampScale:Ue([42,215,177]),BlockGroup:Ue([160]),BlockDuration:Ue([155]),Block:Ue([161]),SimpleBlock:Ue([163])},Ht=[128,64,32,16,8,4,2,1],Xt=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var s=function(e){for(var t=1,i=0;i=i.length)return i.length;var s=Xt(i,n,!1);if(Be(t.bytes,s.bytes))return n;var a=Xt(i,n+s.length);return e(t,i,n+a.length+a.value+s.length)},Yt=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return jt(e)})):[jt(e)]}(i),t=Ue(t);var n=[];if(!i.length)return n;for(var s=0;st.length?t.length:o+r.value,u=t.subarray(o,d);Be(i[0],a.bytes)&&(1===i.length?n.push(u):n=n.concat(e(u,i.slice(1)))),s+=a.length+r.length+u.length}return n},Qt=Ue([0,0,0,1]),Kt=Ue([0,0,1]),Jt=Ue([0,0,3]),Zt=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(d)&&(s=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},ti={webm:Ue([119,101,98,109]),matroska:Ue([109,97,116,114,111,115,107,97]),flac:Ue([102,76,97,67]),ogg:Ue([79,103,103,83]),ac3:Ue([11,119]),riff:Ue([82,73,70,70]),avi:Ue([65,86,73]),wav:Ue([87,65,86,69]),"3gp":Ue([102,116,121,112,51,103]),mp4:Ue([102,116,121,112]),fmp4:Ue([115,116,121,112]),mov:Ue([102,116,121,112,113,116]),moov:Ue([109,111,111,118]),moof:Ue([109,111,111,102])},ii={aac:function(e){var t=$t(e);return Be(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=$t(e);return Be(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Yt(e,[Vt.EBML,Vt.DocType])[0];return Be(t,ti.webm)},mkv:function(e){var t=Yt(e,[Vt.EBML,Vt.DocType])[0];return Be(t,ti.matroska)},mp4:function(e){return!ii["3gp"](e)&&!ii.mov(e)&&(!(!Be(e,ti.mp4,{offset:4})&&!Be(e,ti.fmp4,{offset:4}))||!(!Be(e,ti.moof,{offset:4})&&!Be(e,ti.moov,{offset:4}))||void 0)},mov:function(e){return Be(e,ti.mov,{offset:4})},"3gp":function(e){return Be(e,ti["3gp"],{offset:4})},ac3:function(e){var t=$t(e);return Be(e,ti.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188{if(4===e.readyState)return t()},{EventTarget:oi}=s.default,di=function(e,t){if(!Te(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i`placeholder-uri-${e}-${t}-${n.attributes.NAME||i}`,li=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,hi=(e,t)=>{const i={};for(const n in e){const s=e[n].sidx;if(s){const e=ut(s);if(!t[e])break;const n=t[e].sidxInfo;li(n,s)&&(i[e]=t[e])}}return i};class ci extends oi{constructor(e,t,i={},n){super(),this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",(()=>{this.refreshXml_()})),this.on("mediaupdatetimeout",(()=>{this.media().attributes.serviceLocation||this.refreshMedia_(this.media().id)})),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=h("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){const n=e.sidx&&ut(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n])return void(this.mediaRequest_=window.setTimeout((()=>i(!1)),0));const s=l(e.sidx.resolvedUri),a=(s,a)=>{if(this.requestErrored_(s,a,t))return;const r=this.mainPlaylistLoader_.sidxMapping_;let o;try{o=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Ft(e.subarray(n)),i.firstOffset=Ft(e.subarray(n+8)),n+=16),n+=2;var s=t.getUint16(n);for(n+=2;s>0;n+=12,s--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}(Ue(a.response).subarray(8))}catch(e){return void this.requestErrored_(e,a,t)}return r[n]={sidxInfo:e.sidx,sidx:o},st(e,o,e.sidx.resolvedUri),i(!0)};this.request=((e,t,i)=>{let n,s=[],a=!1;const r=function(e,t,n,s){return t.abort(),a=!0,i(e,t,n,s)},o=function(e,t){if(a)return;if(e)return r(e,t,"",s);const i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length);if(s=function(){for(var e=arguments.length,t=new Array(e),i=0;ir(e,t,"",s)));const o=ai(s);return"ts"===o&&s.length<188||!o&&s.length<376?ri(t,(()=>r(e,t,"",s))):r(null,t,o,s)},d={uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:i}){return Ee(e,null,{statusCode:e.status},o)}))}},u=t(d,(function(e,t){return Ee(u,e,t,o)}));return u})(s,this.vhs_.xhr,((t,i,n,r)=>{if(t)return a(t,i);if(!n||"mp4"!==n)return a({status:i.status,message:`Unsupported ${n||"unknown"} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);const{offset:o,length:d}=e.sidx.byterange;if(r.length>=d+o)return a(t,{response:r.subarray(o,o+d),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:Ae({byterange:e.sidx.byterange})},a)}))}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(i=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=window.setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=window.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,i)=>{if(this.requestErrored_(t,i))return void("HAVE_NOTHING"===this.state&&(this.started=!1));const n=i.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=l(this.mainPlaylistLoader_.srcUrl,i),n?(this.handleMain_(),void this.syncClientServerClock_((()=>e(i,n)))):e(i,n)}))}syncClientServerClock_(e){const t=(i=this.mainPlaylistLoader_.mainXml_,(e=>{const t=At(e,"UTCTiming")[0];if(!t)return null;const i=Pt(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i})(Nt(i)));var i;return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:u(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((i,n)=>{if(!this.request)return;if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let s;s="HEAD"===t.method?n.responseHeaders&&n.responseHeaders.date?Date.parse(n.responseHeaders.date):this.mainLoaded_:Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let t=(({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:n,previousManifest:s})=>{const a=((e,t={})=>{const i=((e,t={})=>{const{manifestUri:i="",NOW:n=Date.now(),clientOffset:s=0,eventHandler:a=function(){}}=t,r=At(e,"Period");if(!r.length)throw new Error("INVALID_NUMBER_OF_PERIOD");const o=At(e,"Location"),d=Pt(e),u=Ot([{baseUrl:i}],At(e,"BaseURL")),l=At(e,"ContentSteering");d.type=d.type||"static",d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=n,d.clientOffset=s,o.length&&(d.locations=o.map(Dt));const h=[];return r.forEach(((e,t)=>{const i=Pt(e),n=h[t-1];i.start=(({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0)({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:d.type}),h.push({node:e,attributes:i})})),{locations:d.locations,contentSteeringInfo:Mt(l,a),representationInfo:Ke(h.map(Rt(d,u))),eventStream:Ke(h.map(Ct))}})(Nt(e),t),n=i.representationInfo.map(It);return _t({dashPlaylists:n,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})})(e,{manifestUri:t,clientOffset:i,sidxMapping:n,previousManifest:s});return pe(a,t,ui),a})({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=((e,t,i)=>{let n=!0,s=U(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{if(e.playlists&&e.playlists.length){const r=e.playlists[0].id,o=be(s,e.playlists[0],di);o&&(s=o,a in s.mediaGroups[t][i]||(s.mediaGroups[t][i][a]=e),s.mediaGroups[t][i][a].playlists[0]=s.playlists[r],n=!1)}})),((e,t)=>{he(e,((i,n,s,a)=>{a in t.mediaGroups[n][s]||delete e.mediaGroups[n][s][a]}))})(s,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1),n?null:s})(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,t)=>{let i=hi(e.playlists,t);return he(e,((e,n,s,a)=>{if(e.playlists&&e.playlists.length){const n=e.playlists;i=U(i,hi(n,t))}})),i})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),Se(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const e=this.mainPlaylistLoader_.main.eventStream.map((e=>({cueTime:e.start,frames:[{data:e.messageData}]})));this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration)}}}var pi={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const mi=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},gi=function(e){return function(){const t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(t){const i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}}(e),i=mi(new Worker(t));i.objURL=t;const n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}},fi=function(e){return`var browserWorkerPolyFill = ${mi.toString()};\nbrowserWorkerPolyFill(self);\n`+e},yi=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},_i=fi(yi((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,s,a;if(i=e[t])if(2===arguments.length)for(s=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},f=function(e){return i(w.hdlr,x[e])},g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),i(w.mdhd,t)},m=function(e){return i(w.mdia,g(e),f(e.type),o(e))},r=function(e){return i(w.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return i(w.minf,"video"===e.type?i(w.vmhd,P):i(w.smhd,k),n(),_(e))},d=function(e,t){for(var n=[],s=t.length;s--;)n[s]=b(t[s]);return i.apply(null,[w.moof,r(e)].concat(n))},u=function(e){for(var t=e.length,n=[];t--;)n[t]=c(e[t]);return i.apply(null,[w.moov,h(4294967295)].concat(n).concat(l(e)))},l=function(e){for(var t=e.length,n=[];t--;)n[t]=S(e[t]);return i.apply(null,[w.mvex].concat(n))},h=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(w.mvhd,t)},y=function(e){var t,n,s=e.samples||[],a=new Uint8Array(4+s.length);for(n=0;n>>8),r.push(255&s[t].byteLength),r=r.concat(Array.prototype.slice.call(s[t]));for(t=0;t>>8),o.push(255&a[t].byteLength),o=o.concat(Array.prototype.slice.call(a[t]));if(n=[w.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(w.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],r,[a.length],o))),i(w.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var d=e.sarRatio[0],u=e.sarRatio[1];n.push(i(w.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return i.apply(null,n)},B=function(e){return i(w.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),s(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return i(w.tkhd,t)},b=function(e){var t,n,s,a,r,o;return t=i(w.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(e.baseMediaDecodeTime/H),o=Math.floor(e.baseMediaDecodeTime%H),n=i(w.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(s=v(e,92),i(w.traf,t,n,s)):(a=y(e),s=v(e,a.length+92),i(w.traf,t,n,s,a))},c=function(e){return e.duration=e.duration||4294967295,i(w.trak,p(e),m(e))},S=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),i(w.trex,t)},$=function(e,t){var i=0,n=0,s=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(s=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|s|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},q=function(e,t){var n,s,a,r,o,d;for(t+=20+16*(r=e.samples||[]).length,a=$(r,t),(s=new Uint8Array(a.length+16*r.length)).set(a),n=a.length,d=0;d>>24,s[n++]=(16711680&o.duration)>>>16,s[n++]=(65280&o.duration)>>>8,s[n++]=255&o.duration,s[n++]=(4278190080&o.size)>>>24,s[n++]=(16711680&o.size)>>>16,s[n++]=(65280&o.size)>>>8,s[n++]=255&o.size,s[n++]=o.flags.isLeading<<2|o.flags.dependsOn,s[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,s[n++]=61440&o.flags.degradationPriority,s[n++]=15&o.flags.degradationPriority,s[n++]=(4278190080&o.compositionTimeOffset)>>>24,s[n++]=(16711680&o.compositionTimeOffset)>>>16,s[n++]=(65280&o.compositionTimeOffset)>>>8,s[n++]=255&o.compositionTimeOffset;return i(w.trun,s)},F=function(e,t){var n,s,a,r,o,d;for(t+=20+8*(r=e.samples||[]).length,a=$(r,t),(n=new Uint8Array(a.length+8*r.length)).set(a),s=a.length,d=0;d>>24,n[s++]=(16711680&o.duration)>>>16,n[s++]=(65280&o.duration)>>>8,n[s++]=255&o.duration,n[s++]=(4278190080&o.size)>>>24,n[s++]=(16711680&o.size)>>>16,n[s++]=(65280&o.size)>>>8,n[s++]=255&o.size;return i(w.trun,n)},v=function(e,t){return"audio"===e.type?F(e,t):q(e,t)};var X,j,z,Y,Q,K,J,Z,ee={ftyp:a=function(){return i(w.ftyp,E,I,E,A)},mdat:function(e){return i(w.mdat,e)},moof:d,moov:u,initSegment:function(e){var t,i=a(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t}},te=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie={groupNalsIntoFrames:function(e){var t,i,n=[],s=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,n.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,n,s,a,r,o=t||0,d=[];for(i=0;ide.ONE_SECOND_IN_TS/2))){for((r=function(){if(!X){var e={96e3:[ne,[227,64],ae(154),[56]],88200:[ne,[231],ae(170),[56]],64e3:[ne,[248,192],ae(240),[56]],48e3:[ne,[255,192],ae(268),[55,148,128],ae(54),[112]],44100:[ne,[255,192],ae(268),[55,163,128],ae(84),[112]],32e3:[ne,[255,192],ae(268),[55,234],ae(226),[112]],24e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,112],ae(126),[224]],16e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,255],ae(269),[223,108],ae(195),[1,192]],12e3:[se,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,253,128],ae(259),[56]],11025:[se,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,255,192],ae(268),[55,175,128],ae(108),[112]],8e3:[se,ae(268),[3,121,16],ae(47),[7]]};t=e,X=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return X}()[e.samplerate])||(r=t[0].data),o=0;o=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},generateSampleTable:function(e){var t,i,n=[];for(t=0;t=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},_e.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},_e.prototype.addText=function(e){this.rows[this.rowIdx]+=e},_e.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Te=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new _e(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new _e(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var be=function(e){e=e||{},be.prototype.init.call(this);var t,i=this,n=e.captionServices||{},s={};Object.keys(n).forEach((e=>{t=n[e],/^SERVICE/.test(e)&&(s[e]=t.encoding)})),this.serviceEncodings=s,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(i.new708Packet(),i.add708Bytes(e)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e))}};be.prototype=new pe,be.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},be.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},be.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,s=0,a=t[s++];for(e.seq=a>>6,e.sizeCode=63&a;s>5)&&n>0&&(i=a=t[s++]),this.pushServiceBlock(i,s,n),n>0&&(s+=n-1)},be.prototype.pushServiceBlock=function(e,t,i){var n,s=t,a=this.current708Packet.data,r=this.services[e];for(r||(r=this.initService(e,s));s("0"+(255&e).toString(16)).slice(-2))).join("");n=String.fromCharCode(parseInt(e,16))}else r=fe[a=l|h]||a,n=4096&a&&a===r?"":String.fromCharCode(r);return p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(n),e},be.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,n=i[e+1],s=i[e+2];return ye(n)&&ye(s)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},be.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},be.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e],s=7&n;t.setCurrentWindow(s);var a=t.currentWindow;return n=i[++e],a.visible=(32&n)>>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},be.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.winAttr;return n=i[++e],s.fillOpacity=(192&n)>>6,s.fillRed=(48&n)>>4,s.fillGreen=(12&n)>>2,s.fillBlue=3&n,n=i[++e],s.borderType=(192&n)>>6,s.borderRed=(48&n)>>4,s.borderGreen=(12&n)>>2,s.borderBlue=3&n,n=i[++e],s.borderType+=(128&n)>>5,s.wordWrap=(64&n)>>6,s.printDirection=(48&n)>>4,s.scrollDirection=(12&n)>>2,s.justify=3&n,n=i[++e],s.effectSpeed=(240&n)>>4,s.effectDirection=(12&n)>>2,s.displayEffect=3&n,e},be.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},be.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},be.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var s=0;s<8;s++)i&1<>4,s.offset=(12&n)>>2,s.penSize=3&n,n=i[++e],s.italics=(128&n)>>7,s.underline=(64&n)>>6,s.edgeType=(56&n)>>3,s.fontStyle=7&n,e},be.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.penColor;return n=i[++e],s.fgOpacity=(192&n)>>6,s.fgRed=(48&n)>>4,s.fgGreen=(12&n)>>2,s.fgBlue=3&n,n=i[++e],s.bgOpacity=(192&n)>>6,s.bgRed=(48&n)>>4,s.bgGreen=(12&n)>>2,s.bgBlue=3&n,n=i[++e],s.edgeRed=(48&n)>>4,s.edgeGreen=(12&n)>>2,s.edgeBlue=3&n,e},be.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],s=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],s.row=15&n,n=i[++e],s.column=63&n,e},be.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Se={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},ve=function(e){return null===e?"":(e=Se[e]||e,String.fromCharCode(e))},we=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ee=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},Ie=function(e,t){Ie.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,s,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,s=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ee();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ee();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ee()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,s))a=ve((n=(3&n)<<8)|s),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,s))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),a=ve((n=(3&n)<<8)|s),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,s))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&s)&&this.addFormatting(e.pts,["i"]),1==(1&s)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,s)){const e=3&s;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(n,s)){var r=we.indexOf(7968&t);if("rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&s&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)){const e=(14&t)>>1;this.column_=4*e,this.nonDisplayed_[this.row_].indent+=e}this.isColorPAC(s)&&14==(14&s)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===s&&(s=null),a=ve(n),a+=ve(s),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ie.prototype=new pe,Ie.prototype.flushDisplayed=function(e){const t=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach(((e,n)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(n)}e.text.length&&i.push({text:e.text,line:n+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(n)})),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},Ie.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ee(),this.nonDisplayed_=Ee(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ie.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ie.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ie.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ie.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ie.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ie.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Ie.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ie.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ie.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ee(),this.displayed_=Ee()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Ie.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Ie.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},Ie.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},Ie.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},ke=function(e){var t,i;ke.prototype.init.call(this),this.type_=e||xe,this.push=function(e){this.type_!==xe&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Pe(e.dts,i),e.pts=Pe(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ke.prototype=new Le;var Oe,Ue={TimestampRolloverStream:ke,handleRollover:Pe},Ce=(e,t,i)=>{if(!e)return-1;for(var n=i;n>>2;l*=4,l+=3&u[7],o.timeStamp=l,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=r}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ye.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ye.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new je,Ve.STREAM_TYPES={h264:27,adts:15},He=function(){var e,t=this,i=!1,n={data:[],size:0},s={data:[],size:0},a={data:[],size:0},r=function(e,i,n){var s,a,r=new Uint8Array(e.size),o={type:i},d=0,u=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,d=0;d>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))}(r,o),s="video"===i||o.packetLength<=e.size,(n||s)&&(e.size=0,e.data.length=0),s&&t.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ye.H264_STREAM_TYPE:e=n,t="video";break;case Ye.ADTS_STREAM_TYPE:e=s,t="audio";break;case Ye.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(n,"video"),r(s,"audio"),r(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}},He.prototype=new je;var Je={PAT_PID:0,MP2T_PACKET_LENGTH:Ke,TransportPacketStream:We,TransportParseStream:Ve,ElementaryStream:He,TimestampRolloverStream:Qe,CaptionStream:ze.CaptionStream,Cea608Stream:ze.Cea608Stream,Cea708Stream:ze.Cea708Stream,MetadataStream:Xe};for(var Ze in Ye)Ye.hasOwnProperty(Ze)&&(Je[Ze]=Ye[Ze]);var et,tt=Je,it=oe.ONE_SECOND_IN_TS,nt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(et=function(e){var t,i=0;et.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${i} outside syncword`})},this.push=function(n){var s,a,r,o,d,u=0;if(e||(i=0),"audio"===n.type){var l;for(t&&t.length?(r=t,(t=new Uint8Array(r.byteLength+n.data.byteLength)).set(r),t.set(n.data,r.byteLength)):t=n.data;u+7>5,d=(o=1024*(1+(3&t[u+6])))*it/nt[(60&t[u+2])>>>2],t.byteLength-u>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:nt[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+a,u+s)}),i++,u+=s}else"number"!=typeof l&&(l=u),u++;"number"==typeof l&&(this.skipWarn_(l,u),l=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new G;var st,at,rt,ot=et,dt=G,ut=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var s=e.byteLength-t,a=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");a.set(e.subarray(s,s+r)),i=new DataView(a.buffer).getUint32(0),n=8*r,t-=r},this.skipBits=function(e){var s;n>e?(i<<=e,n-=e):(e-=n,e-=8*(s=Math.floor(e/8)),t-=s,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var s=Math.min(n,e),a=i>>>32-s;return(n-=s)>0?i<<=s:t>0&&this.loadWord(),(s=e-s)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(at=function(){var e,t,i=0;at.prototype.init.call(this),this.push=function(n){var s;t?((s=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),s.set(n.data,t.byteLength),t=s):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new dt,rt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},st=function(){var e,t,i,n,s,a,r,o=new at;st.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(r){var o={trackId:t,pts:i,dts:n,data:r,nalUnitTypeCode:31&r[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=s(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=s(r.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(e,t){var i,n=8,s=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},mt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=pt(e,t),mt(e,t))},gt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ft={isLikelyAacData:function(e){var t=mt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:pt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=gt(e.subarray(10,14)));do{if((i=gt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var s=0;s>>2;return(o*=4)+(3&r[7])}break}}t+=10,t+=i}while(t=3;)if(e[d]!=="I".charCodeAt(0)||e[d+1]!=="D".charCodeAt(0)||e[d+2]!=="3".charCodeAt(0))if(255!=(255&e[d])||240!=(240&e[d+1]))d++;else{if(e.length-d<7)break;if(d+(o=yt.parseAdtsSize(e,d))>e.length)break;a={type:"audio",data:e.subarray(d,d+o),pts:t,dts:t},this.trigger("data",a),d+=o}else{if(e.length-d<10)break;if(d+(o=yt.parseId3TagSize(e,d))>e.length)break;s={type:"timed-metadata",data:e.subarray(d,d+o)},this.trigger("data",s),d+=o}n=e.length-d,e=n>0?e.subarray(d):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new G;var _t,Tt,bt,St,vt=G,wt=ee,Et=ie,It=ue,At=he,Dt=tt,Lt=oe,xt=ot,Pt=ht.H264Stream,kt=lt,Ot=ft.isLikelyAacData,Ut=oe.ONE_SECOND_IN_TS,Ct=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Rt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Mt=function(e,t){t.stream=e,this.trigger("log",t)},Nt=function(e,t){for(var i=Object.keys(t),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,s,a,o,d,u;for(a=e.byteLength,o=e.nalCount,d=e.duration,t=i=0;tn.pts?t++:(i++,a-=s.byteLength,o-=s.nalCount,d-=s.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=d,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,n,s,a,o,d;for(t=r.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=r[t],s=e[i],n.pts===s.pts){o=!0;break}n.pts>s.pts?t--:(t===r.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(d=o?i:a))return e;var u=e.slice(d),l=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=l.byteLength,u.duration=l.duration,u.nalCount=l.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){r=e}},_t.prototype=new vt,St=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,St.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},St.prototype=new vt,St.prototype.flush=function(e){var t,i,n,s,a=0,r={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Rt.forEach((function(e){r.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Ct.forEach((function(e){r.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?r.type=this.pendingTracks[0].type:r.type="combined",this.emittedTracks+=this.pendingTracks.length,n=wt.initSegment(this.pendingTracks),r.initSegment=new Uint8Array(n.byteLength),r.initSegment.set(n),r.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},St.prototype.setRemux=function(e){this.remuxTracks=e},(bt=function(e){var t,i,n=this,s=!0;bt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="aac",s.metadataStream=new Dt.MetadataStream,s.aacStream=new kt,s.audioTimestampRolloverStream=new Dt.TimestampRolloverStream("audio"),s.timedMetadataTimestampRolloverStream=new Dt.TimestampRolloverStream("timed-metadata"),s.adtsStream=new xt,s.coalesceStream=new St(e,s.metadataStream),s.headOfPipeline=s.aacStream,s.aacStream.pipe(s.audioTimestampRolloverStream).pipe(s.adtsStream),s.aacStream.pipe(s.timedMetadataTimestampRolloverStream).pipe(s.metadataStream).pipe(s.coalesceStream),s.metadataStream.on("timestamp",(function(e){s.aacStream.setTimestamp(e.timeStamp)})),s.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||s.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new Tt(i,e),s.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),Nt(this,s)},this.setupTsPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="ts",s.metadataStream=new Dt.MetadataStream,s.packetStream=new Dt.TransportPacketStream,s.parseStream=new Dt.TransportParseStream,s.elementaryStream=new Dt.ElementaryStream,s.timestampRolloverStream=new Dt.TimestampRolloverStream,s.adtsStream=new xt,s.h264Stream=new Pt,s.captionStream=new Dt.CaptionStream(e),s.coalesceStream=new St(e,s.metadataStream),s.headOfPipeline=s.packetStream,s.packetStream.pipe(s.parseStream).pipe(s.elementaryStream).pipe(s.timestampRolloverStream),s.timestampRolloverStream.pipe(s.h264Stream),s.timestampRolloverStream.pipe(s.adtsStream),s.timestampRolloverStream.pipe(s.metadataStream).pipe(s.coalesceStream),s.h264Stream.pipe(s.captionStream).pipe(s.coalesceStream),s.elementaryStream.on("data",(function(a){var r;if("metadata"===a.type){for(r=a.tracks.length;r--;)t||"video"!==a.tracks[r].type?i||"audio"!==a.tracks[r].type||((i=a.tracks[r]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[r]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!s.videoSegmentStream&&(s.coalesceStream.numberOfTracks++,s.videoSegmentStream=new _t(t,e),s.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),s.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,s.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),s.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),s.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),s.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&s.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),s.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),s.h264Stream.pipe(s.videoSegmentStream).pipe(s.coalesceStream)),i&&!s.audioSegmentStream&&(s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new Tt(i,e),s.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),s.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("id3Frame",(function(e){e.dispatchType=s.metadataStream.dispatchType,n.trigger("id3Frame",e)})),s.coalesceStream.on("caption",this.trigger.bind(this,"caption")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),Nt(this,s)},this.setBaseMediaDecodeTime=function(n){var s=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,At.clearDtsInfo(i),s.audioTimestampRolloverStream&&s.audioTimestampRolloverStream.discontinuity()),t&&(s.videoSegmentStream&&(s.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,At.clearDtsInfo(t),s.captionStream.reset()),s.timestampRolloverStream&&s.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(s){var t=Ot(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),s=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){s=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new vt;var qt,$t,Gt,Wt,Vt={Transmuxer:bt,VideoSegmentStream:_t,AudioSegmentStream:Tt,AUDIO_PROPERTIES:Ct,VIDEO_PROPERTIES:Rt,generateSegmentTimingInfo:Ft},Ht=function(e){return e>>>0},Xt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},jt=Ht,zt=Xt,Yt=function(e,t){var i,n,s,a,r,o=[];if(!t.length)return null;for(i=0;i1?i+n:e.byteLength,s===t[0]&&(1===t.length?o.push(e.subarray(i+8,a)):(r=Yt(e.subarray(i+8,a),t.slice(1))).length&&(o=o.concat(r))),i=a;return o},Qt=Ht,Kt=V.getUint64,Jt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Kt(e.subarray(4)):t.baseMediaDecodeTime=Qt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Zt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ei=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=1&i.flags[2],a=4&i.flags[2],r=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],u=8&i.flags[1],l=n.getUint32(4),h=8;for(s&&(i.dataOffset=n.getInt32(h),h+=4),a&&l&&(t={flags:Zt(e.subarray(h,h+4))},h+=4,r&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),l--);l--;)t={},r&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),d&&(t.flags=Zt(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i},ti=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},s=1&n.flags[2],a=2&n.flags[2],r=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],u=65536&n.flags[0],l=131072&n.flags[0];return t=8,s&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),r&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),d&&(n.defaultSampleFlags=i.getUint32(t)),u&&(n.durationIsEmpty=!0),!s&&l&&(n.baseDataOffsetIsMoof=!0),n},ii=(qt="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},ce.discardEmulationPreventionBytes),ni=Ae.CaptionStream,si=Yt,ai=Jt,ri=ei,oi=ti,di=qt,ui=function(e,t){for(var i=e,n=0;n0;){var d=t.shift();this.parse(d,a,r)}return o=function(e,t,i){if(null===t)return null;var n=function(e,t){var i=si(e,["moof","traf"]),n=si(e,["mdat"]),s={},a=[];return n.forEach((function(e,t){var n=i[t];a.push({mdat:e,traf:n})})),a.forEach((function(e){var i,n,a=e.mdat,r=e.traf,o=si(r,["tfhd"]),d=oi(o[0]),u=d.trackId,l=si(r,["tfdt"]),h=l.length>0?ai(l[0]).baseMediaDecodeTime:0,c=si(r,["trun"]);t===u&&c.length>0&&(i=function(e,t,i){var n=t,s=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,r=i.trackId,o=[];return e.forEach((function(e){var t=ri(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=s),void 0===e.size&&(e.size=a),e.trackId=r,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof n?(e.pts=n+di.BigInt(e.compositionTimeOffset),n+=di.BigInt(e.duration)):(e.pts=n+e.compositionTimeOffset,n+=e.duration)})),o=o.concat(t)})),o}(c,h,d),n=function(e,t,i){var n,s,a,r,o=new DataView(e.buffer,e.byteOffset,e.byteLength),d={logs:[],seiNals:[]};for(s=0;s+41)&&n||s}(u,h)?h:void 0},scaleTime:function(e,t,i,n){return e||0===e?e/t:n+i/t}},gi=Ht,fi=function(e){return("00"+e.toString(16)).slice(-2)},yi=Yt,_i=Xt,Ti=mi,bi=V.getUint64,Si=qt,vi=qe.parseId3Frames;$t=function(e,t){var i=yi(t,["moof","traf"]).reduce((function(t,i){var n,s=yi(i,["tfhd"])[0],a=gi(s[4]<<24|s[5]<<16|s[6]<<8|s[7]),r=e[a]||9e4,o=yi(i,["tfdt"])[0],d=new DataView(o.buffer,o.byteOffset,o.byteLength);let u;return"bigint"==typeof(n=1===o[0]?bi(o.subarray(4,12)):d.getUint32(4))?u=n/Si.BigInt(r):"number"!=typeof n||isNaN(n)||(u=n/r),u11?(s.codec+=".",s.codec+=fi(l[9]),s.codec+=fi(l[10]),s.codec+=fi(l[11])):s.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(s.codec)?(l=h.subarray(28),"esds"===_i(l.subarray(4,8))&&l.length>20&&0!==l[19]?(s.codec+="."+fi(l[19]),s.codec+="."+fi(l[20]>>>2&63).replace(/^0/,"")):s.codec="mp4a.40.2"):s.codec=s.codec.toLowerCase())}var c=yi(e,["mdia","mdhd"])[0];c&&(s.timescale=Wt(c)),i.push(s)})),i};var wi=$t,Ei=Gt,Ii=function(e,t=0){return yi(e,["emsg"]).map((e=>{var i=Ti.parseEmsgBox(new Uint8Array(e)),n=vi(i.message_data);return{cueTime:Ti.scaleTime(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:Ti.scaleTime(i.event_duration,i.timescale),frames:n}}))},Ai=De,Di=function(e){var t=31&e[1];return(t<<=8)|e[2]},Li=function(e){return!!(64&e[1])},xi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Pi=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},ki={parseType:function(e,t){var i=Di(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Li(e),i=4+xi(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Li(e),n=4+xi(e);if(i&&(n+=e[n]+1),1&e[n+5]){var s;s=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+xi(e),i=e.subarray(t),n=0,s=0,a=!1;s3&&"slice_layer_without_partitioning_rbsp_idr"===Pi(31&i[s+3])&&(a=!0),a}},Oi=De,Ui=Ue.handleRollover,Ci={};Ci.ts=ki,Ci.aac=ft;var Ri=oe.ONE_SECOND_IN_TS,Mi=188,Ni=71,Bi=function(e,t,i){for(var n,s,a,r,o=0,d=Mi,u=!1;d<=e.byteLength;)if(e[o]!==Ni||e[d]!==Ni&&d!==e.byteLength)o++,d++;else{if(n=e.subarray(o,d),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"audio"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="audio",i.audio.push(r),u=!0)),u)break;o+=Mi,d+=Mi}for(o=(d=e.byteLength)-Mi,u=!1;o>=0;)if(e[o]!==Ni||e[d]!==Ni&&d!==e.byteLength)o--,d--;else{if(n=e.subarray(o,d),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"audio"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="audio",i.audio.push(r),u=!0)),u)break;o-=Mi,d-=Mi}},Fi=function(e,t,i){for(var n,s,a,r,o,d,u,l=0,h=Mi,c=!1,p={data:[],size:0};h=0;)if(e[l]!==Ni||e[h]!==Ni)l--,h--;else{if(n=e.subarray(l,h),"pes"===Ci.ts.parseType(n,t.pid)&&(s=Ci.ts.parsePesType(n,t.table),a=Ci.ts.parsePayloadUnitStartIndicator(n),"video"===s&&a&&(r=Ci.ts.parsePesTime(n))&&(r.type="video",i.video.push(r),c=!0)),c)break;l-=Mi,h-=Mi}},qi=function(e,t){var i;return i=Ci.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,s=null,a=null,r=0,o=0;e.length-o>=3;){switch(Ci.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((r=Ci.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+r),a=Ci.aac.parseAacTimestamp(t)),o+=r;break;case"audio":if(e.length-o<7){i=!0;break}if((r=Ci.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+r),s=Ci.aac.parseSampleRate(t)),n++,o+=r;break;default:o++}if(i)return null}if(null===s||null===a)return null;var d=Ri/s;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*d,pts:a+1024*n*d}]}}(e):function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,s=Mi;s{const{transmuxer:t,bytes:i,audioAppendStart:n,gopsToAlignWith:s,remux:a,onData:r,onTrackInfo:o,onAudioTimingInfo:d,onVideoTimingInfo:u,onVideoSegmentTimingInfo:l,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=e,_={buffer:[]};let T=y;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&((e,t,i)=>{const{type:n,initSegment:s,captions:a,captionStreams:r,metadata:o,videoFrameDtsTime:d,videoFramePtsTime:u}=e.data.segment;t.buffer.push({captions:a,captionStreams:r,metadata:o});const l=e.data.segment.boxes||{data:e.data.segment.data},h={type:n,data:new Uint8Array(l.data,l.data.byteOffset,l.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};void 0!==d&&(h.videoFrameDtsTime=d),void 0!==u&&(h.videoFramePtsTime=u),i(h)})(i,_,r),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(i,_),"audioTimingInfo"===i.data.action&&d(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&l(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(T=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(T||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:_,callback:m}),Si(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(s)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){const e=i instanceof ArrayBuffer?i:i.buffer,n=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:e,byteOffset:n,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Si=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():bi(e.currentTransmux))},vi=(e,t)=>{e.postMessage({action:t}),Si(e)};var wi=e=>{((e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void vi(t,e);t.transmuxQueue.push(vi.bind(null,t,e))})("reset",e)};const Ei=function(e){const t=e.transmuxer,i=e.endAction||e.action,n=e.callback,s=c({},e,{endAction:null,transmuxer:null,callback:null}),a=s=>{s.data.action===i&&(t.removeEventListener("message",a),s.data.data&&(s.data.data=new Uint8Array(s.data.data,e.byteOffset||0,e.byteLength||s.data.data.byteLength),e.data&&(e.data=s.data.data)),n(s.data))};if(t.addEventListener("message",a),e.data){const i=e.data instanceof ArrayBuffer;s.byteOffset=i?0:e.data.byteOffset,s.byteLength=e.data.byteLength;const n=[i?e.data:e.data.buffer];t.postMessage(s,n)}else t.postMessage(s)},Ii=-101,Ai=-102,Di=e=>{e.forEach((e=>{e.abort()}))},Li=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Ii,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Ai,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t}:null,xi=(e,t,i)=>(n,s)=>{const a=s.response,r=Li(n,s);if(r)return i(r,e);if(16!==a.byteLength)return i({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:2,xhr:s},e);const o=new DataView(a),d=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let e=0;e{const i=ai(e.map.bytes);if("mp4"!==i){const n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${n}`,code:2})}Ei({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:n})=>(e.map.bytes=n,i.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null))})},ki=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{const p=e.map&&e.map.tracks||{},m=Boolean(p.audio&&p.video);let g=n.bind(null,e,"audio","start");const f=n.bind(null,e,"audio","end");let y=n.bind(null,e,"video","start");const _=n.bind(null,e,"video","end");Ei({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:n=>{e.bytes=t=n.data;const p=n.result;p&&(i(e,{hasAudio:p.hasAudio,hasVideo:p.hasVideo,isMuxed:m}),i=null),(e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void bi(e);e.transmuxer.transmuxQueue.push(e)})({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,l(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{g&&void 0!==e.start&&(g(e.start),g=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{s(e)},onAudioSegmentTimingInfo:e=>{a(e)},onId3:(t,i)=>{r(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:d,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}})}})},Oi=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(function(e){return Wt(e,["moof"]).length>0}(p)){e.isFmp4=!0;const{tracks:s}=e.map,a={isFmp4:!0,hasVideo:!!s.video,hasAudio:!!s.audio};s.audio&&s.audio.codec&&"enca"!==s.audio.codec&&(a.audioCodec=s.audio.codec),s.video&&s.video.codec&&"encv"!==s.video.codec&&(a.videoCodec=s.video.codec),s.video&&s.audio&&(a.isMuxed=!0),i(e,a);const d=(t,i)=>{l(e,{data:p,type:a.hasAudio&&!a.isMuxed?"audio":"video"}),i&&i.length&&r(e,i),t&&t.length&&o(e,t),h(null,e,{})};Ei({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:r})=>{t=i.buffer,e.bytes=p=i,a.hasAudio&&!a.isMuxed&&n(e,"audio","start",r),a.hasVideo&&n(e,"video","start",r),Ei({action:"probeEmsgID3",data:p,transmuxer:e.transmuxer,offset:r,callback:({emsgData:i,id3Frames:n})=>{t=i.buffer,e.bytes=p=i,s.video&&i.byteLength&&e.transmuxer?Ei({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[s.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach((function(e){c(U(e,{stream:"mp4CaptionParser"}))})),d(i.captions,n)}}):d(void 0,n)}})}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=ai(p)),"ts"!==e.container&&"aac"!==e.container)return i(e,{hasAudio:!1,hasVideo:!1}),void h(null,e,{});ki({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})}else h(null,e,{})},Ui=function({id:e,key:t,encryptedBytes:i,decryptionWorker:n},s){const a=t=>{if(t.data.source===e){n.removeEventListener("message",a);const e=t.data.decrypted;s(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let r;n.addEventListener("message",a),r=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),n.postMessage(Ge({source:e,encrypted:i,key:r,iv:t.iv}),[i.buffer,r.buffer])},Ci=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:n,abortFn:s,progressFn:a,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[],_=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(g,f)=>{if(!m){if(g)return m=!0,Di(e),h(g,f);if(p+=1,p===e.length){const p=function(){if(f.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})=>{Ui({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,Oi({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})}))})({decryptionWorker:t,segment:f,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c});Oi({segment:f,bytes:f.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l,doneFn:h,onTransmuxerLog:c})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return Ui({decryptionWorker:t,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},(t=>{f.map.bytes=t,Pi(f,(t=>{if(t)return Di(e),h(t,f);p()}))}));p()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f});if(n.key&&!n.key.bytes){const i=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&i.push(n.map.key);const s=e(U(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),xi(n,i,_));y.push(s)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const i=e(U(t,{uri:n.map.key.resolvedUri,responseType:"arraybuffer"}),xi(n,[n.map.key],_));y.push(i)}const i=U(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Ae(n.map)}),s=(({segment:e,finishProcessingFn:t})=>(i,n)=>{const s=Li(i,n);if(s)return t(s,e);const a=new Uint8Array(n.response);if(e.map.key)return e.map.encryptedBytes=a,t(null,e);e.map.bytes=a,Pi(e,(function(i){if(i)return i.xhr=n,i.status=n.status,t(i,e);t(null,e)}))})({segment:n,finishProcessingFn:_}),a=e(i,s);y.push(a)}const T=U(t,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Ae(n)}),b=e(T,(({segment:e,finishProcessingFn:t,responseType:i})=>(n,s)=>{const a=Li(n,s);if(a)return t(a,e);const r="arraybuffer"!==i&&s.responseText?(e=>{const t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(s),e.key?e.encryptedBytes=new Uint8Array(r):e.bytes=new Uint8Array(r),t(null,e)})({segment:n,finishProcessingFn:_,responseType:T.responseType}));b.addEventListener("progress",(({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:a,id3Fn:r,captionsFn:o,isEndOfTimeline:d,endedTimelineFn:u,dataFn:l})=>i=>{if(!i.target.aborted)return e.stats=U(e.stats,(e=>{const t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i})(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)})({segment:n,progressFn:a,trackInfoFn:r,timingInfoFn:o,videoSegmentTimingInfoFn:d,audioSegmentTimingInfoFn:u,id3Fn:l,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(b);const S={};return y.forEach((e=>{e.addEventListener("loadend",(({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)})({loadendState:S,abortFn:s}))})),()=>Di(y)},Ri=h("CodecUtils"),Mi=(e,t)=>{const i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Ni=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:n})=>{t[e]=t[e]||[],t[e].push(A(`${i}${n}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return Ri(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),void(t[e]=null);t[e]=t[e][0]})),t},Bi=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},Fi=function(e,t){const i=t.attributes||{},n=Ni(function(e){const t=e.attributes||{};if(t.CODECS)return D(t.CODECS)}(t)||[]);if(Mi(e,t)&&!n.audio&&!((e,t)=>{if(!Mi(e,t))return!0;const i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(const e in n)if(!n[e].uri&&!n[e].playlists)return!0;return!1})(e,t)){const t=Ni(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var s=i[n];if(s.default&&s.playlists)return D(s.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);t.audio&&(n.audio=t.audio)}return n},qi=h("PlaylistSelector"),$i=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Gi=function(e,t){if(!e)return"";const i=window.getComputedStyle(e);return i?i[t]:""},Wi=function(e,t){const i=e.slice();e.sort((function(e,n){const s=t(e,n);return 0===s?i.indexOf(e)-i.indexOf(n):s}))},Vi=function(e,t){let i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||window.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),n=n||window.Number.MAX_VALUE,i-n};let Hi=function(e,t,i,n,s,a){if(!e)return;const r={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:s};let o=e.playlists;oe.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),r.audioOnly=!0);let d=o.map((e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||window.Number.MAX_VALUE,{bandwidth:t,width:i,height:n,playlist:e}}));Wi(d,((e,t)=>e.bandwidth-t.bandwidth)),d=d.filter((e=>!oe.isIncompatible(e.playlist)));let u=d.filter((e=>oe.isEnabled(e.playlist)));u.length||(u=d.filter((e=>!oe.isDisabled(e.playlist))));const l=u.filter((e=>e.bandwidth*pi.BANDWIDTH_VARIANCEe.bandwidth===h.bandwidth))[0];if(!1===s){const e=c||u[0]||d[0];if(e&&e.playlist){let t="sortedPlaylistReps";return c&&(t="bandwidthBestRep"),u[0]&&(t="enabledPlaylistReps"),qi(`choosing ${$i(e)} using ${t} with options`,r),e.playlist}return qi("could not choose a playlist with options",r),null}const p=l.filter((e=>e.width&&e.height));Wi(p,((e,t)=>e.width-t.width));const m=p.filter((e=>e.width===i&&e.height===n));h=m[m.length-1];const g=m.filter((e=>e.bandwidth===h.bandwidth))[0];let f,y,_,T;if(g||(f=p.filter((e=>e.width>i||e.height>n)),y=f.filter((e=>e.width===f[0].width&&e.height===f[0].height)),h=y[y.length-1],_=y.filter((e=>e.bandwidth===h.bandwidth))[0]),a.leastPixelDiffSelector){const e=p.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e)));Wi(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),T=e[0]}const b=T||_||g||c||u[0]||d[0];if(b&&b.playlist){let e="sortedPlaylistReps";return T?e="leastPixelDiffRep":_?e="resolutionPlusOneRep":g?e="resolutionBestRep":c?e="bandwidthBestRep":u[0]&&(e="enabledPlaylistReps"),qi(`choosing ${$i(b)} using ${e} with options`,r),b.playlist}return qi("could not choose a playlist with options",r),null};const Xi=function(){const e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return Hi(this.playlists.main,this.systemBandwidth,parseInt(Gi(this.tech_.el(),"width"),10)*e,parseInt(Gi(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},ji={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},zi=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Yi=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,s.default.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},Qi=function(e,t,i){let n,s;if(i&&i.cues)for(n=i.cues.length;n--;)s=i.cues[n],s.startTime>=e&&s.endTime<=t&&i.removeCue(s)};var Ki=9e4,Ji=Ki;const Zi=e=>"number"==typeof e&&isFinite(e),en=1/60,tn=e=>{const{startOfSegment:t,duration:i,segment:n,part:s,playlist:{mediaSequence:a,id:r,segments:o=[]},mediaIndex:d,partIndex:u,timeline:l}=e,h=o.length-1;let c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);const p="number"==typeof u,m=e.segment.uri?"segment":"pre-segment",g=p?j({preloadSegment:n})-1:0;return`${m} [${a+d}/${a+h}]`+(p?` part [${u}/${g}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(p?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${l}]`+` selected by [${c}]`+` playlist [${r}]`},nn=e=>`${e}TimingInfo`,sn=(e,t)=>e.length?e.end(e.length-1):t,an=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:n,audioDisabled:s})=>{if(t===i)return!1;if("audio"===n){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===n&&s){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},rn=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+R;class on extends s.default.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.calculateTimestampOffsetForEachSegment_=e.calculateTimestampOffsetForEachSegment,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",(()=>{this.isEndOfStream_()||(this.ended_=!1)})),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=h(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return(e=>{const t=new Ti;t.currentTransmux=null,t.transmuxQueue=[];const i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t})({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&wi(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return C();if("main"===this.loaderType_){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=We(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=Ve(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(n||e).resolvedUri};return n&&(s.bytes=n.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(i&&(i.id?s=i.id:i.uri&&(s=i.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&wi(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=(()=>{}),n=!1){if(t===1/0&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let s=1;const a=()=>{s--,0===s&&i()};!n&&this.audioDisabled_||(s++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=((e,t,i,n)=>{const s=Math.ceil((t-n)*Ji),a=Math.ceil((i-n)*Ji),r=e.slice();let o=e.length;for(;o--&&!(e[o].pts<=a););if(-1===o)return r;let d=o+1;for(;d--&&!(e[d].pts<=s););return d=Math.max(d,0),r.splice(d,o-d+1),r})(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,a));for(const i in this.inbandTextTracks_)Qi(e,t,this.inbandTextTracks_[i]);Qi(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const n="number"==typeof e&&t.segments[e],s=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&s&&a}chooseNextRequest_(){const e=this.buffered_(),t=G(e)||0,i=W(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,s=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const r={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(r.isSyncRequest)r.mediaIndex=function(e,t,i){t=t||[];const n=[];let s=0;for(let a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){const e=a[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;r.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(r.mediaIndex=this.mediaIndex,r.partIndex=i+1):r.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:e,startTime:i,partIndex:n}=oe.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});r.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,r.mediaIndex=e,r.startOfSegment=i,r.partIndex=n}const o=a[r.mediaIndex];let d=o&&"number"==typeof r.partIndex&&o.parts&&o.parts[r.partIndex];if(!o||"number"==typeof r.partIndex&&!d)return null;"number"!=typeof r.partIndex&&o.parts&&(r.partIndex=0,d=o.parts[0]);const u=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!u&&!d.independent)if(0===r.partIndex){const e=a[r.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(r.mediaIndex-=1,r.partIndex=e.parts.length-1,r.independent="previous segment")}else o.parts[r.partIndex-1].independent&&(r.partIndex-=1,r.independent="previous part");const l=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return r.mediaIndex>=a.length-1&&l&&!this.seeking_()?null:this.generateSegmentInfo_(r)}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:s,isSyncRequest:a,partIndex:r,forceTimestampOffset:o,getMediaInfoForTime:d}=e,u=i.segments[n],l="number"==typeof r&&u.parts[r],h={requestId:"segment-loader-"+Math.random(),uri:l&&l.resolvedUri||u.resolvedUri,mediaIndex:n,partIndex:l?r:null,isSyncRequest:a,startOfSegment:s,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:l&&l.duration||u.duration,segment:u,part:l,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:c});const p=G(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=((e,t,i)=>{if(null==t||!e.length)return[];const n=Math.ceil((t-i+3)*Ji);let s;for(s=0;sn);s++);return e.slice(s)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h}timestampOffsetForSegment_(e){return(({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:n,calculateTimestampOffsetForEachSegment:s,overrideCheck:a})=>s?sn(n,i):a||e!==t?e!oe.isIncompatible(e)));let l=u.filter(oe.isEnabled);l.length||(l=u.filter((e=>!oe.isDisabled(e))));const h=l.filter(oe.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const t=d.getSyncPoint(e,s,o,i)?1:2;return{playlist:e,rebufferingImpact:oe.estimateSegmentRequestTime(a,n,e)*t-r}})),c=h.filter((e=>e.rebufferingImpact<=0));return Wi(c,((e,t)=>Vi(t.playlist,e.playlist))),c.length?c[0]:(Wi(h,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),h[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!r)return;const o=s-a-r.rebufferingImpact;let d=.5;a<=R&&(d=1),!r.playlist||r.playlist.uri===this.playlist_.uri||o{n[e.stream]=n[e.stream]||{startTime:1/0,captions:[],endTime:0};const t=n[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)})),Object.keys(n).forEach((e=>{const{startTime:t,endTime:s,captions:a}=n[e],r=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${s} for ${e}`),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);const s=t.textTracks().getTrackById(n);if(s)e[i]=s;else{let s=i,a=i,r=!1;const o=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];o&&(s=o.label,a=o.language,r=o.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:r,label:s,language:a},!1).track}}}(r,this.vhs_.tech_,e),Qi(t,s,r[e]),function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;const n=window.WebKitDataCue||window.VTTCue;t.forEach((t=>{const s=t.stream;t.content?t.content.forEach((a=>{const r=new n(t.startTime+i,t.endTime+i,a.text);r.line=a.line,r.align="left",r.position=a.position,r.positionAlign="line-left",e[s].addCue(r)})):e[s].addCue(new n(t.startTime+i,t.endTime+i,t.text))}))}({captionArray:a,inbandTextTracks:r,timestampOffset:i})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e=>e())),this.metadataQueue_.caption.forEach((e=>e())),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!(!e||this.getCurrentMediaInfo_()&&an({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:s}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||an({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return void this.callQueue_.push(this.handleData_.bind(this,e,t));const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[nn(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let n;t&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});const e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const e=We(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+$(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+$(a).join(", "));const r=s.length?s.start(0):0,o=s.length?s.end(s.length-1):0,d=a.length?a.start(0):0,u=a.length?a.end(a.length-1):0;if(o-r<=1&&u-d<=1)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${$(s).join(", ")}, video buffer: ${$(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const l=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${l}`),this.remove(0,l,(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3)}),!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){n&&(22!==n.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error(`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:s}){if(!s){const e=[n];let t=n.byteLength;i&&(e.unshift(i),t+=i.byteLength),s=(e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,i),i+=e.byteLength}))),t})({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,s=`${e}TimingInfo`;n[s]||(n[s]={}),n[s].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[s].transmuxedPresentationStart=i.start.presentation,n[s].transmuxedDecodeStart=i.start.decode,n[s].transmuxedPresentationEnd=i.end.presentation,n[s].transmuxedDecodeEnd=i.end.decode,n[s].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength)return;if("audio"===i&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:s,data:n})}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{const t=c({},e,{forceTimestampOffset:!0});c(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}))}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=null!==this.mediaIndex,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&s;this.logger_(`Requesting ${tn(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ci({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:n})=>{this.logger_(`${tn(e)} logged from transmuxer stream ${n} as a ${i}: ${t}`)}})}trimBackBuffer_(e){const t=((e,t,i)=>{let n=t-pi.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));const s=t-i;return Math.min(s,n)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?n.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(n.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){const i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=i}return t.map&&(n.map=this.initSegmentForMap(t.map)),n}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e{if(!t.length)return e;if(i)return t.slice();const n=t[0].pts;let s=0;for(;s=n);s++);return e.slice(0,s).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:s,useVideoTimingInfo:a,videoTimingInfo:r,audioTimingInfo:o}){if(void 0!==e)return e;if(!a)return o.start;const d=t.segments[i-1];return 0!==i&&d&&void 0!==d.start&&d.end===n+s?r.start:n}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:i,hasVideo:n,isMuxed:s}=t,a="main"===this.loaderType_&&n,r=!this.audioDisabled_&&i&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,r&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),r&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=((e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null)(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=((e,t)=>{if("hls"!==t)return null;const i=(e=>{let t=0;return["video","audio"].forEach((function(i){const n=e[`${i}TimingInfo`];if(!n)return;const{start:s,end:a}=n;let r;"bigint"==typeof s||"bigint"==typeof a?r=window.BigInt(a)-window.BigInt(s):"number"==typeof s&&"number"==typeof a&&(r=a-s),void 0!==r&&r>t&&(t=r)})),"bigint"==typeof t&&t=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,a=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,r=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(a||r)return this.logger_(`bad ${a?"segment":"part"} ${tn(e)}`),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase()))},ln=["video","audio"],hn=(e,t)=>{const i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},cn=(e,t)=>{if(0===t.queue.length)return;let i=0,n=t.queue[i];if("mediaSource"!==n.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!hn(e,t)){if(n.type!==e){if(i=((e,t)=>{for(let i=0;i{const i=t[`${e}Buffer`],n=un(e);i&&(i.removeEventListener("updateend",t[`on${n}UpdateEnd_`]),i.removeEventListener("error",t[`on${n}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},mn=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),gn=(e,t,i)=>(n,s)=>{const a=s[`${n}Buffer`];if(mn(s.mediaSource,a)){s.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${n}Buffer`);try{a.appendBuffer(e)}catch(e){s.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${n}Buffer`),s.queuePending[n]=null,i(e)}}},fn=(e,t)=>(i,n)=>{const s=n[`${i}Buffer`];if(mn(n.mediaSource,s)){n.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{s.remove(e,t)}catch(s){n.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},yn=e=>(t,i)=>{const n=i[`${t}Buffer`];mn(i.mediaSource,n)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),n.timestampOffset=e)},_n=e=>(t,i)=>{e()},Tn=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){s.default.log.warn("Failed to call media source endOfStream",e)}}},bn=e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){s.default.log.warn("Failed to set media source duration",e)}},Sn=(e,t)=>i=>{const n=un(e),s=x(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const a=i.mediaSource.addSourceBuffer(s);a.addEventListener("updateend",i[`on${n}UpdateEnd_`]),a.addEventListener("error",i[`on${n}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=a},vn=e=>t=>{const i=t[`${e}Buffer`];if(pn(e,t),mn(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){s.default.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},wn=e=>(t,i)=>{const n=i[`${t}Buffer`],s=x(e);mn(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`),n.changeType(s),i.codecs[t]=e)},En=({type:e,sourceUpdater:t,action:i,doneFn:n,name:s})=>{t.queue.push({type:e,action:i,doneFn:n,name:s}),cn(e,t)},In=(e,t)=>i=>{const n=function(e){let t="";for(let i=0;i ${s})`}return t||"empty"}(t[`${e}Buffered`]());if(t.logger_(`${e} source buffer update end. Buffered: \n`,n),t.queuePending[e]){const i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}cn(e,t)};class An extends s.default.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>cn("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=h("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=In("video",this),this.onAudioUpdateEnd_=In("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){En({type:"mediaSource",sourceUpdater:this,action:Sn(e,t),name:"addSourceBuffer"})}abort(e){En({type:e,sourceUpdater:this,action:(e,t)=>{if("open"!==t.mediaSource.readyState)return;const i=t[`${e}Buffer`];if(mn(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){s.default.log.warn(`Failed to abort on ${e}Buffer`,t)}}},name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?En({type:"mediaSource",sourceUpdater:this,action:vn(e),name:"removeSourceBuffer"}):s.default.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!s.default.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?En({type:e,sourceUpdater:this,action:wn(t),name:"changeType"}):s.default.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:s}=e;if(this.processedAppend_=!0,"audio"===n&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${s.length} until video append`);if(En({type:n,sourceUpdater:this,action:gn(s,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===n){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach((e=>{this.appendBuffer.apply(this,e)}))}}audioBuffered(){return mn(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:C()}videoBuffered(){return mn(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:C()}buffered(){const e=mn(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=mn(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,n=null,s=0;const a=[],r=[];if(!(e&&e.length&&t&&t.length))return C();let o=e.length;for(;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>pn(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Dn=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Ln=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class xn extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Pn extends on{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return C();const e=this.subtitlesTrack_.cues;return C([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=We(e);let n=this.initSegments_[i];if(t&&!n&&e.bytes){const t=Ln.byteLength+e.bytes.byteLength,s=new Uint8Array(t);s.set(e.bytes),s.set(Ln,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){Qi(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Ii&&this.handleTimeout_(),e.code===Ai?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const s=n.segment;if(s.map&&(s.map.bytes=t.map.bytes),n.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));s.requested=!0;try{this.parseVTTCues_(n)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,n.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){const t=e.cues;if(!t)return;const i={};for(let n=t.length-1;n>=0;n--){const s=t[n],a=`${s.startTime}-${s.endTime}-${s.text}`;i[a]?e.removeCue(s):i[a]=s}}(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof window.WebVTT)throw new xn;"function"==typeof window.TextDecoder?t=new window.TextDecoder("utf8"):(t=window.WebVTT.StringDecoder(),i=!0);const n=new window.WebVTT.Parser(window,window.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=t=>{e.timestampmap=t},n.onparsingerror=e=>{s.default.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=Dn(t)),n.parse(t)}let a=e.bytes;i&&(a=Dn(a)),n.parse(a),n.flush()}updateTimeMapping_(e,t,i){const n=e.segment;if(!t)return;if(!e.cues.length)return void(n.empty=!0);const s=e.timestampmap,a=s.MPEGTS/Ji-s.LOCAL+t.mapping;if(e.cues.forEach((e=>{e.startTime+=a,e.endTime+=a})),!i.syncInfo){const t=e.cues[0].startTime,s=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,s-n.duration)}}}}const kn=function(e,t){const i=e.cues;for(let e=0;e=n.adStartTime&&t<=n.adEndTime)return n}return null},On=[{name:"VOD",run:(e,t,i,n,s)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(e,t,i,n,s)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let a=null,r=null;const o=H(t);s=s||0;for(let i=0;i{let a=null,r=null;s=s||0;const o=H(t);for(let e=0;e=e)&&(r=e,a={time:u,segmentIndex:i.segmentIndex,partIndex:i.partIndex})}}return a}},{name:"Discontinuity",run:(e,t,i,n,s)=>{let a=null;if(s=s||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let n=0;n=e)&&(i=e,a={time:d.time,segmentIndex:r,partIndex:null})}}}return a}},{name:"Playlist",run:(e,t,i,n,s)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class Un extends s.default.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=h("SyncController")}getSyncPoint(e,t,i,n){const s=this.runStrategies_(e,t,i,n);return s.length?this.selectSyncPoint_(s,{key:"time",value:n}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+K({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n){const s=[];for(let a=0;a86400)s.default.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let n=i-1;n>=0;n--){const i=e.segments[n];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-s.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,s=e.part;let a,r,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),a=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;a=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=a,s.end=r),(!n.start||ao){let n;n=r<0?i.start-K({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+K({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:n,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class Cn extends s.default.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Rn=fi(yi((function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^a]=a;for(r=o=0;!n[r];r^=l||1,o=u[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,n[r]=p,s[p]=r,c=d[h=d[l=d[r]]],g=16843009*c^65537*h^257*l^16843008*r,m=257*d[p]^16843008*p,a=0;a<4;a++)t[a][r]=m=m<<24^m>>>8,i[a][p]=g=g<<24^g>>>8;for(a=0;a<5;a++)t[a]=t[a].slice(0),i[a]=i[a].slice(0);return e}()),this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];const a=this._tables[0][4],r=this._tables[1],o=e.length;let d=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");const u=e.slice(0),l=[];for(this._key=[u,l],i=o;i<4*o+28;i++)s=u[i-1],(i%o==0||8===o&&i%o==4)&&(s=a[s>>>24]<<24^a[s>>16&255]<<16^a[s>>8&255]<<8^a[255&s],i%o==0&&(s=s<<8^s>>>24^d<<24,d=d<<1^283*(d>>7))),u[i]=u[i-o]^s;for(n=0;i;n++,i--)s=u[3&n?i:i-4],l[n]=i<=4||n<4?s:r[0][a[s>>>24]]^r[1][a[s>>16&255]]^r[2][a[s>>8&255]]^r[3][a[255&s]]}decrypt(e,t,i,n,s,a){const r=this._key[1];let o,d,u,l=e^r[0],h=n^r[1],c=i^r[2],p=t^r[3];const m=r.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],T=y[1],b=y[2],S=y[3],v=y[4];for(g=0;g>>24]^T[h>>16&255]^b[c>>8&255]^S[255&p]^r[f],d=_[h>>>24]^T[c>>16&255]^b[p>>8&255]^S[255&l]^r[f+1],u=_[c>>>24]^T[p>>16&255]^b[l>>8&255]^S[255&h]^r[f+2],p=_[p>>>24]^T[l>>16&255]^b[h>>8&255]^S[255&c]^r[f+3],f+=4,l=o,h=d,c=u;for(g=0;g<4;g++)s[(3&-g)+a]=v[l>>>24]<<24^v[h>>16&255]<<16^v[c>>8&255]<<8^v[255&p]^r[f++],o=l,l=h,h=c,c=p,p=o}}class n extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const s=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24};class a{constructor(e,t,i,r){const o=a.STEP,d=new Int32Array(e.buffer),u=new Uint8Array(e.byteLength);let l=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(d.subarray(l,l+o),t,i,u)),l=o;l>2),r=new i(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),d=new Int32Array(o.buffer);let u,l,h,c,p,m,g,f,y;for(u=n[0],l=n[1],h=n[2],c=n[3],y=0;y{const n=e[i];var s;s=n,("function"===ArrayBuffer.isView?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}({source:t.source,decrypted:i}),[i.buffer])}))}})));var Mn=gi(Rn);const Nn=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Bn=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Fn=(e,t)=>{t.activePlaylistLoader=e,e.load()},$n={AUDIO:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:n},excludePlaylist:a}=t;Bn(i,n);const r=n.activeTrack(),o=n.activeGroup(),d=(o.filter((e=>e.default))[0]||o[0]).id,u=n.tracks[d];if(r!==u){s.default.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in n.tracks)n.tracks[e].enabled=n.tracks[e]===u;n.onTrackChanged()}else a({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:n}}=t;s.default.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Bn(i,n);const a=n.activeTrack();a&&(a.mode="disabled"),n.onTrackChanged()}},qn={AUDIO:(e,t,i)=>{if(!t)return;const{tech:n,requestOptions:s,segmentLoaders:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();a.playlist(e,s),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(()=>{a.playlist(t.media(),s),n.paused()||a.load()})),t.on("error",$n[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:n,requestOptions:s,segmentLoaders:{[e]:a},mediaTypes:{[e]:r}}=i;t.on("loadedmetadata",(()=>{const e=t.media();a.playlist(e,s),a.track(r.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(()=>{a.playlist(t.media(),s),n.paused()||a.load()})),t.on("error",$n[e](e,i))}},Gn={AUDIO:(e,t)=>{const{vhs:i,sourceType:n,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:o},mediaTypes:{[e]:{groups:d,tracks:u,logger_:l}},mainPlaylistLoader:h}=t,c=re(h.main);o[e]&&0!==Object.keys(o[e]).length||(o[e]={main:{default:{default:!0}}},c&&(o[e].main.default.playlists=h.main.playlists));for(const a in o[e]){d[a]||(d[a]=[]);for(const p in o[e][a]){let m,g=o[e][a][p];if(c?(l(`AUDIO group '${a}' label '${p}' is a main playlist`),g.isMainPlaylist=!0,m=null):m="vhs-json"===n&&g.playlists?new ve(g.playlists[0],i,r):g.resolvedUri?new ve(g.resolvedUri,i,r):g.playlists&&"dash"===n?new ci(g.playlists[0],i,r,h):null,g=U({id:p,playlistLoader:m},g),qn[e](e,g.playlistLoader,t),d[a].push(g),void 0===u[p]){const e=new s.default.AudioTrack({id:p,kind:Nn(g),enabled:!1,language:g.language,default:g.default,label:p});u[p]=e}}}a.on("error",$n[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:n,sourceType:s,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:o},mediaTypes:{[e]:{groups:d,tracks:u}},mainPlaylistLoader:l}=t;for(const a in o[e]){d[a]||(d[a]=[]);for(const h in o[e][a]){if(!n.options_.useForcedSubtitles&&o[e][a][h].forced)continue;let c,p=o[e][a][h];if("hls"===s)c=new ve(p.resolvedUri,n,r);else if("dash"===s){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new ci(p.playlists[0],n,r,l)}else"vhs-json"===s&&(c=new ve(p.playlists?p.playlists[0]:p.resolvedUri,n,r));if(p=U({id:h,playlistLoader:c},p),qn[e](e,p.playlistLoader,t),d[a].push(p),void 0===u[h]){const e=i.addRemoteTextTrack({id:h,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:h},!1).track;u[h]=e}}}a.on("error",$n[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:n},mediaTypes:{[e]:{groups:s,tracks:a}}}=t;for(const t in n[e]){s[t]||(s[t]=[]);for(const r in n[e][t]){const o=n[e][t][r];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const d=i.options_.vhs&&i.options_.vhs.captionServices||{};let u={label:r,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(d[u.instreamId]&&(u=U(u,d[u.instreamId])),void 0===u.default&&delete u.default,s[t].push(U({id:r},o)),void 0===a[r]){const e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;a[r]=e}}}}},Wn=(e,t)=>{for(let i=0;i()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}};let Hn;const Xn=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],jn=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class zn extends s.default.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:n,bandwidth:s,externVhs:a,useCueTags:r,playlistExclusionDuration:o,enableLowInitialPlaylist:d,sourceType:u,cacheEncryptionKeys:l,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),Hn=a,this.bufferBasedABR=Boolean(c),this.leastPixelDiffSelector=Boolean(p),this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.sourceType_=u,this.useCueTags_=r,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=d,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:dn,activeTrack:dn,getActiveGroup:dn,onGroupChanged:dn,onTrackChanged:dn,lastTrack_:null,logger_:h(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=C(),this.hasPlayed_=!1,this.syncController_=new Un(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Mn,this.sourceUpdater_=new An(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Cn;const f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:l,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new ci(t,this.vhs_,U(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ve(t,this.vhs_,U(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new on(U(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new on(U(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new kn(U(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){n.off("vttjserror",s),e()}function s(){n.off("vttjsloaded",i),t()}n.one("vttjsloaded",i),n.one("vttjserror",s),n.addWebVttScript_()}))}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),Xn.forEach((e=>{this[e+"_"]=jn.bind(this,e)})),this.logger_=h("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),s=n&&(n.id||n.uri),a=e.id||e.uri;s&&s!==a&&(this.logger_(`switch media ${s} -> ${a} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||n.length&&i[n[0]];for(const t in e)if(e[t].default){s={label:t};break}}if(!s)return t;const a=[];for(const t in i)if(i[t][s.label]){const n=i[t][s.label];if(n.playlists&&n.playlists.length)a.push.apply(a,n.playlists);else if(n.uri)a.push(n);else if(e.playlists.length)for(let i=0;i{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ne(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),(e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{Gn[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:n,vhs:s,segmentLoaders:{AUDIO:a,main:r}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=((e,t)=>i=>{const{mainPlaylistLoader:n,mediaTypes:{[e]:{groups:s}}}=t,a=n.media();if(!a)return null;let r=null;a.attributes[e]&&(r=s[a.attributes[e]]);const o=Object.keys(s);if(!r)if("AUDIO"===e&&o.length>1&&re(t.main))for(let e=0;ee.id===i.id))[0]||null})(i,e),t[i].activeTrack=Vn[i](i,e),t[i].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:i,main:n},mediaTypes:{[e]:s}}=t,a=s.activeTrack(),r=s.getActiveGroup(),o=s.activePlaylistLoader,d=s.lastGroup_;r&&d&&r.id===d.id||(s.lastGroup_=r,s.lastTrack_=a,Bn(i,s),r&&!r.isMainPlaylist&&(r.playlistLoader?(i.resyncLoader(),Fn(r.playlistLoader,s)):o&&n.resetEverything()))})(i,e),t[i].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:n}}=t;n.lastGroup_=null,i.abort(),i.pause()})(i,e),t[i].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:n,main:s},mediaTypes:{[e]:a}}=t,r=a.activeTrack(),o=a.getActiveGroup(),d=a.activePlaylistLoader,u=a.lastTrack_;if((!u||!r||u.id!==r.id)&&(a.lastGroup_=o,a.lastTrack_=r,Bn(n,a),o)){if(o.isMainPlaylist){if(!r||!u||r.id===u.id)return;const e=t.vhs.playlistController_,n=e.selectPlaylist();if(e.media()===n)return;return a.logger_(`track change. Switching main audio from ${u.id} to ${r.id}`),i.pause(),s.resetEverything(),void e.fastQualityChange_(n)}if("AUDIO"===e){if(!o.playlistLoader)return s.setAudio(!0),void s.resetEverything();n.setAudio(!0),s.setAudio(!1)}d!==o.playlistLoader?(n.track&&n.track(r),n.resetEverything(),Fn(o.playlistLoader,a)):Fn(o.playlistLoader,a)}})(i,e),t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(i,e)}));const o=t.AUDIO.activeGroup();if(o){const e=(o.filter((e=>e.default))[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),a.setAudio(!0)):r.setAudio(!0)}i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const d=()=>{t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",d),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",(()=>{n.audioTracks().removeEventListener("change",d),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio");for(const e in t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[e])})({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;if(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),"vhs-json"!==this.sourceType_||!this.initialMedia_.segments)return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ne(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{const e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const s=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const t in i.AUDIO[e])i.AUDIO[e][t].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Hn.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(i.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),a=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:n,bufferLowWaterLine:a,bufferHighWaterLine:r,duration:o,bufferBasedABR:d,log:u}){if(!n)return s.default.log.warn("We received no playlist to switch to. Please check your stream."),!1;const l=`allowing switch ${e&&e.id||"null"} -> ${n.id}`;if(!e)return u(`${l} as current playlist is not set`),!0;if(n.id===e.id)return!1;const h=Boolean(B(t,i).length);if(!e.endList)return h||"number"!=typeof e.partTargetDuration?(u(`${l} as current playlist is live`),!0):(u(`not ${l} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const c=W(t,i),p=d?pi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:pi.MAX_BUFFER_LOW_WATER_LINE;if(og)&&c>=a){let e=`${l} as forwardBuffer >= bufferLowWaterLine (${c} >= ${a})`;return d&&(e+=` and next bandwidth > current bandwidth (${m} > ${g})`),u(e),!0}return u(`not ${l} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e!==this.mainPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments()):this.logger_("skipping fastQualityChange because new media is same as old")}resetMainLoaderReplaceSegments(){const e=this.tech_.buffered(),t=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=t,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime(){}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=Hn.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-n<=M;const a=s.end(s.length-1);return a-n<=M&&i-a<=M}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,a=n.filter(te),r=1===a.length&&a[0]===e;if(1===n.length&&i!==1/0)return s.default.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){let t=!1;n.forEach((i=>{if(i===e)return;const n=i.excludeUntil;void 0!==n&&n!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(s.default.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;o=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const d=this.selectPlaylist();if(!d)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const u=t.internal?this.logger_:s.default.log.warn,l=t.message?" "+t.message:"";u(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${l} Switching to playlist ${d.id}.`),d.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),d.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const h=d.targetDuration/2*1e3||5e3,c="number"==typeof d.lastRequest&&Date.now()-d.lastRequest<=h;return this.switchMedia_(d,"exclude",r||c)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n="all"===e;(n||"main"===e)&&i.push(this.mainPlaylistLoader_);const s=[];(n||"audio"===e)&&s.push("AUDIO"),(n||"subtitle"===e)&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const n=this[`${t}SegmentLoader_`];!n||e!==t&&"all"!==e||i.push(n)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=B(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Hn.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const n=this.mainPlaylistLoader_.main,s=Hn.Playlist.seekable(t,i,Hn.Playlist.liveEdgeDelay(n,t));if(0===s.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=Hn.Playlist.seekable(t,i,Hn.Playlist.liveEdgeDelay(n,t)),0===e.length)return}let a,r;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),r=this.seekable_.start(0)),e?e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=C([[e.start(0)>s.start(0)?e.start(0):s.start(0),e.end(0)0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const e in t)t[e].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Fi(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||P}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||P,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const a={};let r;if(["video","audio"].forEach((function(t){if(n.hasOwnProperty(t)&&(i=e[t].isFmp4,s=n[t],!(i?k(s):O(s)))){const i=e[t].isFmp4?"browser":"muxer";a[i]=a[i]||[],a[i].push(n[t]),"audio"===t&&(r=i)}var i,s})),s&&r&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${r} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(D(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,s=(D(n[t]||"")[0]||{}).type;i&&s&&i.toLowerCase()!==s.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${n[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}{const e=Object.keys(a).reduce(((e,t)=>(e&&(e+=", "),e+`${t} does not support codec(s): "${a[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const n=e[i];if(-1!==t.indexOf(n.id))return;t.push(n.id);const s=Fi(this.main,n),a=[];!s.audio||O(s.audio)||k(s.audio)||a.push(`audio codec ${s.audio}`),!s.video||O(s.video)||k(s.video)||a.push(`video codec ${s.video}`),s.text&&"stpp.ttml.im1t"===s.text&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=Ni(D(e)),s=Bi(n),a=n.video&&D(n.video)[0]||null,r=n.audio&&D(n.audio)[0]||null;Object.keys(i).forEach((e=>{const n=i[e];if(-1!==t.indexOf(n.id)||n.excludeUntil===1/0)return;t.push(n.id);const o=[],d=Fi(this.mainPlaylistLoader_.main,n),u=Bi(d);if(d.audio||d.video){if(u!==s&&o.push(`codec count "${u}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const e=d.video&&D(d.video)[0]||null,t=d.audio&&D(d.audio)[0]||null;e&&a&&e.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${a.type}"`),t&&r&&t.type.toLowerCase()!==r.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${r.type}"`)}o.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(!e.segments)return;let n,s=i;for(let i=0;i{const i=e.metadataTrack_;if(!i)return;const n=window.WebKitDataCue||window.VTTCue;t.forEach((e=>{for(const t of Object.keys(e)){if(zi.has(t))continue;const s=new n(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:ji[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}e.processDateRange()}))})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Yi(this.inbandTextTracks_,e,this.tech_),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:n})=>{if(!t)return;const a=window.WebKitDataCue||window.VTTCue,r=e.metadataTrack_;if(!r)return;if(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||window.isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach((e=>{const i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:()=>(s.default.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(s.default.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(s.default.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})}(i),r.addCue(i)}))})),!r.cues||!r.cues.length)return;const o=r.cues,d=[];for(let e=0;e{const i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),l=Object.keys(u).sort(((e,t)=>Number(e)-Number(t)));l.forEach(((e,t)=>{const i=u[e],s=isFinite(n)?n:0,a=Number(l[t+1])||s;i.forEach((e=>{e.endTime=a}))}))})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}}class Yn{constructor(e,t,i){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}var a,r,o;this.codecs=Fi(n.main(),t),this.playlist=t,this.id=i,this.enabled=(a=e.playlists,r=t.id,o=s,e=>{const t=a.main.playlists[r],i=ee(t),n=te(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(o(),e?a.trigger("renditionenabled"):a.trigger("renditiondisabled")),e)})}}const Qn=["seeking","seeked","pause","playing","error"];class Kn{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=h("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,r=["main","subtitle","audio"],o={};r.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},a[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),a[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const d=e=>{["main","audio"].forEach((t=>{a[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(Qn,s),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(Qn,s),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),r.forEach((e=>{a[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),a[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),s=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:M)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${$(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const n=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),a=n.audioBuffer?n.audioBuffered():null,r=n.videoBuffer?n.videoBuffered():null,o=this.media(),d=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-R),u=[a,r];for(let e=0;e ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=F(n,t);return s.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+M;const a=!i.endList,r="number"==typeof i.partTargetDuration;return a&&(r||n)&&(s=e.end(e.length-1)+3*i.targetDuration),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:n,end:s}}return null}}const Jn={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Zn=function(e,t){let i=0,n=0;const a=U(Jn,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const r=function(){n&&e.currentTime(n)},o=function(t){null!=t&&(n=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},d=function(){if(Date.now()-i<1e3*a.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return i=Date.now(),a.getSource.call(e,o);s.default.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},u=function(){e.off("loadedmetadata",r),e.off("error",d),e.off("dispose",u)};e.on("error",d),e.on("dispose",u),e.reloadSourceOnError=function(t){u(),Zn(e,t)}};var es="3.6.0";const ts={PlaylistLoader:ve,Playlist:oe,utils:Xe,STANDARD_PLAYLIST_SELECTOR:Xi,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(oe.isEnabled);return Wi(e,((e,t)=>Vi(e,t))),e.filter((e=>!!Fi(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:Xi,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const n=this.useDevicePixelRatio&&window.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Hi(this.playlists.main,t,parseInt(Gi(this.tech_.el(),"width"),10)*n,parseInt(Gi(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:Vi,comparePlaylistResolution:function(e,t){let i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||window.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||window.Number.MAX_VALUE,i===n&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Ie()};Object.keys(pi).forEach((e=>{Object.defineProperty(ts,e,{get:()=>(s.default.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),pi[e]),set(t){s.default.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?s.default.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):pi[e]=t}})}));const is="videojs-vhs",ns=function(e,t){const i=t.media();let n=-1;for(let t=0;t{if(!e)return e;let n={};t&&t.attributes&&t.attributes.CODECS&&(n=Ni(D(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);const s=x(n.video),a=x(n.audio),r={};for(const i in e)r[i]={},a&&(r[i].audioContentType=a),s&&(r[i].videoContentType=s),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(r[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(r[i].url=e[i]);return U(e,r)},as=(e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const n=t.reduce(((e,t)=>{const n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[]),rs=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:n})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const s=i?n.concat([i]):n,a=as(s,Object.keys(t)),r=[],o=[];return a.forEach((t=>{o.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),r.push(new Promise(((i,n)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?n(e):i()}))})))})),Promise.race([Promise.all(r),Promise.race(o)])},os=({player:e,sourceKeySystems:t,media:i,audioMedia:n})=>{const a=ss(t,i,n);return!(!a||(e.currentSource().keySystems=a,a&&!e.eme&&(s.default.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1)))},ds=()=>{if(!window.localStorage)return null;const e=window.localStorage.getItem(is);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},us=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,ls=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},hs=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},cs=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},ps=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};ts.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const e=document.createElement("video");return!!s.default.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),ts.supportsNativeDash=!!(document&&document.createElement&&s.default.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),ts.supportsTypeNatively=e=>"hls"===e?ts.supportsNativeHls:"dash"===e&&ts.supportsNativeDash,ts.isSupported=function(){return s.default.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},ts.xhr.onRequest=function(e){ls(ts.xhr,e)},ts.xhr.onResponse=function(e){hs(ts.xhr,e)},ts.xhr.offRequest=function(e){cs(ts.xhr,e)},ts.xhr.offResponse=function(e){ps(ts.xhr,e)};const ms=s.default.getComponent("Component");class gs extends ms{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=h("VhsHandler"),t.options_&&t.options_.playerId){const e=s.default.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=ds();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=pi.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===pi.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=us(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=ts,this.options_.sourceType=Oe(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new zn(this.options_);const i=U({liveRangeSafeTimeDelta:M},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Kn(i),this.playlistController_.on("error",(()=>{const e=s.default.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const n=this.options_.bufferBasedABR?ts.movingAverageBandwidthSelector(.55):ts.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=ts.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const n=1e3*t.downlink*1e3;e=n>=i&&e>=i?Math.max(e,n):n}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set(){s.default.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>q(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>q(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",(()=>{this.options_.useBandwidthFromLocalStorage&&(e=>{if(!window.localStorage)return!1;let t=ds();t=t?U(t,e):e;try{window.localStorage.setItem(is,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const t=e.playlistController_.main(),i=re(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!ee(e))).map(((t,i)=>new Yn(e,t,t.id))):[]}})),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",(()=>{this.setupEme_()})),this.on(this.playlistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.playlistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),rs({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=os({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"!==e.status)return;const t=this.playlistController_.main();if(!t||!t.playlists)return;const i=[];t.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,i.push(e))})),i.length&&(s.default.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...i),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=s.default.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{var e,t;e=this.qualityLevels_,(t=this).representations().forEach((t=>{e.addQualityLevel(t)})),ns(e,t.playlists)})),this.playlists.on("mediachange",(()=>{ns(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":es,"mux.js":"7.0.0","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return An.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return(({playlist:e,time:t,callback:i})=>{if(!i)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});const n=((e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,n=0;for(let s=0;sn){if(e>n+.25*s.duration)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}})(t,e);if(!n)return i({message:"valid programTime was not found"});if("estimate"===n.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const s={mediaSeconds:t},a=((e,t)=>{if(!t.dateTimeObject)return null;const i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)})(t,n.segment);return a&&(s.programDateTime=a.toISOString()),i(null,s)})({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return je({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{ls(this.xhr,e)},this.xhr.onResponse=e=>{hs(this.xhr,e)},this.xhr.offRequest=e=>{cs(this.xhr,e)},this.xhr.offResponse=e=>{ps(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const fs={name:"videojs-http-streaming",VERSION:es,canHandleSource(e,t={}){const i=U(s.default.options,t);return fs.canPlayType(e.type,i)},handleSource(e,t,i={}){const n=U(s.default.options,i);return t.vhs=new gs(e,t,n),t.vhs.xhr=Ie(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=Oe(e);if(!i)return"";const n=fs.getOverrideNative(t);return!ts.supportsTypeNatively(i)||n?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(s.default.browser.IS_ANY_SAFARI||s.default.browser.IS_IOS),{overrideNative:n=i}=t;return n}};k("avc1.4d400d,mp4a.40.2")&&s.default.getTech("Html5").registerSourceHandler(fs,0),s.default.VhsHandler=gs,s.default.VhsSourceHandler=fs,s.default.Vhs=ts,s.default.use||s.default.registerComponent("Vhs",ts),s.default.options.vhs=s.default.options.vhs||{},s.default.getPlugin&&s.default.getPlugin("reloadSourceOnError")||s.default.registerPlugin("reloadSourceOnError",(function(e){Zn(this,e)})),e.LOCAL_STORAGE_KEY=is,e.Vhs=ts,e.VhsHandler=gs,e.VhsSourceHandler=fs,e.emeKeySystems=ss,e.expandDataUri=us,e.getAllPsshKeySystemsOptions=as,e.setupEmeOptions=os,e.simpleTypeFromSourceType=Oe,e.waitForKeySessionCreation=rs,Object.defineProperty(e,"__esModule",{value:!0})})); +/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */r(null,(e=u).subarray(0,e.byteLength-e[e.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(e,t,n,a){return function(){const r=function(e,t,n){const a=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),r=new i(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),d=new Int32Array(o.buffer);let u,l,h,c,p,m,g,f,y;for(u=n[0],l=n[1],h=n[2],c=n[3],y=0;y{const n=e[i];var s;s=n,("function"===ArrayBuffer.isView?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}({source:t.source,decrypted:i}),[i.buffer])}))}})));var Mn=gi(Rn);const Nn=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Bn=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Fn=(e,t)=>{t.activePlaylistLoader=e,e.load()},qn={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:i},excludePlaylist:n}=t,a=i.activeTrack(),r=i.activeGroup(),o=(r.filter((e=>e.default))[0]||r[0]).id,d=i.tracks[o];if(a!==d){s.default.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in i.tracks)i.tracks[e].enabled=i.tracks[e]===d;i.onTrackChanged()}else n({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:i}}=t;s.default.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=i.activeTrack();n&&(n.mode="disabled"),i.onTrackChanged()}},$n={AUDIO:(e,t,i)=>{if(!t)return;const{tech:n,requestOptions:s,segmentLoaders:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();a.playlist(e,s),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(()=>{a.playlist(t.media(),s),n.paused()||a.load()})),t.on("error",qn[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:n,requestOptions:s,segmentLoaders:{[e]:a},mediaTypes:{[e]:r}}=i;t.on("loadedmetadata",(()=>{const e=t.media();a.playlist(e,s),a.track(r.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(()=>{a.playlist(t.media(),s),n.paused()||a.load()})),t.on("error",qn[e](e,i))}},Gn={AUDIO:(e,t)=>{const{vhs:i,sourceType:n,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:o},mediaTypes:{[e]:{groups:d,tracks:u,logger_:l}},mainPlaylistLoader:h}=t,c=re(h.main);o[e]&&0!==Object.keys(o[e]).length||(o[e]={main:{default:{default:!0}}},c&&(o[e].main.default.playlists=h.main.playlists));for(const a in o[e]){d[a]||(d[a]=[]);for(const p in o[e][a]){let m,g=o[e][a][p];if(c?(l(`AUDIO group '${a}' label '${p}' is a main playlist`),g.isMainPlaylist=!0,m=null):m="vhs-json"===n&&g.playlists?new ve(g.playlists[0],i,r):g.resolvedUri?new ve(g.resolvedUri,i,r):g.playlists&&"dash"===n?new ci(g.playlists[0],i,r,h):null,g=U({id:p,playlistLoader:m},g),$n[e](e,g.playlistLoader,t),d[a].push(g),void 0===u[p]){const e=new s.default.AudioTrack({id:p,kind:Nn(g),enabled:!1,language:g.language,default:g.default,label:p});u[p]=e}}}a.on("error",qn[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:n,sourceType:s,segmentLoaders:{[e]:a},requestOptions:r,main:{mediaGroups:o},mediaTypes:{[e]:{groups:d,tracks:u}},mainPlaylistLoader:l}=t;for(const a in o[e]){d[a]||(d[a]=[]);for(const h in o[e][a]){if(!n.options_.useForcedSubtitles&&o[e][a][h].forced)continue;let c,p=o[e][a][h];if("hls"===s)c=new ve(p.resolvedUri,n,r);else if("dash"===s){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new ci(p.playlists[0],n,r,l)}else"vhs-json"===s&&(c=new ve(p.playlists?p.playlists[0]:p.resolvedUri,n,r));if(p=U({id:h,playlistLoader:c},p),$n[e](e,p.playlistLoader,t),d[a].push(p),void 0===u[h]){const e=i.addRemoteTextTrack({id:h,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:h},!1).track;u[h]=e}}}a.on("error",qn[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:n},mediaTypes:{[e]:{groups:s,tracks:a}}}=t;for(const t in n[e]){s[t]||(s[t]=[]);for(const r in n[e][t]){const o=n[e][t][r];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const d=i.options_.vhs&&i.options_.vhs.captionServices||{};let u={label:r,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(d[u.instreamId]&&(u=U(u,d[u.instreamId])),void 0===u.default&&delete u.default,s[t].push(U({id:r},o)),void 0===a[r]){const e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;a[r]=e}}}}},Wn=(e,t)=>{for(let i=0;i()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}};class Hn{constructor(){this.priority_=[]}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=u(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}}class Xn extends s.default.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new Hn,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.logger_=h("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i)return this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),void this.trigger("error");i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=this.queryBeforeStart?i:u(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart||!1,this.proxyServerUrl_=t.proxyServerURL||null,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"),this.queryBeforeStart&&this.requestSteeringManifest(this.steeringManifest.reloadUri))}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!e&&!t)return;const i=e||this.getRequestURI(t);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();this.request_=this.xhr_({uri:i},((e,t)=>{if(e){if(410===t.status)return this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i);if(429===t.status){const i=t.responseHeaders["retry-after"];return this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),void this.startTTLTimeout_(parseInt(i,10))}return this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_()}const n=JSON.parse(this.request_.responseText);this.startTTLTimeout_(),this.assignSteeringProperties_(n)}))}setProxyServerUrl_(e){const t=new window.URL(e),i=new window.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(window.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new window.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(n){const e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),void this.trigger("error");this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(e=>{for(const t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!t(i))return i}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=1e3*e;this.ttlTimeout_=window.setTimeout((()=>{this.requestSteeringManifest()}),t)}clearTTLTimeout_(){window.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new Hn}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}}let jn;const zn=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Yn=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class Qn extends s.default.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:n,bandwidth:s,externVhs:a,useCueTags:r,playlistExclusionDuration:o,enableLowInitialPlaylist:d,sourceType:u,cacheEncryptionKeys:l,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),jn=a,this.bufferBasedABR=Boolean(c),this.leastPixelDiffSelector=Boolean(p),this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.sourceType_=u,this.useCueTags_=r,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=d,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:dn,activeTrack:dn,getActiveGroup:dn,onGroupChanged:dn,onTrackChanged:dn,lastTrack_:null,logger_:h(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=C(),this.hasPlayed_=!1,this.syncController_=new Un(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Mn,this.sourceUpdater_=new An(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Cn;const f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:l,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new ci(t,this.vhs_,U(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ve(t,this.vhs_,U(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new on(U(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new on(U(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Pn(U(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){n.off("vttjserror",s),e()}function s(){n.off("vttjsloaded",i),t()}n.one("vttjsloaded",i),n.one("vttjserror",s),n.addWebVttScript_()}))}),e),this.contentSteeringController_=new Xn(this.vhs_.xhr,(()=>this.mainSegmentLoader_.bandwidth)),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),zn.forEach((e=>{this[e+"_"]=Yn.bind(this,e)})),this.logger_=h("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),s=n&&(n.id||n.uri),a=e.id||e.uri;s&&s!==a&&(this.logger_(`switch media ${s} -> ${a} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(i&&n){const t=(i.length?i[0].playlists:i.playlists).filter((e=>e.attributes.serviceLocation===n));t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}}))}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||n.length&&i[n[0]];for(const t in e)if(e[t].default){s={label:t};break}}if(!s)return t;const a=[];for(const t in i)if(i[t][s.label]){const n=i[t][s.label];if(n.playlists&&n.playlists.length)a.push.apply(a,n.playlists);else if(n.uri)a.push(n);else if(e.playlists.length)for(let i=0;i{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ne(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),(e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{Gn[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:n,vhs:s,segmentLoaders:{AUDIO:a,main:r}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=((e,t)=>i=>{const{mainPlaylistLoader:n,mediaTypes:{[e]:{groups:s}}}=t,a=n.media();if(!a)return null;let r=null;a.attributes[e]&&(r=s[a.attributes[e]]);const o=Object.keys(s);if(!r)if("AUDIO"===e&&o.length>1&&re(t.main))for(let e=0;ee.id===i.id))[0]||null})(i,e),t[i].activeTrack=Vn[i](i,e),t[i].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:i,main:n},mediaTypes:{[e]:s}}=t,a=s.activeTrack(),r=s.getActiveGroup(),o=s.activePlaylistLoader,d=s.lastGroup_;r&&d&&r.id===d.id||(s.lastGroup_=r,s.lastTrack_=a,Bn(i,s),r&&!r.isMainPlaylist&&(r.playlistLoader?(i.resyncLoader(),Fn(r.playlistLoader,s)):o&&n.resetEverything()))})(i,e),t[i].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:n}}=t;n.lastGroup_=null,i.abort(),i.pause()})(i,e),t[i].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:n,main:s},mediaTypes:{[e]:a}}=t,r=a.activeTrack(),o=a.getActiveGroup(),d=a.activePlaylistLoader,u=a.lastTrack_;if((!u||!r||u.id!==r.id)&&(a.lastGroup_=o,a.lastTrack_=r,Bn(n,a),o)){if(o.isMainPlaylist){if(!r||!u||r.id===u.id)return;const e=t.vhs.playlistController_,n=e.selectPlaylist();if(e.media()===n)return;return a.logger_(`track change. Switching main audio from ${u.id} to ${r.id}`),i.pause(),s.resetEverything(),void e.fastQualityChange_(n)}if("AUDIO"===e){if(!o.playlistLoader)return s.setAudio(!0),void s.resetEverything();n.setAudio(!0),s.setAudio(!1)}d!==o.playlistLoader?(n.track&&n.track(r),n.resetEverything(),Fn(o.playlistLoader,a)):Fn(o.playlistLoader,a)}})(i,e),t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(i,e)}));const o=t.AUDIO.activeGroup();if(o){const e=(o.filter((e=>e.default))[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),a.setAudio(!0)):r.setAudio(!0)}i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const d=()=>{t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",d),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",(()=>{n.audioTracks().removeEventListener("change",d),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio");for(const e in t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[e])})({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;if(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),"vhs-json"!==this.sourceType_||!this.initialMedia_.segments)return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ne(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{const e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const s=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const t in i.AUDIO[e])i.AUDIO[e][t].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),jn.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(i.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),a=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:n,bufferLowWaterLine:a,bufferHighWaterLine:r,duration:o,bufferBasedABR:d,log:u}){if(!n)return s.default.log.warn("We received no playlist to switch to. Please check your stream."),!1;const l=`allowing switch ${e&&e.id||"null"} -> ${n.id}`;if(!e)return u(`${l} as current playlist is not set`),!0;if(n.id===e.id)return!1;const h=Boolean(B(t,i).length);if(!e.endList)return h||"number"!=typeof e.partTargetDuration?(u(`${l} as current playlist is live`),!0):(u(`not ${l} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const c=W(t,i),p=d?pi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:pi.MAX_BUFFER_LOW_WATER_LINE;if(og)&&c>=a){let e=`${l} as forwardBuffer >= bufferLowWaterLine (${c} >= ${a})`;return d&&(e+=` and next bandwidth > current bandwidth (${m} > ${g})`),u(e),!0}return u(`not ${l} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e!==this.mainPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments()):this.logger_("skipping fastQualityChange because new media is same as old")}resetMainLoaderReplaceSegments(){const e=this.tech_.buffered(),t=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=t,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime(){}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=jn.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-n<=M;const a=s.end(s.length-1);return a-n<=M&&i-a<=M}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,a=n.filter(te),r=1===a.length&&a[0]===e;if(1===n.length&&i!==1/0)return s.default.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){const t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),void setTimeout((()=>{this.contentSteeringController_.addAvailablePathway(t)}),i)}let t=!1;n.forEach((i=>{if(i===e)return;const n=i.excludeUntil;void 0!==n&&n!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(s.default.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;o=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const d=this.selectPlaylist();if(!d)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const u=t.internal?this.logger_:s.default.log.warn,l=t.message?" "+t.message:"";u(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${l} Switching to playlist ${d.id}.`),d.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),d.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const h=d.targetDuration/2*1e3||5e3,c="number"==typeof d.lastRequest&&Date.now()-d.lastRequest<=h;return this.switchMedia_(d,"exclude",r||c)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n="all"===e;(n||"main"===e)&&i.push(this.mainPlaylistLoader_);const s=[];(n||"audio"===e)&&s.push("AUDIO"),(n||"subtitle"===e)&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const n=this[`${t}SegmentLoader_`];!n||e!==t&&"all"!==e||i.push(n)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=B(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:jn.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const n=this.mainPlaylistLoader_.main,s=jn.Playlist.seekable(t,i,jn.Playlist.liveEdgeDelay(n,t));if(0===s.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=jn.Playlist.seekable(t,i,jn.Playlist.liveEdgeDelay(n,t)),0===e.length)return}let a,r;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),r=this.seekable_.start(0)),e?e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=C([[e.start(0)>s.start(0)?e.start(0):s.start(0),e.end(0)0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const e in t)t[e].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Fi(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||O}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||O,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const a={};let r;if(["video","audio"].forEach((function(t){if(n.hasOwnProperty(t)&&(i=e[t].isFmp4,s=n[t],!(i?P(s):k(s)))){const i=e[t].isFmp4?"browser":"muxer";a[i]=a[i]||[],a[i].push(n[t]),"audio"===t&&(r=i)}var i,s})),s&&r&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${r} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(D(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,s=(D(n[t]||"")[0]||{}).type;i&&s&&i.toLowerCase()!==s.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${n[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}{const e=Object.keys(a).reduce(((e,t)=>(e&&(e+=", "),e+`${t} does not support codec(s): "${a[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const n=e[i];if(-1!==t.indexOf(n.id))return;t.push(n.id);const s=Fi(this.main,n),a=[];!s.audio||k(s.audio)||P(s.audio)||a.push(`audio codec ${s.audio}`),!s.video||k(s.video)||P(s.video)||a.push(`video codec ${s.video}`),s.text&&"stpp.ttml.im1t"===s.text&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=Ni(D(e)),s=Bi(n),a=n.video&&D(n.video)[0]||null,r=n.audio&&D(n.audio)[0]||null;Object.keys(i).forEach((e=>{const n=i[e];if(-1!==t.indexOf(n.id)||n.excludeUntil===1/0)return;t.push(n.id);const o=[],d=Fi(this.mainPlaylistLoader_.main,n),u=Bi(d);if(d.audio||d.video){if(u!==s&&o.push(`codec count "${u}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const e=d.video&&D(d.video)[0]||null,t=d.audio&&D(d.audio)[0]||null;e&&a&&e.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${a.type}"`),t&&r&&t.type.toLowerCase()!==r.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${r.type}"`)}o.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(!e.segments)return;let n,s=i;for(let i=0;i{const i=e.metadataTrack_;if(!i)return;const n=window.WebKitDataCue||window.VTTCue;t.forEach((e=>{for(const t of Object.keys(e)){if(zi.has(t))continue;const s=new n(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:ji[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}e.processDateRange()}))})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Yi(this.inbandTextTracks_,e,this.tech_),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:n})=>{if(!t)return;const a=window.WebKitDataCue||window.VTTCue,r=e.metadataTrack_;if(!r)return;if(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||window.isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach((e=>{const i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:()=>(s.default.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(s.default.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(s.default.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})}(i),r.addCue(i)}))})),!r.cues||!r.cues.length)return;const o=r.cues,d=[];for(let e=0;e{const i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),l=Object.keys(u).sort(((e,t)=>Number(e)-Number(t)));l.forEach(((e,t)=>{const i=u[e],s=isFinite(n)?n:0,a=Number(l[t+1])||s;i.forEach((e=>{e.endTime=a}))}))})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(!e.contentSteering)return;const t=e=>{for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering)};t(e),this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("mediaupdatetimeout",(()=>{this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id),this.contentSteeringController_.abort(),this.contentSteeringController_.clearTTLTimeout_(),this.contentSteeringController_.clearAvailablePathways(),t(this.main())})),this.contentSteeringController_.queryBeforeStart||this.tech_.one("canplay",(()=>{this.contentSteeringController_.requestSteeringManifest()}))}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;const t=this.main().playlists,i=new Set;let n=!1;Object.keys(t).forEach((s=>{const a=t[s],r=this.pathwayAttribute_(a),o=r&&e!==r;a.excludeUntil===1/0&&"content-steering"===a.lastExcludeReason_&&!o&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const d=!a.excludeUntil&&a.excludeUntil!==1/0;!i.has(a.id)&&o&&d&&(i.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))})),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach((t=>{const i=this.mediaTypes_[t];if(i.activePlaylistLoader){const t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(n=!0)}})),n&&this.changeSegmentPathway_()}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}}class Kn{constructor(e,t,i){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}var a,r,o;this.codecs=Fi(n.main(),t),this.playlist=t,this.id=i,this.enabled=(a=e.playlists,r=t.id,o=s,e=>{const t=a.main.playlists[r],i=ee(t),n=te(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(o(),e?a.trigger("renditionenabled"):a.trigger("renditiondisabled")),e)})}}const Jn=["seeking","seeked","pause","playing","error"];class Zn{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=h("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,r=["main","subtitle","audio"],o={};r.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},a[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),a[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const d=e=>{["main","audio"].forEach((t=>{a[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(Jn,s),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(Jn,s),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),r.forEach((e=>{a[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),a[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),s=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:M)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${q(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const n=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),a=n.audioBuffer?n.audioBuffered():null,r=n.videoBuffer?n.videoBuffered():null,o=this.media(),d=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-R),u=[a,r];for(let e=0;e ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=F(n,t);return s.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+M;const a=!i.endList,r="number"==typeof i.partTargetDuration;return a&&(r||n)&&(s=e.end(e.length-1)+3*i.targetDuration),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:n,end:s}}return null}}const es={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},ts=function(e,t){let i=0,n=0;const a=U(es,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const r=function(){n&&e.currentTime(n)},o=function(t){null!=t&&(n=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},d=function(){if(Date.now()-i<1e3*a.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(a.getSource&&"function"==typeof a.getSource)return i=Date.now(),a.getSource.call(e,o);s.default.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},u=function(){e.off("loadedmetadata",r),e.off("error",d),e.off("dispose",u)};e.on("error",d),e.on("dispose",u),e.reloadSourceOnError=function(t){u(),ts(e,t)}};var is="3.7.0";const ns={PlaylistLoader:ve,Playlist:oe,utils:Xe,STANDARD_PLAYLIST_SELECTOR:Xi,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(oe.isEnabled);return Wi(e,((e,t)=>Vi(e,t))),e.filter((e=>!!Fi(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:Xi,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const n=this.useDevicePixelRatio&&window.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Hi(this.playlists.main,t,parseInt(Gi(this.tech_.el(),"width"),10)*n,parseInt(Gi(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:Vi,comparePlaylistResolution:function(e,t){let i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||window.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||window.Number.MAX_VALUE,i===n&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Ie()};Object.keys(pi).forEach((e=>{Object.defineProperty(ns,e,{get:()=>(s.default.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),pi[e]),set(t){s.default.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?s.default.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):pi[e]=t}})}));const ss="videojs-vhs",as=function(e,t){const i=t.media();let n=-1;for(let t=0;t{if(!e)return e;let n={};t&&t.attributes&&t.attributes.CODECS&&(n=Ni(D(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);const s=x(n.video),a=x(n.audio),r={};for(const i in e)r[i]={},a&&(r[i].audioContentType=a),s&&(r[i].videoContentType=s),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(r[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(r[i].url=e[i]);return U(e,r)},os=(e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const n=t.reduce(((e,t)=>{const n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[]),ds=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:n})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const s=i?n.concat([i]):n,a=os(s,Object.keys(t)),r=[],o=[];return a.forEach((t=>{o.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),r.push(new Promise(((i,n)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?n(e):i()}))})))})),Promise.race([Promise.all(r),Promise.race(o)])},us=({player:e,sourceKeySystems:t,media:i,audioMedia:n})=>{const a=rs(t,i,n);return!(!a||(e.currentSource().keySystems=a,a&&!e.eme&&(s.default.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1)))},ls=()=>{if(!window.localStorage)return null;const e=window.localStorage.getItem(ss);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},hs=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,cs=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},ps=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},ms=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},gs=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};ns.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const e=document.createElement("video");return!!s.default.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),ns.supportsNativeDash=!!(document&&document.createElement&&s.default.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),ns.supportsTypeNatively=e=>"hls"===e?ns.supportsNativeHls:"dash"===e&&ns.supportsNativeDash,ns.isSupported=function(){return s.default.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},ns.xhr.onRequest=function(e){cs(ns.xhr,e)},ns.xhr.onResponse=function(e){ps(ns.xhr,e)},ns.xhr.offRequest=function(e){ms(ns.xhr,e)},ns.xhr.offResponse=function(e){gs(ns.xhr,e)};const fs=s.default.getComponent("Component");class ys extends fs{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=h("VhsHandler"),t.options_&&t.options_.playerId){const e=s.default.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=ls();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=pi.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===pi.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=hs(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=ns,this.options_.sourceType=ke(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new Qn(this.options_);const i=U({liveRangeSafeTimeDelta:M},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Zn(i),this.playlistController_.on("error",(()=>{const e=s.default.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const n=this.options_.bufferBasedABR?ns.movingAverageBandwidthSelector(.55):ns.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=ns.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const n=1e3*t.downlink*1e3;e=n>=i&&e>=i?Math.max(e,n):n}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set(){s.default.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>$(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>$(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",(()=>{this.options_.useBandwidthFromLocalStorage&&(e=>{if(!window.localStorage)return!1;let t=ls();t=t?U(t,e):e;try{window.localStorage.setItem(ss,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const t=e.playlistController_.main(),i=re(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!ee(e))).map(((t,i)=>new Kn(e,t,t.id))):[]}})),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",(()=>{this.setupEme_()})),this.on(this.playlistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.playlistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),ds({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=us({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"!==e.status)return;const t=this.playlistController_.main();if(!t||!t.playlists)return;const i=[];t.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,i.push(e))})),i.length&&(s.default.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...i),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=s.default.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{var e,t;e=this.qualityLevels_,(t=this).representations().forEach((t=>{e.addQualityLevel(t)})),as(e,t.playlists)})),this.playlists.on("mediachange",(()=>{as(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":is,"mux.js":"7.0.1","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return An.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return(({playlist:e,time:t,callback:i})=>{if(!i)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});const n=((e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,n=0;for(let s=0;sn){if(e>n+.25*s.duration)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}})(t,e);if(!n)return i({message:"valid programTime was not found"});if("estimate"===n.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const s={mediaSeconds:t},a=((e,t)=>{if(!t.dateTimeObject)return null;const i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)})(t,n.segment);return a&&(s.programDateTime=a.toISOString()),i(null,s)})({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return je({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{cs(this.xhr,e)},this.xhr.onResponse=e=>{ps(this.xhr,e)},this.xhr.offRequest=e=>{ms(this.xhr,e)},this.xhr.offResponse=e=>{gs(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const _s={name:"videojs-http-streaming",VERSION:is,canHandleSource(e,t={}){const i=U(s.default.options,t);return _s.canPlayType(e.type,i)},handleSource(e,t,i={}){const n=U(s.default.options,i);return t.vhs=new ys(e,t,n),t.vhs.xhr=Ie(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=ke(e);if(!i)return"";const n=_s.getOverrideNative(t);return!ns.supportsTypeNatively(i)||n?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(s.default.browser.IS_ANY_SAFARI||s.default.browser.IS_IOS),{overrideNative:n=i}=t;return n}};P("avc1.4d400d,mp4a.40.2")&&s.default.getTech("Html5").registerSourceHandler(_s,0),s.default.VhsHandler=ys,s.default.VhsSourceHandler=_s,s.default.Vhs=ns,s.default.use||s.default.registerComponent("Vhs",ns),s.default.options.vhs=s.default.options.vhs||{},s.default.getPlugin&&s.default.getPlugin("reloadSourceOnError")||s.default.registerPlugin("reloadSourceOnError",(function(e){ts(this,e)})),e.LOCAL_STORAGE_KEY=ss,e.Vhs=ns,e.VhsHandler=ys,e.VhsSourceHandler=_s,e.emeKeySystems=rs,e.expandDataUri=hs,e.getAllPsshKeySystemsOptions=os,e.setupEmeOptions=us,e.simpleTypeFromSourceType=ke,e.waitForKeySessionCreation=ds,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux b/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux deleted file mode 100644 index adf5a58517..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../mux.js/bin/transmux.js" "$@" -else - exec node "$basedir/../mux.js/bin/transmux.js" "$@" -fi diff --git a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.cmd b/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.cmd deleted file mode 100644 index bdcf003944..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mux.js\bin\transmux.js" %* diff --git a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.ps1 b/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.ps1 deleted file mode 100644 index 823e3c8f83..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/.bin/muxjs-transmux.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../mux.js/bin/transmux.js" $args - } else { - & "$basedir/node$exe" "$basedir/../mux.js/bin/transmux.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../mux.js/bin/transmux.js" $args - } else { - & "node$exe" "$basedir/../mux.js/bin/transmux.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/CHANGELOG.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/CHANGELOG.md deleted file mode 100644 index c66ea74c58..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/CHANGELOG.md +++ /dev/null @@ -1,190 +0,0 @@ - -# [7.0.0](https://github.com/videojs/mux.js/compare/v6.3.0...v7.0.0) (2023-07-21) - -### Features - -* add position data to captions ([#434](https://github.com/videojs/mux.js/issues/434)) ([30f2132](https://github.com/videojs/mux.js/commit/30f2132)) - -### Chores - -* add npm publish step to the release workflow ([a8306cd](https://github.com/videojs/mux.js/commit/a8306cd)) -* rename workflow name from github-release to release and add discussion category name for github releases ([4ba1607](https://github.com/videojs/mux.js/commit/4ba1607)) -* Update CI and release workflows ([#431](https://github.com/videojs/mux.js/issues/431)) ([dc56f1b](https://github.com/videojs/mux.js/commit/dc56f1b)) -* update collaborator guide md ([51b3ed4](https://github.com/videojs/mux.js/commit/51b3ed4)) -* update git push suggestion in collaborator guide md ([73a5b60](https://github.com/videojs/mux.js/commit/73a5b60)) - - -# [6.3.0](https://github.com/videojs/mux.js/compare/v6.2.0...v6.3.0) (2023-02-22) - -### Features - -* support emsg box parsing ([2e77285](https://github.com/videojs/mux.js/commit/2e77285)) - -### Bug Fixes - -* emsg ie11 test failures ([528e9ed](https://github.com/videojs/mux.js/commit/528e9ed)) - - -# [6.2.0](https://github.com/videojs/mux.js/compare/v6.1.0...v6.2.0) (2022-07-08) - -### Features - -* add ID3 parsing for text, link, and APIC frames ([#412](https://github.com/videojs/mux.js/issues/412)) ([5454bdd](https://github.com/videojs/mux.js/commit/5454bdd)) - -### Bug Fixes - -* replace indexOf with typedArrayIndexOf for IE11 support ([#417](https://github.com/videojs/mux.js/issues/417)) ([4e1b195](https://github.com/videojs/mux.js/commit/4e1b195)) - - -# [6.1.0](https://github.com/videojs/mux.js/compare/v6.0.1...v6.1.0) (2022-05-26) - -### Features - -* send ID3 tag even when a frame has malformed content ([#408](https://github.com/videojs/mux.js/issues/408)) ([1da5d23](https://github.com/videojs/mux.js/commit/1da5d23)) - - -## [6.0.1](https://github.com/videojs/mux.js/compare/v6.0.0...v6.0.1) (2021-12-20) - -### Bug Fixes - -* fix IE11 by replacing arrow function ([#406](https://github.com/videojs/mux.js/issues/406)) ([47302fe](https://github.com/videojs/mux.js/commit/47302fe)) - - -# [6.0.0](https://github.com/videojs/mux.js/compare/v5.14.1...v6.0.0) (2021-11-29) - -### Features - -* use bigint for 64 bit ints if needed and available. ([#383](https://github.com/videojs/mux.js/issues/383)) ([83779b9](https://github.com/videojs/mux.js/commit/83779b9)) - -### Chores - -* don't run tests on version ([#404](https://github.com/videojs/mux.js/issues/404)) ([45623ea](https://github.com/videojs/mux.js/commit/45623ea)) - - -### BREAKING CHANGES - -* In some cases, mux.js will now be returning a BigInt rather than a regular Number value. This means that consumers of this library will need to add checks for BigInt for optimal operation. - - -## [5.14.1](https://github.com/videojs/mux.js/compare/v5.14.0...v5.14.1) (2021-10-14) - -### Bug Fixes - -* avoid mismatch with avc1 and hvc1 codec ([#400](https://github.com/videojs/mux.js/issues/400)) ([8a58d6e](https://github.com/videojs/mux.js/commit/8a58d6e)) -* prevent adding duplicate log listeners on every push after a flush ([#402](https://github.com/videojs/mux.js/issues/402)) ([eb332c1](https://github.com/videojs/mux.js/commit/eb332c1)) - - -# [5.14.0](https://github.com/videojs/mux.js/compare/v5.13.0...v5.14.0) (2021-09-21) - -### Features - -* Add multibyte character support ([#398](https://github.com/videojs/mux.js/issues/398)) ([0849e0a](https://github.com/videojs/mux.js/commit/0849e0a)) - - -# [5.13.0](https://github.com/videojs/mux.js/compare/v5.12.2...v5.13.0) (2021-08-24) - -### Features - -* add firstSequenceNumber option to Transmuxer to start sequence somewhere other than zero ([#395](https://github.com/videojs/mux.js/issues/395)) ([6ff42f4](https://github.com/videojs/mux.js/commit/6ff42f4)) - -### Chores - -* add github release ci action ([#397](https://github.com/videojs/mux.js/issues/397)) ([abe7936](https://github.com/videojs/mux.js/commit/abe7936)) -* update ci workflow to fix ci ([#396](https://github.com/videojs/mux.js/issues/396)) ([86cfdca](https://github.com/videojs/mux.js/commit/86cfdca)) - - -## [5.12.2](https://github.com/videojs/mux.js/compare/v5.12.1...v5.12.2) (2021-07-14) - -### Bug Fixes - -* Do not scale width by sarRatio, let decoder handle it via the pasp box ([#393](https://github.com/videojs/mux.js/issues/393)) ([9e9982f](https://github.com/videojs/mux.js/commit/9e9982f)) - - -## [5.12.1](https://github.com/videojs/mux.js/compare/v5.12.0...v5.12.1) (2021-07-09) - -### Code Refactoring - -* rename warn event to log, change console logs to log events ([#392](https://github.com/videojs/mux.js/issues/392)) ([4995603](https://github.com/videojs/mux.js/commit/4995603)) - - -# [5.12.0](https://github.com/videojs/mux.js/compare/v5.11.3...v5.12.0) (2021-07-02) - -### Features - -* add general error/warn/debug log events and log skipped adts data ([#391](https://github.com/videojs/mux.js/issues/391)) ([6588d48](https://github.com/videojs/mux.js/commit/6588d48)) - - -## [5.11.3](https://github.com/videojs/mux.js/compare/v5.11.2...v5.11.3) (2021-06-30) - -### Bug Fixes - -* Prevent skipping frames when we have garbage data between adts sync words ([#390](https://github.com/videojs/mux.js/issues/390)) ([71bac64](https://github.com/videojs/mux.js/commit/71bac64)) - - -## [5.11.2](https://github.com/videojs/mux.js/compare/v5.11.1...v5.11.2) (2021-06-24) - -### Bug Fixes - -* on flush if a pmt has not been emitted and we have one, emit it ([#388](https://github.com/videojs/mux.js/issues/388)) ([67b4aab](https://github.com/videojs/mux.js/commit/67b4aab)) - - -## [5.11.1](https://github.com/videojs/mux.js/compare/v5.11.0...v5.11.1) (2021-06-22) - -### Bug Fixes - -* inspect all program map tables for stream types ([#386](https://github.com/videojs/mux.js/issues/386)) ([bac4da9](https://github.com/videojs/mux.js/commit/bac4da9)) - - -# [5.11.0](https://github.com/videojs/mux.js/compare/v5.10.0...v5.11.0) (2021-03-29) - -### Features - -* parse ctts atom in mp4 inspector ([#379](https://github.com/videojs/mux.js/issues/379)) ([b75a7a4](https://github.com/videojs/mux.js/commit/b75a7a4)) -* stss atom parsing ([#380](https://github.com/videojs/mux.js/issues/380)) ([305eb4f](https://github.com/videojs/mux.js/commit/305eb4f)) - - -# [5.10.0](https://github.com/videojs/mux.js/compare/v5.9.2...v5.10.0) (2021-03-05) - -### Features - -* parse edts boxes ([#375](https://github.com/videojs/mux.js/issues/375)) ([989bffd](https://github.com/videojs/mux.js/commit/989bffd)) - -### Bug Fixes - -* Check if baseTimestamp is NaN ([#370](https://github.com/videojs/mux.js/issues/370)) ([b4e61dd](https://github.com/videojs/mux.js/commit/b4e61dd)) -* only parse PES packets as PES packets ([#378](https://github.com/videojs/mux.js/issues/378)) ([bb984db](https://github.com/videojs/mux.js/commit/bb984db)) - - -## [5.9.2](https://github.com/videojs/mux.js/compare/v5.9.1...v5.9.2) (2021-02-24) - -### Features - -* add a nodejs binary for transmux via command line ([#366](https://github.com/videojs/mux.js/issues/366)) ([b87ed0f](https://github.com/videojs/mux.js/commit/b87ed0f)) - -### Bug Fixes - -* ts inspect ptsTime/dtsTime typo ([#377](https://github.com/videojs/mux.js/issues/377)) ([112e6e1](https://github.com/videojs/mux.js/commit/112e6e1)) - -### Chores - -* switch to rollup-plugin-data-files ([#369](https://github.com/videojs/mux.js/issues/369)) ([0bb1556](https://github.com/videojs/mux.js/commit/0bb1556)) -* update vjsverify to fix publish failure ([cb06bb5](https://github.com/videojs/mux.js/commit/cb06bb5)) - - -## [5.9.1](https://github.com/videojs/mux.js/compare/v5.9.0...v5.9.1) (2021-01-20) - -### Chores - -* **package:** fixup browser field ([#368](https://github.com/videojs/mux.js/issues/368)) ([8926506](https://github.com/videojs/mux.js/commit/8926506)) - - -# [5.9.0](https://github.com/videojs/mux.js/compare/v5.8.0...v5.9.0) (2021-01-20) - -### Features - -* **CaptionStream:** add flag to turn off 708 captions ([#365](https://github.com/videojs/mux.js/issues/365)) ([8a7cdb6](https://github.com/videojs/mux.js/commit/8a7cdb6)) - -### Chores - -* update this project to use the generator ([#352](https://github.com/videojs/mux.js/issues/352)) ([fa920a6](https://github.com/videojs/mux.js/commit/fa920a6)) - diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/LICENSE b/node_modules/@videojs/http-streaming/node_modules/mux.js/LICENSE deleted file mode 100644 index cd4596f265..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright Brightcove, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/README.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/README.md deleted file mode 100644 index 45a2a74b45..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/README.md +++ /dev/null @@ -1,363 +0,0 @@ -# mux.js -[![Build Status](https://travis-ci.org/videojs/mux.js.svg?branch=main)](https://travis-ci.org/videojs/mux.js)[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/mux.js.svg)](https://greenkeeper.io/) -[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com) - - -Lightweight utilities for inspecting and manipulating video container formats. - -Maintenance Status: Stable - -## Table of Contents - -- [Installation](#installation) - - [NPM](#npm) - - [Manual Build](#manual-build) -- [Building](#building) -- [Collaborator](#collaborator) -- [Contributing](#contributing) -- [Options](#options) -- [Background](#background) - - [fmp4](#fmp4) -- [MPEG2-TS to fMP4 Transmuxer](#mpeg2-ts-to-fmp4-transmuxer) - - [Diagram](#diagram) -- [Usage Examples](#usage-examples) - - [Basic Usage](#basic-usage) - - [Metadata](#metadata) - - [MP4 Inspector](#mp4-inspector) -- [Documentation](#documentation) -- [Talk to Us](#talk-to-us) - -## Installation -### NPM - -To install `mux.js` with npm run - -```bash -npm install --save mux.js -``` - -### Manual Build -Download a copy of this git repository and then follow the steps in [Building](#building) - -## Building -If you're using this project in a node-like environment, just `require()` whatever you need. If you'd like to package up a distribution to include separately, run `npm run build`. See the `package.json` for other handy scripts if you're thinking about contributing. - -## Collaborator -If you are a collaborator, we have a guide on how to [release](./COLLABORATOR_GUIDE.md#releasing) the project. - -## Contributing -If you are interested in contributing to `mux.js`, take a look at our docs on [streams](/docs/streams.md) to get started. - -## Options - -The exported `muxjs` object contains the following modules: - -- [codecs](#codecs): a module for handling various codecs -- [mp4](#mp4): a module for handling ISOBMFF MP4 boxes -- [flv](#flv): a module for handling Flash content -- [mp2t](#mp2t): a module for handling MPEG 2 Transport Stream content - -### Codecs - -#### Adts - -`muxjs.codecs.Adts` - -The Adts(Audio Data Transport Stream) module handles audio data, specifically AAC. Includes an `AdtsStream` that takes ADTS audio and parses out AAC frames to pass on to the next Stream component in a pipeline. - -#### h264 - -`muxjs.codecs.h264` - -The h264 module Handles H264 bitstreams, including a `NalByteStream` and `H264Stream` to parse out NAL Units and pass them on to the next Stream component in a pipeline. - -### mp4 - -#### MP4 Generator - -`muxjs.mp4.generator` - -The MP4 Generator module contains multiple functions that can be used to generate fragmented MP4s (fmp4s) that can be used in MSE. - -#### MP4 Probe - -`muxjs.mp4.probe` - -The MP4 Probe contains basic utilites that can be used to parse metadata about an MP4 segment. Some examples include: `timescale` and getting the base media decode time of a fragment in seconds. - -#### MP4 Transmuxer - -`muxjs.mp4.Transmuxer` - -Takes MPEG2-TS segments and transmuxes them into fmp4 segments. - -Options: - -##### baseMediaDecodeTime - -Type: `number` - -Default: `0` - -The Base Media Decode Time of the first segment to be passed into the transmuxer. - -##### keepOriginalTimestamps - -Type: `boolean` - -Default: `false` - -The default behavior of the MP4 Transmuxer is to rewrite the timestamps of media segments to ensure that they begin at `0` on the media timeline in MSE. To avoid this behavior, you may set this option to `true`. - -**Note**: This will affect behavior of captions and metadata, and these may not align with audio and video without additional manipulation of timing metadata. - -##### remux - -Type: `boolean` - -Default: `true` - -Set to `true` to remux audio and video into a single MP4 segment. - -#### CaptionParser - -`muxjs.mp4.CaptionParser` - -This module reads CEA-608 captions out of FMP4 segments. - -#### Tools - -`muxjs.mp4.tools` - -This module includes utilities to parse MP4s into an equivalent javascript object, primarily for debugging purposes. - -### flv - -#### Transmuxer - -`muxjs.flv.Transmuxer` - -Takes MPEG2-TS segments and transmuxes them into FLV segments. This module is in maintenance mode and will not have further major development. - -#### Tools - -`muxjs.flv.tools` - -This module includes utilities to parse FLV tags into an equivalent javascript object, primarily for debugging purposes. - -### mp2t - -`muxjs.mp2t` - -Contains Streams specifically to handle MPEG2-TS data, for example `ElementaryStream` and `TransportPacketStream`. This is used in the MP4 module. - -#### CaptionStream - -`muxjs.mp2t.CaptionStream` - -Handles the bulk of parsing CEA-608 captions out of MPEG2-TS segments. - -#### Tools - -`muxjs.mp2t.tools` - -This module contains utilities to parse basic timing information out of MPEG2-TS segments. - -## Background - -### fMP4 -Before making use of the Transmuxer it is best to understand the structure of a fragmented MP4 (fMP4). - -fMP4's are structured in *boxes* as described in the ISOBMFF spec. - -For a basic fMP4 to be valid it needs to have the following boxes: - -1) ftyp (File Type Box) -2) moov (Movie Header Box) -3) moof (Movie Fragment Box) -4) mdat (Movie Data Box) - -Every fMP4 stream needs to start with an `ftyp` and `moov` box which is then followed by many `moof` and `mdat` pairs. - -It is important to understand that when you append your first segment to [Media Source Extensions](https://www.w3.org/TR/media-source/) that this segment will need to start with an `ftyp` and `moov` followed by a `moof` and `mdat`. A segment containing a `ftyp` and `moov` box is often referred to as an Initialization Segment(`init`) segment, and segments containing `moof` and `mdat` boxes, referring to media itself as Media Segments. - -If you would like to see a clearer representation of your fMP4 you can use the `muxjs.mp4.tools.inspect()` method. - -## MPEG2-TS to fMP4 Transmuxer -### Diagram -![mux.js diagram](/docs/diagram.png) - -## Usage Examples - -### Basic Usage - -To make use of the Transmuxer method you will need to push data to the transmuxer you have created. - -Feed in `Uint8Array`s of an MPEG-2 transport stream, get out a fragmented MP4. - -Lets look at a very basic representation of what needs to happen the first time you want to append a fMP4 to an MSE buffer. - -```js -// Create your transmuxer: -// initOptions is optional and can be omitted at this time. -var transmuxer = new muxjs.mp4.Transmuxer(initOptions); - -// Create an event listener which will be triggered after the transmuxer processes data: -// 'data' events signal a new fMP4 segment is ready -transmuxer.on('data', function (segment) { - // This code will be executed when the event listener is triggered by a Transmuxer.push() method execution. - // Create an empty Uint8Array with the summed value of both the initSegment and data byteLength properties. - let data = new Uint8Array(segment.initSegment.byteLength + segment.data.byteLength); - - // Add the segment.initSegment (ftyp/moov) starting at position 0 - data.set(segment.initSegment, 0); - - // Add the segment.data (moof/mdat) starting after the initSegment - data.set(segment.data, segment.initSegment.byteLength); - - // Uncomment this line below to see the structure of your new fMP4 - // console.log(muxjs.mp4.tools.inspect(data)); - - // Add your brand new fMP4 segment to your MSE Source Buffer - sourceBuffer.appendBuffer(data); -}); - -// When you push your starting MPEG-TS segment it will cause the 'data' event listener above to run. -// It is important to push after your event listener has been defined. -transmuxer.push(transportStreamSegment); -transmuxer.flush(); -``` - -Above we are adding in the `initSegment` (ftyp/moov) to our data array before appending to the MSE Source Buffer. - -This is required for the first part of data we append to the MSE Source Buffer, but we will omit the `initSegment` for our remaining chunks (moof/mdat)'s of video we are going to append to our Source Buffer. - -In the case of appending additional segments after your first segment we will just need to use the following event listener anonymous function: - -```js -transmuxer.on('data', function(segment){ - sourceBuffer.appendBuffer(new Uint8Array(segment.data)); -}); -``` - -Here we put all of this together in a very basic example player. - -```html - - - Basic Transmuxer Test - - - - - - - -``` -*NOTE: This player is only for example and should not be used in production.* - -### Metadata - -The transmuxer can also parse out supplementary video data like timed ID3 metadata and CEA-608 captions. -You can find both attached to the data event object: - -```js -transmuxer.on('data', function (segment) { - // create a metadata text track cue for each ID3 frame: - segment.metadata.frames.forEach(function(frame) { - metadataTextTrack.addCue(new VTTCue(time, time, frame.value)); - }); - // create a VTTCue for all the parsed CEA-608 captions:> - segment.captions.forEach(function(cue) { - captionTextTrack.addCue(new VTTCue(cue.startTime, cue.endTime, cue.text)); - }); -}); -``` - -### MP4 Inspector - -Parse MP4s into javascript objects or a text representation for display or debugging: - -```js -// drop in a Uint8Array of an MP4: -var parsed = muxjs.mp4.tools.inspect(bytes); -// dig into the boxes: -console.log('The major brand of the first box:', parsed[0].majorBrand); -// print out the structure of the MP4: -document.body.appendChild(document.createTextNode(muxjs.textifyMp4(parsed))); -``` -The MP4 inspector is used extensively as a debugging tool for the transmuxer. You can see it in action by cloning the project and opening [the debug page](https://github.com/videojs/mux.js/blob/master/debug/index.html) in your browser. - -## Documentation - -Check out our [troubleshooting guide](/docs/troubleshooting.md). -We have some tips on [creating test content](/docs/test-content.md). -Also, check out our guide on [working with captions in Mux.js](/docs/captions.md). - -## Talk to us -Drop by our slack channel (#playback) on the [Video.js slack](http://slack.videojs.com). diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/bin/transmux.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/bin/transmux.js deleted file mode 100644 index 2659be8667..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/bin/transmux.js +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable no-console */ - -const fs = require('fs'); -const path = require('path'); -const {Transmuxer} = require('../lib/mp4'); -const {version} = require('../package.json'); -const {concatTypedArrays} = require('@videojs/vhs-utils/cjs/byte-helpers'); -const {ONE_SECOND_IN_TS} = require('../lib/utils/clock.js'); - -const showHelp = function() { - console.log(` - transmux media-file > foo.mp4 - transmux media-file -o foo.mp4 - curl -s 'some-media-ulr' | transmux.js -o foo.mp4 - wget -O - -o /dev/null 'some-media-url' | transmux.js -o foo.mp4 - - transmux a supported segment (ts or adts) info an fmp4 - - -h, --help print help - -v, --version print the version - -o, --output write to a file instead of stdout - -d, --debugger add a break point just before data goes to transmuxer -`); -}; - -const parseArgs = function(args) { - const options = {}; - - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - - if ((/^--version|-v$/).test(arg)) { - console.log(`transmux.js v${version}`); - process.exit(0); - } else if ((/^--help|-h$/).test(arg)) { - showHelp(); - process.exit(0); - } else if ((/^--debugger|-d$/).test(arg)) { - options.debugger = true; - } else if ((/^--output|-o$/).test(arg)) { - i++; - options.output = args[i]; - } else { - options.file = arg; - } - } - - return options; -}; - -const cli = function(stdin) { - const options = parseArgs(process.argv.slice(2)); - let inputStream; - let outputStream; - - // if stdin was provided - if (stdin && options.file) { - console.error(`You cannot pass in a file ${options.file} and pipe from stdin!`); - process.exit(1); - } - - if (stdin) { - inputStream = process.stdin; - } else if (options.file) { - inputStream = fs.createReadStream(path.resolve(options.file)); - } - - if (!inputStream) { - console.error('A file or stdin must be passed in as an argument or via pipeing to this script!'); - process.exit(1); - } - - if (options.output) { - outputStream = fs.createWriteStream(path.resolve(options.output), { - encoding: null - }); - } else { - outputStream = process.stdout; - } - - return new Promise(function(resolve, reject) { - let allData; - - inputStream.on('data', (chunk) => { - allData = concatTypedArrays(allData, chunk); - }); - inputStream.on('error', reject); - - inputStream.on('close', () => { - if (!allData || !allData.length) { - return reject('file is empty'); - } - resolve(allData); - }); - }).then(function(inputData) { - const transmuxer = new Transmuxer(); - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(ONE_SECOND_IN_TS); - - transmuxer.on('data', function(data) { - if (data.initSegment) { - outputStream.write(concatTypedArrays(data.initSegment, data.data)); - } else { - outputStream.write(data.data); - } - }); - - if (options.debugger) { - // eslint-disable-next-line - debugger; - } - transmuxer.push(inputData); - transmuxer.flush(); - process.exit(0); - }).catch(function(e) { - console.error(e); - process.exit(1); - }); -}; - -// no stdin if isTTY is set -cli(!process.stdin.isTTY ? process.stdin : null); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/index.js deleted file mode 100644 index df0662fa9b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/index.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var aacUtils = require('./utils'); // Constants - - -var _AacStream; -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - -_AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -_AacStream.prototype = new Stream(); -module.exports = _AacStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/utils.js deleted file mode 100644 index 2f72b3640a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/aac/utils.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - -var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); -}; // TODO: use vhs-utils - - -var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}; // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding - - -var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}; // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. - - -var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; -}; - -var parseType = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; -}; - -var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/adts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/adts.js deleted file mode 100644 index 271189331d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/adts.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var _AdtsStream; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - -_AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function (start, end) { - this.trigger('log', { - level: 'warn', - message: "adts skiping bytes " + start + " to " + end + " in frame " + frameNum + " outside syncword" - }); - }; - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - var skip; // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - - while (i + 7 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - - - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - - if (buffer.byteLength - i < frameLength) { - break; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // remove processed bytes from the buffer. - - - buffer = buffer.subarray(i); - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -_AdtsStream.prototype = new Stream(); -module.exports = _AdtsStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/h264.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/h264.js deleted file mode 100644 index ad473548b4..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/h264.js +++ /dev/null @@ -1,571 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ExpGolomb = require('../utils/exp-golomb.js'); - -var _H264Stream, _NalByteStream; - -var PROFILES_WITH_OPTIONAL_SPS_DATA; -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - -_NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; -}; - -_NalByteStream.prototype = new Stream(); // values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax - -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true -}; -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - -_H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2, - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; -}; - -_H264Stream.prototype = new Stream(); -module.exports = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/index.js deleted file mode 100644 index e2e32b8287..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/codecs/index.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/audio-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/audio-properties.js deleted file mode 100644 index 5384d3f1b9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/audio-properties.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -// constants -var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; -module.exports = AUDIO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/video-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/video-properties.js deleted file mode 100644 index 2da6b07034..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/constants/video-properties.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; -module.exports = VIDEO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/data/silence.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/data/silence.js deleted file mode 100644 index 1560b3d92e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/data/silence.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - -var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; -}; - -var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - -var silence; - -module.exports = function () { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 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]], - 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]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/coalesce-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/coalesce-stream.js deleted file mode 100644 index ce63c5d462..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/coalesce-stream.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - -var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); - -CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); -}; - -module.exports = CoalesceStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-header.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-header.js deleted file mode 100644 index aa8c1898e9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-header.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); // For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array - - -var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; -}; - -module.exports = getFlvHeader; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-tag.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-tag.js deleted file mode 100644 index bb73b25844..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/flv-tag.js +++ /dev/null @@ -1,372 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - -_FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; -}; - -_FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - -_FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - -_FlvTag.METADATA_TAG = 0x12; // == 18, :uint -// (tag:ByteArray):Boolean { - -_FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; // (tag:ByteArray):uint { - - -_FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; -}; - -module.exports = _FlvTag; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/index.js deleted file mode 100644 index 193e8849ef..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/index.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/tag-list.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/tag-list.js deleted file mode 100644 index 2b0785c496..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/tag-list.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); -}; - -module.exports = TagList; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/transmuxer.js deleted file mode 100644 index f1268fa7c2..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/flv/transmuxer.js +++ /dev/null @@ -1,425 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var FlvTag = require('./flv-tag.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var CoalesceStream = require('./coalesce-stream.js'); - -var TagList = require('./tag-list.js'); - -var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function metaDataTag(track, pts) { - var tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; -}; - -extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new TagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - -_VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new TagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - -_Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream.on('done', function () { - self.trigger('done'); - }); -}; - -_Transmuxer.prototype = new Stream(); // forward compatibility - -module.exports = _Transmuxer; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/index.js deleted file mode 100644 index 97dc1ba77c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; // include all the tools when the full library is required - -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); -module.exports = muxjs; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/caption-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/caption-stream.js deleted file mode 100644 index 12e1827951..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/caption-stream.js +++ /dev/null @@ -1,1939 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); - -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({ - captionServices: options.captionServices - }); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } -}; - -CaptionStream.prototype = new Stream(); - -CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = cea708Parser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = cea708Parser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); -}; // Only called if handling partial data - - -CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); -}; // From the CEA-608 spec: - -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. - - -CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; -}; - -CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; -}; - -CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; -}; - -CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; // ---------------------- -// Session to Application -// ---------------------- -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. - - -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - -}; - -var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; -}; - -var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function Cea708Service(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided - - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } -}; -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - -Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - -Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; -}; -/** - * Try to create a TextDecoder if it is natively supported - */ - - -Cea708Service.prototype.createTextDecoder = function (encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } -}; - -var Cea708Stream = function Cea708Stream(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; // Get service encodings from captionServices option block - - Object.keys(captionServices).forEach(function (serviceName) { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; - -Cea708Stream.prototype = new Stream(); -/** - * Push current 708 packet, create new 708 packet. - */ - -Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; -/** - * Add pts and both bytes from packet into current 708 packet. - */ - - -Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; -/** - * Parse completed 708 packet into service blocks and push each service block. - */ - - -Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - -Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) {// DLC: Delay cancel, nothing to do - } else if (b === 0x03) {// ETX: End Text, don't need to do anything - } else if (b === 0x00) {// Padding - } else {// Unknown command - } - } -}; -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, { - isExtended: true - }); - } else {// Unknown command - } - - return i; -}; -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - -Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - -Cea708Stream.prototype.initService = function (serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; -}; -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.handleText = function (i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; // Use the TextDecoder if one was created for this service - - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; -}; -/** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, { - isMultiByte: true - }); - } else {// Unknown command - } - - return i; -}; -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; -}; -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; -}; -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; -}; -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; -}; -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } -}; -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; -}; -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; -}; -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; -}; -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; -}; -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - -Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); -}; // This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. - - -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - -}; - -var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; // the index of the last row in a CEA-608 display buffer - - -var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. - -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. -// We keep track of positioning information as we go by storing the -// number of indentations and the tab offset in this buffer. - -var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push({ - text: '', - indent: 0, - offset: 0 - }); - } - - return result; -}; - -var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - - this.nonDisplayed_[this.row_].offset = offset; - this.column_ += offset; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - var indentations = (data & 0xe) >> 1; - this.column_ = indentations * 4; // add to the number of indentations for positioning - - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; -}; - -Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the current state of the -// display buffer - -Cea608Stream.prototype.flushDisplayed = function (pts) { - var _this = this; - - var logWarning = function logWarning(index) { - _this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - - var content = []; - this.displayed_.forEach(function (row, i) { - if (row && row.text && row.text.length) { - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - - - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 - }); - } - } else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content: content, - stream: this.name_ - }); - } -}; -/** - * Zero out the data, used for startup and on seek - */ - - -Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; -}; -/** - * Sets up control code and related constants for this instance - */ - - -Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - -Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - -Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - -Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; -}; -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - -Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; -}; -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - -Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; -}; -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - -Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; -}; -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - -Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; -}; -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - -Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { - text: '', - indent: 0, - offset: 0 - }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; // Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing - - -Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; // Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting - - -Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; // Mode Implementations - - -Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; -}; - -Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; -}; - -Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = { - text: '', - indent: 0, - offset: 0 - }; -}; - -Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; -}; // exports - - -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/index.js deleted file mode 100644 index 218f0fd5ac..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/m2ts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/m2ts.js deleted file mode 100644 index 838922f70f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/m2ts.js +++ /dev/null @@ -1,572 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; // object types - - -var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - -_TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; - -_TransportPacketStream.prototype = new Stream(); -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - -_TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === StreamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; - -_TransportParseStream.prototype = new Stream(); -_TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - -_ElementaryStream = function ElementaryStream() { - var self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var pmt = { - type: 'metadata', - tracks: [] - }; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; -}; - -_ElementaryStream.prototype = new Stream(); -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/metadata-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/metadata-stream.js deleted file mode 100644 index 269de00367..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/metadata-stream.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - id3 = require('../tools/parse-id3'), - _MetadataStream; - -_MetadataStream = function MetadataStream(options) { - var settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - - break; - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (id3.frameParsers[frame.id]) { - // use frame specific parser - id3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - id3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - id3.frameParsers['W*'](frame); - } // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; -}; - -_MetadataStream.prototype = new Stream(); -module.exports = _MetadataStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/probe.js deleted file mode 100644 index 739a0a7097..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/probe.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; -}; - -var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; -}; - -var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; -}; - -var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } -}; - -var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; -}; - -var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/stream-types.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/stream-types.js deleted file mode 100644 index 9ecf7ad526..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index 852f6a7905..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; -var RO_THRESH = 4294967296; -var TYPE_SHARED = 'shared'; - -var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; -}; - -var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/audio-frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/audio-frame-utils.js deleted file mode 100644 index 133cbd97c2..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/audio-frame-utils.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); - -var clock = require('../utils/clock'); -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - -var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; // Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer - - -var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; -}; // If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track - - -var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); -}; // generate the track's raw mdat data from an array of frames - - -var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; -}; // generate the track's sample table from an array of frames - - -var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/caption-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/caption-parser.js deleted file mode 100644 index 1bd65a4df3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/caption-parser.js +++ /dev/null @@ -1,490 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; - -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; - -var findBox = require('../mp4/find-box.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var window = require('global/window'); -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - -var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = { - logs: [], - seiNals: [] - }, - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - result.logs.push({ - level: 'warn', - message: 'We\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.' - }); - break; - } - - result.seiNals.push(seiNal); - break; - - default: - break; - } - } - - return result; -}; -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - if (typeof currentDts === 'bigint') { - sample.pts = currentDts + window.BigInt(sample.compositionTimeOffset); - currentDts += window.BigInt(sample.duration); - } else { - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - } - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; -}; -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - -var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var result; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - result = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = { - seiNals: [], - logs: [] - }; - } - - captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals); - captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs); - } - }); - return captionNals; -}; -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {Object[]} parsedCaptions[].content - A list of individual caption segments - * @return {String} parsedCaptions[].content.text - The visible content of the caption segment - * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment - * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 - **/ - - -var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - captionNals = parseCaptionNals(segment, trackId); - var trackNals = captionNals[trackId] || {}; - return { - seiNals: trackNals.seiNals, - logs: trackNals.logs, - timescale: timescale - }; -}; -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - -var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - captionStream.on('log', function (log) { - parsedCaptions.logs.push(log); - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData && parsedData.logs) { - parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs); - } - - if (parsedData === null || !parsedData.seiNals) { - if (parsedCaptions.logs.length) { - return { - logs: parsedCaptions.logs, - captions: [], - captionStreams: [] - }; - } - - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - parsedCaptions.logs = []; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {}, - logs: [] - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/emsg.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/emsg.js deleted file mode 100644 index af28c406ba..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/emsg.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -var uint8ToCString = require('../utils/string.js').uint8ToCString; - -var getUint64 = require('../utils/numbers.js').getUint64; -/** - * Based on: ISO/IEC 23009 Section: 5.10.3.3 - * References: - * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format - * https://aomediacodec.github.io/id3-emsg/ - * - * Takes emsg box data as a uint8 array and returns a emsg box object - * @param {UInt8Array} boxData data from emsg box - * @returns A parsed emsg box object - */ - - -var parseEmsgBox = function parseEmsgBox(boxData) { - // version + flags - var offset = 4; - var version = boxData[0]; - var scheme_id_uri, value, timescale, presentation_time, presentation_time_delta, event_duration, id, message_data; - - if (version === 0) { - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time_delta = dv.getUint32(offset); - offset += 4; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - } else if (version === 1) { - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time = getUint64(boxData.subarray(offset)); - offset += 8; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - } - - message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength)); - var emsgBox = { - scheme_id_uri: scheme_id_uri, - value: value, - // if timescale is undefined or 0 set to 1 - timescale: timescale ? timescale : 1, - presentation_time: presentation_time, - presentation_time_delta: presentation_time_delta, - event_duration: event_duration, - id: id, - message_data: message_data - }; - return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined; -}; -/** - * Scales a presentation time or time delta with an offset with a provided timescale - * @param {number} presentationTime - * @param {number} timescale - * @param {number} timeDelta - * @param {number} offset - * @returns the scaled time as a number - */ - - -var scaleTime = function scaleTime(presentationTime, timescale, timeDelta, offset) { - return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale; -}; -/** - * Checks the emsg box data for validity based on the version - * @param {number} version of the emsg box to validate - * @param {Object} emsg the emsg data to validate - * @returns if the box is valid as a boolean - */ - - -var isValidEmsgBox = function isValidEmsgBox(version, emsg) { - var hasScheme = emsg.scheme_id_uri !== '\0'; - var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme; - var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; // Only valid versions of emsg are 0 and 1 - - return !(version > 1) && isValidV0Box || isValidV1Box; -}; // Utility function to check if an object is defined - - -var isDefined = function isDefined(data) { - return data !== undefined || data !== null; -}; - -module.exports = { - parseEmsgBox: parseEmsgBox, - scaleTime: scaleTime -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/find-box.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/find-box.js deleted file mode 100644 index d9b88b0e8b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/find-box.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var parseType = require('./parse-type.js'); - -var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; -}; - -module.exports = findBox; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/frame-utils.js deleted file mode 100644 index 34c39c038e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/frame-utils.js +++ /dev/null @@ -1,304 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; -}; // Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. - - -var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; -}; -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - -var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - -var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - -var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; // generate the track's sample table from an array of gops - - -var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; -}; // generate the track's raw mdat data from an array of gops - - -var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; -}; // generate the track's sample table from a frame - - -var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; -}; // generate the track's raw mdat data from a frame - - -var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/index.js deleted file mode 100644 index d8d359dd31..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/index.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/mp4-generator.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/mp4-generator.js deleted file mode 100644 index a7f6349e29..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/mp4-generator.js +++ /dev/null @@ -1,611 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var MAX_UINT32 = require('../utils/numbers.js').MAX_UINT32; - -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - -(function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); -})(); - -box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; -}; - -dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; - -mdat = function mdat(data) { - return box(types.mdat, data); -}; - -mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); -}; - -mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; - -mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); -}; - -minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); -}; - -moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - -moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; - -mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); -}; - -mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); -}; - -stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); -}; - -(function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -})(); - -tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); -}; -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - -traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); -}; -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - -trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); -}; - -trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -})(); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/parse-type.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/parse-type.js deleted file mode 100644 index 4ba9e7e3ed..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/parse-type.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - -module.exports = parseType; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/probe.js deleted file mode 100644 index 0b0604b43a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/probe.js +++ /dev/null @@ -1,393 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var toHexString = require('../utils/bin').toHexString; - -var findBox = require('../mp4/find-box.js'); - -var parseType = require('../mp4/parse-type.js'); - -var emsg = require('../mp4/emsg.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var getUint64 = require('../utils/numbers.js').getUint64; - -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3; - -var window = require('global/window'); - -var parseId3Frames = require('../tools/parse-id3.js').parseId3Frames; -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - -timescale = function timescale(init) { - var result = {}, - traks = findBox(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); -}; -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - -startTime = function startTime(timescale, fragment) { - var trafs, result; // we need info from two childrend of each track fragment box - - trafs = findBox(fragment, ['moof', 'traf']); // determine the start times for each track - - var lowestTime = trafs.reduce(function (acc, traf) { - var tfhd = findBox(traf, ['tfhd'])[0]; // get the track id from the tfhd - - var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - var tfdt = findBox(traf, ['tfdt'])[0]; - var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength); - var baseTime; // version 1 is 64 bit - - if (tfdt[0] === 1) { - baseTime = getUint64(tfdt.subarray(4, 12)); - } else { - baseTime = dv.getUint32(4); - } // convert base time to seconds if it is a valid number. - - - var seconds; - - if (typeof baseTime === 'bigint') { - seconds = baseTime / window.BigInt(scale); - } else if (typeof baseTime === 'number' && !isNaN(baseTime)) { - seconds = baseTime / scale; - } - - if (seconds < Number.MAX_SAFE_INTEGER) { - seconds = Number(seconds); - } - - if (seconds < acc) { - acc = seconds; - } - - return acc; - }, Infinity); - return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0; -}; -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - -compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - if (typeof baseMediaDecodeTime === 'bigint') { - compositionTimeOffset = window.BigInt(compositionTimeOffset); - timescale = window.BigInt(timescale); - } - - var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale; - - if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) { - result = Number(result); - } - - return result; -}; -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - -getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); -}; -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - -getTracks = function getTracks(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[asm]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; -}; -/** - * Returns an array of emsg ID3 data from the provided segmentData. - * An offset can also be provided as the Latest Arrival Time to calculate - * the Event Start Time of v0 EMSG boxes. - * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing - * - * @param {Uint8Array} segmentData the segment byte array. - * @param {number} offset the segment start time or Latest Arrival Time, - * @return {Object[]} an array of ID3 parsed from EMSG boxes - */ - - -getEmsgID3 = function getEmsgID3(segmentData, offset) { - if (offset === void 0) { - offset = 0; - } - - var emsgBoxes = findBox(segmentData, ['emsg']); - return emsgBoxes.map(function (data) { - var parsedBox = emsg.parseEmsgBox(new Uint8Array(data)); - var parsedId3Frames = parseId3Frames(parsedBox.message_data); - return { - cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset), - duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale), - frames: parsedId3Frames - }; - }); -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader, - getEmsgID3: getEmsgID3 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/track-decode-info.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/track-decode-info.js deleted file mode 100644 index 51748ed14b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/track-decode-info.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - -var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/transmuxer.js deleted file mode 100644 index a7796c6de0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/mp4/transmuxer.js +++ /dev/null @@ -1,1112 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('./mp4-generator.js'); - -var frameUtils = require('./frame-utils'); - -var audioFrameUtils = require('./audio-frame-utils'); - -var trackDecodeInfo = require('./track-decode-info'); - -var m2ts = require('../m2ts/m2ts.js'); - -var clock = require('../utils/clock'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var AacStream = require('../aac'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); // object types - - -var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - -var retriggerForStream = function retriggerForStream(key, event) { - event.stream = key; - this.trigger('log', event); -}; - -var addPipelineLogRetriggers = function addPipelineLogRetriggers(transmuxer, pipeline) { - var keys = Object.keys(pipeline); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; // skip non-stream keys and headOfPipeline - // which is just a duplicate - - if (key === 'headOfPipeline' || !pipeline[key].on) { - continue; - } - - pipeline[key].on('log', retriggerForStream.bind(transmuxer, key)); - } -}; -/** - * Compare two arrays (even typed) for same-ness - */ - - -var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - -_VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - -_CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -_CoalesceStream.prototype = new Stream(); - -_CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -_CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - -_Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream')); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - this.getLogTrigger_ = function (key) { - var self = this; - return function (event) { - event.stream = key; - self.trigger('log', event); - }; - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; -}; - -_Transmuxer.prototype = new Stream(); -module.exports = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/audio-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/audio-segment-stream.js deleted file mode 100644 index 93bf9c56f7..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/audio-segment-stream.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var audioFrameUtils = require('../mp4/audio-frame-utils'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - -var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); -module.exports = AudioSegmentStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/index.js deleted file mode 100644 index 287fa599d0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - Transmuxer: require('./transmuxer') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/transmuxer.js deleted file mode 100644 index 3627f00b71..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/transmuxer.js +++ /dev/null @@ -1,324 +0,0 @@ -"use strict"; - -var Stream = require('../utils/stream.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var codecs = require('../codecs/index.js'); - -var AudioSegmentStream = require('./audio-segment-stream.js'); - -var VideoSegmentStream = require('./video-segment-stream.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var AdtsStream = require('../codecs/adts'); - -var AacStream = require('../aac/index'); - -var clock = require('../utils/clock'); - -var createPipeline = function createPipeline(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - return object; -}; - -var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); -module.exports = Transmuxer; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/video-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/video-segment-stream.js deleted file mode 100644 index 826bab6c5c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/partial/video-segment-stream.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var frameUtils = require('../mp4/frame-utils'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); -module.exports = VideoSegmentStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/caption-packet-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/caption-packet-parser.js deleted file mode 100644 index 129adc6b73..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/caption-packet-parser.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. - -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - -var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; // see ANSI/SCTE 128-1 (2013), section 8.1 - - -var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); -}; // see CEA-708-D, section 4.4 - - -var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; -}; - -var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; -}; // exports - - -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/flv-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/flv-inspector.js deleted file mode 100644 index 6502fd18b7..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/flv-inspector.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' -}, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); -}, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); -}, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; -}, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; -}, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; -}, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; -}, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; -}, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - - case 0x12: - } - - return header; -}, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; -}, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); -}; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/mp4-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/mp4-inspector.js deleted file mode 100644 index df033a1a03..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/mp4-inspector.js +++ /dev/null @@ -1,756 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var numberHelpers = require('../utils/numbers.js'); - -var MAX_UINT32 = numberHelpers.MAX_UINT32; -var getUint64 = numberHelpers.getUint64; - -var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); -}, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; -}, - // registry of handlers for individual mp4 box types -parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: getUint64(data.subarray(i)), - mediaTime: getUint64(data.subarray(i + 8)), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } -}; -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - -inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; -}; -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - -_textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-id3.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-id3.js deleted file mode 100644 index 0b6fdedbbc..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-id3.js +++ /dev/null @@ -1,243 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Tools for parsing ID3 frame data - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var typedArrayIndexOf = require('../utils/typed-array').typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text -// encoding description byte [ID3v2.4.0 section 4.] -textEncodingDescriptionByte = { - Iso88591: 0x00, - // ISO-8859-1, terminated with \0. - Utf16: 0x01, - // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, - // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - -}, - // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}, - // return the string representation of the specified byte range, -// interpreted as UTf-8. -parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); -}, - // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}, - frameParsers = { - 'APIC': function APIC(frame) { - var i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parsing fields [ID3v2.4.0 section 4.14.] - - - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } // parsing Mime type field (terminated with \0) - - - frame.mimeType = parseIso88591(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field - - frame.pictureType = frame.data[i]; - i++; - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (descriptionEndIndex < 0) { - // malformed frame - return; - } // parsing Description field (terminated with \0) - - - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591(frame.data, i, frame.data.length); - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function T(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - - - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - - frame.values = frame.value.split('\0'); - }, - 'TXXX': function TXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the text fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - - frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function W(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function WXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the description and URL fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - - frame.url = parseIso88591(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, ''); - }, - 'PRIV': function PRIV(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591(frame.data, 0, i); - break; - } - } - - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } -}; - -var parseId3Frames = function parseId3Frames(data) { - var frameSize, - frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - - if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) { - return; - } // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - - - tagSize = parseSyncSafeInteger(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; // check bit 6 of byte 5 for the extended header flag. - - var hasExtendedHeader = data[5] & 0x40; - - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger(data.subarray(16, 20)); // clip any padding off the end - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - break; - } - - frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]); - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; -}; - -module.exports = { - parseId3Frames: parseId3Frames, - parseSyncSafeInteger: parseSyncSafeInteger, - frameParsers: frameParsers -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sample-flags.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sample-flags.js deleted file mode 100644 index 2595561a51..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sample-flags.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; -}; - -module.exports = parseSampleFlags; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sidx.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sidx.js deleted file mode 100644 index bb383ac42f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-sidx.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -var getUint64 = require('../utils/numbers.js').getUint64; - -var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = getUint64(data.subarray(i)); - result.firstOffset = getUint64(data.subarray(i + 8)); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - -module.exports = parseSidx; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfdt.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfdt.js deleted file mode 100644 index 3e670b557f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfdt.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var getUint64 = require('../utils/numbers.js').getUint64; - -var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime = getUint64(data.subarray(4)); - } else { - result.baseMediaDecodeTime = toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]); - } - - return result; -}; - -module.exports = tfdt; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfhd.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfhd.js deleted file mode 100644 index 6a99afdf04..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-tfhd.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; - -var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; -}; - -module.exports = tfhd; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-trun.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-trun.js deleted file mode 100644 index 0e464dadd3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/parse-trun.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; - -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; -}; - -module.exports = trun; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/ts-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/ts-inspector.js deleted file mode 100644 index ba27ede257..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/tools/ts-inspector.js +++ /dev/null @@ -1,555 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); - -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; - -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - -var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - -var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - -var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - -var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; -/** - * inspects the aac data stream for start and end time information - */ - - -var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; -}; -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - -var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - - default: - break; - } - } - } - - return result; -}; -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - -var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/bin.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/bin.js deleted file mode 100644 index c8e8933e26..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/bin.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function toUnsigned(value) { - return value >>> 0; -}; - -var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/clock.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/clock.js deleted file mode 100644 index 91b0b43497..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/clock.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = 90000, - // 90kHz clock -secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - -metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/exp-golomb.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/exp-golomb.js deleted file mode 100644 index 5fd249e70e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/exp-golomb.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - -ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/numbers.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/numbers.js deleted file mode 100644 index 47177302fc..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/numbers.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -var MAX_UINT32 = Math.pow(2, 32); - -var getUint64 = function getUint64(uint8) { - var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength); - var value; - - if (dv.getBigUint64) { - value = dv.getBigUint64(0); - - if (value < Number.MAX_SAFE_INTEGER) { - return Number(value); - } - - return value; - } - - return dv.getUint32(0) * MAX_UINT32 + dv.getUint32(4); -}; - -module.exports = { - getUint64: getUint64, - MAX_UINT32: MAX_UINT32 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/stream.js deleted file mode 100644 index 7d28c99d38..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/stream.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; -}; -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - -Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; -}; // Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. - - -Stream.prototype.push = function (data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/string.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/string.js deleted file mode 100644 index bb882bd397..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/string.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -/** - * Returns the first string in the data array ending with a null char '\0' - * @param {UInt8} data - * @returns the string with the null char - */ -var uint8ToCString = function uint8ToCString(data) { - var index = 0; - var curChar = String.fromCharCode(data[index]); - var retString = ''; - - while (curChar !== '\0') { - retString += curChar; - index++; - curChar = String.fromCharCode(data[index]); - } // Add nullChar - - - retString += curChar; - return retString; -}; - -module.exports = { - uint8ToCString: uint8ToCString -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/typed-array.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/typed-array.js deleted file mode 100644 index d774359c89..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/cjs/utils/typed-array.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -// IE11 doesn't support indexOf for TypedArrays. -// Once IE11 support is dropped, this function should be removed. -var typedArrayIndexOf = function typedArrayIndexOf(typedArray, element, fromIndex) { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; -}; - -module.exports = { - typedArrayIndexOf: typedArrayIndexOf -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.js deleted file mode 100644 index c26adbb11c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.js +++ /dev/null @@ -1,5264 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory()); -}(this, (function () { 'use strict'; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ - - var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - - _FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; - }; - - _FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - - _FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - - _FlvTag.METADATA_TAG = 0x12; // == 18, :uint - // (tag:ByteArray):Boolean { - - _FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; - }; // (tag:ByteArray):uint { - - - _FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; - }; - - var flvTag = _FlvTag; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({ - captionServices: options.captionServices - }); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream.prototype = new stream(); - - CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided - - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - /** - * Try to create a TextDecoder if it is natively supported - */ - - - Cea708Service.prototype.createTextDecoder = function (encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } - }; - - var Cea708Stream = function Cea708Stream(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; // Get service encodings from captionServices option block - - Object.keys(captionServices).forEach(function (serviceName) { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, { - isExtended: true - }); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; // Use the TextDecoder if one was created for this service - - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, { - isMultiByte: true - }); - } - - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - // We keep track of positioning information as we go by storing the - // number of indentations and the tab offset in this buffer. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push({ - text: '', - indent: 0, - offset: 0 - }); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - - this.nonDisplayed_[this.row_].offset = offset; - this.column_ += offset; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - var indentations = (data & 0xe) >> 1; - this.column_ = indentations * 4; // add to the number of indentations for positioning - - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var _this = this; - - var logWarning = function logWarning(index) { - _this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - - var content = []; - this.displayed_.forEach(function (row, i) { - if (row && row.text && row.text.length) { - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - - - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 - }); - } - } else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { - text: '', - indent: 0, - offset: 0 - }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = { - text: '', - indent: 0, - offset: 0 - }; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover - }; - - // IE11 doesn't support indexOf for TypedArrays. - // Once IE11 support is dropped, this function should be removed. - var typedArrayIndexOf$1 = function typedArrayIndexOf(typedArray, element, fromIndex) { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; - }; - - var typedArray = { - typedArrayIndexOf: typedArrayIndexOf$1 - }; - - var typedArrayIndexOf = typedArray.typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text - // encoding description byte [ID3v2.4.0 section 4.] - textEncodingDescriptionByte = { - Iso88591: 0x00, - // ISO-8859-1, terminated with \0. - Utf16: 0x01, - // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, - // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - - }, - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - frameParsers = { - 'APIC': function APIC(frame) { - var i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parsing fields [ID3v2.4.0 section 4.14.] - - - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } // parsing Mime type field (terminated with \0) - - - frame.mimeType = parseIso88591(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field - - frame.pictureType = frame.data[i]; - i++; - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (descriptionEndIndex < 0) { - // malformed frame - return; - } // parsing Description field (terminated with \0) - - - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591(frame.data, i, frame.data.length); - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function T(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - - - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - - frame.values = frame.value.split('\0'); - }, - 'TXXX': function TXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the text fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - - frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function W(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function WXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the description and URL fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - - frame.url = parseIso88591(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, ''); - }, - 'PRIV': function PRIV(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591(frame.data, 0, i); - break; - } - } - - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } - }; - - var parseId3Frames = function parseId3Frames(data) { - var frameSize, - frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - - if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) { - return; - } // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - - - tagSize = parseSyncSafeInteger(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; // check bit 6 of byte 5 for the extended header flag. - - var hasExtendedHeader = data[5] & 0x40; - - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger(data.subarray(16, 20)); // clip any padding off the end - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - break; - } - - frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]); - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; - }; - - var parseId3 = { - parseId3Frames: parseId3Frames, - parseSyncSafeInteger: parseSyncSafeInteger, - frameParsers: frameParsers - }; - - var _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseId3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseId3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseId3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseId3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - - break; - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (parseId3.frameParsers[frame.id]) { - // use frame specific parser - parseId3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - parseId3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - parseId3.frameParsers['W*'](frame); - } // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var pmt = { - type: 'metadata', - tracks: [] - }; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS$1 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$1; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$1; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$1, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function (start, end) { - this.trigger('log', { - level: 'warn', - message: "adts skiping bytes " + start + " to " + end + " in frame " + frameNum + " outside syncword" - }); - }; - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - var skip; // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - - while (i + 7 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - - - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - - if (buffer.byteLength - i < frameLength) { - break; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // remove processed bytes from the buffer. - - - buffer = buffer.subarray(i); - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2, - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - - var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; - }; - - CoalesceStream.prototype = new stream(); - - CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); - }; - - var coalesceStream = CoalesceStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); - }; - - var tagList = TagList; - - var H264Stream = h264.H264Stream; - - var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; - /** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - - collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } - }; - - metaDataTag = function metaDataTag(track, pts) { - var tag = new flvTag(flvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; - }; - - extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new flvTag(flvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; - }; - /** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new tagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new flvTag(flvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new flvTag(flvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new flvTag(flvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - - _VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new tagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new flvTag(flvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - - _Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream$1; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts_1.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts_1.TransportPacketStream(); - parseStream = new m2ts_1.TransportParseStream(); - elementaryStream = new m2ts_1.ElementaryStream(); - videoTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - adtsStream = new adts(); - h264Stream = new H264Stream(); - coalesceStream$1 = new coalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream$1); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts_1.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream$1); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream$1.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream$1); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream$1.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream$1); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream$1.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream$1.on('done', function () { - self.trigger('done'); - }); - }; - - _Transmuxer.prototype = new stream(); // forward compatibility - - var transmuxer = _Transmuxer; - - // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. - // Technically, this function returns the header and a metadata FLV tag - // if duration is greater than zero - // duration in seconds - // @return {object} the bytes of the FLV header as a Uint8Array - - - var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new flvTag(flvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; - }; - - var flvHeader = getFlvHeader; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var flv = { - tag: flvTag, - Transmuxer: transmuxer, - getFlvHeader: flvHeader - }; - - return flv; - -}))); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.min.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.min.js deleted file mode 100644 index e7251dca61..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-flv.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e()}(this,(function(){"use strict";var t;(t=function(e,i){var s,a=0,n=16384,r=function(t,e){var i,s=t.position+e;s0)throw new Error("Attempted to create new NAL wihout closing the old one");a=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===a+4?this.length-=4:a>0&&(e=a+4,i=this.length-e,this.position=a,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),a=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(p,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&e)>>>8,this.bytes[15]=(255&e)>>>0;break;case t.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=i?0:1;break;case t.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,a),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return s=this.length-11,this.bytes[1]=(16711680&s)>>>16,this.bytes[2]=(65280&s)>>>8,this.bytes[3]=(255&s)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=t.frameTime(this.bytes),this}}).AUDIO_TAG=8,t.VIDEO_TAG=9,t.METADATA_TAG=18,t.isAudioFrame=function(e){return t.AUDIO_TAG===e[0]},t.isVideoFrame=function(e){return t.VIDEO_TAG===e[0]},t.isMetaData=function(e){return t.METADATA_TAG===e[0]},t.isKeyFrame=function(e){return t.isVideoFrame(e)?23===e[11]:!!t.isAudioFrame(e)||!!t.isMetaData(e)},t.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var e=t,i=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var s;return!!t[e]&&(s=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(s,1),s>-1)},this.trigger=function(e){var i,s,a,n;if(i=t[e])if(2===arguments.length)for(a=i.length,s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},l.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},l.prototype.addText=function(t){this.rows[this.rowIdx]+=t},l.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var c=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new l(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};c.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new l(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},c.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},c.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var u=function t(e){e=e||{},t.prototype.init.call(this);var i,s=this,a=e.captionServices||{},n={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(n[t]=i.encoding)})),this.serviceEncodings=n,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(s.new708Packet(),s.add708Bytes(t)):(null===s.current708Packet&&s.new708Packet(),s.add708Bytes(t))}};u.prototype=new s,u.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},u.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,s=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},u.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,s=null,a=0,n=e[a++];for(t.seq=n>>6,t.sizeCode=63&n;a>5)&&s>0&&(i=n=e[a++]),this.pushServiceBlock(i,a,s),s>0&&(a+=s-1)},u.prototype.pushServiceBlock=function(t,e,i){var s,a=e,n=this.current708Packet.data,r=this.services[t];for(r||(r=this.initService(t,a));a>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++t],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++t],n.anchorHorizontal=s,s=i[++t],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++t],n.columnCount=63&s,s=i[++t],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,t},u.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.winAttr;return s=i[++t],a.fillOpacity=(192&s)>>6,a.fillRed=(48&s)>>4,a.fillGreen=(12&s)>>2,a.fillBlue=3&s,s=i[++t],a.borderType=(192&s)>>6,a.borderRed=(48&s)>>4,a.borderGreen=(12&s)>>2,a.borderBlue=3&s,s=i[++t],a.borderType+=(128&s)>>5,a.wordWrap=(64&s)>>6,a.printDirection=(48&s)>>4,a.scrollDirection=(12&s)>>2,a.justify=3&s,s=i[++t],a.effectSpeed=(240&s)>>4,a.effectDirection=(12&s)>>2,a.displayEffect=3&s,t},u.prototype.flushDisplayed=function(t,e){for(var i=[],s=0;s<8;s++)e.windows[s].visible&&!e.windows[s].isEmpty()&&i.push(e.windows[s].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},u.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},u.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],s=this.getPts(t);this.flushDisplayed(s,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&s)>>2,a.penSize=3&s,s=i[++t],a.italics=(128&s)>>7,a.underline=(64&s)>>6,a.edgeType=(56&s)>>3,a.fontStyle=7&s,t},u.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penColor;return s=i[++t],a.fgOpacity=(192&s)>>6,a.fgRed=(48&s)>>4,a.fgGreen=(12&s)>>2,a.fgBlue=3&s,s=i[++t],a.bgOpacity=(192&s)>>6,a.bgRed=(48&s)>>4,a.bgGreen=(12&s)>>2,a.bgBlue=3&s,s=i[++t],a.edgeRed=(48&s)>>4,a.edgeGreen=(12&s)>>2,a.edgeBlue=3&s,t},u.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,s=i[++t],a.row=15&s,s=i[++t],a.column=63&s,t},u.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var f={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},g=function(t){return null===t?"":(t=f[t]||t,String.fromCharCode(t))},y=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],m=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},_=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,s,a,n;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),s=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=m();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=m();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=m()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,a))n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isExtCharacter(s,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isMidRowCode(s,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,a)){var r=3&a;this.nonDisplayed_[this.row_].offset=r,this.column_+=r}else if(this.isPAC(s,a)){var o=y.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var h=(14&e)>>1;this.column_=4*h,this.nonDisplayed_[this.row_].indent+=h}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(0===a&&(a=null),n=g(s),n+=g(a),this[this.mode_](t.pts,n),this.column_+=n.length)}else this.lastControlCode_=null}};_.prototype=new s,_.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},s=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&s.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:s,stream:this.name_})},_.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=m(),this.nonDisplayed_=m(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},_.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},_.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},_.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},_.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},_.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},_.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},_.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},_.prototype.isNormalChar=function(t){return t>=32&&t<=127},_.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=m(),this.displayed_=m()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},_.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},_.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},_.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},_.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},k=function t(e){var i,s;t.prototype.init.call(this),this.type_=e||v,this.push=function(t){this.type_!==v&&t.type!==this.type_||(void 0===s&&(s=t.dts),t.dts=T(t.dts,s),t.pts=T(t.pts,s),i=t.dts,this.trigger("data",t))},this.flush=function(){s=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){s=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};k.prototype=new s;var S,A=k,C=function(t,e,i){if(!t)return-1;for(var s=i;s>>2;d*=4,d+=3&p[7],o.timeStamp=d,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=r}while(i>>4>1&&(s+=e[s]+1),0===i.pid)i.type="pat",t(e.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,s,i]):this.processPes_(e,s,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=b.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=b.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new s,I.STREAM_TYPES={h264:27,adts:15},(L=function(){var t,e=this,i=!1,s={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r=function(t,i,s){var a,n,r=new Uint8Array(t.size),o={type:i},h=0,p=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h>>3,l.pts*=4,l.pts+=(6&d[13])>>>1,l.dts=l.pts,64&c&&(l.dts=(14&d[14])<<27|(255&d[15])<<20|(254&d[16])<<12|(255&d[17])<<5|(254&d[18])>>>3,l.dts*=4,l.dts+=(6&d[18])>>>1)),l.data=d.subarray(9+d[8])),a="video"===i||o.packetLength<=t.size,(s||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};L.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case b.H264_STREAM_TYPE:t=s,e="video";break;case b.ADTS_STREAM_TYPE:t=a,e="audio";break;case b.METADATA_STREAM_TYPE:t=n,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",s)}})[o.type]()},this.reset=function(){s.size=0,s.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(s,"video"),r(a,"audio"),r(n,"timed-metadata")},this.flush=function(){if(!i&&t){var s={type:"metadata",tracks:[]};null!==t.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new s;var W={PAT_PID:0,MP2T_PACKET_LENGTH:N,TransportPacketStream:O,TransportParseStream:I,ElementaryStream:L,TimestampRolloverStream:G,CaptionStream:w.CaptionStream,Cea608Stream:w.Cea608Stream,Cea708Stream:w.Cea708Stream,MetadataStream:B};for(var F in b)b.hasOwnProperty(F)&&(W[F]=b[F]);var z,V,Y,X,j=W,q=9e4;z=function(t){return t*q},V=function(t,e){return t*e},Y=function(t){return t/q},X=function(t,e){return t/e};var H,K=q,Z=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(H=function(t){var e,i=0;H.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(s){var a,n,r,o,h,p=0;if(t||(i=0),"audio"===s.type){var d;for(e&&e.length?(r=e,(e=new Uint8Array(r.byteLength+s.data.byteLength)).set(r),e.set(s.data,r.byteLength)):e=s.data;p+7>5,h=(o=1024*(1+(3&e[p+6])))*K/Z[(60&e[p+2])>>>2],e.byteLength-p>>6&3),channelcount:(1&e[p+2])<<2|(192&e[p+3])>>>6,samplerate:Z[(60&e[p+2])>>>2],samplingfrequencyindex:(60&e[p+2])>>>2,samplesize:16,data:e.subarray(p+7+n,p+a)}),i++,p+=a}else"number"!=typeof d&&(d=p),p++;"number"==typeof d&&(this.skipWarn_(d,p),d=null),e=e.subarray(p)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new s;var $,J,Q,tt=H,et=function(t){var e=t.byteLength,i=0,s=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+s},this.loadWord=function(){var a=t.byteLength-e,n=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");n.set(t.subarray(a,a+r)),i=new DataView(n.buffer).getUint32(0),s=8*r,e-=r},this.skipBits=function(t){var a;s>t?(i<<=t,s-=t):(t-=s,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,s-=t)},this.readBits=function(t){var a=Math.min(s,t),n=i>>>32-a;return(s-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?n<>>t))return i<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(J=function(){var t,e,i=0;J.prototype.init.call(this),this.push=function(s){var a;e?((a=new Uint8Array(e.byteLength+s.data.byteLength)).set(e),a.set(s.data,e.byteLength),e=a):e=s.data;for(var n=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new s,Q={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},($=function(){var t,e,i,s,a,n,r,o=new J;$.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,s=t.dts,o.push(t))},o.on("data",(function(r){var o={trackId:e,pts:i,dts:s,data:r,nalUnitTypeCode:31&r[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(r.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(t,e){var i,s=8,a=8;for(i=0;i=a[0]&&(o=a.shift(),this.writeMetaDataTags(h,o)),(t.extraData!==i||n.pts-o>=1e3)&&(this.writeMetaDataTags(h,n.pts),i=t.extraData,o=n.pts),(r=new e(e.AUDIO_TAG)).pts=n.pts,r.dts=n.dts,r.writeBytes(n.data),h.push(r.finalize());a.length=0,i=null,this.trigger("data",{track:t,tags:h.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(i,s){var a;(a=new e(e.METADATA_TAG)).pts=s,a.dts=s,a.writeMetaDataDouble("audiocodecid",10),a.writeMetaDataBoolean("stereo",2===t.channelcount),a.writeMetaDataDouble("audiosamplerate",t.samplerate),a.writeMetaDataDouble("audiosamplesize",16),i.push(a.finalize()),(a=new e(e.AUDIO_TAG,!0)).pts=s,a.dts=s,a.view.setUint16(a.position,t.extraData),a.position+=2,a.length=Math.max(a.length,a.position),i.push(a.finalize())},this.onVideoKeyFrame=function(t){a.push(t)}}).prototype=new s,(nt=function(t){var i,s,a=[];nt.prototype.init.call(this),this.finishFrame=function(e,a){if(a){if(i&&t&&t.newMetadata&&(a.keyFrame||0===e.length)){var n=ht(i,a.dts).finalize(),r=pt(t,a.dts).finalize();n.metaDataTag=r.metaDataTag=!0,e.push(n),e.push(r),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),e.push(a.finalize()),s=null}},this.push=function(e){ot(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),a.push(e)},this.flush=function(){for(var n,r=new lt;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0!==a.length){for(;a.length;)"seq_parameter_set_rbsp"===(n=a.shift()).nalUnitType?(t.newMetadata=!0,i=n.config,t.width=i.width,t.height=i.height,t.sps=[n.data],t.profileIdc=i.profileIdc,t.levelIdc=i.levelIdc,t.profileCompatibility=i.profileCompatibility,s.endNalUnit()):"pic_parameter_set_rbsp"===n.nalUnitType?(t.newMetadata=!0,t.pps=[n.data],s.endNalUnit()):"access_unit_delimiter_rbsp"===n.nalUnitType?(s&&this.finishFrame(r,s),(s=new e(e.VIDEO_TAG)).pts=n.pts,s.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(s.keyFrame=!0),s.endNalUnit()),s.startNalUnit(),s.writeBytes(n.data);s&&this.finishFrame(r,s),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new s,(at=function(t){var e,i,s,a,n,r,o,h,p,d,l,c,u=this;at.prototype.init.call(this),t=t||{},this.metadataStream=new j.MetadataStream,t.metadataStream=this.metadataStream,e=new j.TransportPacketStream,i=new j.TransportParseStream,s=new j.ElementaryStream,a=new j.TimestampRolloverStream("video"),n=new j.TimestampRolloverStream("audio"),r=new j.TimestampRolloverStream("timed-metadata"),o=new tt,h=new ct,c=new dt(t),e.pipe(i).pipe(s),s.pipe(a).pipe(h),s.pipe(n).pipe(o),s.pipe(r).pipe(this.metadataStream).pipe(c),l=new j.CaptionStream(t),h.pipe(l).pipe(c),s.on("data",(function(t){var e,i,s;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(s=t.tracks[e]);i&&!p&&(c.numberOfTracks++,p=new nt(i),h.pipe(p).pipe(c)),s&&!d&&(c.numberOfTracks++,d=new rt(s),o.pipe(d).pipe(c),p&&p.on("keyframe",d.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){l.reset()},c.on("data",(function(t){u.trigger("data",t)})),c.on("done",(function(){u.trigger("done")}))}).prototype=new s;var ut=function(t,i,s){var a,n,r,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,i=void 0===i||i,s=void 0===s||s,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(i?4:0)|(s?1:0)),h.setUint32(5,o.byteLength),t<=0?((n=new Uint8Array(o.byteLength+4)).set(o),n.set([0,0,0,0],o.byteLength),n):((a=new e(e.METADATA_TAG)).pts=a.dts=0,a.writeMetaDataDouble("duration",t),r=a.finalize().length,(n=new Uint8Array(o.byteLength+r)).set(o),n.set(h.byteLength,r),n)};return{tag:e,Transmuxer:at,getFlvHeader:ut}})); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.js deleted file mode 100644 index 4550d1aa38..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.js +++ /dev/null @@ -1,8072 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window')) : - typeof define === 'function' && define.amd ? define(['global/window'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory(global.window)); -}(this, (function (window) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - - var MAX_UINT32$1 = Math.pow(2, 32); - - var getUint64$3 = function getUint64(uint8) { - var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength); - var value; - - if (dv.getBigUint64) { - value = dv.getBigUint64(0); - - if (value < Number.MAX_SAFE_INTEGER) { - return Number(value); - } - - return value; - } - - return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4); - }; - - var numbers = { - getUint64: getUint64$3, - MAX_UINT32: MAX_UINT32$1 - }; - - var MAX_UINT32 = numbers.MAX_UINT32; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$1 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$1; - - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - - /** - * Returns the first string in the data array ending with a null char '\0' - * @param {UInt8} data - * @returns the string with the null char - */ - var uint8ToCString$1 = function uint8ToCString(data) { - var index = 0; - var curChar = String.fromCharCode(data[index]); - var retString = ''; - - while (curChar !== '\0') { - retString += curChar; - index++; - curChar = String.fromCharCode(data[index]); - } // Add nullChar - - - retString += curChar; - return retString; - }; - - var string = { - uint8ToCString: uint8ToCString$1 - }; - - var uint8ToCString = string.uint8ToCString; - var getUint64$2 = numbers.getUint64; - /** - * Based on: ISO/IEC 23009 Section: 5.10.3.3 - * References: - * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format - * https://aomediacodec.github.io/id3-emsg/ - * - * Takes emsg box data as a uint8 array and returns a emsg box object - * @param {UInt8Array} boxData data from emsg box - * @returns A parsed emsg box object - */ - - var parseEmsgBox = function parseEmsgBox(boxData) { - // version + flags - var offset = 4; - var version = boxData[0]; - var scheme_id_uri, value, timescale, presentation_time, presentation_time_delta, event_duration, id, message_data; - - if (version === 0) { - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time_delta = dv.getUint32(offset); - offset += 4; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - } else if (version === 1) { - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time = getUint64$2(boxData.subarray(offset)); - offset += 8; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - } - - message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength)); - var emsgBox = { - scheme_id_uri: scheme_id_uri, - value: value, - // if timescale is undefined or 0 set to 1 - timescale: timescale ? timescale : 1, - presentation_time: presentation_time, - presentation_time_delta: presentation_time_delta, - event_duration: event_duration, - id: id, - message_data: message_data - }; - return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined; - }; - /** - * Scales a presentation time or time delta with an offset with a provided timescale - * @param {number} presentationTime - * @param {number} timescale - * @param {number} timeDelta - * @param {number} offset - * @returns the scaled time as a number - */ - - - var scaleTime = function scaleTime(presentationTime, timescale, timeDelta, offset) { - return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale; - }; - /** - * Checks the emsg box data for validity based on the version - * @param {number} version of the emsg box to validate - * @param {Object} emsg the emsg data to validate - * @returns if the box is valid as a boolean - */ - - - var isValidEmsgBox = function isValidEmsgBox(version, emsg) { - var hasScheme = emsg.scheme_id_uri !== '\0'; - var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme; - var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; // Only valid versions of emsg are 0 and 1 - - return !(version > 1) && isValidV0Box || isValidV1Box; - }; // Utility function to check if an object is defined - - - var isDefined = function isDefined(data) { - return data !== undefined || data !== null; - }; - - var emsg = { - parseEmsgBox: parseEmsgBox, - scaleTime: scaleTime - }; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var toUnsigned$1 = bin.toUnsigned; - var getUint64$1 = numbers.getUint64; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime = getUint64$1(data.subarray(4)); - } else { - result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]); - } - - return result; - }; - - var parseTfdt = tfdt; - - // IE11 doesn't support indexOf for TypedArrays. - // Once IE11 support is dropped, this function should be removed. - var typedArrayIndexOf$1 = function typedArrayIndexOf(typedArray, element, fromIndex) { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; - }; - - var typedArray = { - typedArrayIndexOf: typedArrayIndexOf$1 - }; - - var typedArrayIndexOf = typedArray.typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text - // encoding description byte [ID3v2.4.0 section 4.] - textEncodingDescriptionByte = { - Iso88591: 0x00, - // ISO-8859-1, terminated with \0. - Utf16: 0x01, - // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, - // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - - }, - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - frameParsers = { - 'APIC': function APIC(frame) { - var i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parsing fields [ID3v2.4.0 section 4.14.] - - - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } // parsing Mime type field (terminated with \0) - - - frame.mimeType = parseIso88591$1(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field - - frame.pictureType = frame.data[i]; - i++; - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (descriptionEndIndex < 0) { - // malformed frame - return; - } // parsing Description field (terminated with \0) - - - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591$1(frame.data, i, frame.data.length); - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function T(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - - - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - - frame.values = frame.value.split('\0'); - }, - 'TXXX': function TXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the text fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - - frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function W(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function WXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the description and URL fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - - frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, ''); - }, - 'PRIV': function PRIV(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591$1(frame.data, 0, i); - break; - } - } - - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } - }; - - var parseId3Frames$1 = function parseId3Frames(data) { - var frameSize, - frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - - if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) { - return; - } // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - - - tagSize = parseSyncSafeInteger$1(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; // check bit 6 of byte 5 for the extended header flag. - - var hasExtendedHeader = data[5] & 0x40; - - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20)); // clip any padding off the end - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - break; - } - - frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]); - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; - }; - - var parseId3 = { - parseId3Frames: parseId3Frames$1, - parseSyncSafeInteger: parseSyncSafeInteger$1, - frameParsers: frameParsers - }; - - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var getUint64 = numbers.getUint64; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3; - var parseId3Frames = parseId3.parseId3Frames; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - var lowestTime = trafs.reduce(function (acc, traf) { - var tfhd = findBox_1(traf, ['tfhd'])[0]; // get the track id from the tfhd - - var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - var tfdt = findBox_1(traf, ['tfdt'])[0]; - var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength); - var baseTime; // version 1 is 64 bit - - if (tfdt[0] === 1) { - baseTime = getUint64(tfdt.subarray(4, 12)); - } else { - baseTime = dv.getUint32(4); - } // convert base time to seconds if it is a valid number. - - - var seconds; - - if (typeof baseTime === 'bigint') { - seconds = baseTime / window__default['default'].BigInt(scale); - } else if (typeof baseTime === 'number' && !isNaN(baseTime)) { - seconds = baseTime / scale; - } - - if (seconds < Number.MAX_SAFE_INTEGER) { - seconds = Number(seconds); - } - - if (seconds < acc) { - acc = seconds; - } - - return acc; - }, Infinity); - return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - if (typeof baseMediaDecodeTime === 'bigint') { - compositionTimeOffset = window__default['default'].BigInt(compositionTimeOffset); - timescale = window__default['default'].BigInt(timescale); - } - - var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale; - - if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) { - result = Number(result); - } - - return result; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[asm]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - /** - * Returns an array of emsg ID3 data from the provided segmentData. - * An offset can also be provided as the Latest Arrival Time to calculate - * the Event Start Time of v0 EMSG boxes. - * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing - * - * @param {Uint8Array} segmentData the segment byte array. - * @param {number} offset the segment start time or Latest Arrival Time, - * @return {Object[]} an array of ID3 parsed from EMSG boxes - */ - - - getEmsgID3 = function getEmsgID3(segmentData, offset) { - if (offset === void 0) { - offset = 0; - } - - var emsgBoxes = findBox_1(segmentData, ['emsg']); - return emsgBoxes.map(function (data) { - var parsedBox = emsg.parseEmsgBox(new Uint8Array(data)); - var parsedId3Frames = parseId3Frames(parsedBox.message_data); - return { - cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset), - duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale), - frames: parsedId3Frames - }; - }); - }; - - var probe = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader, - getEmsgID3: getEmsgID3 - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 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]], - 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]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS$3 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$3; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$3; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$3, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$2; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({ - captionServices: options.captionServices - }); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided - - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - /** - * Try to create a TextDecoder if it is natively supported - */ - - - Cea708Service.prototype.createTextDecoder = function (encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } - }; - - var Cea708Stream = function Cea708Stream(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; // Get service encodings from captionServices option block - - Object.keys(captionServices).forEach(function (serviceName) { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, { - isExtended: true - }); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; // Use the TextDecoder if one was created for this service - - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, { - isMultiByte: true - }); - } - - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - // We keep track of positioning information as we go by storing the - // number of indentations and the tab offset in this buffer. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push({ - text: '', - indent: 0, - offset: 0 - }); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - - this.nonDisplayed_[this.row_].offset = offset; - this.column_ += offset; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - var indentations = (data & 0xe) >> 1; - this.column_ = indentations * 4; // add to the number of indentations for positioning - - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var _this = this; - - var logWarning = function logWarning(index) { - _this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - - var content = []; - this.displayed_.forEach(function (row, i) { - if (row && row.text && row.text.length) { - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - - - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 - }); - } - } else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { - text: '', - indent: 0, - offset: 0 - }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = { - text: '', - indent: 0, - offset: 0 - }; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover - }; - - var _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseId3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseId3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseId3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseId3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - - break; - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (parseId3.frameParsers[frame.id]) { - // use frame specific parser - parseId3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - parseId3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - parseId3.frameParsers['W*'](frame); - } // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var pmt = { - type: 'metadata', - tracks: [] - }; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts; - - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function (start, end) { - this.trigger('log', { - level: 'warn', - message: "adts skiping bytes " + start + " to " + end + " in frame " + frameNum + " outside syncword" - }); - }; - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - var skip; // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - - while (i + 7 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - - - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$1 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - - if (buffer.byteLength - i < frameLength) { - break; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // remove processed bytes from the buffer. - - - buffer = buffer.subarray(i); - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2, - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$1 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$1, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; - - // constants - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - - var H264Stream = h264.H264Stream; - var isLikelyAacData = utils.isLikelyAacData; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - - var retriggerForStream = function retriggerForStream(key, event) { - event.stream = key; - this.trigger('log', event); - }; - - var addPipelineLogRetriggers = function addPipelineLogRetriggers(transmuxer, pipeline) { - var keys = Object.keys(pipeline); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; // skip non-stream keys and headOfPipeline - // which is just a duplicate - - if (key === 'headOfPipeline' || !pipeline[key].on) { - continue; - } - - pipeline[key].on('log', retriggerForStream.bind(transmuxer, key)); - } - }; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream')); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - this.getLogTrigger_ = function (key) { - var self = this; - return function (event) { - event.stream = key; - self.trigger('log', event); - }; - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer.prototype = new stream(); - var transmuxer = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = { - logs: [], - seiNals: [] - }, - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - result.logs.push({ - level: 'warn', - message: 'We\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.' - }); - break; - } - - result.seiNals.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - if (typeof currentDts === 'bigint') { - sample.pts = currentDts + window__default['default'].BigInt(sample.compositionTimeOffset); - currentDts += window__default['default'].BigInt(sample.duration); - } else { - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - } - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var result; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - result = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = { - seiNals: [], - logs: [] - }; - } - - captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals); - captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {Object[]} parsedCaptions[].content - A list of individual caption segments - * @return {String} parsedCaptions[].content.text - The visible content of the caption segment - * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment - * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - captionNals = parseCaptionNals(segment, trackId); - var trackNals = captionNals[trackId] || {}; - return { - seiNals: trackNals.seiNals, - logs: trackNals.logs, - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - captionStream.on('log', function (log) { - parsedCaptions.logs.push(log); - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData && parsedData.logs) { - parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs); - } - - if (parsedData === null || !parsedData.seiNals) { - if (parsedCaptions.logs.length) { - return { - logs: parsedCaptions.logs, - captions: [], - captionStreams: [] - }; - } - - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - parsedCaptions.logs = []; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {}, - logs: [] - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var mp4 = { - generator: mp4Generator, - probe: probe, - Transmuxer: transmuxer.Transmuxer, - AudioSegmentStream: transmuxer.AudioSegmentStream, - VideoSegmentStream: transmuxer.VideoSegmentStream, - CaptionParser: captionParser - }; - - return mp4; - -}))); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.min.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.min.js deleted file mode 100644 index 874b305381..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux-mp4.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i,n,a,r,s,o,d,h,p,u,l,c,f,g,m,y,S,v,b,_,w,T,C,k,P,A,D,x,U,E,L,O,I,R,M,N,B,W,G,z,F=e(t),V=Math.pow(2,32),Y={getUint64:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.getBigUint64?(e=i.getBigUint64(0))>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},m=function(t){return i(T.hdlr,x[t])},g=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),i(T.mdhd,e)},f=function(t){return i(T.mdia,g(t),m(t.type),o(t))},s=function(t){return i(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},o=function(t){return i(T.minf,"video"===t.type?i(T.vmhd,U):i(T.smhd,E),n(),S(t))},d=function(t,e){for(var n=[],a=e.length;a--;)n[a]=b(e[a]);return i.apply(null,[T.moof,s(t)].concat(n))},h=function(t){for(var e=t.length,n=[];e--;)n[e]=l(t[e]);return i.apply(null,[T.moov,u(4294967295)].concat(n).concat(p(t)))},p=function(t){for(var e=t.length,n=[];e--;)n[e]=_(t[e]);return i.apply(null,[T.mvex].concat(n))},u=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(T.mvhd,e)},y=function(t){var e,n,a=t.samples||[],r=new Uint8Array(4+a.length);for(n=0;n>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));for(e=0;e>>8),o.push(255&r[e].byteLength),o=o.concat(Array.prototype.slice.call(r[e]));if(n=[T.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(T.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([a.length],s,[r.length],o))),i(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var d=t.sarRatio[0],h=t.sarRatio[1];n.push(i(T.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h])))}return i.apply(null,n)},B=function(t){return i(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),a(t))},c=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return i(T.tkhd,e)},b=function(t){var e,n,a,r,s,o;return e=i(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(t.baseMediaDecodeTime/X),o=Math.floor(t.baseMediaDecodeTime%X),n=i(T.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===t.type?(a=w(t,92),i(T.traf,e,n,a)):(r=y(t),a=w(t,r.length+92),i(T.traf,e,n,a,r))},l=function(t){return t.duration=t.duration||4294967295,i(T.trak,c(t),f(t))},_=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),i(T.trex,e)},z=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},G=function(t,e){var n,a,r,s,o,d;for(e+=20+16*(s=t.samples||[]).length,r=z(s,e),(a=new Uint8Array(r.length+16*s.length)).set(r),n=r.length,d=0;d>>24,a[n++]=(16711680&o.duration)>>>16,a[n++]=(65280&o.duration)>>>8,a[n++]=255&o.duration,a[n++]=(4278190080&o.size)>>>24,a[n++]=(16711680&o.size)>>>16,a[n++]=(65280&o.size)>>>8,a[n++]=255&o.size,a[n++]=o.flags.isLeading<<2|o.flags.dependsOn,a[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,a[n++]=61440&o.flags.degradationPriority,a[n++]=15&o.flags.degradationPriority,a[n++]=(4278190080&o.compositionTimeOffset)>>>24,a[n++]=(16711680&o.compositionTimeOffset)>>>16,a[n++]=(65280&o.compositionTimeOffset)>>>8,a[n++]=255&o.compositionTimeOffset;return i(T.trun,a)},W=function(t,e){var n,a,r,s,o,d;for(e+=20+8*(s=t.samples||[]).length,r=z(s,e),(n=new Uint8Array(r.length+8*s.length)).set(r),a=r.length,d=0;d>>24,n[a++]=(16711680&o.duration)>>>16,n[a++]=(65280&o.duration)>>>8,n[a++]=255&o.duration,n[a++]=(4278190080&o.size)>>>24,n[a++]=(16711680&o.size)>>>16,n[a++]=(65280&o.size)>>>8,n[a++]=255&o.size;return i(T.trun,n)},w=function(t,e){return"audio"===t.type?W(t,e):G(t,e)};var j,q,H,$,Z,K,J,Q={ftyp:r=function(){return i(T.ftyp,C,k,C,P)},mdat:function(t){return i(T.mdat,t)},moof:d,moov:h,initSegment:function(t){var e,i=r(),n=h(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},tt=function(t){return t>>>0},et=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},it=tt,nt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},at=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},rt=Y.getUint64,st=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&ot(e.presentation_time_delta)&&i,a=1===t&&ot(e.presentation_time)&&i;return!(t>1)&&n||a},ot=function(t){return void 0!==t||null!==t},dt=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=rt(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return st(h,u)?u:void 0},ht=function(t,e,i,n){return t||0===t?t/e:n+i/e},pt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},ut=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},lt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:ut(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=ut(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},ct=tt,ft=Y.getUint64,gt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=ft(t.subarray(4)):e.baseMediaDecodeTime=ct(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},mt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=kt(p[9]),a.codec+=kt(p[10]),a.codec+=kt(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===et(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+kt(p[19]),a.codec+="."+kt(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=nt(t,["mdia","mdhd"])[0];l&&(a.timescale=K(l)),i.push(a)})),i},J=function(t,e){return void 0===e&&(e=0),nt(t,["emsg"]).map((function(t){var i=dt(new Uint8Array(t)),n=At(i.message_data);return{cueTime:ht(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:ht(i.event_duration,i.timescale),frames:n}}))};var Dt={findBox:nt,parseType:et,timescale:j,startTime:q,compositionStartTime:H,videoTrackIds:$,tracks:Z,getTimescaleFromMediaHeader:K=function(t){var e=0===t[0]?12:20;return Ct(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:J},xt=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},Vt=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;iZt/2))){for((s=Ht()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ie=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},me.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},me.prototype.addText=function(t){this.rows[this.rowIdx]+=t},me.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var ye=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new me(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};ye.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new me(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},ye.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},ye.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Se=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Se.prototype=new Bt,Se.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Se.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Se.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Se.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Se.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Se.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Se.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Se.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Se.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Se.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var ve={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},be=function(t){return null===t?"":(t=ve[t]||t,String.fromCharCode(t))},_e=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],we=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},Te=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=we();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=we();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=we()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a)){var s=3&a;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(n,a)){var o=_e.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var d=(14&e)>>1;this.column_=4*d,this.nonDisplayed_[this.row_].indent+=d}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=be(n),r+=be(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Te.prototype=new Bt,Te.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},n=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&n.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),n.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:n,stream:this.name_})},Te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=we(),this.nonDisplayed_=we(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Te.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Te.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Te.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Te.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Te.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Te.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Te.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Te.prototype.isNormalChar=function(t){return t>=32&&t<=127},Te.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=we(),this.displayed_=we()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Te.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Te.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},Te.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},Te.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},De=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Pe,this.push=function(t){this.type_!==Pe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=Ae(t.dts,n),t.pts=Ae(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};De.prototype=new Bt;var xe,Ue=De;(xe=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(xe.prototype.init.call(this),this.dispatchType=ke.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=ke.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ke.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new Bt,Le.STREAM_TYPES={h264:27,adts:15},(Oe=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};Oe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case ke.H264_STREAM_TYPE:t=n,e="video";break;case ke.ADTS_STREAM_TYPE:t=a,e="audio";break;case ke.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new Bt;var Ne={PAT_PID:0,MP2T_PACKET_LENGTH:Me,TransportPacketStream:Ee,TransportParseStream:Le,ElementaryStream:Oe,TimestampRolloverStream:Re,CaptionStream:Ce.CaptionStream,Cea608Stream:Ce.Cea608Stream,Cea708Stream:Ce.Cea708Stream,MetadataStream:Ie};for(var Be in ke)ke.hasOwnProperty(Be)&&(Ne[Be]=ke[Be]);var We,Ge=Ne,ze=Zt,Fe=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(We=function(t){var e,i=0;We.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(n){var a,r,s,o,d,h=0;if(t||(i=0),"audio"===n.type){var p;for(e&&e.length?(s=e,(e=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),e.set(n.data,s.byteLength)):e=n.data;h+7>5,d=(o=1024*(1+(3&e[h+6])))*ze/Fe[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:Fe[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new Bt;var Ve,Ye,Xe,je=We,qe=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Ye=function(){var t,e,i=0;Ye.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new Bt,Xe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ve=function(){var t,e,i,n,a,r,s,o=new Ye;Ve.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i=0?i:0,(16&t[e+5])>>4?i+20:i+10},Ke=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=Ze(e,i))},Je=function(t){var e=Ke(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},Qe=Ze,ti=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i};(He=function(){var t=new Uint8Array,e=0;He.prototype.init.call(this),this.setTimestamp=function(t){e=t},this.push=function(i){var n,a,r,s,o=0,d=0;for(t.length?(s=t.length,(t=new Uint8Array(i.byteLength+s)).set(t.subarray(0,s)),t.set(i,s)):t=i;t.length-d>=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ti(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=Qe(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new Bt;var ei,ii,ni,ai,ri=He,si=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],oi=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],di=$e.H264Stream,hi=Je,pi=Zt,ui=function(t,e){e.stream=t,this.trigger("log",e)},li=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new Bt,(ai=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ai.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new Bt,ai.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,oi.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,si.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Q.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ai.prototype.setRemux=function(t){this.remuxTracks=t},(ni=function(t){var e,i,n=this,a=!0;ni.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new Ge.MetadataStream,a.aacStream=new ri,a.audioTimestampRolloverStream=new Ge.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Ge.TimestampRolloverStream("timed-metadata"),a.adtsStream=new je,a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new Ge.MetadataStream,a.packetStream=new Ge.TransportPacketStream,a.parseStream=new Ge.TransportParseStream,a.elementaryStream=new Ge.ElementaryStream,a.timestampRolloverStream=new Ge.TimestampRolloverStream,a.adtsStream=new je,a.h264Stream=new di,a.captionStream=new Ge.CaptionStream(t),a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new ei(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,re(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,re(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=hi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Bt;var gi={Transmuxer:ni,VideoSegmentStream:ei,AudioSegmentStream:ii,AUDIO_PROPERTIES:si,VIDEO_PROPERTIES:oi,generateSegmentTimingInfo:fi},mi=ue,yi=Ce.CaptionStream,Si=function(t,e){for(var i=t,n=0;n0?gt(h[0]).baseMediaDecodeTime:0,u=nt(r,["trun"]);e===d&&u.length>0&&(i=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=vi(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}}})); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.js deleted file mode 100644 index 77a3a8467b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.js +++ /dev/null @@ -1,11462 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window')) : - typeof define === 'function' && define.amd ? define(['global/window'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.muxjs = factory(global.window)); -}(this, (function (window) { 'use strict'; - - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - - var window__default = /*#__PURE__*/_interopDefaultLegacy(window); - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ - - var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; - }; - /** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - - Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; - }; // Default stream functions that are expected to be overridden to perform - // actual work. These are provided by the prototype as a sort of no-op - // implementation so that we don't have to check for their existence in the - // `pipe` function above. - - - Stream.prototype.push = function (data) { - this.trigger('data', data); - }; - - Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); - }; - - Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); - }; - - Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); - }; - - Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); - }; - - var stream = Stream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var ONE_SECOND_IN_TS$5 = 90000, - // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - - secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS$5; - }; - - secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; - }; - - videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS$5; - }; - - audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; - }; - - audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); - }; - - videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); - }; - /** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - - metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); - }; - - var clock = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$5, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds - }; - - var ONE_SECOND_IN_TS$4 = clock.ONE_SECOND_IN_TS; - - var _AdtsStream; - - var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - /* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - - _AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function (start, end) { - this.trigger('log', { - level: 'warn', - message: "adts skiping bytes " + start + " to " + end + " in frame " + frameNum + " outside syncword" - }); - }; - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - var skip; // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - - while (i + 7 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - - - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$4 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - - if (buffer.byteLength - i < frameLength) { - break; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // remove processed bytes from the buffer. - - - buffer = buffer.subarray(i); - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; - }; - - _AdtsStream.prototype = new stream(); - var adts = _AdtsStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ExpGolomb; - /** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - - ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); - }; - - var expGolomb = ExpGolomb; - - var _H264Stream, _NalByteStream; - - var PROFILES_WITH_OPTIONAL_SPS_DATA; - /** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - - _NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - }; - - _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS - // see Recommendation ITU-T H.264 (4/2013), - // 7.3.2.1.1 Sequence parameter set data syntax - - PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true - }; - /** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - - _H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - expGolombDecoder = new expGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2, - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; - }; - - _H264Stream.prototype = new stream(); - var h264 = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var codecs = { - Adts: adts, - h264: h264 - }; - - var MAX_UINT32$1 = Math.pow(2, 32); - - var getUint64$5 = function getUint64(uint8) { - var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength); - var value; - - if (dv.getBigUint64) { - value = dv.getBigUint64(0); - - if (value < Number.MAX_SAFE_INTEGER) { - return Number(value); - } - - return value; - } - - return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4); - }; - - var numbers = { - getUint64: getUint64$5, - MAX_UINT32: MAX_UINT32$1 - }; - - var MAX_UINT32 = numbers.MAX_UINT32; - var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - - (function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); - })(); - - box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; - }; - - dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); - }; - - esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); - }; - - ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); - }; - - hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); - }; - - mdat = function mdat(data) { - return box(types.mdat, data); - }; - - mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); - }; - - mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); - }; - - mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); - }; - - minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); - }; - - moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); - }; - /** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - - moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); - }; - - mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); - }; - - mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); - }; - - sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); - }; - - stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); - }; - - (function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; - })(); - - tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); - }; - /** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - - traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun$1(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); - }; - /** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - - trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); - }; - - trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); - }; - - (function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun$1 = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; - })(); - - var mp4Generator = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var toUnsigned$3 = function toUnsigned(value) { - return value >>> 0; - }; - - var toHexString$1 = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); - }; - - var bin = { - toUnsigned: toUnsigned$3, - toHexString: toHexString$1 - }; - - var parseType$2 = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; - }; - - var parseType_1 = parseType$2; - - var toUnsigned$2 = bin.toUnsigned; - - var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; - }; - - var findBox_1 = findBox; - - /** - * Returns the first string in the data array ending with a null char '\0' - * @param {UInt8} data - * @returns the string with the null char - */ - var uint8ToCString$1 = function uint8ToCString(data) { - var index = 0; - var curChar = String.fromCharCode(data[index]); - var retString = ''; - - while (curChar !== '\0') { - retString += curChar; - index++; - curChar = String.fromCharCode(data[index]); - } // Add nullChar - - - retString += curChar; - return retString; - }; - - var string = { - uint8ToCString: uint8ToCString$1 - }; - - var uint8ToCString = string.uint8ToCString; - var getUint64$4 = numbers.getUint64; - /** - * Based on: ISO/IEC 23009 Section: 5.10.3.3 - * References: - * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format - * https://aomediacodec.github.io/id3-emsg/ - * - * Takes emsg box data as a uint8 array and returns a emsg box object - * @param {UInt8Array} boxData data from emsg box - * @returns A parsed emsg box object - */ - - var parseEmsgBox = function parseEmsgBox(boxData) { - // version + flags - var offset = 4; - var version = boxData[0]; - var scheme_id_uri, value, timescale, presentation_time, presentation_time_delta, event_duration, id, message_data; - - if (version === 0) { - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time_delta = dv.getUint32(offset); - offset += 4; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - } else if (version === 1) { - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time = getUint64$4(boxData.subarray(offset)); - offset += 8; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - } - - message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength)); - var emsgBox = { - scheme_id_uri: scheme_id_uri, - value: value, - // if timescale is undefined or 0 set to 1 - timescale: timescale ? timescale : 1, - presentation_time: presentation_time, - presentation_time_delta: presentation_time_delta, - event_duration: event_duration, - id: id, - message_data: message_data - }; - return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined; - }; - /** - * Scales a presentation time or time delta with an offset with a provided timescale - * @param {number} presentationTime - * @param {number} timescale - * @param {number} timeDelta - * @param {number} offset - * @returns the scaled time as a number - */ - - - var scaleTime = function scaleTime(presentationTime, timescale, timeDelta, offset) { - return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale; - }; - /** - * Checks the emsg box data for validity based on the version - * @param {number} version of the emsg box to validate - * @param {Object} emsg the emsg data to validate - * @returns if the box is valid as a boolean - */ - - - var isValidEmsgBox = function isValidEmsgBox(version, emsg) { - var hasScheme = emsg.scheme_id_uri !== '\0'; - var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme; - var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; // Only valid versions of emsg are 0 and 1 - - return !(version > 1) && isValidV0Box || isValidV1Box; - }; // Utility function to check if an object is defined - - - var isDefined = function isDefined(data) { - return data !== undefined || data !== null; - }; - - var emsg = { - parseEmsgBox: parseEmsgBox, - scaleTime: scaleTime - }; - - var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; - }; - - var parseTfhd = tfhd; - - var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; - }; - - var parseSampleFlags_1 = parseSampleFlags; - - var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags_1(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; - }; - - var parseTrun = trun; - - var toUnsigned$1 = bin.toUnsigned; - var getUint64$3 = numbers.getUint64; - - var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime = getUint64$3(data.subarray(4)); - } else { - result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]); - } - - return result; - }; - - var parseTfdt = tfdt; - - // IE11 doesn't support indexOf for TypedArrays. - // Once IE11 support is dropped, this function should be removed. - var typedArrayIndexOf$1 = function typedArrayIndexOf(typedArray, element, fromIndex) { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; - }; - - var typedArray = { - typedArrayIndexOf: typedArrayIndexOf$1 - }; - - var typedArrayIndexOf = typedArray.typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text - // encoding description byte [ID3v2.4.0 section 4.] - textEncodingDescriptionByte = { - Iso88591: 0x00, - // ISO-8859-1, terminated with \0. - Utf16: 0x01, - // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, - // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - - }, - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode$1 = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode$1(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591$1 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }, - frameParsers = { - 'APIC': function APIC(frame) { - var i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parsing fields [ID3v2.4.0 section 4.14.] - - - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } // parsing Mime type field (terminated with \0) - - - frame.mimeType = parseIso88591$1(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field - - frame.pictureType = frame.data[i]; - i++; - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (descriptionEndIndex < 0) { - // malformed frame - return; - } // parsing Description field (terminated with \0) - - - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591$1(frame.data, i, frame.data.length); - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function T(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - - - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - - frame.values = frame.value.split('\0'); - }, - 'TXXX': function TXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the text fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - - frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function W(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function WXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the description and URL fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - - frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, ''); - }, - 'PRIV': function PRIV(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591$1(frame.data, 0, i); - break; - } - } - - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } - }; - - var parseId3Frames$1 = function parseId3Frames(data) { - var frameSize, - frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - - if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) { - return; - } // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - - - tagSize = parseSyncSafeInteger$1(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; // check bit 6 of byte 5 for the extended header flag. - - var hasExtendedHeader = data[5] & 0x40; - - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger$1(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20)); // clip any padding off the end - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - break; - } - - frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]); - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; - }; - - var parseId3 = { - parseId3Frames: parseId3Frames$1, - parseSyncSafeInteger: parseSyncSafeInteger$1, - frameParsers: frameParsers - }; - - var toUnsigned = bin.toUnsigned; - var toHexString = bin.toHexString; - var getUint64$2 = numbers.getUint64; - var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3; - var parseId3Frames = parseId3.parseId3Frames; - /** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - timescale = function timescale(init) { - var result = {}, - traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox_1(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); - }; - /** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - - startTime = function startTime(timescale, fragment) { - var trafs; // we need info from two childrend of each track fragment box - - trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track - - var lowestTime = trafs.reduce(function (acc, traf) { - var tfhd = findBox_1(traf, ['tfhd'])[0]; // get the track id from the tfhd - - var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - var tfdt = findBox_1(traf, ['tfdt'])[0]; - var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength); - var baseTime; // version 1 is 64 bit - - if (tfdt[0] === 1) { - baseTime = getUint64$2(tfdt.subarray(4, 12)); - } else { - baseTime = dv.getUint32(4); - } // convert base time to seconds if it is a valid number. - - - var seconds; - - if (typeof baseTime === 'bigint') { - seconds = baseTime / window__default['default'].BigInt(scale); - } else if (typeof baseTime === 'number' && !isNaN(baseTime)) { - seconds = baseTime / scale; - } - - if (seconds < Number.MAX_SAFE_INTEGER) { - seconds = Number(seconds); - } - - if (seconds < acc) { - acc = seconds; - } - - return acc; - }, Infinity); - return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0; - }; - /** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - - compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox_1(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox_1(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - if (typeof baseMediaDecodeTime === 'bigint') { - compositionTimeOffset = window__default['default'].BigInt(compositionTimeOffset); - timescale = window__default['default'].BigInt(timescale); - } - - var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale; - - if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) { - result = Number(result); - } - - return result; - }; - /** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - - getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox_1(trak, ['mdia', 'hdlr']); - var tkhds = findBox_1(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType_1(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; - }; - - getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }; - /** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - - getTracks = function getTracks(init) { - var traks = findBox_1(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox_1(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType_1(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType_1(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox_1(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[asm]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType_1(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; - }; - /** - * Returns an array of emsg ID3 data from the provided segmentData. - * An offset can also be provided as the Latest Arrival Time to calculate - * the Event Start Time of v0 EMSG boxes. - * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing - * - * @param {Uint8Array} segmentData the segment byte array. - * @param {number} offset the segment start time or Latest Arrival Time, - * @return {Object[]} an array of ID3 parsed from EMSG boxes - */ - - - getEmsgID3 = function getEmsgID3(segmentData, offset) { - if (offset === void 0) { - offset = 0; - } - - var emsgBoxes = findBox_1(segmentData, ['emsg']); - return emsgBoxes.map(function (data) { - var parsedBox = emsg.parseEmsgBox(new Uint8Array(data)); - var parsedId3Frames = parseId3Frames(parsedBox.message_data); - return { - cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset), - duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale), - frames: parsedId3Frames - }; - }); - }; - - var probe$2 = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader, - getEmsgID3: getEmsgID3 - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - // Convert an array of nal units into an array of frames with each frame being - // composed of the nal units that make up that frame - // Also keep track of cummulative data about the frame from the nal units such - // as the frame duration, starting pts, etc. - var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; - }; // Convert an array of frames into an array of Gop with each Gop being composed - // of the frames that make up that Gop - // Also keep track of cummulative data about the Gop from the frames such as the - // Gop duration, starting pts, etc. - - - var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; - }; - /* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - - var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; - }; - /** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - - var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; - }; - /* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - - var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; - }; // generate the track's sample table from an array of gops - - - var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; - }; // generate the track's raw mdat data from an array of gops - - - var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; - }; // generate the track's sample table from a frame - - - var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; - }; // generate the track's raw mdat data from a frame - - - var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; - }; - - var frameUtils = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable$1, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - var highPrefix = [33, 16, 5, 32, 164, 27]; - var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - - var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; - }; - - var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); - }; - - var silence; - - var silence_1 = function silence_1() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 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]], - 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]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - /** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; - }; // Possibly pad (prefix) the audio track with silence if appending this track - // would lead to the introduction of a gap in the audio buffer - - - var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = silence_1()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; - }; // If the audio segment extends before the earliest allowed dts - // value, remove AAC frames until starts at or after the earliest - // allowed DTS so that we don't end up with a negative baseMedia- - // DecodeTime for the audio track - - - var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); - }; // generate the track's raw mdat data from an array of frames - - - var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; - }; // generate the track's sample table from an array of frames - - - var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; - }; - - var audioFrameUtils = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS; - /** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } - }; - /** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - - var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; - }; - /** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS$3; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; - }; - - var trackDecodeInfo = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - // payload type field to indicate how they are to be - // interpreted. CEAS-708 caption content is always transmitted with - // payload type 0x04. - - var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - /** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - - var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; - }; // see ANSI/SCTE 128-1 (2013), section 8.1 - - - var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); - }; // see CEA-708-D, section 4.4 - - - var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; - }; - - var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; // exports - - - var captionPacketParser = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes$1, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 - }; - - // Link To Transport - // ----------------- - - - var CaptionStream$1 = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({ - captionServices: options.captionServices - }); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - }; - - CaptionStream$1.prototype = new stream(); - - CaptionStream$1.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; - }; - - CaptionStream$1.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); - }; - - CaptionStream$1.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); - }; - - CaptionStream$1.prototype.flush = function () { - return this.flushStream('flush'); - }; // Only called if handling partial data - - - CaptionStream$1.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); - }; - - CaptionStream$1.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); - }; // From the CEA-608 spec: - - /* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. - */ - // With that in mind, we ignore any data between an XDS control code and a - // subsequent closed-captioning control code. - - - CaptionStream$1.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); - }; - - CaptionStream$1.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; - }; - - CaptionStream$1.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; - }; - - CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; - }; - - CaptionStream$1.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } - }; // ---------------------- - // Session to Application - // ---------------------- - // This hash maps special and extended character codes to their - // proper Unicode equivalent. The first one-byte key is just a - // non-standard character code. The two-byte keys that follow are - // the extended CEA708 character codes, along with the preceding - // 0x10 extended character byte to distinguish these codes from - // non-extended character codes. Every CEA708 character code that - // is not in this object maps directly to a standard unicode - // character code. - // The transparent space and non-breaking transparent space are - // technically not fully supported since there is no code to - // make them transparent, so they have normal non-transparent - // stand-ins. - // The special closed caption (CC) character isn't a standard - // unicode character, so a fairly similar unicode character was - // chosen in it's place. - - - var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - - }; - - var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); - }; - - var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; - }; - - var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); - }; - - Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; - }; - - Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); - }; - - Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; - }; - - Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } - }; - - Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; - }; - - Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; - }; - - Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } - }; - - var Cea708Service = function Cea708Service(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided - - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } - }; - /** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - - Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } - }; - /** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - - Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; - }; - /** - * Try to create a TextDecoder if it is natively supported - */ - - - Cea708Service.prototype.createTextDecoder = function (encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } - }; - - var Cea708Stream = function Cea708Stream(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; // Get service encodings from captionServices option block - - Object.keys(captionServices).forEach(function (serviceName) { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; - }; - - Cea708Stream.prototype = new stream(); - /** - * Push current 708 packet, create new 708 packet. - */ - - Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; - }; - /** - * Add pts and both bytes from packet into current 708 packet. - */ - - - Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); - }; - /** - * Parse completed 708 packet into service blocks and push each service block. - */ - - - Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } - }; - /** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - - Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else ; - } - }; - /** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, { - isExtended: true - }); - } - - return i; - }; - /** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - - Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; - }; - /** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - - Cea708Stream.prototype.initService = function (serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; - }; - /** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.handleText = function (i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; // Use the TextDecoder if one was created for this service - - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; - }; - /** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, { - isMultiByte: true - }); - } - - return i; - }; - /** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; - }; - /** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; - }; - /** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; - }; - /** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; - }; - /** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - - Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } - }; - /** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; - }; - /** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; - }; - /** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; - }; - /** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; - }; - /** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; - }; - /** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; - }; - /** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; - }; - /** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - - Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; - }; - /** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - - Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); - }; // This hash maps non-ASCII, special, and extended character codes to their - // proper Unicode equivalent. The first keys that are only a single byte - // are the non-standard ASCII characters, which simply map the CEA608 byte - // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 - // character codes, but have their MSB bitmasked with 0x03 so that a lookup - // can be performed regardless of the field and data channel on which the - // character code was received. - - - var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - - }; - - var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); - }; // the index of the last row in a CEA-608 display buffer - - - var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of - // getting it through bit logic. - - var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character - // cells. The "bottom" row is the last element in the outer array. - // We keep track of positioning information as we go by storing the - // number of indentations and the tab offset in this buffer. - - var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push({ - text: '', - indent: 0, - offset: 0 - }); - } - - return result; - }; - - var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - - this.nonDisplayed_[this.row_].offset = offset; - this.column_ += offset; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - var indentations = (data & 0xe) >> 1; - this.column_ = indentations * 4; // add to the number of indentations for positioning - - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; - }; - - Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the - // display buffer - - Cea608Stream.prototype.flushDisplayed = function (pts) { - var _this = this; - - var logWarning = function logWarning(index) { - _this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - - var content = []; - this.displayed_.forEach(function (row, i) { - if (row && row.text && row.text.length) { - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - - - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 - }); - } - } else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content: content, - stream: this.name_ - }); - } - }; - /** - * Zero out the data, used for startup and on seek - */ - - - Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; - }; - /** - * Sets up control code and related constants for this instance - */ - - - Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; - }; - /** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - - Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - - Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; - }; - /** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - - Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; - }; - /** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - - Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; - }; - /** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - - Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; - }; - /** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - - Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; - }; - /** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - - Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; - }; - /** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - - Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { - text: '', - indent: 0, - offset: 0 - }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; - }; // Adds the opening HTML tag for the passed character to the caption text, - // and keeps track of it for later closing - - - Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); - }; // Adds HTML closing tags for current formatting to caption text and - // clears remembered formatting - - - Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); - }; // Mode Implementations - - - Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; - - Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = { - text: '', - indent: 0, - offset: 0 - }; - }; - - Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; - }; // exports - - - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var streamTypes = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 - }; - - var MAX_TS = 8589934592; - var RO_THRESH = 4294967296; - var TYPE_SHARED = 'shared'; - - var handleRollover$1 = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; - }; - - var TimestampRolloverStream$1 = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover$1(data.dts, referenceDTS); - data.pts = handleRollover$1(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; - }; - - TimestampRolloverStream$1.prototype = new stream(); - var timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }; - - var _MetadataStream; - - _MetadataStream = function MetadataStream(options) { - var settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseId3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseId3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= parseId3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseId3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - - break; - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (parseId3.frameParsers[frame.id]) { - // use frame specific parser - parseId3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - parseId3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - parseId3.frameParsers['W*'](frame); - } // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; - }; - - _MetadataStream.prototype = new stream(); - var metadataStream = _MetadataStream; - - var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types - - var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - - var MP2T_PACKET_LENGTH$1 = 188, - // bytes - SYNC_BYTE$1 = 0x47; - /** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - - _TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH$1, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH$1; - endIndex += MP2T_PACKET_LENGTH$1; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; - }; - - _TransportPacketStream.prototype = new stream(); - /** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - - _TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === streamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = streamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = streamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; - }; - - _TransportParseStream.prototype = new stream(); - _TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f - }; - /** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - - _ElementaryStream = function ElementaryStream() { - var self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case streamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case streamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case streamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var pmt = { - type: 'metadata', - tracks: [] - }; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; - }; - - _ElementaryStream.prototype = new stream(); - var m2ts$1 = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, - MetadataStream: metadataStream - }; - - for (var type in streamTypes) { - if (streamTypes.hasOwnProperty(type)) { - m2ts$1[type] = streamTypes[type]; - } - } - - var m2ts_1 = m2ts$1; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ - - var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - - var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; - }; - - var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); - }; // TODO: use vhs-utils - - - var isLikelyAacData$2 = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; - }; - - var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; - }; // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - - - var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; - }; // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - - - var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }; - - var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; - }; - - var parseType$1 = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; - }; - - var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; - }; - - var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; - }; - - var utils = { - isLikelyAacData: isLikelyAacData$2, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType$1, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp - }; - - var _AacStream; - /** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - - _AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; - }; - - _AacStream.prototype = new stream(); - var aac = _AacStream; - - // constants - var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; - var audioProperties = AUDIO_PROPERTIES; - - var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; - var videoProperties = VIDEO_PROPERTIES; - - var H264Stream$1 = h264.H264Stream; - var isLikelyAacData$1 = utils.isLikelyAacData; - var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS; // object types - - var _VideoSegmentStream$1, _AudioSegmentStream$1, _Transmuxer$1, _CoalesceStream; - - var retriggerForStream = function retriggerForStream(key, event) { - event.stream = key; - this.trigger('log', event); - }; - - var addPipelineLogRetriggers = function addPipelineLogRetriggers(transmuxer, pipeline) { - var keys = Object.keys(pipeline); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; // skip non-stream keys and headOfPipeline - // which is just a duplicate - - if (key === 'headOfPipeline' || !pipeline[key].on) { - continue; - } - - pipeline[key].on('log', retriggerForStream.bind(transmuxer, key)); - } - }; - /** - * Compare two arrays (even typed) for same-ness - */ - - - var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - }; - - var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; - }; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - - _AudioSegmentStream$1 = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _AudioSegmentStream$1.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS$2 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - _AudioSegmentStream$1.prototype = new stream(); - /** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - _VideoSegmentStream$1 = function VideoSegmentStream(track, options) { - var sequenceNumber, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _VideoSegmentStream$1.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; - }; - - _VideoSegmentStream$1.prototype = new stream(); - /** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - - _CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; - }; - - _CoalesceStream.prototype = new stream(); - - _CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - videoProperties.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - audioProperties.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - }; - - _CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; - }; - /** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - - _Transmuxer$1 = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer$1.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new aac(); - pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new adts(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream$1(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts_1.TransportPacketStream(); - pipeline.parseStream = new m2ts_1.TransportParseStream(); - pipeline.elementaryStream = new m2ts_1.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream(); - pipeline.adtsStream = new adts(); - pipeline.h264Stream = new H264Stream$1(); - pipeline.captionStream = new m2ts_1.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream$1(videoTrack, options); - pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream')); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream$1(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - this.getLogTrigger_ = function (key) { - var self = this; - return function (event) { - event.stream = key; - self.trigger('log', event); - }; - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData$1(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - }; - - _Transmuxer$1.prototype = new stream(); - var transmuxer$2 = { - Transmuxer: _Transmuxer$1, - VideoSegmentStream: _VideoSegmentStream$1, - AudioSegmentStream: _AudioSegmentStream$1, - AUDIO_PROPERTIES: audioProperties, - VIDEO_PROPERTIES: videoProperties, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo - }; - - var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes; - var CaptionStream = captionStream.CaptionStream; - /** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; - }; - /** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - - var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = { - logs: [], - seiNals: [] - }, - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - result.logs.push({ - level: 'warn', - message: 'We\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.' - }); - break; - } - - result.seiNals.push(seiNal); - break; - } - } - - return result; - }; - /** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - - var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - if (typeof currentDts === 'bigint') { - sample.pts = currentDts + window__default['default'].BigInt(sample.compositionTimeOffset); - currentDts += window__default['default'].BigInt(sample.duration); - } else { - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - } - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; - }; - /** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - - var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox_1(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox_1(traf, ['trun']); - var samples; - var result; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - result = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = { - seiNals: [], - logs: [] - }; - } - - captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals); - captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs); - } - }); - return captionNals; - }; - /** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {Object[]} parsedCaptions[].content - A list of individual caption segments - * @return {String} parsedCaptions[].content.text - The visible content of the caption segment - * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment - * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 - **/ - - - var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - captionNals = parseCaptionNals(segment, trackId); - var trackNals = captionNals[trackId] || {}; - return { - seiNals: trackNals.seiNals, - logs: trackNals.logs, - timescale: timescale - }; - }; - /** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - - var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - captionStream.on('log', function (log) { - parsedCaptions.logs.push(log); - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData && parsedData.logs) { - parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs); - } - - if (parsedData === null || !parsedData.seiNals) { - if (parsedCaptions.logs.length) { - return { - logs: parsedCaptions.logs, - captions: [], - captionStreams: [] - }; - } - - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - parsedCaptions.logs = []; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {}, - logs: [] - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); - }; - - var captionParser = CaptionParser; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var mp4 = { - generator: mp4Generator, - probe: probe$2, - Transmuxer: transmuxer$2.Transmuxer, - AudioSegmentStream: transmuxer$2.AudioSegmentStream, - VideoSegmentStream: transmuxer$2.VideoSegmentStream, - CaptionParser: captionParser - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ - - var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - - _FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; - }; - - _FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - - _FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - - _FlvTag.METADATA_TAG = 0x12; // == 18, :uint - // (tag:ByteArray):Boolean { - - _FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; - }; // (tag:ByteArray):Boolean { - - - _FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; - }; // (tag:ByteArray):uint { - - - _FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; - }; - - var flvTag = _FlvTag; - - /** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - - var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; - }; - - CoalesceStream.prototype = new stream(); - - CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); - }; - - var coalesceStream = CoalesceStream; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); - }; - - var tagList = TagList; - - var H264Stream = h264.H264Stream; - - var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; - /** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - - collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } - }; - - metaDataTag = function metaDataTag(track, pts) { - var tag = new flvTag(flvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; - }; - - extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new flvTag(flvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; - }; - /** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - - _AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new tagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new flvTag(flvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new flvTag(flvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new flvTag(flvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; - }; - - _AudioSegmentStream.prototype = new stream(); - /** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - - _VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new tagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new flvTag(flvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - }; - - _VideoSegmentStream.prototype = new stream(); - /** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - - _Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream$1; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts_1.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts_1.TransportPacketStream(); - parseStream = new m2ts_1.TransportParseStream(); - elementaryStream = new m2ts_1.ElementaryStream(); - videoTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata'); - adtsStream = new adts(); - h264Stream = new H264Stream(); - coalesceStream$1 = new coalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream$1); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts_1.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream$1); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream$1.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream$1); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream$1.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream$1); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream$1.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream$1.on('done', function () { - self.trigger('done'); - }); - }; - - _Transmuxer.prototype = new stream(); // forward compatibility - - var transmuxer$1 = _Transmuxer; - - // http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. - // Technically, this function returns the header and a metadata FLV tag - // if duration is greater than zero - // duration in seconds - // @return {object} the bytes of the FLV header as a Uint8Array - - - var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new flvTag(flvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; - }; - - var flvHeader = getFlvHeader; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var flv = { - tag: flvTag, - Transmuxer: transmuxer$1, - getFlvHeader: flvHeader - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var m2ts = m2ts_1; - - var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; - /** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - audioProperties.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4Generator.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4Generator.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackDecodeInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; - }; - - AudioSegmentStream.prototype = new stream(); - var audioSegmentStream = AudioSegmentStream; - - var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - videoProperties.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4Generator.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackDecodeInfo.clearDtsInfo(track); - trackDecodeInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4Generator.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4Generator.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; - }; - - VideoSegmentStream.prototype = new stream(); - var videoSegmentStream = VideoSegmentStream; - - var isLikelyAacData = utils.isLikelyAacData; - - var createPipeline = function createPipeline(object) { - object.prototype = new stream(); - object.prototype.init.call(object); - return object; - }; - - var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts_1.TransportPacketStream(), - parse: new m2ts_1.TransportParseStream(), - elementary: new m2ts_1.ElementaryStream(), - timestampRollover: new m2ts_1.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts_1.CaptionStream(options), - metadataStream: new m2ts_1.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new videoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new audioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; - }; - - var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts_1.MetadataStream(), - aacStream: new aac(), - audioRollover: new m2ts_1.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts_1.TimestampRolloverStream('timed-metadata'), - adtsStream: new adts(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new audioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; - }; - - var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); - }; - - var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; - }; - - Transmuxer.prototype = new stream(); - var transmuxer = Transmuxer; - - var partial = { - Transmuxer: transmuxer - }; - - var getUint64$1 = numbers.getUint64; - - var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = getUint64$1(data.subarray(i)); - result.firstOffset = getUint64$1(data.subarray(i + 8)); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; - }; - - var parseSidx_1 = parseSidx; - - var getUint64 = numbers.getUint64; - - var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); - }, - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; - }, - // registry of handlers for individual mp4 box types - parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: getUint64(data.subarray(i)), - mediaTime: getUint64(data.subarray(i + 8)), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType_1(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType_1(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType_1(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: parseSidx_1, - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: parseTfdt, - tfhd: parseTfhd, - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: parseTrun, - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } - }; - /** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - - inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType_1(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; - }; - /** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - - _textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); - }; - - var mp4Inspector = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType_1, - findBox: findBox_1, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx - }; - - /** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ - - var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' - }, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); - }, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); - }, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; - }, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; - }, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; - }, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; - }, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; - }, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - } - - return header; - }, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; - }, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); - }; - - var flvInspector = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv - }; - - var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; - }; - - var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); - }; - - var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; - }; - - var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; - }; - - var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; - }; - - var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; - }; - - var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - return 'video'; - - case streamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case streamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } - }; - - var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; - }; - - var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } - }; - - var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; - }; - - var probe$1 = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame - }; - - var handleRollover = timestampRolloverStream.handleRollover; - var probe = {}; - probe.ts = probe$1; - probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS; - var MP2T_PACKET_LENGTH = 188, - // bytes - SYNC_BYTE = 0x47; - /** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - - var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - - var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - - var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } - }; - /** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - - var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } - }; - /** - * inspects the aac data stream for start and end time information - */ - - - var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; - }; - /** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - - var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case streamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case streamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - } - } - } - - return result; - }; - /** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - - var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; - }; - - var tsInspector = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ - }; - - var muxjs = { - codecs: codecs, - mp4: mp4, - flv: flv, - mp2t: m2ts, - partial: partial - }; // include all the tools when the full library is required - - muxjs.mp4.tools = mp4Inspector; - muxjs.flv.tools = flvInspector; - muxjs.mp2t.tools = tsInspector; - var lib = muxjs; - - return lib; - -}))); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.min.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.min.js deleted file mode 100644 index 10217bd60c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/dist/mux.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! @name mux.js @version 7.0.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(t),n=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n>5,d=(o=1024*(1+(3&e[h+6])))*v/S[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:S[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new u;var w,T,_,k=c,U=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(T=function(){var t,e,i=0;T.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new u,_={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(w=function(){var t,e,i,n,a,r,s,o=new T;w.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},z=function(t){return A(H.hdlr,Q[t])},F=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),A(H.mdhd,e)},N=function(t){return A(H.mdia,F(t),z(t.type),L(t))},I=function(t){return A(H.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},L=function(t){return A(H.minf,"video"===t.type?A(H.vmhd,tt):A(H.smhd,et),D(),G(t))},x=function(t,e){for(var i=[],n=e.length;n--;)i[n]=j(e[n]);return A.apply(null,[H.moof,I(t)].concat(i))},O=function(t){for(var e=t.length,i=[];e--;)i[e]=R(t[e]);return A.apply(null,[H.moov,M(4294967295)].concat(i).concat(E(t)))},E=function(t){for(var e=t.length,i=[];e--;)i[e]=q(t[e]);return A.apply(null,[H.mvex].concat(i))},M=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return A(H.mvhd,e)},V=function(t){var e,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(i=0;i>>8),r.push(255&n[e].byteLength),r=r.concat(Array.prototype.slice.call(n[e]));for(e=0;e>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));if(i=[H.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A(H.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length],r,[a.length],s))),A(H.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var o=t.sarRatio[0],d=t.sarRatio[1];i.push(A(H.pasp,new Uint8Array([(4278190080&o)>>24,(16711680&o)>>16,(65280&o)>>8,255&o,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return A.apply(null,i)},dt=function(t){return A(H.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),C(t))},B=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return A(H.tkhd,e)},j=function(t){var e,i,n,a,r,s;return e=A(H.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/mt),s=Math.floor(t.baseMediaDecodeTime%mt),i=A(H.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=Y(t,92),A(H.traf,e,i,n)):(a=V(t),n=Y(t,a.length+92),A(H.traf,e,i,n,a))},R=function(t){return t.duration=t.duration||4294967295,A(H.trak,B(t),N(t))},q=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),A(H.trex,e)},ut=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},pt=function(t,e){var i,n,a,r,s,o;for(e+=20+16*(r=t.samples||[]).length,a=ut(r,e),(n=new Uint8Array(a.length+16*r.length)).set(a),i=a.length,o=0;o>>24,n[i++]=(16711680&s.duration)>>>16,n[i++]=(65280&s.duration)>>>8,n[i++]=255&s.duration,n[i++]=(4278190080&s.size)>>>24,n[i++]=(16711680&s.size)>>>16,n[i++]=(65280&s.size)>>>8,n[i++]=255&s.size,n[i++]=s.flags.isLeading<<2|s.flags.dependsOn,n[i++]=s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,n[i++]=61440&s.flags.degradationPriority,n[i++]=15&s.flags.degradationPriority,n[i++]=(4278190080&s.compositionTimeOffset)>>>24,n[i++]=(16711680&s.compositionTimeOffset)>>>16,n[i++]=(65280&s.compositionTimeOffset)>>>8,n[i++]=255&s.compositionTimeOffset;return A(H.trun,n)},ht=function(t,e){var i,n,a,r,s,o;for(e+=20+8*(r=t.samples||[]).length,a=ut(r,e),(i=new Uint8Array(a.length+8*r.length)).set(a),n=a.length,o=0;o>>24,i[n++]=(16711680&s.duration)>>>16,i[n++]=(65280&s.duration)>>>8,i[n++]=255&s.duration,i[n++]=(4278190080&s.size)>>>24,i[n++]=(16711680&s.size)>>>16,i[n++]=(65280&s.size)>>>8,i[n++]=255&s.size;return A(H.trun,i)},Y=function(t,e){return"audio"===t.type?ht(t,e):pt(t,e)};var yt,bt,vt,St,wt,Tt,_t,kt={ftyp:P=function(){return A(H.ftyp,X,K,X,$)},mdat:function(t){return A(H.mdat,t)},moof:x,moov:O,initSegment:function(t){var e,i=P(),n=O(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},Ut=function(t){return t>>>0},At=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},Dt=Ut,Ct=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},Pt=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},It=gt.getUint64,Lt=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&xt(e.presentation_time_delta)&&i,a=1===t&&xt(e.presentation_time)&&i;return!(t>1)&&n||a},xt=function(t){return void 0!==t||null!==t},Ot=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=It(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return Lt(h,u)?u:void 0},Et=function(t,e,i,n){return t||0===t?t/e:n+i/e},Mt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},Rt=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Bt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:Rt(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=Rt(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},Nt=Ut,Ft=gt.getUint64,zt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=Ft(t.subarray(4)):e.baseMediaDecodeTime=Nt(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},Vt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=$t(p[9]),a.codec+=$t(p[10]),a.codec+=$t(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===At(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+$t(p[19]),a.codec+="."+$t(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=Ct(t,["mdia","mdhd"])[0];l&&(a.timescale=Tt(l)),i.push(a)})),i},_t=function(t,e){return void 0===e&&(e=0),Ct(t,["emsg"]).map((function(t){var i=Ot(new Uint8Array(t)),n=Jt(i.message_data);return{cueTime:Et(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:Et(i.event_duration,i.timescale),frames:n}}))};var Qt,te={findBox:Ct,parseType:At,timescale:yt,startTime:bt,compositionStartTime:vt,videoTrackIds:St,tracks:wt,getTimescaleFromMediaHeader:Tt=function(t){var e=0===t[0]?12:20;return Kt(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:_t},ee=function(t,e){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=e,i.compositionTimeOffset=t.pts-t.dts,i.duration=t.duration,i.size=4*t.length,i.size+=t.byteLength,t.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie=function(t){var e,i,n=[],a=[];for(a.byteLength=0,a.nalCount=0,a.duration=0,n.byteLength=0,e=0;e1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},re=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;if/2))){for((s=le()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ge=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Pe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Pe.prototype.addText=function(t){this.rows[this.rowIdx]+=t},Pe.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var Ie=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new Pe(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};Ie.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new Pe(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},Ie.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},Ie.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Le=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Le.prototype=new u,Le.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Le.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Le.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Le.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Le.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Le.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Le.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Le.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Le.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Le.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Le.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var xe={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Oe=function(t){return null===t?"":(t=xe[t]||t,String.fromCharCode(t))},Ee=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Me=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},Re=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=Me();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Me();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=Me()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=Oe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),r=Oe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a)){var s=3&a;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(n,a)){var o=Ee.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var d=(14&e)>>1;this.column_=4*d,this.nonDisplayed_[this.row_].indent+=d}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=Oe(n),r+=Oe(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Re.prototype=new u,Re.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},n=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&n.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),n.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:n,stream:this.name_})},Re.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Me(),this.nonDisplayed_=Me(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Re.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Re.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Re.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Re.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Re.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Re.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Re.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Re.prototype.isNormalChar=function(t){return t>=32&&t<=127},Re.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=Me(),this.displayed_=Me()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Re.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Re.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},Re.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},Re.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},Ve=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Fe,this.push=function(t){this.type_!==Fe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=ze(t.dts,n),t.pts=ze(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ve.prototype=new u;var Ge,We=Ve,je=ze;(Ge=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(Ge.prototype.init.call(this),this.dispatchType=Ne.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=Ne.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ne.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new u,Ye.STREAM_TYPES={h264:27,adts:15},(He=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case Ne.H264_STREAM_TYPE:t=n,e="video";break;case Ne.ADTS_STREAM_TYPE:t=a,e="audio";break;case Ne.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new u;var Ze={PAT_PID:0,MP2T_PACKET_LENGTH:$e,TransportPacketStream:qe,TransportParseStream:Ye,ElementaryStream:He,TimestampRolloverStream:Ke,CaptionStream:Be.CaptionStream,Cea608Stream:Be.Cea608Stream,Cea708Stream:Be.Cea708Stream,MetadataStream:Xe};for(var Je in Ne)Ne.hasOwnProperty(Je)&&(Ze[Je]=Ne[Je]);var Qe,ti=Ze,ei=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ii=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return i=i>=0?i:0,(16&t[e+5])>>4?i+20:i+10},ni=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=ii(e,i))},ai=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},ri={isLikelyAacData:function(t){var e=ni(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},parseId3TagSize:ii,parseAdtsSize:function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},parseType:function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},parseSampleRate:function(t){for(var e=0;e+5>>2];e++}return null},parseAacTimestamp:function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=ai(t.subarray(10,14)));do{if((i=ai(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var a=0;a>>2;return s*=4,s+=3&r[7]}break}}e+=10,e+=i}while(e=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ri.parseAdtsSize(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=ri.parseId3TagSize(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new u;var si,oi,di,hi,pi=Qe,ui=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],li=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ci=lt.H264Stream,fi=ri.isLikelyAacData,gi=f,mi=function(t,e){e.stream=t,this.trigger("log",e)},yi=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new u,(hi=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,hi.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new u,hi.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,li.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ui.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=kt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},hi.prototype.setRemux=function(t){this.remuxTracks=t},(di=function(t){var e,i,n=this,a=!0;di.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new ti.MetadataStream,a.aacStream=new pi,a.audioTimestampRolloverStream=new ti.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new ti.TimestampRolloverStream("timed-metadata"),a.adtsStream=new k,a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new ti.MetadataStream,a.packetStream=new ti.TransportPacketStream,a.parseStream=new ti.TransportParseStream,a.elementaryStream=new ti.ElementaryStream,a.timestampRolloverStream=new ti.TimestampRolloverStream,a.adtsStream=new k,a.h264Stream=new ci,a.captionStream=new ti.CaptionStream(t),a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new si(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,be(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,be(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=fi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new u;var Si,wi={Transmuxer:di,VideoSegmentStream:si,AudioSegmentStream:oi,AUDIO_PROPERTIES:ui,VIDEO_PROPERTIES:li,generateSegmentTimingInfo:vi},Ti=ke,_i=Be.CaptionStream,ki=function(t,e){for(var i=t,n=0;n0?zt(p[0]).baseMediaDecodeTime:0,l=Ct(s,["trun"]);e===h&&l.length>0&&(n=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=Ui(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}};(Si=function(t,e){var i,n=0,a=16384,r=function(t,e){var i,n=t.position+e;n0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===n+4?this.length-=4:n>0&&(e=n+4,i=this.length-e,this.position=n,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),n=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(s,this.position),this.position+=5;else if("height"===t)this.bytes.set(o,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case Si.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case Si.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=Si.frameTime(this.bytes),this}}).AUDIO_TAG=8,Si.VIDEO_TAG=9,Si.METADATA_TAG=18,Si.isAudioFrame=function(t){return Si.AUDIO_TAG===t[0]},Si.isVideoFrame=function(t){return Si.VIDEO_TAG===t[0]},Si.isMetaData=function(t){return Si.METADATA_TAG===t[0]},Si.isKeyFrame=function(t){return Si.isVideoFrame(t)?23===t[11]:!!Si.isAudioFrame(t)||!!Si.isMetaData(t)},Si.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var Di=Si,Ci=function t(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,t.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};(Ci.prototype=new u).flush=function(t){var e,i,n,a,r={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks=n[0]&&(s=n.shift(),this.writeMetaDataTags(o,s)),(t.extraData!==e||a.pts-s>=1e3)&&(this.writeMetaDataTags(o,a.pts),e=t.extraData,s=a.pts),(r=new Di(Di.AUDIO_TAG)).pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),o.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,i){var n;(n=new Di(Di.METADATA_TAG)).pts=i,n.dts=i,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),(n=new Di(Di.AUDIO_TAG,!0)).pts=i,n.dts=i,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}}).prototype=new u,(Ii=function(t){var e,i,n=[];Ii.prototype.init.call(this),this.finishFrame=function(n,a){if(a){if(e&&t&&t.newMetadata&&(a.keyFrame||0===n.length)){var r=Oi(e,a.dts).finalize(),s=Ei(t,a.dts).finalize();r.metaDataTag=s.metaDataTag=!0,n.push(r),n.push(s),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),n.push(a.finalize()),i=null}},this.push=function(e){xi(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),n.push(e)},this.flush=function(){for(var a,r=new Ri;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0!==n.length){for(;n.length;)"seq_parameter_set_rbsp"===(a=n.shift()).nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(i&&this.finishFrame(r,i),(i=new Di(Di.VIDEO_TAG)).pts=a.pts,i.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(a.data);i&&this.finishFrame(r,i),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new u,(Pi=function(t){var e,i,n,a,r,s,o,d,h,p,u,l,c=this;Pi.prototype.init.call(this),t=t||{},this.metadataStream=new ti.MetadataStream,t.metadataStream=this.metadataStream,e=new ti.TransportPacketStream,i=new ti.TransportParseStream,n=new ti.ElementaryStream,a=new ti.TimestampRolloverStream("video"),r=new ti.TimestampRolloverStream("audio"),s=new ti.TimestampRolloverStream("timed-metadata"),o=new k,d=new Bi,l=new Mi(t),e.pipe(i).pipe(n),n.pipe(a).pipe(d),n.pipe(r).pipe(o),n.pipe(s).pipe(this.metadataStream).pipe(l),u=new ti.CaptionStream(t),d.pipe(u).pipe(l),n.on("data",(function(t){var e,i,n;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(n=t.tracks[e]);i&&!h&&(l.numberOfTracks++,h=new Ii(i),d.pipe(h).pipe(l)),n&&!p&&(l.numberOfTracks++,p=new Li(n),o.pipe(p).pipe(l),h&&h.on("keyframe",p.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){u.reset()},l.on("data",(function(t){c.trigger("data",t)})),l.on("done",(function(){c.trigger("done")}))}).prototype=new u;var Ni=function(t,e,i){var n,a,r,s=new Uint8Array(9),o=new DataView(s.buffer);return t=t||0,e=void 0===e||e,i=void 0===i||i,o.setUint8(0,70),o.setUint8(1,76),o.setUint8(2,86),o.setUint8(3,1),o.setUint8(4,(e?4:0)|(i?1:0)),o.setUint32(5,s.byteLength),t<=0?((a=new Uint8Array(s.byteLength+4)).set(s),a.set([0,0,0,0],s.byteLength),a):((n=new Di(Di.METADATA_TAG)).pts=n.dts=0,n.writeMetaDataDouble("duration",t),r=n.finalize().length,(a=new Uint8Array(s.byteLength+r)).set(s),a.set(o.byteLength,r),a)},Fi={tag:Di,Transmuxer:Pi,getFlvHeader:Ni},zi=ti,Vi=f,Gi=function t(e,i){var n=[],a=0,r=0,s=0,o=1/0,d=null,h=null;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),e&&ui.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(t){r=t},this.setVideoBaseMediaDecodeTime=function(t){o=t},this.setAudioAppendStart=function(t){s=t},this.processFrames_=function(){var t,p,u,l,c;0!==n.length&&0!==(t=fe(n,e,r)).length&&(e.baseMediaDecodeTime=ve(e,i.keepOriginalTimestamps),ce(e,t,s,o),e.samples=ge(t),u=kt.mdat(me(t)),n=[],p=kt.moof(a,[e]),a++,e.initSegment=kt.initSegment([e]),(l=new Uint8Array(p.byteLength+u.byteLength)).set(p),l.set(u,p.byteLength),be(e),null===d&&(h=d=t[0].pts),h+=t.length*(1024*Vi/e.samplerate),c={start:d},this.trigger("timingInfo",c),this.trigger("data",{track:e,boxes:l}))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:d,end:h}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){be(e),d=null,h=null},this.reset=function(){this.resetTiming_(),n=[],this.trigger("reset")}};Gi.prototype=new u;var Wi=Gi,ji=function t(e,i){var n,a,r,s=0,o=[],d=[],h=null,p=null,u=!0;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],li.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||a||(a=t.data,e.pps=[t.data]),o.push(t)},this.processNals_=function(t){var n;for(o=d.concat(o);o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0!==o.length){var a=ie(o);if(a.length)if(d=a[a.length-1],t&&(a.pop(),a.duration-=d.duration,a.nalCount-=d.length,a.byteLength-=d.byteLength),a.length){if(this.trigger("timelineStartInfo",e.timelineStartInfo),u){if(!(r=ne(a))[0][0].keyFrame){if(!(r=ae(r))[0][0].keyFrame)return o=[].concat.apply([],a).concat(d),void(d=[]);(a=[].concat.apply([],r)).duration=r.duration}u=!1}for(null===h&&(h=a[0].pts,p=h),p+=a.duration,this.trigger("timingInfo",{start:h,end:p}),n=0;nMALFORMED DATA");else switch(31&t[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+t[e]&31)}return a},an={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:$i(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,a,r=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,a=0;a>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:At(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n>10)),a.language+=String.fromCharCode(96+((992&e)>>5)),a.language+=String.fromCharCode(96+(31&e)),a},mdia:function(t){return{boxes:$i(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:$i(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return t.byteLength>28&&(i.streamDescriptor=$i(t.subarray(28))[0]),i},moof:function(t){return{boxes:$i(t)}},moov:function(t){return{boxes:$i(t)}},mvex:function(t){return{boxes:$i(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=en(e.getUint32(i)),i+=8,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=en(e.getUint32(i)),i+=4,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=e.getUint32(n),i.firstOffset=e.getUint32(n+4),n+=8):(i.earliestPresentationTime=Qi(t.subarray(n)),i.firstOffset=Qi(t.subarray(n+8)),n+=16),n+=2;var a=e.getUint16(n);for(n+=2;a>0;n+=12,a--)i.references.push({referenceType:(128&t[n])>>>7,referencedSize:2147483647&e.getUint32(n),subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(128&t[n+8]),sapType:(112&t[n+8])>>>4,sapDeltaTime:268435455&e.getUint32(n+8)});return i},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:$i(t)}},ctts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),compositionOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=8,a--)n.compositionOffsets.push({sampleCount:i.getUint32(e),sampleOffset:i[0===n.version?"getUint32":"getInt32"](e+4)});return n},stss:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),syncSamples:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.syncSamples.push(i.getUint32(e));return n},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)a.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return a},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:$i(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:Bt,"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},rn={inspect:$i=function(t){for(var e,i,n,a,r,s=0,o=[],d=new ArrayBuffer(t.length),h=new Uint8Array(d),p=0;p1?s+i:t.byteLength,(r=(an[n]||function(t){return{data:t}})(t.subarray(s+8,a))).size=i,r.type=n,o.push(r),s=a;return o},textify:Zi=function(t,e){var i;return e=e||0,i=new Array(2*e+1).join(" "),t.map((function(t,n){return i+t.type+"\n"+Object.keys(t).filter((function(t){return"type"!==t&&"boxes"!==t})).map((function(e){var n=i+" "+e+": ",a=t[e];if(a instanceof Uint8Array||a instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)).map((function(t){return" "+("00"+t.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return r?1===r.length?n+"<"+r.join("").slice(1)+">":n+"<\n"+r.map((function(t){return i+" "+t})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(a,null,2).split("\n").map((function(t,e){return 0===e?t:i+" "+t})).join("\n")})).join("\n")+(t.boxes?"\n"+Zi(t.boxes,e+1):"")})).join("\n")},parseType:At,findBox:Ct,parseTraf:an.traf,parseTfdt:an.tfdt,parseHdlr:an.hdlr,parseTfhd:an.tfhd,parseTrun:an.trun,parseSidx:an.sidx},sn={8:"audio",9:"video",18:"metadata"},on=function(t){for(var e,i=[];t.byteLength>0;)e=0,i.push("0x"+("00"+t[e++].toString(16)).slice(-2).toUpperCase()),t=t.subarray(1);return i.join(" ")},dn=function(t,e){var i=t[0]&parseInt("00001111",2);return(e=e||{}).frameType=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"][(t[0]&parseInt("11110000",2))>>>4],e.codecID=i,7===i?function(t,e){var i=t[1]&parseInt("01111111",2)<<16|t[2]<<8|t[3];return(e=e||{}).avcPacketType=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"][t[0]],e.CompositionTime=t[1]&parseInt("10000000",2)?-i:i,1===t[0]?e.nalUnitTypeRaw=on(t.subarray(4,100)):e.data=on(t.subarray(4)),e}(t.subarray(1),e):e},hn=function(t,e){var i=(t[0]&parseInt("11110000",2))>>>4;return(e=e||{}).soundFormat=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"][i],e.soundRate=["5.5-kHz","11-kHz","22-kHz","44-kHz"][(t[0]&parseInt("00001100",2))>>>2],e.soundSize=(t[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",e.soundType=t[0]&parseInt("00000001",2)?"Stereo":"Mono",10===i?function(t,e){return(e=e||{}).aacPacketType=["AAC Sequence Header","AAC Raw"][t[0]],e.data=on(t.subarray(1)),e}(t.subarray(1),e):e},pn=function(t){var e=function(t){return{tagType:sn[t[0]],dataSize:t[1]<<16|t[2]<<8|t[3],timestamp:t[7]<<24|t[4]<<16|t[5]<<8|t[6],streamID:t[8]<<16|t[9]<<8|t[10]}}(t);switch(t[0]){case 8:hn(t.subarray(11),e);break;case 9:dn(t.subarray(11),e)}return e},un={inspectTag:pn,inspect:function(t){var e,i,n=9,a=[];for(n+=4;n>>4>1&&(e+=t[4]+1),e},gn=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},mn={parseType:function(t,e){var i=ln(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},parsePat:function(t){var e=cn(t),i=4+fn(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},parsePmt:function(t){var e={},i=cn(t),n=4+fn(t);if(i&&(n+=t[n]+1),1&t[n+5]){var a;a=3+((15&t[n+1])<<8|t[n+2])-4;for(var r=12+((15&t[n+10])<<8|t[n+11]);r=t.byteLength)return null;var i,n=null;return 192&(i=t[e+7])&&((n={}).pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},videoPacketContainsKeyFrame:function(t){for(var e=4+fn(t),i=t.subarray(e),n=0,a=0,r=!1;a3&&"slice_layer_without_partitioning_rbsp_idr"===gn(31&i[a+3])&&(r=!0),r}},yn=je,bn={};bn.ts=mn,bn.aac=ri;var vn=f,Sn=188,wn=71,Tn=function(t,e,i){for(var n,a,r,s,o=0,d=Sn,h=!1;d<=t.byteLength;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o++,d++;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o+=Sn,d+=Sn}for(o=(d=t.byteLength)-Sn,h=!1;o>=0;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o--,d--;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o-=Sn,d-=Sn}},_n=function(t,e,i){for(var n,a,r,s,o,d,h,p=0,u=Sn,l=!1,c={data:[],size:0};u=0;)if(t[p]!==wn||t[u]!==wn)p--,u--;else{switch(n=t.subarray(p,u),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"video"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),l=!0)}if(l)break;p-=Sn,u-=Sn}},kn=function(t){var e={pid:null,table:null},i={};for(var n in function(t,e){for(var i,n=0,a=Sn;a=3;){switch(bn.aac.parseType(t,o)){case"timed-metadata":if(t.length-o<10){i=!0;break}if((s=bn.aac.parseId3TagSize(t,o))>t.length){i=!0;break}null===r&&(e=t.subarray(o,o+s),r=bn.aac.parseAacTimestamp(e)),o+=s;break;case"audio":if(t.length-o<7){i=!0;break}if((s=bn.aac.parseAdtsSize(t,o))>t.length){i=!0;break}null===a&&(e=t.subarray(o,o+s),a=bn.aac.parseSampleRate(e)),n++,o+=s;break;default:o++}if(i)return null}if(null===a||null===r)return null;var d=vn/a;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*n*d,pts:r+1024*n*d}]}}(t):kn(t))&&(i.audio||i.video)?(function(t,e){if(t.audio&&t.audio.length){var i=e;(void 0===i||isNaN(i))&&(i=t.audio[0].dts),t.audio.forEach((function(t){t.dts=yn(t.dts,i),t.pts=yn(t.pts,i),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn}))}if(t.video&&t.video.length){var n=e;if((void 0===n||isNaN(n))&&(n=t.video[0].dts),t.video.forEach((function(t){t.dts=yn(t.dts,n),t.pts=yn(t.pts,n),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn})),t.firstKeyFrame){var a=t.firstKeyFrame;a.dts=yn(a.dts,n),a.pts=yn(a.pts,n),a.dtsTime=a.dts/vn,a.ptsTime=a.pts/vn}}}(i,e),i):null},parseAudioPes_:Tn},An={codecs:ct,mp4:Ai,flv:Fi,mp2t:zi,partial:Ji};return An.mp4.tools=rn,An.flv.tools=un,An.mp2t.tools=Un,An})); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/captions.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/captions.md deleted file mode 100644 index e3545b3272..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/captions.md +++ /dev/null @@ -1,37 +0,0 @@ -# In-Band Captions -Captions come in two varieties, based on their relationship to the -video. Typically on the web, captions are delivered as a separate file -and associated with a video through the `` element. This type -of captions are sometimes referred to as *out-of-band*. - -The alternative method involves embedding the caption data directly into -the video content and is sometimes called *in-band captions*. In-band -captions exist in many videos today that were originally encoded for -broadcast and they are also a standard method used to provide captions -for live events. In-band HLS captions follow the CEA-708 standard. - -In this project, in-band captions are parsed using a [CaptionStream][caption-stream]. For MPEG2-TS sources, the CaptionStream is used as part of the [Transmuxer TS Pipeline][transmuxer]. For ISOBMFF sources, the CaptionStream is used as part of the [MP4 CaptionParser][mp4-caption-parser]. - -## Is my stream CEA-608/CEA-708 compatible? - -If you are having difficulties getting caption data as you expect out of Mux.js, take a look at our [Troubleshooting Guide](/docs/troubleshooting.md#608/708-caption-parsing) to ensure your content is compatible. - -# Useful Tools - -- [CCExtractor][cc-extractor] -- [Thumbcoil][thumbcoil] - -# References -- [Rec. ITU-T H.264][h264-spec]: H.264 video data specification. CEA-708 captions are encapsulated in supplemental enhancement information (SEI) network abstraction layer (NAL) units within the video stream. -- [ANSI/SCTE 128-1][ansi-scte-spec]: the binary encapsulation of caption data within an SEI user_data_registered_itu_t_t35 payload. -- CEA-708-E: describes the framing and interpretation of caption data reassembled out of the picture user data blobs. -- CEA-608-E: specifies the hex to character mapping for extended language characters. -- [Closed Captioning Intro by Technology Connections](https://www.youtube.com/watch?v=6SL6zs2bDks) - -[h264-spec]: https://www.itu.int/rec/T-REC-H.264 -[ansi-scte-spec]: https://www.scte.org/documents/pdf/Standards/ANSI_SCTE%20128-1%202013.pdf -[caption-stream]: /lib/m2ts/caption-stream.js -[transmuxer]: /lib/mp4/transmuxer.js -[mp4-caption-parser]: /lib/mp4/caption-parser.js -[thumbcoil]: http://thumb.co.il/ -[cc-extractor]: https://github.com/CCExtractor/ccextractor diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/diagram.png b/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/diagram.png deleted file mode 100644 index c78f22db5a..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/diagram.png and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/streams.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/streams.md deleted file mode 100644 index 0e4e89e1dd..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/streams.md +++ /dev/null @@ -1,26 +0,0 @@ -# Streams - -mux.js uses a concept of `streams` to allow a flexible architecture to read and manipulate video bitstreams. The `streams` are loosely based on [Node Streams][node-streams] and are meant to be composible into a series of streams: a `pipeline`. - -## Stream API - -Take a look at the base [Stream][stream] to get an idea of the methods and events available. In general, data is `push`ed into a stream and is `flush`ed out of a stream. Streams can be connected by calling `pipe` on the source `Stream` and passing in the destination `Stream`. `data` events correspond to `push`es and `done` events correspond to `flush`es. - -## MP4 Transmuxer - -An example of a `pipeline` is contained in the [MP4 Transmuxer][mp4-transmuxer]. This is a diagram showing the whole pipeline, including the flow of data from beginning to end: - -![mux.js diagram](./diagram.png) - -You can gain a better understanding of what is going on by using our [debug page][debug-demo] and following the bytes through the pipeline: - -```bash -npm start -``` - -and go to `http://localhost:9999/debug/` - -[node-streams]: https://nodejs.org/api/stream.html -[mp4-transmuxer]: ../lib/mp4/transmuxer.js -[stream]: ../lib/utils/stream.js -[debug-demo]: ../debug/index.html diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/test-content.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/test-content.md deleted file mode 100644 index d3016501fa..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/test-content.md +++ /dev/null @@ -1,61 +0,0 @@ -# Creating Test Content - -## Table of Contents - -- [CEA-608 Content](#creating-cea-608-content) - -## Creating CEA-608 Content - -- Use ffmpeg to create an MP4 file to start with: - - `ffmpeg -f lavfi -i testsrc=duration=300:size=1280x720:rate=30 -profile:v baseline -pix_fmt yuv420p output.mp4` (no audio) - - `ffmpeg -f lavfi -i testsrc=duration=300:size=1280x720:rate=30 -profile:v baseline -pix_fmt yuv420p -filter_complex "anoisesrc=d=300" output.mp4` (audio + video) - - This uses ffmpeg's built-in `testsrc` source which generates a test video pattern with a color and timestamp. For this example, we are using a duration of `300` seconds, a size of `1280x720` and a framerate of `30fps`. We also specify extra settings `profile` and `pix_fmt` to force the output to be encoded using `avc1.42C01F`. - -- Create an [srt file][srt] with the captions you would like to see with their timestamps. - -- Use ffmpeg to convert `ouput.mp4` to a flv file: - - `ffmpeg -i output.mp4 -acodec copy -vcodec copy output.flv` - -- Use [libcaption][] to embed the captions into the flv: - - `flv+srt output.flv captions.srt with-captions.flv` - -- Use ffmpeg to convert `with-captions.flv` to mp4 - - `ffmpeg -i with-captions.flv -acodec copy -vcodec copy with-captions.mp4` - -- Use [Bento4][bento4] to convert the file into a FMP4 file: - - `bento4 mp4fragment with-captions.mp4 \ - --verbosity 3 \ - --fragment-duration 4000 \ - --timescale 90000 \ - with-captions-fragment.mf4` - -Then do *either* of the following: - -- Use [Bento4][bento4] to split the file into an init segment and a fmp4 media segments: - - `bento4 mp4split --verbose \ - --init-segment with-captions-init.mp4 \ - --media-segment segs/with-captions-segment-%llu.m4s \ - with-captions-fragment.mf4` - -- Use [Bento4][bento4] to create a DASH manifest: - - `bento4 mp4dash -v \ - --mpd-name=with-captions.mpd \ - --init-segment=with-captions-init.mp4 \ - --subtitles - with-captions-fragment.mf4` - - This will create a DASH MPD and media segments in a new directory called `output`. - - -[srt]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format -[libcaption]: https://github.com/szatmary/libcaption -[bento4]: https://www.bento4.com/documentation/ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/troubleshooting.md b/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/troubleshooting.md deleted file mode 100644 index 3b4a179b62..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/docs/troubleshooting.md +++ /dev/null @@ -1,20 +0,0 @@ -# Troubleshooting Guide - -## Table of Contents -- [608/708 Caption Parsing](caption-parsing) - -## 608/708 Caption Parsing - -**I have a stream with caption data in more than one field, but only captions from one field are being returned** - -You may want to confirm the SEI NAL units are constructed according to the CEA-608 or CEA-708 specification. Specifically: - -- that control codes/commands are doubled -- control codes starting from 0x14, 0x20 and ending with 0x14, 0x2f in field 1 are replaced with 0x15, 0x20 to 0x15, 0x2f when used in field 2 -- control codes starting from 0x1c, 0x20 and ending with 0x1c, 0x2f in field 1 are replaced with 0x1d, 0x20 to 0x1d, 0x2f when used in field 2 - -**I am getting the wrong times for only some captions, other captions are correct** - -If your content includes B-frames, there is an existing [issue](https://github.com/videojs/mux.js/issues/214) to fix this problem. We recommend that you ensure that all the segments in your source start with keyframes, to allow proper caption timing. - -[caption-parsing]: /docs/troubleshooting.md#608/708-caption-parsing diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/index.js deleted file mode 100644 index df0662fa9b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/index.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var aacUtils = require('./utils'); // Constants - - -var _AacStream; -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - - -_AacStream = function AacStream() { - var everything = new Uint8Array(), - timeStamp = 0; - - _AacStream.prototype.init.call(this); - - this.setTimestamp = function (timestamp) { - timeStamp = timestamp; - }; - - this.push = function (bytes) { - var frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) { - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } // check framesize - - - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - - if (byteIndex + frameSize > everything.length) { - break; - } - - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) { - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - - byteIndex++; - } - - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function () { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function () { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -_AacStream.prototype = new Stream(); -module.exports = _AacStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/utils.js deleted file mode 100644 index 2f72b3640a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/aac/utils.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; - -var parseId3TagSize = function parseId3TagSize(header, byteIndex) { - var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0 - - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - - return returnSize + 10; -}; - -var getId3Offset = function getId3Offset(data, offset) { - if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - return getId3Offset(data, offset); -}; // TODO: use vhs-utils - - -var isLikelyAacData = function isLikelyAacData(data) { - var offset = getId3Offset(data, 0); - return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}; // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding - - -var percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}; // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. - - -var parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function parseAdtsSize(header, byteIndex) { - var lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - return highTwo | middle | lowThree; -}; - -var parseType = function parseType(header, byteIndex) { - if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) { - return 'timed-metadata'; - } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) { - return 'audio'; - } - - return null; -}; - -var parseSampleRate = function parseSampleRate(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function parseAacTimestamp(packet) { - var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag - - frameStart = 10; - - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - return null; - } - - frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - return size; - } - - break; - } - } - } - - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/adts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/adts.js deleted file mode 100644 index 271189331d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/adts.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var _AdtsStream; - -var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ - -_AdtsStream = function AdtsStream(handlePartialSegments) { - var buffer, - frameNum = 0; - - _AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function (start, end) { - this.trigger('log', { - level: 'warn', - message: "adts skiping bytes " + start + " to " + end + " in frame " + frameNum + " outside syncword" - }); - }; - - this.push = function (packet) { - var i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - - - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - - - var skip; // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - - while (i + 7 < buffer.length) { - // Look for the start of an ADTS header.. - if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - - - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - - - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - - frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5; - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS / ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - - if (buffer.byteLength - i < frameLength) { - break; - } // Otherwise, deliver the complete AAC frame - - - this.trigger('data', { - pts: packet.pts + frameNum * adtsFrameDuration, - dts: packet.dts + frameNum * adtsFrameDuration, - sampleCount: sampleCount, - audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1, - channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6, - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } // remove processed bytes from the buffer. - - - buffer = buffer.subarray(i); - }; - - this.flush = function () { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function () { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function () { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -_AdtsStream.prototype = new Stream(); -module.exports = _AdtsStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/h264.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/h264.js deleted file mode 100644 index ad473548b4..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/h264.js +++ /dev/null @@ -1,571 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var ExpGolomb = require('../utils/exp-golomb.js'); - -var _H264Stream, _NalByteStream; - -var PROFILES_WITH_OPTIONAL_SPS_DATA; -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ - -_NalByteStream = function NalByteStream() { - var syncPoint = 0, - i, - buffer; - - _NalByteStream.prototype.init.call(this); - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - - - this.push = function (data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - - var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - // advance the sync point to a NAL start, if necessary - - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } // deliver the NAL unit if it isn't empty - - - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } // drop trailing zeroes - - - do { - i++; - } while (buffer[i] !== 1 && i < len); - - syncPoint = i - 2; - i += 3; - break; - - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) { - i += 3; - break; - } // deliver the NAL unit - - - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } // filter out the NAL units that were delivered - - - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function () { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function () { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } // reset the stream state - - - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; -}; - -_NalByteStream.prototype = new Stream(); // values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax - -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true -}; -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ - -_H264Stream = function H264Stream() { - var nalByteStream = new _NalByteStream(), - self, - trackId, - currentPts, - currentDts, - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - _H264Stream.prototype.init.call(this); - - self = this; - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - - this.push = function (packet) { - if (packet.type !== 'video') { - return; - } - - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - nalByteStream.push(packet); - }; - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - - - nalByteStream.on('data', function (data) { - var event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - - default: - break; - } // This triggers data on the H264Stream - - - self.trigger('data', event); - }); - nalByteStream.on('done', function () { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function () { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function () { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function () { - self.trigger('endedtimeline'); - }); - - this.flush = function () { - nalByteStream.flush(); - }; - - this.partialFlush = function () { - nalByteStream.partialFlush(); - }; - - this.reset = function () { - nalByteStream.reset(); - }; - - this.endTimeline = function () { - nalByteStream.endTimeline(); - }; - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - - - skipScalingList = function skipScalingList(count, expGolombDecoder) { - var lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = nextScale === 0 ? lastScale : nextScale; - } - }; - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - - - discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; - }; - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - - - readSequenceParameterSet = function readSequenceParameterSet(data) { - var frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, - profileIdc, - levelIdc, - profileCompatibility, - chromaFormatIdc, - picOrderCntType, - numRefFramesInPicOrderCntCycle, - picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - // some profiles have more optional data we don't need - - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - - if (expGolombDecoder.readBoolean()) { - // seq_scaling_matrix_present_flag - scalingListCount = chromaFormatIdc !== 3 ? 8 : 12; - - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { - // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - - if (expGolombDecoder.readBoolean()) { - // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - - switch (aspectRatioIdc) { - case 1: - sarRatio = [1, 1]; - break; - - case 2: - sarRatio = [12, 11]; - break; - - case 3: - sarRatio = [10, 11]; - break; - - case 4: - sarRatio = [16, 11]; - break; - - case 5: - sarRatio = [40, 33]; - break; - - case 6: - sarRatio = [24, 11]; - break; - - case 7: - sarRatio = [20, 11]; - break; - - case 8: - sarRatio = [32, 11]; - break; - - case 9: - sarRatio = [80, 33]; - break; - - case 10: - sarRatio = [18, 11]; - break; - - case 11: - sarRatio = [15, 11]; - break; - - case 12: - sarRatio = [64, 33]; - break; - - case 13: - sarRatio = [160, 99]; - break; - - case 14: - sarRatio = [4, 3]; - break; - - case 15: - sarRatio = [3, 2]; - break; - - case 16: - sarRatio = [2, 1]; - break; - - case 255: - { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()]; - break; - } - } - - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2, - height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2, - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; -}; - -_H264Stream.prototype = new Stream(); -module.exports = { - H264Stream: _H264Stream, - NalByteStream: _NalByteStream -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/index.js deleted file mode 100644 index 6b93772d8f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/codecs/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/audio-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/audio-properties.js deleted file mode 100644 index d77d0bd3d9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/audio-properties.js +++ /dev/null @@ -1,3 +0,0 @@ -// constants -var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize']; -module.exports = AUDIO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/video-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/video-properties.js deleted file mode 100644 index 9aed7fe338..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/constants/video-properties.js +++ /dev/null @@ -1,2 +0,0 @@ -var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio']; -module.exports = VIDEO_PROPERTIES; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/data/silence.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/data/silence.js deleted file mode 100644 index e74ed24dc0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/data/silence.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; - -var zeroFill = function zeroFill(count) { - var a = []; - - while (count--) { - a.push(0); - } - - return a; -}; - -var makeTable = function makeTable(metaTable) { - return Object.keys(metaTable).reduce(function (obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - -var silence; - -module.exports = function () { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 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]], - 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]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - - return silence; -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/coalesce-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/coalesce-stream.js deleted file mode 100644 index ce63c5d462..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/coalesce-stream.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ - - -var CoalesceStream = function CoalesceStream(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - CoalesceStream.prototype.init.call(this); // Take output from multiple - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); - -CoalesceStream.prototype.flush = function (flushSource) { - var id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; // Emit the final segment - - this.trigger('data', event); - this.trigger('done'); -}; - -module.exports = CoalesceStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-header.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-header.js deleted file mode 100644 index aa8c1898e9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-header.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); // For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array - - -var getFlvHeader = function getFlvHeader(duration, audio, video) { - // :ByteArray { - var headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; // default arguments - - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; // signature - - head.setUint8(0, 0x46); // 'F' - - head.setUint8(1, 0x4c); // 'L' - - head.setUint8(2, 0x56); // 'V' - // version - - head.setUint8(3, 0x01); // flags - - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); // data offset, should be 9 for FLV v1 - - head.setUint32(5, headBytes.byteLength); // init the first FLV tag - - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } // write out the duration metadata tag - - - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - return result; -}; - -module.exports = getFlvHeader; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-tag.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-tag.js deleted file mode 100644 index bb73b25844..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/flv-tag.js +++ /dev/null @@ -1,372 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var _FlvTag; // (type:uint, extraData:Boolean = false) extends ByteArray - - -_FlvTag = function FlvTag(type, extraData) { - var // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, - // :uint - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function prepareWrite(flv, count) { - var bytes, - minLength = flv.position + count; - - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } // allocate a new buffer and copy over the data that will not be modified - - - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - // commonly used metadata properties - widthBytes = _FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = _FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = _FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!_FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - _FlvTag.widthBytes = widthBytes; - _FlvTag.heightBytes = heightBytes; - _FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case _FlvTag.VIDEO_TAG: - this.length = 16; // Start the buffer at 256k - - bufferStartSize *= 6; - break; - - case _FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - - case _FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - // presentation timestamp - - this.pts = 0; // decoder timestamp - - this.dts = 0; // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - - this.writeBytes = function (bytes, offset, length) { - var start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - this.position += length; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeByte(value:int):void - - - this.writeByte = function (byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; // ByteArray#writeShort(value:int):void - - - this.writeShort = function (short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; // Negative index into array - // (pos:uint):int - - - this.negIndex = function (pos) { - return this.bytes[this.length - pos]; - }; // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - - - this.nalUnitSize = function () { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function () { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } // reserve 4 bytes for nal unit size - - - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; // (nal:ByteArray = null):void - - - this.endNalUnit = function (nalContainer) { - var nalStart, // :uint - nalLength; // :uint - // Rewind to the marker and write the size - - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - - - this.writeMetaDataDouble = function (key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); // write size of property name - - this.view.setUint16(this.position, key.length); - this.position += 2; // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - // write property name - - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } // skip null byte - - - this.position++; // write property value - - this.view.setFloat64(this.position, val); - this.position += 8; // update flv tag length - - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // (key:String, val:Boolean):void - - - this.writeMetaDataBoolean = function (key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; // ():ByteArray - - - this.finalize = function () { - var dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case _FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = (this.keyFrame || extraData ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case _FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case _FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - - this.position += 2; // set "onMetaData" - - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - - this.length = this.position; - break; - } - - len = this.length - 11; // write the DataSize field - - this.bytes[1] = (len & 0x00FF0000) >>> 16; - this.bytes[2] = (len & 0x0000FF00) >>> 8; - this.bytes[3] = (len & 0x000000FF) >>> 0; // write the Timestamp - - this.bytes[4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[7] = (this.dts & 0xFF000000) >>> 24; // write the StreamID - - this.bytes[8] = 0; - this.bytes[9] = 0; - this.bytes[10] = 0; // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; // trim down the byte buffer to what is actually being used - - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = _FlvTag.frameTime(this.bytes); // if bytes.bytelength isn't equal to this.length, handle error - - return this; - }; -}; - -_FlvTag.AUDIO_TAG = 0x08; // == 8, :uint - -_FlvTag.VIDEO_TAG = 0x09; // == 9, :uint - -_FlvTag.METADATA_TAG = 0x12; // == 18, :uint -// (tag:ByteArray):Boolean { - -_FlvTag.isAudioFrame = function (tag) { - return _FlvTag.AUDIO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isVideoFrame = function (tag) { - return _FlvTag.VIDEO_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isMetaData = function (tag) { - return _FlvTag.METADATA_TAG === tag[0]; -}; // (tag:ByteArray):Boolean { - - -_FlvTag.isKeyFrame = function (tag) { - if (_FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (_FlvTag.isAudioFrame(tag)) { - return true; - } - - if (_FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; // (tag:ByteArray):uint { - - -_FlvTag.frameTime = function (tag) { - var pts = tag[4] << 16; // :uint - - pts |= tag[5] << 8; - pts |= tag[6] << 0; - pts |= tag[7] << 24; - return pts; -}; - -module.exports = _FlvTag; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/index.js deleted file mode 100644 index b0fff3ec2d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/tag-list.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/tag-list.js deleted file mode 100644 index 2b0785c496..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/tag-list.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function TagList() { - var self = this; - this.list = []; - - this.push = function (tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function get() { - return self.list.length; - } - }); -}; - -module.exports = TagList; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/transmuxer.js deleted file mode 100644 index f1268fa7c2..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/flv/transmuxer.js +++ /dev/null @@ -1,425 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var FlvTag = require('./flv-tag.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var CoalesceStream = require('./coalesce-stream.js'); - -var TagList = require('./tag-list.js'); - -var _Transmuxer, _VideoSegmentStream, _AudioSegmentStream, collectTimelineInfo, metaDataTag, extraDataTag; -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -collectTimelineInfo = function collectTimelineInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function metaDataTag(track, pts) { - var tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - return tag; -}; - -extraDataTag = function extraDataTag(track, pts) { - var i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - tag.dts = pts; - tag.pts = pts; - tag.writeByte(0x01); // version - - tag.writeByte(track.profileIdc); // profile - - tag.writeByte(track.profileCompatibility); // compatibility - - tag.writeByte(track.levelIdc); // level - - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - - tag.writeShort(track.sps[0].length); // data of SPS - - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track) { - var adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = track.audioobjecttype << 11 | track.samplingfrequencyindex << 7 | track.channelcount << 3; - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer audio data until end() is called - - adtsFrames.push(data); - }; - - this.flush = function () { - var currentFrame, - adtsFrame, - lastMetaPts, - tags = new TagList(); // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); // write out a metadata frame at every video key frame - - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - - - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - adtsFrame.writeBytes(currentFrame.data); - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', { - track: track, - tags: tags.list - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function (tags, pts) { - var adtsFrame; - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; // AAC is always 10 - - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); // Is AAC always 16 bit? - - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - tags.push(adtsFrame.finalize()); - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - - adtsFrame.pts = pts; - adtsFrame.dts = pts; - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function (pts) { - videoKeyFrames.push(pts); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ - -_VideoSegmentStream = function VideoSegmentStream(track) { - var nalUnits = [], - config, - h264Frame; - - _VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function (tags, frame) { - if (!frame) { - return; - } // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - - - if (config && track && track.newMetadata && (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - metaTag.metaDataTag = extraTag.metaDataTag = true; - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function (data) { - collectTimelineInfo(track, data); - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); // buffer video until flush() is called - - nalUnits.push(data); - }; - - this.flush = function () { - var currentNal, - tags = new TagList(); // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); // record the track config - - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - - h264Frame.endNalUnit(); - } - - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', { - track: track, - tags: tags.list - }); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ - -_Transmuxer = function Transmuxer(options) { - var self = this, - packetStream, - parseStream, - elementaryStream, - videoTimestampRolloverStream, - audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, - h264Stream, - videoSegmentStream, - audioSegmentStream, - captionStream, - coalesceStream; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; // expose the metadata stream - - this.metadataStream = new m2ts.MetadataStream(); - options.metadataStream = this.metadataStream; // set up the parsing pipeline - - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); // disassemble MPEG2-TS packets into elementary streams - - packetStream.pipe(parseStream).pipe(elementaryStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream); - elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream); - elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream); // if CEA-708 parsing is available, hook up a caption stream - - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream).pipe(coalesceStream); // hook up the segment streams once track metadata is delivered - - elementaryStream.on('data', function (data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new _VideoSegmentStream(videoTrack); // Set up the final part of the video pipeline - - h264Stream.pipe(videoSegmentStream).pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new _AudioSegmentStream(audioTrack); // Set up the final part of the audio pipeline - - adtsStream.pipe(audioSegmentStream).pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); // feed incoming data to the front of the parsing pipeline - - this.push = function (data) { - packetStream.push(data); - }; // flush any buffered data - - - this.flush = function () { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - captionStream.reset(); - }; // Re-emit any data coming from the coalesce stream to the outside world - - - coalesceStream.on('data', function (event) { - self.trigger('data', event); - }); // Let the consumer know we have finished flushing the entire pipeline - - coalesceStream.on('done', function () { - self.trigger('done'); - }); -}; - -_Transmuxer.prototype = new Stream(); // forward compatibility - -module.exports = _Transmuxer; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/index.js deleted file mode 100644 index 97dc1ba77c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; // include all the tools when the full library is required - -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); -module.exports = muxjs; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/caption-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/caption-stream.js deleted file mode 100644 index 12e1827951..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/caption-stream.js +++ /dev/null @@ -1,1939 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); - -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function CaptionStream(options) { - options = options || {}; - CaptionStream.prototype.init.call(this); // parse708captions flag, default to true - - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true; - this.captionPackets_ = []; - this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({ - captionServices: options.captionServices - }); // eslint-disable-line no-use-before-define - } - - this.reset(); // forward data and done events from CCs to this CaptionStream - - this.ccStreams_.forEach(function (cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } -}; - -CaptionStream.prototype = new Stream(); - -CaptionStream.prototype.push = function (event) { - var sei, userData, newCaptionPackets; // only examine SEI NALs - - if (event.nalUnitType !== 'sei_rbsp') { - return; - } // parse the sei - - - sei = cea708Parser.parseSei(event.escapedRBSP); // no payload data, skip - - if (!sei.payload) { - return; - } // ignore everything but user_data_registered_itu_t_t35 - - - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } // parse out the user data payload - - - userData = cea708Parser.parseUserData(sei); // ignore unrecognized userData - - if (!userData) { - return; - } // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - - - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) { - this.numSameDts_--; - - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - - return; - } // parse out CC data packets and save them for later - - - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function (flushType) { - this.ccStreams_.forEach(function (cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function (flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - - - this.captionPackets_.forEach(function (elem, idx) { - elem.presortIndex = idx; - }); // sort caption byte-pairs based on their PTS values - - this.captionPackets_.sort(function (a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - - return a.pts - b.pts; - }); - this.captionPackets_.forEach(function (packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function () { - return this.flushStream('flush'); -}; // Only called if handling partial data - - -CaptionStream.prototype.partialFlush = function () { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function () { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function (ccStream) { - ccStream.reset(); - }); -}; // From the CEA-608 spec: - -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. - - -CaptionStream.prototype.dispatchCea608Packet = function (packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1000; -}; - -CaptionStream.prototype.setsChannel2Active = function (packet) { - return (packet.ccData & 0x7800) === 0x1800; -}; - -CaptionStream.prototype.setsTextOrXDSActive = function (packet) { - return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a; -}; - -CaptionStream.prototype.dispatchCea708Packet = function (packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; // ---------------------- -// Session to Application -// ---------------------- -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. - - -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, - // ♪ - 0x1020: 0x20, - // Transparent Space - 0x1021: 0xa0, - // Nob-breaking Transparent Space - 0x1025: 0x2026, - // … - 0x102a: 0x0160, - // Š - 0x102c: 0x0152, - // Œ - 0x1030: 0x2588, - // █ - 0x1031: 0x2018, - // ‘ - 0x1032: 0x2019, - // ’ - 0x1033: 0x201c, - // “ - 0x1034: 0x201d, - // ” - 0x1035: 0x2022, - // • - 0x1039: 0x2122, - // ™ - 0x103a: 0x0161, - // š - 0x103c: 0x0153, - // œ - 0x103d: 0x2120, - // ℠ - 0x103f: 0x0178, - // Ÿ - 0x1076: 0x215b, - // ⅛ - 0x1077: 0x215c, - // ⅜ - 0x1078: 0x215d, - // ⅝ - 0x1079: 0x215e, - // ⅞ - 0x107a: 0x23d0, - // ⏐ - 0x107b: 0x23a4, - // ⎤ - 0x107c: 0x23a3, - // ⎣ - 0x107d: 0x23af, - // ⎯ - 0x107e: 0x23a6, - // ⎦ - 0x107f: 0x23a1, - // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) - -}; - -var get708CharFromCode = function get708CharFromCode(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if (code & 0x1000 && code === newCode) { - // Invalid extended code - return ''; - } - - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function within708TextBlock(b) { - return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff; -}; - -var Cea708Window = function Cea708Window(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function () { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; // These default values are arbitrary, - // defineWindow will usually override them - - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function () { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function () { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function (pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } // Show all virtual rows since there's no visible scrolling - - - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function () { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function (text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function () { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function Cea708Service(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided - - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } -}; -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ - - -Cea708Service.prototype.init = function (pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ - - -Cea708Service.prototype.setCurrentWindow = function (windowNum) { - this.currentWindow = this.windows[windowNum]; -}; -/** - * Try to create a TextDecoder if it is natively supported - */ - - -Cea708Service.prototype.createTextDecoder = function (encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } -}; - -var Cea708Stream = function Cea708Stream(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; // Get service encodings from captionServices option block - - Object.keys(captionServices).forEach(function (serviceName) { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function (packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; - -Cea708Stream.prototype = new Stream(); -/** - * Push current 708 packet, create new 708 packet. - */ - -Cea708Stream.prototype.new708Packet = function () { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; -/** - * Add pts and both bytes from packet into current 708 packet. - */ - - -Cea708Stream.prototype.add708Bytes = function (packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; -/** - * Parse completed 708 packet into service blocks and push each service block. - */ - - -Cea708Stream.prototype.push708Packet = function () { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ - - -Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) {// DLC: Delay cancel, nothing to do - } else if (b === 0x03) {// ETX: End Text, don't need to do anything - } else if (b === 0x00) {// Padding - } else {// Unknown command - } - } -}; -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.extendedCommands = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service, { - isExtended: true - }); - } else {// Unknown command - } - - return i; -}; -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ - - -Cea708Stream.prototype.getPts = function (byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ - - -Cea708Stream.prototype.initService = function (serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function (pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - return this.services[serviceNum]; -}; -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.handleText = function (i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; // Use the TextDecoder if one was created for this service - - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - return i; -}; -/** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, { - isMultiByte: true - }); - } else {// Unknown command - } - - return i; -}; -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setCurrentWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - return i; -}; -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.defineWindow = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - - win.rowLock = (b & 0x10) >> 4; // rl - - win.columnLock = (b & 0x08) >> 3; // cl - - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - - win.penStyle = b & 0x07; // ps - // The spec says there are (rowCount+1) "virtual rows" - - win.virtualRowCount = win.rowCount + 1; - return i; -}; -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setWindowAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - - winAttr.fillRed = (b & 0x30) >> 4; // fr - - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - - winAttr.borderRed = (b & 0x30) >> 4; // br - - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - - winAttr.wordWrap = (b & 0x40) >> 6; // ww - - winAttr.printDirection = (b & 0x30) >> 4; // pd - - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - - winAttr.displayEffect = b & 0x03; // de - - return i; -}; -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.flushDisplayed = function (pts, service) { - var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - service.startPts = pts; -}; -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ - - -Cea708Stream.prototype.pushCaption = function (service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - service.text = ''; - service.startPts = service.endPts; - } -}; -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.displayWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 1; - } - } - - return i; -}; -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.hideWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible = 0; - } - } - - return i; -}; -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.toggleWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.clearWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].clearText(); - } - } - - return i; -}; -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.deleteWindows = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & 0x01 << winId) { - service.windows[winId].reset(); - } - } - - return i; -}; -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenAttributes = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - - penAttr.offset = (b & 0x0c) >> 2; // o - - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - - penAttr.underline = (b & 0x40) >> 6; // u - - penAttr.edgeType = (b & 0x38) >> 3; // et - - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenColor = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - - penColor.fgRed = (b & 0x30) >> 4; // fr - - penColor.fgGreen = (b & 0x0c) >> 2; // fg - - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - - penColor.bgRed = (b & 0x30) >> 4; // br - - penColor.bgGreen = (b & 0x0c) >> 2; // bg - - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ - - -Cea708Stream.prototype.setPenLocation = function (i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - - service.currentWindow.pendingNewLine = true; - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ - - -Cea708Stream.prototype.reset = function (i, service) { - var pts = this.getPts(i); - this.flushDisplayed(pts, service); - return this.initService(service.serviceNum, i); -}; // This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. - - -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, - // á - 0x5c: 0xe9, - // é - 0x5e: 0xed, - // í - 0x5f: 0xf3, - // ó - 0x60: 0xfa, - // ú - 0x7b: 0xe7, - // ç - 0x7c: 0xf7, - // ÷ - 0x7d: 0xd1, - // Ñ - 0x7e: 0xf1, - // ñ - 0x7f: 0x2588, - // █ - 0x0130: 0xae, - // ® - 0x0131: 0xb0, - // ° - 0x0132: 0xbd, - // ½ - 0x0133: 0xbf, - // ¿ - 0x0134: 0x2122, - // ™ - 0x0135: 0xa2, - // ¢ - 0x0136: 0xa3, - // £ - 0x0137: 0x266a, - // ♪ - 0x0138: 0xe0, - // à - 0x0139: 0xa0, - // - 0x013a: 0xe8, - // è - 0x013b: 0xe2, - // â - 0x013c: 0xea, - // ê - 0x013d: 0xee, - // î - 0x013e: 0xf4, - // ô - 0x013f: 0xfb, - // û - 0x0220: 0xc1, - // Á - 0x0221: 0xc9, - // É - 0x0222: 0xd3, - // Ó - 0x0223: 0xda, - // Ú - 0x0224: 0xdc, - // Ü - 0x0225: 0xfc, - // ü - 0x0226: 0x2018, - // ‘ - 0x0227: 0xa1, - // ¡ - 0x0228: 0x2a, - // * - 0x0229: 0x27, - // ' - 0x022a: 0x2014, - // — - 0x022b: 0xa9, - // © - 0x022c: 0x2120, - // ℠ - 0x022d: 0x2022, - // • - 0x022e: 0x201c, - // “ - 0x022f: 0x201d, - // ” - 0x0230: 0xc0, - // À - 0x0231: 0xc2, - //  - 0x0232: 0xc7, - // Ç - 0x0233: 0xc8, - // È - 0x0234: 0xca, - // Ê - 0x0235: 0xcb, - // Ë - 0x0236: 0xeb, - // ë - 0x0237: 0xce, - // Î - 0x0238: 0xcf, - // Ï - 0x0239: 0xef, - // ï - 0x023a: 0xd4, - // Ô - 0x023b: 0xd9, - // Ù - 0x023c: 0xf9, - // ù - 0x023d: 0xdb, - // Û - 0x023e: 0xab, - // « - 0x023f: 0xbb, - // » - 0x0320: 0xc3, - // à - 0x0321: 0xe3, - // ã - 0x0322: 0xcd, - // Í - 0x0323: 0xcc, - // Ì - 0x0324: 0xec, - // ì - 0x0325: 0xd2, - // Ò - 0x0326: 0xf2, - // ò - 0x0327: 0xd5, - // Õ - 0x0328: 0xf5, - // õ - 0x0329: 0x7b, - // { - 0x032a: 0x7d, - // } - 0x032b: 0x5c, - // \ - 0x032c: 0x5e, - // ^ - 0x032d: 0x5f, - // _ - 0x032e: 0x7c, - // | - 0x032f: 0x7e, - // ~ - 0x0330: 0xc4, - // Ä - 0x0331: 0xe4, - // ä - 0x0332: 0xd6, - // Ö - 0x0333: 0xf6, - // ö - 0x0334: 0xdf, - // ß - 0x0335: 0xa5, - // ¥ - 0x0336: 0xa4, - // ¤ - 0x0337: 0x2502, - // │ - 0x0338: 0xc5, - // Å - 0x0339: 0xe5, - // å - 0x033a: 0xd8, - // Ø - 0x033b: 0xf8, - // ø - 0x033c: 0x250c, - // ┌ - 0x033d: 0x2510, - // ┐ - 0x033e: 0x2514, - // └ - 0x033f: 0x2518 // ┘ - -}; - -var getCharFromCode = function getCharFromCode(code) { - if (code === null) { - return ''; - } - - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; // the index of the last row in a CEA-608 display buffer - - -var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. - -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. -// We keep track of positioning information as we go by storing the -// number of indentations and the tab offset in this buffer. - -var createDisplayBuffer = function createDisplayBuffer() { - var result = [], - i = BOTTOM_ROW + 1; - - while (i--) { - result.push({ - text: '', - indent: 0, - offset: 0 - }); - } - - return result; -}; - -var Cea608Stream = function Cea608Stream(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1); - this.setConstants(); - this.reset(); - - this.push = function (packet) { - var data, swap, char0, char1, text; // remove the parity bits - - data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice - - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } // Store control codes - - - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now - - this.flushDisplayed(packet.pts); // flip memory - - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; // start measuring the time to display the caption - - this.startPts_ = packet.pts; - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - - - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } // Detect offset control codes and adjust cursor - - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - - this.nonDisplayed_[this.row_].offset = offset; - this.column_ += offset; // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode - - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - - - if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - var indentations = (data & 0xe) >> 1; - this.column_ = indentations * 4; // add to the number of indentations for positioning - - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } // We have a normal character in char0, and possibly one in char1 - - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - } // finish data processing - - }; -}; - -Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the current state of the -// display buffer - -Cea608Stream.prototype.flushDisplayed = function (pts) { - var _this = this; - - var logWarning = function logWarning(index) { - _this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - - var content = []; - this.displayed_.forEach(function (row, i) { - if (row && row.text && row.text.length) { - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - - - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 - }); - } - } else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content: content, - stream: this.name_ - }); - } -}; -/** - * Zero out the data, used for startup and on seek - */ - - -Cea608Stream.prototype.reset = function () { - this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing - - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; // This variable holds currently-applied formatting - - this.formatting_ = []; -}; -/** - * Sets up control code and related constants for this instance - */ - - -Cea608Stream.prototype.setConstants = function () { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - - - this.PADDING_ = 0x0000; // Pop-on Mode - - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode - - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode - - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure - - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ - - -Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ - - -Cea608Stream.prototype.isExtCharacter = function (char0, char1) { - return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f; -}; -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ - - -Cea608Stream.prototype.isMidRowCode = function (char0, char1) { - return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f; -}; -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ - - -Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) { - return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23; -}; -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ - - -Cea608Stream.prototype.isPAC = function (char0, char1) { - return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f; -}; -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ - - -Cea608Stream.prototype.isColorPAC = function (char1) { - return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f; -}; -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ - - -Cea608Stream.prototype.isNormalChar = function (char) { - return char >= 0x20 && char <= 0x7f; -}; -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ - - -Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up - - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { - text: '', - indent: 0, - offset: 0 - }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; // Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing - - -Cea608Stream.prototype.addFormatting = function (pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function (text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; // Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting - - -Cea608Stream.prototype.clearFormatting = function (pts) { - if (!this.formatting_.length) { - return; - } - - var text = this.formatting_.reverse().reduce(function (text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; // Mode Implementations - - -Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters - - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; -}; - -Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; -}; - -Cea608Stream.prototype.shiftRowsUp_ = function () { - var i; // clear out inactive rows - - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } - - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { - text: '', - indent: 0, - offset: 0 - }; - } // shift displayed rows up - - - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } // clear out the bottom row - - - this.displayed_[this.row_] = { - text: '', - indent: 0, - offset: 0 - }; -}; - -Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_].text; - baseRow += text; - this.displayed_[this.row_].text = baseRow; -}; // exports - - -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/index.js deleted file mode 100644 index bff191ad38..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/m2ts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/m2ts.js deleted file mode 100644 index 838922f70f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/m2ts.js +++ /dev/null @@ -1,572 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; // object types - - -var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants - - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ - -_TransportPacketStream = function TransportPacketStream() { - var buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - - - this.push = function (bytes) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } // While we have enough data for a packet - - - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - - - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - - - this.flush = function () { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function () { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; - -_TransportPacketStream.prototype = new Stream(); -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ - -_TransportParseStream = function TransportParseStream() { - var parsePsi, parsePat, parsePmt, self; - - _TransportParseStream.prototype.init.call(this); - - self = this; - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function parsePsi(payload, psi) { - var offset = 0; // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function parsePat(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - // skip the PSI header and parse the first PMT entry - - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - - - parsePmt = function parsePmt(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - if (!(payload[5] & 0x01)) { - return; - } // overwrite any existing program map table - - - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; // the mapping table ends at the end of the current section - - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table - - offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - - if (streamType === StreamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } // move to the next table entry - // skip past the elementary stream descriptors, if present - - - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } // record the map on the packet as well - - - pmt.programMapTable = self.programMapTable; - }; - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - - - this.push = function (packet) { - var result = {}, - offset = 4; - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1] - - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[offset] + 1; - } // parse the rest of the packet based on the type - - - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now - - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function (packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; - -_TransportParseStream.prototype = new Stream(); -_TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ - -_ElementaryStream = function ElementaryStream() { - var self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function parsePes(payload, pes) { - var ptsDtsFlags; - var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array - - pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - - if (startPrefix !== 1) { - return; - } // get the packet length, this will be 0 for video - - - pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe - - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - - - pes.data = payload.subarray(9 + payload[8]); - }, - - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function flushStream(stream, type, forceFlush) { - var packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; // do nothing if there is not enough buffered data for a complete - // PES header - - if (!stream.data.length || stream.size < 9) { - return; - } - - event.trackId = stream.data[0].pid; // reassemble the packet - - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } // parse assembled packet's PES header - - - parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - - packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right - - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - - - if (packetFlushable) { - self.trigger('data', event); - } - }; - - _ElementaryStream.prototype.init.call(this); - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - - - this.push = function (data) { - ({ - pat: function pat() {// we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function pes() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - - default: - // ignore unknown stream types - return; - } // if a new packet is starting, we can flush the completed - // packet - - - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } // buffer this fragment until we are sure we've received the - // complete payload - - - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function pmt() { - var event = { - type: 'metadata', - tracks: [] - }; - programMapTable = data.programMapTable; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function () { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - - - this.flushStreams_ = function () { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function () { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var pmt = { - type: 'metadata', - tracks: [] - }; // translate audio and video streams to tracks - - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; -}; - -_ElementaryStream.prototype = new Stream(); -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: _TransportPacketStream, - TransportParseStream: _TransportParseStream, - ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/metadata-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/metadata-stream.js deleted file mode 100644 index 269de00367..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/metadata-stream.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - id3 = require('../tools/parse-id3'), - _MetadataStream; - -_MetadataStream = function MetadataStream(options) { - var settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - - - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function (chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - - if (chunk.type !== 'timed-metadata') { - return; - } // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - - - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } // ignore events that don't look like ID3 data - - - if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } // add this chunk to the data we've collected so far - - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header - - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; - } // if the entire frame has not arrived, wait for more data - - - if (bufferSize < tagSize) { - return; - } // collect the entire frame so it can be parsed - - - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } // find the start of the first frame and the end of the tag - - - frameStart = 10; - - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end - - tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - - break; - } - - frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]); - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (id3.frameParsers[frame.id]) { - // use frame specific parser - id3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - id3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - id3.frameParsers['W*'](frame); - } // handle the special PRIV frame used to indicate the start - // time for raw AAC data - - - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.data, - size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - this.trigger('data', tag); - }; -}; - -_MetadataStream.prototype = new Stream(); -module.exports = _MetadataStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/probe.js deleted file mode 100644 index 739a0a7097..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/probe.js +++ /dev/null @@ -1,299 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function parsePid(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function parseAdaptionField(packet) { - var offset = 0; // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - - if ((packet[3] & 0x30) >>> 4 > 0x01) { - offset += packet[4] + 1; - } - - return offset; -}; - -var parseType = function parseType(packet, pmtPid) { - var pid = parsePid(packet); - - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - - return null; -}; - -var parsePat = function parsePat(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function parsePmt(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - - - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section - - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how - // long the program info descriptors are - - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table - - var offset = 12 + programInfoLength; - - while (offset < tableEnd) { - var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type - - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry - // skip past the elementary stream descriptors, if present - - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - - return programMapTable; -}; - -var parsePesType = function parsePesType(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - - default: - return null; - } -}; - -var parsePesTime = function parsePesTime(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - - ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - - if (ptsDtsFlags & 0xC0) { - pes = {}; // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - - pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - - pes.dts = pes.pts; - - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - - return pes; -}; - -var parseNalUnitType = function parseNalUnitType(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - - case 0x06: - return 'sei_rbsp'; - - case 0x07: - return 'seq_parameter_set_rbsp'; - - case 0x08: - return 'pic_parameter_set_rbsp'; - - case 0x09: - return 'access_unit_delimiter_rbsp'; - - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; // advance the sync point to a NAL start, if necessary - - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } // drop trailing zeroes - - - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - - frameSyncPoint = frameI - 2; - frameI += 3; - break; - - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; // parse the final nal - - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/stream-types.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/stream-types.js deleted file mode 100644 index 9ecf7ad526..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index 852f6a7905..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; -var RO_THRESH = 4294967296; -var TYPE_SHARED = 'shared'; - -var handleRollover = function handleRollover(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - - - while (Math.abs(reference - value) > RO_THRESH) { - value += direction * MAX_TS; - } - - return value; -}; - -var TimestampRolloverStream = function TimestampRolloverStream(type) { - var lastDTS, referenceDTS; - TimestampRolloverStream.prototype.init.call(this); // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - - this.type_ = type || TYPE_SHARED; - - this.push = function (data) { - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - lastDTS = data.dts; - this.trigger('data', data); - }; - - this.flush = function () { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function () { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function () { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/audio-frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/audio-frame-utils.js deleted file mode 100644 index 8dd7e12d21..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/audio-frame-utils.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); - -var clock = require('../utils/clock'); -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ - - -var sumFrameByteLengths = function sumFrameByteLengths(array) { - var i, - currentObj, - sum = 0; // sum the byteLength's all each nal unit in the frame - - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; // Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer - - -var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills - - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap - - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - - - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - return audioFillDuration; -}; // If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track - - -var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } // We will need to recalculate the earliest segment Dts - - - track.minSegmentDts = Infinity; - return adtsFrames.filter(function (currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } // Otherwise, discard it - - - return false; - }); -}; // generate the track's raw mdat data from an array of frames - - -var generateSampleTable = function generateSampleTable(frames) { - var i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - - }); - } - - return samples; -}; // generate the track's sample table from an array of frames - - -var concatenateFrameData = function concatenateFrameData(frames) { - var i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/caption-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/caption-parser.js deleted file mode 100644 index 1bd65a4df3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/caption-parser.js +++ /dev/null @@ -1,490 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; - -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; - -var findBox = require('../mp4/find-box.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var window = require('global/window'); -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var mapToSample = function mapToSample(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ - - -var findSeiNals = function findSeiNals(avcStream, samples, trackId) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = { - logs: [], - seiNals: [] - }, - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // Bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - result.logs.push({ - level: 'warn', - message: 'We\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.' - }); - break; - } - - result.seiNals.push(seiNal); - break; - - default: - break; - } - } - - return result; -}; -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ - - -var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - truns.forEach(function (trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - samples.forEach(function (sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - - sample.trackId = trackId; - sample.dts = currentDts; - - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - if (typeof currentDts === 'bigint') { - sample.pts = currentDts + window.BigInt(sample.compositionTimeOffset); - currentDts += window.BigInt(sample.duration); - } else { - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - } - }); - allSamples = allSamples.concat(samples); - }); - return allSamples; -}; -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ - - -var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); // To get SEI NAL units - - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs - - mdats.forEach(function (mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - mdatTrafPairs.forEach(function (pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); // Exactly 1 tfhd per traf - - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); // Either 0 or 1 tfdt per traf - - var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var result; // Only parse video data for the chosen video track - - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - result = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = { - seiNals: [], - logs: [] - }; - } - - captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals); - captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs); - } - }); - return captionNals; -}; -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {Object[]} parsedCaptions[].content - A list of individual caption segments - * @return {String} parsedCaptions[].content.text - The visible content of the caption segment - * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment - * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 - **/ - - -var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) { - var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - - if (trackId === null) { - return null; - } - - captionNals = parseCaptionNals(segment, trackId); - var trackNals = captionNals[trackId] || {}; - return { - seiNals: trackNals.seiNals, - logs: trackNals.logs, - timescale: timescale - }; -}; -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ - - -var CaptionParser = function CaptionParser() { - var isInitialized = false; - var captionStream; // Stores segments seen before trackId and timescale are set - - var segmentCache; // Stores video track ID of the track being parsed - - var trackId; // Stores the timescale of the track being parsed - - var timescale; // Stores captions parsed so far - - var parsedCaptions; // Stores whether we are receiving partial data or not - - var parsingPartial; - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - - this.isInitialized = function () { - return isInitialized; - }; - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - - - this.init = function (options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; // Collect dispatched captions - - captionStream.on('data', function (event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - captionStream.on('log', function (log) { - parsedCaptions.logs.push(log); - }); - }; - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - - - this.isNewInit = function (videoTrackIds, timescales) { - if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) { - return false; - } - - return trackId !== videoTrackIds[0] || timescale !== timescales[trackId]; - }; - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - - - this.parse = function (segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } // Now that a timescale and trackId is set, parse cached segments - - - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData && parsedData.logs) { - parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs); - } - - if (parsedData === null || !parsedData.seiNals) { - if (parsedCaptions.logs.length) { - return { - logs: parsedCaptions.logs, - captions: [], - captionStreams: [] - }; - } - - return null; - } - - this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched - - this.flushStream(); - return parsedCaptions; - }; - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - - - this.pushNals = function (nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function (nal) { - captionStream.push(nal); - }); - }; - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - - - this.flushStream = function () { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - /** - * Reset caption buckets for new data - **/ - - - this.clearParsedCaptions = function () { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - parsedCaptions.logs = []; - }; - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - - - this.resetCaptionStream = function () { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - - - this.clearAllCaptions = function () { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - /** - * Reset caption parser - **/ - - - this.reset = function () { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {}, - logs: [] - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/emsg.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/emsg.js deleted file mode 100644 index 49a276c39b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/emsg.js +++ /dev/null @@ -1,103 +0,0 @@ -var uint8ToCString = require('../utils/string.js').uint8ToCString; - -var getUint64 = require('../utils/numbers.js').getUint64; -/** - * Based on: ISO/IEC 23009 Section: 5.10.3.3 - * References: - * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format - * https://aomediacodec.github.io/id3-emsg/ - * - * Takes emsg box data as a uint8 array and returns a emsg box object - * @param {UInt8Array} boxData data from emsg box - * @returns A parsed emsg box object - */ - - -var parseEmsgBox = function parseEmsgBox(boxData) { - // version + flags - var offset = 4; - var version = boxData[0]; - var scheme_id_uri, value, timescale, presentation_time, presentation_time_delta, event_duration, id, message_data; - - if (version === 0) { - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time_delta = dv.getUint32(offset); - offset += 4; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - } else if (version === 1) { - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time = getUint64(boxData.subarray(offset)); - offset += 8; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - } - - message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength)); - var emsgBox = { - scheme_id_uri: scheme_id_uri, - value: value, - // if timescale is undefined or 0 set to 1 - timescale: timescale ? timescale : 1, - presentation_time: presentation_time, - presentation_time_delta: presentation_time_delta, - event_duration: event_duration, - id: id, - message_data: message_data - }; - return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined; -}; -/** - * Scales a presentation time or time delta with an offset with a provided timescale - * @param {number} presentationTime - * @param {number} timescale - * @param {number} timeDelta - * @param {number} offset - * @returns the scaled time as a number - */ - - -var scaleTime = function scaleTime(presentationTime, timescale, timeDelta, offset) { - return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale; -}; -/** - * Checks the emsg box data for validity based on the version - * @param {number} version of the emsg box to validate - * @param {Object} emsg the emsg data to validate - * @returns if the box is valid as a boolean - */ - - -var isValidEmsgBox = function isValidEmsgBox(version, emsg) { - var hasScheme = emsg.scheme_id_uri !== '\0'; - var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme; - var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; // Only valid versions of emsg are 0 and 1 - - return !(version > 1) && isValidV0Box || isValidV1Box; -}; // Utility function to check if an object is defined - - -var isDefined = function isDefined(data) { - return data !== undefined || data !== null; -}; - -module.exports = { - parseEmsgBox: parseEmsgBox, - scaleTime: scaleTime -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/find-box.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/find-box.js deleted file mode 100644 index 4d9b2515b3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/find-box.js +++ /dev/null @@ -1,45 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; - -var parseType = require('./parse-type.js'); - -var findBox = function findBox(data, path) { - var results = [], - i, - size, - type, - end, - subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - - if (subresults.length) { - results = results.concat(subresults); - } - } - } - - i = end; - } // we've finished searching all of data - - - return results; -}; - -module.exports = findBox; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/frame-utils.js deleted file mode 100644 index 3384c14393..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/frame-utils.js +++ /dev/null @@ -1,302 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) { - var i, - currentNal, - currentFrame = [], - frames = []; // TODO added for LHLS, make sure this is OK - - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; // Split on 'aud'-type nal units - - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - - - if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } // Push the final frame - // TODO added for LHLS, make sure this is OK - - - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - return frames; -}; // Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. - - -var groupFramesIntoGops = function groupFramesIntoGops(frames) { - var i, - currentFrame, - currentGop = [], - gops = []; // We must pre-set some of the values on the Gop since we - // keep running totals of these values - - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; // store some metadata about all the Gops - - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; // push the final Gop - - gops.push(currentGop); - return gops; -}; -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ - - -var extendFirstKeyFrame = function extendFirstKeyFrame(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ - - -var createDefaultSample = function createDefaultSample() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ - - -var sampleForFrame = function sampleForFrame(frame, dataOffset) { - var sample = createDefaultSample(); - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; // generate the track's sample table from an array of gops - - -var generateSampleTable = function generateSampleTable(gops, baseDataOffset) { - var h, - i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - sample = sampleForFrame(currentFrame, dataOffset); - dataOffset += sample.size; - samples.push(sample); - } - } - - return samples; -}; // generate the track's raw mdat data from an array of gops - - -var concatenateNalData = function concatenateNalData(gops) { - var h, - i, - j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each Gop.. - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; // For each Frame.. - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; // For each NAL.. - - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - - return data; -}; // generate the track's sample table from a frame - - -var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) { - var sample, - dataOffset = baseDataOffset || 0, - samples = []; - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - return samples; -}; // generate the track's raw mdat data from a frame - - -var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) { - var i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); // For each NAL.. - - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/index.js deleted file mode 100644 index 0f771f0541..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/mp4-generator.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/mp4-generator.js deleted file mode 100644 index a7f6349e29..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/mp4-generator.js +++ /dev/null @@ -1,611 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var MAX_UINT32 = require('../utils/numbers.js').MAX_UINT32; - -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants - -(function () { - var i; - types = { - avc1: [], - // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], - // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)]; - } - } - - MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]); - AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor - ]); -})(); - -box = function box(type) { - var payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; // calculate the total size we need to allocate - - while (i--) { - size += payload[i].byteLength; - } - - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); // copy the payload into the result - - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - - return result; -}; - -dinf = function dinf() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function esds(track) { - return box(types.esds, new Uint8Array([0x00, // version - 0x00, 0x00, 0x00, // flags - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function ftyp() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function hdlr(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; - -mdat = function mdat(data) { - return box(types.mdat, data); -}; - -mdhd = function mdhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00]); // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - - if (track.samplerate) { - result[12] = track.samplerate >>> 24 & 0xFF; - result[13] = track.samplerate >>> 16 & 0xFF; - result[14] = track.samplerate >>> 8 & 0xFF; - result[15] = track.samplerate & 0xFF; - } - - return box(types.mdhd, result); -}; - -mdia = function mdia(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; - -mfhd = function mfhd(sequenceNumber) { - return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number - ])); -}; - -minf = function minf(track) { - return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track)); -}; - -moof = function moof(sequenceNumber, tracks) { - var trackFragments = [], - i = tracks.length; // build traf boxes for each track fragment - - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - - return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ - - -moov = function moov(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; - -mvex = function mvex(tracks) { - var i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - - return box.apply(null, [types.mvex].concat(boxes)); -}; - -mvhd = function mvhd(duration) { - var bytes = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function sdtp(track) { - var samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; // leave the full box header (4 bytes) all zero - // write the sample table - - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy; - } - - return box(types.sdtp, bytes); -}; - -stbl = function stbl(track) { - return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO)); -}; - -(function () { - var videoSample, audioSample; - - stsd = function stsd(track) { - return box(types.stsd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function videoSample(track) { - var sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; // assemble the SPSs - - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength - - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } // assemble the PPSs - - - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push(pps[i].byteLength & 0xFF); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, track.width & 0xff, // width - (track.height & 0xff00) >> 8, track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat([sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ]))]; - - if (track.sarRatio) { - var hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF]))); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function audioSample(track) { - return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount - (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16 - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -})(); - -tkhd = function tkhd(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height - ]); - return box(types.tkhd, result); -}; -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ - - -traf = function traf(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32); - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - - dataOffset = 32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8; // mdat header - // audio tracks require less metadata - - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun); - } // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - - - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, sampleDependencyTable.length + dataOffset); - return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable); -}; -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ - - -trak = function trak(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, tkhd(track), mdia(track)); -}; - -trex = function trex(track) { - var result = new Uint8Array([0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function () { - var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - - trunHeader = function trunHeader(samples, offset) { - var durationPresent = 0, - sizePresent = 0, - flagsPresent = 0, - compositionTimeOffset = 0; // trun flag constants - - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [0x00, // version 0 - 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags - (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset - ]; - }; - - videoTrun = function videoTrun(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 16 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - - bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn; - bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - - return box(types.trun, bytes); - }; - - audioTrun = function audioTrun(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - samples = track.samples || []; - offset += 8 + 12 + 8 * samples.length; - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function trun(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -})(); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function initSegment(tracks) { - var fileType = ftyp(), - movie = moov(tracks), - result; - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/parse-type.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/parse-type.js deleted file mode 100644 index 05a7fe8dbf..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/parse-type.js +++ /dev/null @@ -1,10 +0,0 @@ -var parseType = function parseType(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - -module.exports = parseType; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/probe.js deleted file mode 100644 index 0b0604b43a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/probe.js +++ /dev/null @@ -1,393 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; - -var toHexString = require('../utils/bin').toHexString; - -var findBox = require('../mp4/find-box.js'); - -var parseType = require('../mp4/parse-type.js'); - -var emsg = require('../mp4/emsg.js'); - -var parseTfhd = require('../tools/parse-tfhd.js'); - -var parseTrun = require('../tools/parse-trun.js'); - -var parseTfdt = require('../tools/parse-tfdt.js'); - -var getUint64 = require('../utils/numbers.js').getUint64; - -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3; - -var window = require('global/window'); - -var parseId3Frames = require('../tools/parse-id3.js').parseId3Frames; -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ - - -timescale = function timescale(init) { - var result = {}, - traks = findBox(init, ['moov', 'trak']); // mdhd timescale - - return traks.reduce(function (result, trak) { - var tkhd, version, index, id, mdhd; - tkhd = findBox(trak, ['tkhd'])[0]; - - if (!tkhd) { - return null; - } - - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]); - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (!mdhd) { - return null; - } - - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - return result; - }, result); -}; -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ - - -startTime = function startTime(timescale, fragment) { - var trafs, result; // we need info from two childrend of each track fragment box - - trafs = findBox(fragment, ['moof', 'traf']); // determine the start times for each track - - var lowestTime = trafs.reduce(function (acc, traf) { - var tfhd = findBox(traf, ['tfhd'])[0]; // get the track id from the tfhd - - var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified - - var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt - - var tfdt = findBox(traf, ['tfdt'])[0]; - var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength); - var baseTime; // version 1 is 64 bit - - if (tfdt[0] === 1) { - baseTime = getUint64(tfdt.subarray(4, 12)); - } else { - baseTime = dv.getUint32(4); - } // convert base time to seconds if it is a valid number. - - - var seconds; - - if (typeof baseTime === 'bigint') { - seconds = baseTime / window.BigInt(scale); - } else if (typeof baseTime === 'number' && !isNaN(baseTime)) { - seconds = baseTime / scale; - } - - if (seconds < Number.MAX_SAFE_INTEGER) { - seconds = Number(seconds); - } - - if (seconds < acc) { - acc = seconds; - } - - return acc; - }, Infinity); - return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0; -}; -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ - - -compositionStartTime = function compositionStartTime(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - - - var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds - - if (typeof baseMediaDecodeTime === 'bigint') { - compositionTimeOffset = window.BigInt(compositionTimeOffset); - timescale = window.BigInt(timescale); - } - - var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale; - - if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) { - result = Number(result); - } - - return result; -}; -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ - - -getVideoTrackIds = function getVideoTrackIds(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - traks.forEach(function (trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - hdlrs.forEach(function (hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = version === 0 ? view.getUint32(12) : view.getUint32(20); - videoTrackIds.push(trackId); - } - }); - }); - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); -}; -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ - - -getTracks = function getTracks(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - traks.forEach(function (trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; // id - - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; // type - - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } // codec - - - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); // gives the codec type string - - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if (/^[asm]vc[1-9]$/i.test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; // left padded with zeroes for single digit hex - // profile idc - - track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags - - track.codec += toHexString(codecConfig[10]); // level idc - - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if (/^mp4[a,v]$/i.test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit - - track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - return tracks; -}; -/** - * Returns an array of emsg ID3 data from the provided segmentData. - * An offset can also be provided as the Latest Arrival Time to calculate - * the Event Start Time of v0 EMSG boxes. - * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing - * - * @param {Uint8Array} segmentData the segment byte array. - * @param {number} offset the segment start time or Latest Arrival Time, - * @return {Object[]} an array of ID3 parsed from EMSG boxes - */ - - -getEmsgID3 = function getEmsgID3(segmentData, offset) { - if (offset === void 0) { - offset = 0; - } - - var emsgBoxes = findBox(segmentData, ['emsg']); - return emsgBoxes.map(function (data) { - var parsedBox = emsg.parseEmsgBox(new Uint8Array(data)); - var parsedId3Frames = parseId3Frames(parsedBox.message_data); - return { - cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset), - duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale), - frames: parsedId3Frames - }; - }); -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader, - getEmsgID3: getEmsgID3 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/track-decode-info.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/track-decode-info.js deleted file mode 100644 index e4b53d2051..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/track-decode-info.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ - - -var collectDtsInfo = function collectDtsInfo(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ - - -var clearDtsInfo = function clearDtsInfo(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) { - var baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero. - - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - - - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first - - baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative - - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/transmuxer.js deleted file mode 100644 index a7796c6de0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/mp4/transmuxer.js +++ /dev/null @@ -1,1112 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('./mp4-generator.js'); - -var frameUtils = require('./frame-utils'); - -var audioFrameUtils = require('./audio-frame-utils'); - -var trackDecodeInfo = require('./track-decode-info'); - -var m2ts = require('../m2ts/m2ts.js'); - -var clock = require('../utils/clock'); - -var AdtsStream = require('../codecs/adts.js'); - -var H264Stream = require('../codecs/h264').H264Stream; - -var AacStream = require('../aac'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); // object types - - -var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream; - -var retriggerForStream = function retriggerForStream(key, event) { - event.stream = key; - this.trigger('log', event); -}; - -var addPipelineLogRetriggers = function addPipelineLogRetriggers(transmuxer, pipeline) { - var keys = Object.keys(pipeline); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; // skip non-stream keys and headOfPipeline - // which is just a duplicate - - if (key === 'headOfPipeline' || !pipeline[key].on) { - continue; - } - - pipeline[key].on('log', retriggerForStream.bind(transmuxer, key)); - } -}; -/** - * Compare two arrays (even typed) for same-ness - */ - - -var arrayEquals = function arrayEquals(a, b) { - var i; - - if (a.length !== b.length) { - return false; - } // compare the value of each element in the array - - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) { - var ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - - -_AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function () { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock - - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackDecodeInfo.clearDtsInfo(track); - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - - if (frames.length) { - segmentDuration = frames.length * frameDuration; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration - frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)); - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - - this.trigger('data', { - track: track, - boxes: boxes - }); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function () { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -_AudioSegmentStream.prototype = new Stream(); -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ - -_VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - options = options || {}; - sequenceNumber = options.firstSequenceNumber || 0; - - _VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - this.gopCache_ = []; - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - - this.push = function (nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - - - this.flush = function () { - var frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - - - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } // Trim gops to align with gopsToAlignWith - - - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith - - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - - - trackDecodeInfo.clearDtsInfo(track); - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - - track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat - - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - this.trigger('processedGopsInfo', gops.map(function (gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration)); - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); // save all the nals in the last GOP into the gop cache - - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); // Keep a maximum of 6 GOPs in the cache - - this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits - - nalUnits = []; - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - moof = mp4.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time - - sequenceNumber++; - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes - }); - this.resetStream_(); // Continue with the flush process now - - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function () { - trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - config = undefined; - pps = undefined; - }; // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - - - this.getGopForFusion_ = function (nalUnit) { - var halfSecond = 45000, - // Half-a-second in a 90khz clock - allowableOverlap = 10000, - // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; // Search for the GOP nearest to the beginning of this nal unit - - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS - - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } // Reject Gops that would require a negative baseMediaDecodeTime - - - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } // The distance between the end of the gop and the start of the nalUnit - - - dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - - if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) { - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - - return null; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - - - this.alignGopsAtStart_ = function (gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } // current gop starts before the current gop we want to align on. so increment gop - // index - - - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - - - this.alignGopsAtEnd_ = function (gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function (total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { - byteLength: 0, - duration: 0, - nalCount: 0 - }); - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - return alignedGops; - }; - - this.alignGopsWith = function (newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -_VideoSegmentStream.prototype = new Stream(); -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ - -_CoalesceStream = function CoalesceStream(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - _CoalesceStream.prototype.init.call(this); // Take output from multiple - - - this.push = function (output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } // buffer incoming id3 tags until the final flush - - - if (output.frames) { - return this.pendingMetadata.push(output); - } // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - - - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -_CoalesceStream.prototype = new Stream(); - -_CoalesceStream.prototype.flush = function (flushSource) { - var offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function (prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - initSegment = mp4.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment - - event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov - // and track definitions - - event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats - - event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together - - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - - - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - - - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps); - event.metadata.push(id3); - } // We add this to every single emitted segment even though we only need - // it for the first - - - event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state - - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - - this.trigger('data', event); // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - this.trigger('caption', caption); - } // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - - - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - this.trigger('id3Frame', id3); - } - } // Only emit `done` if all tracks have been flushed and emitted - - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -_CoalesceStream.prototype.setRemux = function (val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ - - -_Transmuxer = function Transmuxer(options) { - var self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - _Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; - - this.setupTsPipeline = function () { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline - - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams - - pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!! - // demux the streams - - pipeline.timestampRolloverStream.pipe(pipeline.h264Stream); - pipeline.timestampRolloverStream.pipe(pipeline.adtsStream); - pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream - - pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream); - pipeline.elementaryStream.on('data', function (data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; // scan the tracks listed in the metadata - - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } // hook up the video segment stream to the first track with h264 data - - - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream')); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo')); - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline - - pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); - } // emit pmt info - - - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); // Re-emit any data coming from the coalesce stream to the outside world - - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function (id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline - - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - addPipelineLogRetriggers(this, pipeline); - }; // hook up the segment streams once track metadata is delivered - - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function (timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function (val) { - var pipeline = this.transmuxPipeline_; - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function (gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - this.getLogTrigger_ = function (key) { - var self = this; - return function (event) { - event.stream = key; - self.trigger('log', event); - }; - }; // feed incoming data to the front of the parsing pipeline - - - this.push = function (data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - - this.transmuxPipeline_.headOfPipeline.push(data); - }; // flush any buffered data - - - this.flush = function () { - hasFlushed = true; // Start at the top of the pipeline and flush all pending work - - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function () { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; // Caption data has to be reset when seeking outside buffered range - - - this.resetCaptions = function () { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; -}; - -_Transmuxer.prototype = new Stream(); -module.exports = { - Transmuxer: _Transmuxer, - VideoSegmentStream: _VideoSegmentStream, - AudioSegmentStream: _AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/audio-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/audio-segment-stream.js deleted file mode 100644 index 93bf9c56f7..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/audio-segment-stream.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var audioFrameUtils = require('../mp4/audio-frame-utils'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ - - -var AudioSegmentStream = function AudioSegmentStream(track, options) { - var adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - options = options || {}; - AudioSegmentStream.prototype.init.call(this); - - this.push = function (data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function (prop) { - track[prop] = data[prop]; - }); - } // buffer audio data until end() is called - - - adtsFrames.push(data); - }; - - this.setEarliestDts = function (earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function (timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function () { - var frames, moof, mdat, boxes, timingInfo; // return early if no audio data has been observed - - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts); - - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - - track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat - - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - adtsFrames = []; - moof = mp4.moof(sequenceNumber, [track]); // bump the sequence number for next time - - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - timingInfo = { - start: segmentStartPts - }; - this.trigger('timingInfo', timingInfo); - this.trigger('data', { - track: track, - boxes: boxes - }); - }; - - this.flush = function () { - this.processFrames_(); // trigger final timing info - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function () { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function () { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function () { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); -module.exports = AudioSegmentStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/index.js deleted file mode 100644 index 380fc725d3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - Transmuxer: require('./transmuxer') -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/transmuxer.js deleted file mode 100644 index 9ed0034fb9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/transmuxer.js +++ /dev/null @@ -1,322 +0,0 @@ -var Stream = require('../utils/stream.js'); - -var m2ts = require('../m2ts/m2ts.js'); - -var codecs = require('../codecs/index.js'); - -var AudioSegmentStream = require('./audio-segment-stream.js'); - -var VideoSegmentStream = require('./video-segment-stream.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var isLikelyAacData = require('../aac/utils').isLikelyAacData; - -var AdtsStream = require('../codecs/adts'); - -var AacStream = require('../aac/index'); - -var clock = require('../utils/clock'); - -var createPipeline = function createPipeline(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - return object; -}; - -var tsPipeline = function tsPipeline(options) { - var pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - pipeline.headOfPipeline = pipeline.packet; // Transport Stream - - pipeline.packet.pipe(pipeline.parse).pipe(pipeline.elementary).pipe(pipeline.timestampRollover); // H264 - - pipeline.timestampRollover.pipe(pipeline.h264); // Hook up CEA-608/708 caption stream - - pipeline.h264.pipe(pipeline.captionStream); - pipeline.timestampRollover.pipe(pipeline.metadataStream); // ADTS - - pipeline.timestampRollover.pipe(pipeline.adts); - pipeline.elementary.on('data', function (data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - pipeline.videoSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - pipeline.videoSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - pipeline.videoSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.h264.pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - pipeline.adts.pipe(pipeline.audioSegmentStream); - } // emit pmt info - - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - pipeline.captionStream.on('data', function (caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } // Translate caption PTS times into second offsets into the - // video timeline for the segment - - - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - pipeline.trigger('caption', caption); - }); - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var aacPipeline = function aacPipeline(options) { - var pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; // set up the parsing pipeline - - pipeline.headOfPipeline = pipeline.aacStream; - pipeline.aacStream.pipe(pipeline.audioRollover).pipe(pipeline.adtsStream); - pipeline.aacStream.pipe(pipeline.timedMetadataRollover).pipe(pipeline.metadataStream); - pipeline.metadataStream.on('timestamp', function (frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - pipeline.aacStream.on('data', function (data) { - if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; // hook up the audio segment stream to the first track with aac data - - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - pipeline.audioSegmentStream.on('data', function (data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - pipeline.audioSegmentStream.on('partialdone', pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', pipeline.trigger.bind(pipeline, 'audioTimingInfo')); // Set up the final part of the audio pipeline - - pipeline.adtsStream.pipe(pipeline.audioSegmentStream); - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); // set the pipeline up as a stream before binding to get access to the trigger function - - pipeline = createPipeline(pipeline); - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - return pipeline; -}; - -var setupPipelineListeners = function setupPipelineListeners(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function (event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; // keep original time, can be adjusted if needed at a higher level - - event.cueTime = clock.videoTsToSeconds(event.pts); - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function (event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function Transmuxer(options) { - var pipeline = null, - hasFlushed = true; - options = options || {}; - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function (bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function () { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function () { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - } - }; - - this.setRemux = function (val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.setAudioAppendStart = function (audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - - - this.alignGopsWith = function (gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); -module.exports = Transmuxer; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/video-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/video-segment-stream.js deleted file mode 100644 index 826bab6c5c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/partial/video-segment-stream.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -var mp4 = require('../mp4/mp4-generator.js'); - -var trackInfo = require('../mp4/track-decode-info.js'); - -var frameUtils = require('../mp4/frame-utils'); - -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function VideoSegmentStream(track, options) { - var sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - options = options || {}; - VideoSegmentStream.prototype.init.call(this); - - this.push = function (nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } // record the track config - - - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - VIDEO_PROPERTIES.forEach(function (prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } // buffer video until flush() is called - - - nalUnits.push(nalUnit); - }; - - this.processNals_ = function (cacheLastFrame) { - var i; - nalUnits = frameCache.concat(nalUnits); // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - - nalUnits.shift(); - } // Return early if no video data has been observed - - - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - - - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = [].concat.apply([], frames).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - track.samples = frameUtils.generateSampleTableForFrame(frame); - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); - var moof = mp4.moof(sequenceNumber, [track]); - sequenceNumber++; - track.initSegment = mp4.initSegment([track]); - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function () { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function () { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function () { - this.processNals_(false); // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function () { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function () { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); -module.exports = VideoSegmentStream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/caption-packet-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/caption-packet-parser.js deleted file mode 100644 index 129adc6b73..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/caption-packet-parser.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ -'use strict'; // Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. - -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ - -var parseSei = function parseSei(bytes) { - var i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message - - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } // Parse payload type - - - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - - payloadType += bytes[i++]; // Parse payload size - - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - - payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } // skip the payload and parse the next message - - - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; // see ANSI/SCTE 128-1 (2013), section 8.1 - - -var parseUserData = function parseUserData(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } // itu_t_t35_provider_code should be 49 (ATSC) for captions - - - if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) { - return null; - } // the user_identifier should be "GA94" to indicate ATSC1 data - - - if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') { - return null; - } // finally, user_data_type_code should be 0x03 for caption data - - - if (sei.payload[7] !== 0x03) { - return null; - } // return the user_data_type_structure and strip the trailing - // marker bits - - - return sei.payload.subarray(8, sei.payload.length - 1); -}; // see CEA-708-D, section 4.4 - - -var parseCaptionPackets = function parseCaptionPackets(pts, userData) { - var results = [], - i, - count, - offset, - data; // if this is just filler, return immediately - - if (!(userData[0] & 0x40)) { - return results; - } // parse out the cc_data_1 and cc_data_2 fields - - - count = userData[0] & 0x1f; - - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; // capture cc data when cc_valid is 1 - - if (userData[offset + 2] & 0x04) { - data.ccData = userData[offset + 3] << 8 | userData[offset + 4]; - results.push(data); - } - } - - return results; -}; - -var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) { - var length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, - newData; // Find all `Emulation Prevention Bytes` - - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } // If no Emulation Prevention Bytes were found just return the original - // array - - - if (emulationPreventionBytesPositions.length === 0) { - return data; - } // Create a new array to hold the NAL unit data - - - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; // Remove this position index - - emulationPreventionBytesPositions.shift(); - } - - newData[i] = data[sourceIndex]; - } - - return newData; -}; // exports - - -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/flv-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/flv-inspector.js deleted file mode 100644 index 6502fd18b7..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/flv-inspector.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' -}, - hex = function hex(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); -}, - hexStringList = function hexStringList(data) { - var arr = [], - i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - - return arr.join(' '); -}, - parseAVCTag = function parseAVCTag(tag, obj) { - var avcPacketTypes = ['AVC Sequence Header', 'AVC NALU', 'AVC End-of-Sequence'], - compositionTime = tag[1] & parseInt('01111111', 2) << 16 | tag[2] << 8 | tag[3]; - obj = obj || {}; - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = tag[1] & parseInt('10000000', 2) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; -}, - parseVideoTag = function parseVideoTag(tag, obj) { - var frameTypes = ['Unknown', 'Keyframe (for AVC, a seekable frame)', 'Inter frame (for AVC, a nonseekable frame)', 'Disposable inter frame (H.263 only)', 'Generated keyframe (reserved for server use only)', 'Video info/command frame'], - codecID = tag[0] & parseInt('00001111', 2); - obj = obj || {}; - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - - return obj; -}, - parseAACTag = function parseAACTag(tag, obj) { - var packetTypes = ['AAC Sequence Header', 'AAC Raw']; - obj = obj || {}; - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - return obj; -}, - parseAudioTag = function parseAudioTag(tag, obj) { - var formatTable = ['Linear PCM, platform endian', 'ADPCM', 'MP3', 'Linear PCM, little endian', 'Nellymoser 16-kHz mono', 'Nellymoser 8-kHz mono', 'Nellymoser', 'G.711 A-law logarithmic PCM', 'G.711 mu-law logarithmic PCM', 'reserved', 'AAC', 'Speex', 'MP3 8-Khz', 'Device-specific sound'], - samplingRateTable = ['5.5-kHz', '11-kHz', '22-kHz', '44-kHz'], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - obj = obj || {}; - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = (tag[0] & parseInt('00000010', 2)) >>> 1 ? '16-bit' : '8-bit'; - obj.soundType = tag[0] & parseInt('00000001', 2) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - - return obj; -}, - parseGenericTag = function parseGenericTag(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: tag[1] << 16 | tag[2] << 8 | tag[3], - timestamp: tag[7] << 24 | tag[4] << 16 | tag[5] << 8 | tag[6], - streamID: tag[8] << 16 | tag[9] << 8 | tag[10] - }; -}, - inspectFlvTag = function inspectFlvTag(tag) { - var header = parseGenericTag(tag); - - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - - case 0x12: - } - - return header; -}, - inspectFlv = function inspectFlv(bytes) { - var i = 9, - // header - dataSize, - parsedResults = [], - tag; // traverse the tags - - i += 4; // skip previous tag size - - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - - return parsedResults; -}, - textifyFlv = function textifyFlv(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); -}; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/mp4-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/mp4-inspector.js deleted file mode 100644 index df033a1a03..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/mp4-inspector.js +++ /dev/null @@ -1,756 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var numberHelpers = require('../utils/numbers.js'); - -var MAX_UINT32 = numberHelpers.MAX_UINT32; -var getUint64 = numberHelpers.getUint64; - -var inspectMp4, - _textifyMp, - parseMp4Date = function parseMp4Date(seconds) { - return new Date(seconds * 1000 - 2082844800000); -}, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function nalParse(avcStream) { - var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; // bail if this doesn't appear to be an H264 stream - - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - - case 0x06: - result.push('sei_rbsp'); - break; - - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - - return result; -}, - // registry of handlers for individual mp4 box types -parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function avc1(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + view.getUint16(30) / 16, - vertresolution: view.getUint16(32) + view.getUint16(34) / 16, - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function avcC(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; // iterate past any SPSs - - offset = 6; - - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } // iterate past any PPSs - - - numOfPictureParameterSets = data[offset]; - offset++; - - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - - return result; - }, - btrt: function btrt(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: getUint64(data.subarray(i)), - mediaTime: getUint64(data.subarray(i + 8)), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - - return result; - }, - esds: function esds(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: data[6] << 8 | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: data[12] >>> 2 & 0x3f, - bufferSize: data[13] << 16 | data[14] << 8 | data[15], - maxBitrate: data[16] << 24 | data[17] << 16 | data[18] << 8 | data[19], - avgBitrate: data[20] << 24 | data[21] << 16 | data[22] << 8 | data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: data[26] >>> 3 & 0x1f, - samplingFrequencyIndex: (data[26] & 0x07) << 1 | data[27] >>> 7 & 0x01, - channelConfiguration: data[27] >>> 3 & 0x0f - } - } - }; - }, - ftyp: function ftyp(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - - return result; - }, - dinf: function dinf(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function dref(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function hdlr(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; // parse out the name field - - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - - result.name += String.fromCharCode(data[i]); - } // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - - - result.name = decodeURIComponent(escape(result.name)); - return result; - }, - mdat: function mdat(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function mdhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - return result; - }, - mdia: function mdia(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function mfhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7] - }; - }, - minf: function minf(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function mp4a(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + view.getUint16(26) / 65536 - }; // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - - return result; - }, - moof: function moof(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function moov(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function mvex(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function mvhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; // convert fixed-point, base 16 back to a number - - result.rate = view.getUint16(i) + view.getUint16(i + 2) / 16; - i += 4; - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function pdin(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function sdtp(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function smhd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + data[5] / 256 - }; - }, - stbl: function stbl(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function ctts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[result.version === 0 ? 'getUint32' : 'getInt32'](i + 4) - }); - } - - return result; - }, - stss: function stss(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - - return result; - }, - stco: function stco(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - - return result; - }, - stsc: function stsc(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - - return result; - }, - stsd: function stsd(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function stsz(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - - return result; - }, - stts: function stts(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - - return result; - }, - styp: function styp(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function tkhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; // convert fixed-point, base 16 back to a number - - result.volume = view.getUint8(i) + view.getUint8(i + 1) / 8; - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + 9 * 4)); - i += 9 * 4; - result.width = view.getUint16(i) + view.getUint16(i + 2) / 65536; - i += 4; - result.height = view.getUint16(i) + view.getUint16(i + 2) / 65536; - return result; - }, - traf: function traf(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function trak(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function trex(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function url(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function vmhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), view.getUint16(8), view.getUint16(10)]) - }; - } -}; -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ - - -inspectMp4 = function inspectMp4(data) { - var i = 0, - result = [], - view, - size, - type, - end, - box; // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; // parse type-specific data - - box = (parse[type] || function (data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - - box.size = size; - box.type = type; // store this box and move to the next - - result.push(box); - i = end; - } - - return result; -}; -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ - - -_textifyMp = function textifyMp4(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); // iterate over all the boxes - - return inspectedMp4.map(function (box, index) { - // list the box type first at the current indentation level - return indent + box.type + '\n' + // the type is already included and handle child boxes separately - Object.keys(box).filter(function (key) { - return key !== 'type' && key !== 'boxes'; // output all the box properties - }).map(function (key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; // print out raw bytes as hexademical - - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)).map(function (byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - - if (!bytes) { - return prefix + '<>'; - } - - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - - return prefix + '<\n' + bytes.map(function (line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } // stringify generic objects - - - return prefix + JSON.stringify(value, null, 2).split('\n').map(function (line, index) { - if (index === 0) { - return line; - } - - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + ( // recursively textify the child boxes - box.boxes ? '\n' + _textifyMp(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: _textifyMp, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-id3.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-id3.js deleted file mode 100644 index 0b6fdedbbc..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-id3.js +++ /dev/null @@ -1,243 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Tools for parsing ID3 frame data - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var typedArrayIndexOf = require('../utils/typed-array').typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text -// encoding description byte [ID3v2.4.0 section 4.] -textEncodingDescriptionByte = { - Iso88591: 0x00, - // ISO-8859-1, terminated with \0. - Utf16: 0x01, - // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, - // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - -}, - // return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -percentEncode = function percentEncode(bytes, start, end) { - var i, - result = ''; - - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - - return result; -}, - // return the string representation of the specified byte range, -// interpreted as UTf-8. -parseUtf8 = function parseUtf8(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); -}, - // return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -parseIso88591 = function parseIso88591(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}, - parseSyncSafeInteger = function parseSyncSafeInteger(data) { - return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3]; -}, - frameParsers = { - 'APIC': function APIC(frame) { - var i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parsing fields [ID3v2.4.0 section 4.14.] - - - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } // parsing Mime type field (terminated with \0) - - - frame.mimeType = parseIso88591(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field - - frame.pictureType = frame.data[i]; - i++; - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - - if (descriptionEndIndex < 0) { - // malformed frame - return; - } // parsing Description field (terminated with \0) - - - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591(frame.data, i, frame.data.length); - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function T(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - - - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - - frame.values = frame.value.split('\0'); - }, - 'TXXX': function TXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the text fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - - frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function W(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function WXXX(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } // parse the description and URL fields - - - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - - frame.url = parseIso88591(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, ''); - }, - 'PRIV': function PRIV(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591(frame.data, 0, i); - break; - } - } - - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } -}; - -var parseId3Frames = function parseId3Frames(data) { - var frameSize, - frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - - if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) { - return; - } // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - - - tagSize = parseSyncSafeInteger(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - - tagSize += 10; // check bit 6 of byte 5 for the extended header flag. - - var hasExtendedHeader = data[5] & 0x40; - - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - - frameStart += parseSyncSafeInteger(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger(data.subarray(16, 20)); // clip any padding off the end - } // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - - - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(data.subarray(frameStart + 4, frameStart + 8)); - - if (frameSize < 1) { - break; - } - - frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]); - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; // parse frame values - - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - frameStart += 10; // advance past the frame header - - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; -}; - -module.exports = { - parseId3Frames: parseId3Frames, - parseSyncSafeInteger: parseSyncSafeInteger, - frameParsers: frameParsers -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sample-flags.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sample-flags.js deleted file mode 100644 index 993a61e71e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sample-flags.js +++ /dev/null @@ -1,13 +0,0 @@ -var parseSampleFlags = function parseSampleFlags(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: flags[2] << 8 | flags[3] - }; -}; - -module.exports = parseSampleFlags; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sidx.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sidx.js deleted file mode 100644 index 2fb2fff95c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-sidx.js +++ /dev/null @@ -1,44 +0,0 @@ -var getUint64 = require('../utils/numbers.js').getUint64; - -var parseSidx = function parseSidx(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = getUint64(data.subarray(i)); - result.firstOffset = getUint64(data.subarray(i + 8)); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - -module.exports = parseSidx; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfdt.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfdt.js deleted file mode 100644 index cc549bc3e6..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfdt.js +++ /dev/null @@ -1,20 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; - -var getUint64 = require('../utils/numbers.js').getUint64; - -var tfdt = function tfdt(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - result.baseMediaDecodeTime = getUint64(data.subarray(4)); - } else { - result.baseMediaDecodeTime = toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]); - } - - return result; -}; - -module.exports = tfdt; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfhd.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfhd.js deleted file mode 100644 index 41b90effc3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-tfhd.js +++ /dev/null @@ -1,56 +0,0 @@ -var tfhd = function tfhd(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - i = 8; - - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - - result.baseDataOffset = view.getUint32(12); - i += 4; - } - - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - - return result; -}; - -module.exports = tfhd; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-trun.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-trun.js deleted file mode 100644 index 4b7932d48a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/parse-trun.js +++ /dev/null @@ -1,99 +0,0 @@ -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function trun(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, - // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, - // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, - // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, - // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, - // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, - // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - - - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - - offset += 4; - } - - result.samples.push(sample); - } - - return result; -}; - -module.exports = trun; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/ts-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/ts-inspector.js deleted file mode 100644 index ba27ede257..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/tools/ts-inspector.js +++ /dev/null @@ -1,555 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); - -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; - -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); - -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var MP2T_PACKET_LENGTH = 188, - // bytes -SYNC_BYTE = 0x47; -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ - -var parsePsi_ = function parsePsi_(bytes, pmt) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - - case 'pmt': - var table = probe.ts.parsePmt(packet); - pmt.table = pmt.table || {}; - Object.keys(table).forEach(function (key) { - pmt.table[key] = table[key]; - }); - break; - - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ - - -var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed; - var endLoop = false; // Start walking from start of segment to get first audio packet - - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last audio packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ - - -var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) { - var startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, - type, - pesType, - pusi, - parsed, - frame, - i, - pes; - var endLoop = false; - var currentFrame = { - data: [], - size: 0 - }; // Start walking from start of segment to get first video packet - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn('Failed to extract PTS/DTS from PES at first keyframe. ' + 'This could be an unusual TS segment, or else mux.js did not ' + 'parse your TS segment correctly. If you know your TS ' + 'segments do contain PTS/DTS on keyframes please file a bug ' + 'report! You can try ffprobe to double check for yourself.'); - } - } - - currentFrame.size = 0; - } - } - - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - - break; - - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex++; - endIndex++; - } // Start walking from end of segment to get last video packet - - - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - - break; - - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - - - startIndex--; - endIndex--; - } -}; -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ - - -var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - - segmentInfo.audio.forEach(function (info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - - segmentInfo.video.forEach(function (info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds - - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds - - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; -/** - * inspects the aac data stream for start and end time information - */ - - -var inspectAac_ = function inspectAac_(bytes) { - var endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - - byteIndex += frameSize; - break; - - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer - // to emit a full packet - - if (frameSize > bytes.length) { - endLoop = true; - break; - } - - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - - audioCount++; - byteIndex += frameSize; - break; - - default: - byteIndex++; - break; - } - - if (endLoop) { - return null; - } - } - - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - var result = { - audio: [{ - type: 'audio', - dts: timestamp, - pts: timestamp - }, { - type: 'audio', - dts: timestamp + audioCount * 1024 * audioTimescale, - pts: timestamp + audioCount * 1024 * audioTimescale - }] - }; - return result; -}; -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ - - -var inspectTs_ = function inspectTs_(bytes) { - var pmt = { - pid: null, - table: null - }; - var result = {}; - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - - if (result.video.length === 0) { - delete result.video; - } - - break; - - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - - if (result.audio.length === 0) { - delete result.audio; - } - - break; - - default: - break; - } - } - } - - return result; -}; -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ - - -var inspect = function inspect(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || !result.audio && !result.video) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/bin.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/bin.js deleted file mode 100644 index 963bd5fdd3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/bin.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function toUnsigned(value) { - return value >>> 0; -}; - -var toHexString = function toHexString(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/clock.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/clock.js deleted file mode 100644 index d68b177561..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/clock.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = 90000, - // 90kHz clock -secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function secondsToVideoTs(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function videoTsToSeconds(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ - - -metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/exp-golomb.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/exp-golomb.js deleted file mode 100644 index 5fd249e70e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/exp-golomb.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ - -ExpGolomb = function ExpGolomb(workingData) { - var // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - // the current word being examined - workingWord = 0, - // :uint - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - // ():uint - - this.length = function () { - return 8 * workingBytesAvailable; - }; // ():uint - - - this.bitsAvailable = function () { - return 8 * workingBytesAvailable + workingBitsAvailable; - }; // ():void - - - this.loadWord = function () { - var position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed - - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; // (count:int):void - - - this.skipBits = function (count) { - var skipBytes; // :int - - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - count -= skipBytes * 8; - workingBytesAvailable -= skipBytes; - this.loadWord(); - workingWord <<= count; - workingBitsAvailable -= count; - } - }; // (size:int):uint - - - this.readBits = function (size) { - var bits = Math.min(workingBitsAvailable, size), - // :uint - valu = workingWord >>> 32 - bits; // :uint - // if size > 31, handle error - - workingBitsAvailable -= bits; - - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - - return valu; - }; // ():uint - - - this.skipLeadingZeros = function () { - var leadingZeroCount; // :uint - - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } // we exhausted workingWord and still have not found a 1 - - - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; // ():void - - - this.skipUnsignedExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():void - - - this.skipExpGolomb = function () { - this.skipBits(1 + this.skipLeadingZeros()); - }; // ():uint - - - this.readUnsignedExpGolomb = function () { - var clz = this.skipLeadingZeros(); // :uint - - return this.readBits(clz + 1) - 1; - }; // ():int - - - this.readExpGolomb = function () { - var valu = this.readUnsignedExpGolomb(); // :int - - if (0x01 & valu) { - // the number is odd if the low order bit is set - return 1 + valu >>> 1; // add 1 to make it even, and divide by 2 - } - - return -1 * (valu >>> 1); // divide by two then make it negative - }; // Some convenience functions - // :Boolean - - - this.readBoolean = function () { - return this.readBits(1) === 1; - }; // ():int - - - this.readUnsignedByte = function () { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/numbers.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/numbers.js deleted file mode 100644 index 19a4552d30..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/numbers.js +++ /dev/null @@ -1,23 +0,0 @@ -var MAX_UINT32 = Math.pow(2, 32); - -var getUint64 = function getUint64(uint8) { - var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength); - var value; - - if (dv.getBigUint64) { - value = dv.getBigUint64(0); - - if (value < Number.MAX_SAFE_INTEGER) { - return Number(value); - } - - return value; - } - - return dv.getUint32(0) * MAX_UINT32 + dv.getUint32(4); -}; - -module.exports = { - getUint64: getUint64, - MAX_UINT32: MAX_UINT32 -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/stream.js deleted file mode 100644 index 7d28c99d38..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/stream.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function Stream() { - this.init = function () { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - - this.on = function (type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - - - this.off = function (type, listener) { - var index; - - if (!listeners[type]) { - return false; - } - - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - - - this.trigger = function (type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - - if (!callbacks) { - return; - } // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - - - if (arguments.length === 2) { - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - - length = callbacks.length; - - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - - - this.dispose = function () { - listeners = {}; - }; - }; -}; -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ - - -Stream.prototype.pipe = function (destination) { - this.on('data', function (data) { - destination.push(data); - }); - this.on('done', function (flushSource) { - destination.flush(flushSource); - }); - this.on('partialdone', function (flushSource) { - destination.partialFlush(flushSource); - }); - this.on('endedtimeline', function (flushSource) { - destination.endTimeline(flushSource); - }); - this.on('reset', function (flushSource) { - destination.reset(flushSource); - }); - return destination; -}; // Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. - - -Stream.prototype.push = function (data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function (flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function (flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function (flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function (flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/string.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/string.js deleted file mode 100644 index 65198d939b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/string.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Returns the first string in the data array ending with a null char '\0' - * @param {UInt8} data - * @returns the string with the null char - */ -var uint8ToCString = function uint8ToCString(data) { - var index = 0; - var curChar = String.fromCharCode(data[index]); - var retString = ''; - - while (curChar !== '\0') { - retString += curChar; - index++; - curChar = String.fromCharCode(data[index]); - } // Add nullChar - - - retString += curChar; - return retString; -}; - -module.exports = { - uint8ToCString: uint8ToCString -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/typed-array.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/typed-array.js deleted file mode 100644 index 1ea332c7e4..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/es/utils/typed-array.js +++ /dev/null @@ -1,21 +0,0 @@ -// IE11 doesn't support indexOf for TypedArrays. -// Once IE11 support is dropped, this function should be removed. -var typedArrayIndexOf = function typedArrayIndexOf(typedArray, element, fromIndex) { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; -}; - -module.exports = { - typedArrayIndexOf: typedArrayIndexOf -}; \ No newline at end of file diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/index.html b/node_modules/@videojs/http-streaming/node_modules/mux.js/index.html deleted file mode 100644 index 5adb9c09f1..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Mux.js Demo - - - -

use window.muxjs in the console!

- - - - - diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/index.js deleted file mode 100644 index 5a8e40f918..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/index.js +++ /dev/null @@ -1,131 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based aac to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'); -var aacUtils = require('./utils'); - -// Constants -var AacStream; - -/** - * Splits an incoming stream of binary data into ADTS and ID3 Frames. - */ - -AacStream = function() { - var - everything = new Uint8Array(), - timeStamp = 0; - - AacStream.prototype.init.call(this); - - this.setTimestamp = function(timestamp) { - timeStamp = timestamp; - }; - - this.push = function(bytes) { - var - frameSize = 0, - byteIndex = 0, - bytesLeft, - chunk, - packet, - tempLength; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (everything.length) { - tempLength = everything.length; - everything = new Uint8Array(bytes.byteLength + tempLength); - everything.set(everything.subarray(0, tempLength)); - everything.set(bytes, tempLength); - } else { - everything = bytes; - } - - while (everything.length - byteIndex >= 3) { - if ((everything[byteIndex] === 'I'.charCodeAt(0)) && - (everything[byteIndex + 1] === 'D'.charCodeAt(0)) && - (everything[byteIndex + 2] === '3'.charCodeAt(0))) { - - // Exit early because we don't have enough to parse - // the ID3 tag header - if (everything.length - byteIndex < 10) { - break; - } - - // check framesize - frameSize = aacUtils.parseId3TagSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - // Add to byteIndex to support multiple ID3 tags in sequence - if (byteIndex + frameSize > everything.length) { - break; - } - chunk = { - type: 'timed-metadata', - data: everything.subarray(byteIndex, byteIndex + frameSize) - }; - this.trigger('data', chunk); - byteIndex += frameSize; - continue; - } else if (((everything[byteIndex] & 0xff) === 0xff) && - ((everything[byteIndex + 1] & 0xf0) === 0xf0)) { - - // Exit early because we don't have enough to parse - // the ADTS frame header - if (everything.length - byteIndex < 7) { - break; - } - - frameSize = aacUtils.parseAdtsSize(everything, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (byteIndex + frameSize > everything.length) { - break; - } - - packet = { - type: 'audio', - data: everything.subarray(byteIndex, byteIndex + frameSize), - pts: timeStamp, - dts: timeStamp - }; - this.trigger('data', packet); - byteIndex += frameSize; - continue; - } - byteIndex++; - } - bytesLeft = everything.length - byteIndex; - - if (bytesLeft > 0) { - everything = everything.subarray(byteIndex); - } else { - everything = new Uint8Array(); - } - }; - - this.reset = function() { - everything = new Uint8Array(); - this.trigger('reset'); - }; - - this.endTimeline = function() { - everything = new Uint8Array(); - this.trigger('endedtimeline'); - }; -}; - -AacStream.prototype = new Stream(); - -module.exports = AacStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/utils.js deleted file mode 100644 index f95758f910..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/aac/utils.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about Aac data. - */ -'use strict'; - -var ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 -]; - -var parseId3TagSize = function(header, byteIndex) { - var - returnSize = (header[byteIndex + 6] << 21) | - (header[byteIndex + 7] << 14) | - (header[byteIndex + 8] << 7) | - (header[byteIndex + 9]), - flags = header[byteIndex + 5], - footerPresent = (flags & 16) >> 4; - - // if we get a negative returnSize clamp it to 0 - returnSize = returnSize >= 0 ? returnSize : 0; - - if (footerPresent) { - return returnSize + 20; - } - return returnSize + 10; -}; - -var getId3Offset = function(data, offset) { - if (data.length - offset < 10 || - data[offset] !== 'I'.charCodeAt(0) || - data[offset + 1] !== 'D'.charCodeAt(0) || - data[offset + 2] !== '3'.charCodeAt(0)) { - return offset; - } - - offset += parseId3TagSize(data, offset); - - return getId3Offset(data, offset); -}; - - -// TODO: use vhs-utils -var isLikelyAacData = function(data) { - var offset = getId3Offset(data, 0); - - return data.length >= offset + 2 && - (data[offset] & 0xFF) === 0xFF && - (data[offset + 1] & 0xF0) === 0xF0 && - // verify that the 2 layer bits are 0, aka this - // is not mp3 data but aac data. - (data[offset + 1] & 0x16) === 0x10; -}; - -var parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); -}; - -// return a percent-encoded representation of the specified byte range -// @see http://en.wikipedia.org/wiki/Percent-encoding -var percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; -}; - -// return the string representation of the specified byte range, -// interpreted as ISO-8859-1. -var parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line -}; - -var parseAdtsSize = function(header, byteIndex) { - var - lowThree = (header[byteIndex + 5] & 0xE0) >> 5, - middle = header[byteIndex + 4] << 3, - highTwo = header[byteIndex + 3] & 0x3 << 11; - - return (highTwo | middle) | lowThree; -}; - -var parseType = function(header, byteIndex) { - if ((header[byteIndex] === 'I'.charCodeAt(0)) && - (header[byteIndex + 1] === 'D'.charCodeAt(0)) && - (header[byteIndex + 2] === '3'.charCodeAt(0))) { - return 'timed-metadata'; - } else if ((header[byteIndex] & 0xff === 0xff) && - ((header[byteIndex + 1] & 0xf0) === 0xf0)) { - return 'audio'; - } - return null; -}; - -var parseSampleRate = function(packet) { - var i = 0; - - while (i + 5 < packet.length) { - if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) { - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2]; - } - - return null; -}; - -var parseAacTimestamp = function(packet) { - var frameStart, frameSize, frame, frameHeader; - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (packet[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(packet.subarray(10, 14)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - return null; - } - frameHeader = String.fromCharCode(packet[frameStart], - packet[frameStart + 1], - packet[frameStart + 2], - packet[frameStart + 3]); - - if (frameHeader === 'PRIV') { - frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10); - - for (var i = 0; i < frame.byteLength; i++) { - if (frame[i] === 0) { - var owner = parseIso88591(frame, 0, i); - if (owner === 'com.apple.streaming.transportStreamTimestamp') { - var d = frame.subarray(i + 1); - var size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - size *= 4; - size += d[7] & 0x03; - - return size; - } - break; - } - } - } - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < packet.byteLength); - return null; -}; - -module.exports = { - isLikelyAacData: isLikelyAacData, - parseId3TagSize: parseId3TagSize, - parseAdtsSize: parseAdtsSize, - parseType: parseType, - parseSampleRate: parseSampleRate, - parseAacTimestamp: parseAacTimestamp -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/adts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/adts.js deleted file mode 100644 index 4ba867805d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/adts.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var AdtsStream; - -var - ADTS_SAMPLING_FREQUENCIES = [ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350 - ]; - -/* - * Accepts a ElementaryStream and emits data events with parsed - * AAC Audio Frames of the individual packets. Input audio in ADTS - * format is unpacked and re-emitted as AAC frames. - * - * @see http://wiki.multimedia.cx/index.php?title=ADTS - * @see http://wiki.multimedia.cx/?title=Understanding_AAC - */ -AdtsStream = function(handlePartialSegments) { - var - buffer, - frameNum = 0; - - AdtsStream.prototype.init.call(this); - - this.skipWarn_ = function(start, end) { - this.trigger('log', { - level: 'warn', - message: `adts skiping bytes ${start} to ${end} in frame ${frameNum} outside syncword` - }); - }; - - this.push = function(packet) { - var - i = 0, - frameLength, - protectionSkipBytes, - frameEnd, - oldBuffer, - sampleCount, - adtsFrameDuration; - - if (!handlePartialSegments) { - frameNum = 0; - } - - if (packet.type !== 'audio') { - // ignore non-audio data - return; - } - - // Prepend any data in the buffer to the input data so that we can parse - // aac frames the cross a PES packet boundary - if (buffer && buffer.length) { - oldBuffer = buffer; - buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength); - buffer.set(oldBuffer); - buffer.set(packet.data, oldBuffer.byteLength); - } else { - buffer = packet.data; - } - - // unpack any ADTS frames which have been fully received - // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS - var skip; - - // We use i + 7 here because we want to be able to parse the entire header. - // If we don't have enough bytes to do that, then we definitely won't have a full frame. - while ((i + 7) < buffer.length) { - // Look for the start of an ADTS header.. - if ((buffer[i] !== 0xFF) || (buffer[i + 1] & 0xF6) !== 0xF0) { - if (typeof skip !== 'number') { - skip = i; - } - // If a valid header was not found, jump one forward and attempt to - // find a valid ADTS header starting at the next byte - i++; - continue; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } - - // The protection skip bit tells us if we have 2 bytes of CRC data at the - // end of the ADTS header - protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; - - // Frame length is a 13 bit integer starting 16 bits from the - // end of the sync sequence - // NOTE: frame length includes the size of the header - frameLength = ((buffer[i + 3] & 0x03) << 11) | - (buffer[i + 4] << 3) | - ((buffer[i + 5] & 0xe0) >> 5); - - sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024; - adtsFrameDuration = (sampleCount * ONE_SECOND_IN_TS) / - ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2]; - - // If we don't have enough data to actually finish this ADTS frame, - // then we have to wait for more data - if ((buffer.byteLength - i) < frameLength) { - break; - } - - // Otherwise, deliver the complete AAC frame - this.trigger('data', { - pts: packet.pts + (frameNum * adtsFrameDuration), - dts: packet.dts + (frameNum * adtsFrameDuration), - sampleCount: sampleCount, - audioobjecttype: ((buffer[i + 2] >>> 6) & 0x03) + 1, - channelcount: ((buffer[i + 2] & 1) << 2) | - ((buffer[i + 3] & 0xc0) >>> 6), - samplerate: ADTS_SAMPLING_FREQUENCIES[(buffer[i + 2] & 0x3c) >>> 2], - samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2, - // assume ISO/IEC 14496-12 AudioSampleEntry default of 16 - samplesize: 16, - // data is the frame without it's header - data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength) - }); - - frameNum++; - i += frameLength; - } - - if (typeof skip === 'number') { - this.skipWarn_(skip, i); - skip = null; - } - - // remove processed bytes from the buffer. - buffer = buffer.subarray(i); - }; - - this.flush = function() { - frameNum = 0; - this.trigger('done'); - }; - - this.reset = function() { - buffer = void 0; - this.trigger('reset'); - }; - - this.endTimeline = function() { - buffer = void 0; - this.trigger('endedtimeline'); - }; -}; - -AdtsStream.prototype = new Stream(); - -module.exports = AdtsStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/h264.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/h264.js deleted file mode 100644 index 47ff191548..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/h264.js +++ /dev/null @@ -1,489 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var ExpGolomb = require('../utils/exp-golomb.js'); - -var H264Stream, NalByteStream; -var PROFILES_WITH_OPTIONAL_SPS_DATA; - -/** - * Accepts a NAL unit byte stream and unpacks the embedded NAL units. - */ -NalByteStream = function() { - var - syncPoint = 0, - i, - buffer; - NalByteStream.prototype.init.call(this); - - /* - * Scans a byte stream and triggers a data event with the NAL units found. - * @param {Object} data Event received from H264Stream - * @param {Uint8Array} data.data The h264 byte stream to be scanned - * - * @see H264Stream.push - */ - this.push = function(data) { - var swapBuffer; - - if (!buffer) { - buffer = data.data; - } else { - swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength); - swapBuffer.set(buffer); - swapBuffer.set(data.data, buffer.byteLength); - buffer = swapBuffer; - } - var len = buffer.byteLength; - - // Rec. ITU-T H.264, Annex B - // scan for NAL unit boundaries - - // a match looks like this: - // 0 0 1 .. NAL .. 0 0 1 - // ^ sync point ^ i - // or this: - // 0 0 1 .. NAL .. 0 0 0 - // ^ sync point ^ i - - // advance the sync point to a NAL start, if necessary - for (; syncPoint < len - 3; syncPoint++) { - if (buffer[syncPoint + 2] === 1) { - // the sync point is properly aligned - i = syncPoint + 5; - break; - } - } - - while (i < len) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (buffer[i]) { - case 0: - // skip past non-sync sequences - if (buffer[i - 1] !== 0) { - i += 2; - break; - } else if (buffer[i - 2] !== 0) { - i++; - break; - } - - // deliver the NAL unit if it isn't empty - if (syncPoint + 3 !== i - 2) { - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - } - - // drop trailing zeroes - do { - i++; - } while (buffer[i] !== 1 && i < len); - syncPoint = i - 2; - i += 3; - break; - case 1: - // skip past non-sync sequences - if (buffer[i - 1] !== 0 || - buffer[i - 2] !== 0) { - i += 3; - break; - } - - // deliver the NAL unit - this.trigger('data', buffer.subarray(syncPoint + 3, i - 2)); - syncPoint = i - 2; - i += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - i += 3; - break; - } - } - // filter out the NAL units that were delivered - buffer = buffer.subarray(syncPoint); - i -= syncPoint; - syncPoint = 0; - }; - - this.reset = function() { - buffer = null; - syncPoint = 0; - this.trigger('reset'); - }; - - this.flush = function() { - // deliver the last buffered NAL unit - if (buffer && buffer.byteLength > 3) { - this.trigger('data', buffer.subarray(syncPoint + 3)); - } - // reset the stream state - buffer = null; - syncPoint = 0; - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; -}; -NalByteStream.prototype = new Stream(); - -// values of profile_idc that indicate additional fields are included in the SPS -// see Recommendation ITU-T H.264 (4/2013), -// 7.3.2.1.1 Sequence parameter set data syntax -PROFILES_WITH_OPTIONAL_SPS_DATA = { - 100: true, - 110: true, - 122: true, - 244: true, - 44: true, - 83: true, - 86: true, - 118: true, - 128: true, - - // TODO: the three profiles below don't - // appear to have sps data in the specificiation anymore? - 138: true, - 139: true, - 134: true -}; - -/** - * Accepts input from a ElementaryStream and produces H.264 NAL unit data - * events. - */ -H264Stream = function() { - var - nalByteStream = new NalByteStream(), - self, - trackId, - currentPts, - currentDts, - - discardEmulationPreventionBytes, - readSequenceParameterSet, - skipScalingList; - - H264Stream.prototype.init.call(this); - self = this; - - /* - * Pushes a packet from a stream onto the NalByteStream - * - * @param {Object} packet - A packet received from a stream - * @param {Uint8Array} packet.data - The raw bytes of the packet - * @param {Number} packet.dts - Decode timestamp of the packet - * @param {Number} packet.pts - Presentation timestamp of the packet - * @param {Number} packet.trackId - The id of the h264 track this packet came from - * @param {('video'|'audio')} packet.type - The type of packet - * - */ - this.push = function(packet) { - if (packet.type !== 'video') { - return; - } - trackId = packet.trackId; - currentPts = packet.pts; - currentDts = packet.dts; - - nalByteStream.push(packet); - }; - - /* - * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps - * for the NALUs to the next stream component. - * Also, preprocess caption and sequence parameter NALUs. - * - * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push` - * @see NalByteStream.push - */ - nalByteStream.on('data', function(data) { - var - event = { - trackId: trackId, - pts: currentPts, - dts: currentDts, - data: data, - nalUnitTypeCode: data[0] & 0x1f - }; - - switch (event.nalUnitTypeCode) { - case 0x05: - event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr'; - break; - case 0x06: - event.nalUnitType = 'sei_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - break; - case 0x07: - event.nalUnitType = 'seq_parameter_set_rbsp'; - event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1)); - event.config = readSequenceParameterSet(event.escapedRBSP); - break; - case 0x08: - event.nalUnitType = 'pic_parameter_set_rbsp'; - break; - case 0x09: - event.nalUnitType = 'access_unit_delimiter_rbsp'; - break; - default: - break; - } - // This triggers data on the H264Stream - self.trigger('data', event); - }); - nalByteStream.on('done', function() { - self.trigger('done'); - }); - nalByteStream.on('partialdone', function() { - self.trigger('partialdone'); - }); - nalByteStream.on('reset', function() { - self.trigger('reset'); - }); - nalByteStream.on('endedtimeline', function() { - self.trigger('endedtimeline'); - }); - - this.flush = function() { - nalByteStream.flush(); - }; - - this.partialFlush = function() { - nalByteStream.partialFlush(); - }; - - this.reset = function() { - nalByteStream.reset(); - }; - - this.endTimeline = function() { - nalByteStream.endTimeline(); - }; - - /** - * Advance the ExpGolomb decoder past a scaling list. The scaling - * list is optionally transmitted as part of a sequence parameter - * set and is not relevant to transmuxing. - * @param count {number} the number of entries in this scaling list - * @param expGolombDecoder {object} an ExpGolomb pointed to the - * start of a scaling list - * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1 - */ - skipScalingList = function(count, expGolombDecoder) { - var - lastScale = 8, - nextScale = 8, - j, - deltaScale; - - for (j = 0; j < count; j++) { - if (nextScale !== 0) { - deltaScale = expGolombDecoder.readExpGolomb(); - nextScale = (lastScale + deltaScale + 256) % 256; - } - - lastScale = (nextScale === 0) ? lastScale : nextScale; - } - }; - - /** - * Expunge any "Emulation Prevention" bytes from a "Raw Byte - * Sequence Payload" - * @param data {Uint8Array} the bytes of a RBSP from a NAL - * unit - * @return {Uint8Array} the RBSP without any Emulation - * Prevention Bytes - */ - discardEmulationPreventionBytes = function(data) { - var - length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, newData; - - // Find all `Emulation Prevention Bytes` - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (emulationPreventionBytesPositions.length === 0) { - return data; - } - - // Create a new array to hold the NAL unit data - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - emulationPreventionBytesPositions.shift(); - } - newData[i] = data[sourceIndex]; - } - - return newData; - }; - - /** - * Read a sequence parameter set and return some interesting video - * properties. A sequence parameter set is the H264 metadata that - * describes the properties of upcoming video frames. - * @param data {Uint8Array} the bytes of a sequence parameter set - * @return {object} an object with configuration parsed from the - * sequence parameter set, including the dimensions of the - * associated video frames. - */ - readSequenceParameterSet = function(data) { - var - frameCropLeftOffset = 0, - frameCropRightOffset = 0, - frameCropTopOffset = 0, - frameCropBottomOffset = 0, - sarScale = 1, - expGolombDecoder, profileIdc, levelIdc, profileCompatibility, - chromaFormatIdc, picOrderCntType, - numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, - picHeightInMapUnitsMinus1, - frameMbsOnlyFlag, - scalingListCount, - sarRatio = [1, 1], - aspectRatioIdc, - i; - - expGolombDecoder = new ExpGolomb(data); - profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc - profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag - levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8) - expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id - - // some profiles have more optional data we don't need - if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) { - chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb(); - if (chromaFormatIdc === 3) { - expGolombDecoder.skipBits(1); // separate_colour_plane_flag - } - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8 - expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8 - expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag - if (expGolombDecoder.readBoolean()) { // seq_scaling_matrix_present_flag - scalingListCount = (chromaFormatIdc !== 3) ? 8 : 12; - for (i = 0; i < scalingListCount; i++) { - if (expGolombDecoder.readBoolean()) { // seq_scaling_list_present_flag[ i ] - if (i < 6) { - skipScalingList(16, expGolombDecoder); - } else { - skipScalingList(64, expGolombDecoder); - } - } - } - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4 - picOrderCntType = expGolombDecoder.readUnsignedExpGolomb(); - - if (picOrderCntType === 0) { - expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4 - } else if (picOrderCntType === 1) { - expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag - expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic - expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field - numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb(); - for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) { - expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ] - } - } - - expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames - expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag - - picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb(); - - frameMbsOnlyFlag = expGolombDecoder.readBits(1); - if (frameMbsOnlyFlag === 0) { - expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag - } - - expGolombDecoder.skipBits(1); // direct_8x8_inference_flag - if (expGolombDecoder.readBoolean()) { // frame_cropping_flag - frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb(); - frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb(); - } - if (expGolombDecoder.readBoolean()) { - // vui_parameters_present_flag - if (expGolombDecoder.readBoolean()) { - // aspect_ratio_info_present_flag - aspectRatioIdc = expGolombDecoder.readUnsignedByte(); - switch (aspectRatioIdc) { - case 1: sarRatio = [1, 1]; break; - case 2: sarRatio = [12, 11]; break; - case 3: sarRatio = [10, 11]; break; - case 4: sarRatio = [16, 11]; break; - case 5: sarRatio = [40, 33]; break; - case 6: sarRatio = [24, 11]; break; - case 7: sarRatio = [20, 11]; break; - case 8: sarRatio = [32, 11]; break; - case 9: sarRatio = [80, 33]; break; - case 10: sarRatio = [18, 11]; break; - case 11: sarRatio = [15, 11]; break; - case 12: sarRatio = [64, 33]; break; - case 13: sarRatio = [160, 99]; break; - case 14: sarRatio = [4, 3]; break; - case 15: sarRatio = [3, 2]; break; - case 16: sarRatio = [2, 1]; break; - case 255: { - sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte(), - expGolombDecoder.readUnsignedByte() << 8 | - expGolombDecoder.readUnsignedByte() ]; - break; - } - } - if (sarRatio) { - sarScale = sarRatio[0] / sarRatio[1]; - } - } - } - return { - profileIdc: profileIdc, - levelIdc: levelIdc, - profileCompatibility: profileCompatibility, - width: (((picWidthInMbsMinus1 + 1) * 16) - frameCropLeftOffset * 2 - frameCropRightOffset * 2), - height: ((2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16) - (frameCropTopOffset * 2) - (frameCropBottomOffset * 2), - // sar is sample aspect ratio - sarRatio: sarRatio - }; - }; - -}; -H264Stream.prototype = new Stream(); - -module.exports = { - H264Stream: H264Stream, - NalByteStream: NalByteStream -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/index.js deleted file mode 100644 index 4e1da2177c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/codecs/index.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - Adts: require('./adts'), - h264: require('./h264') -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/audio-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/audio-properties.js deleted file mode 100644 index a87d9b780d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/audio-properties.js +++ /dev/null @@ -1,10 +0,0 @@ -// constants -var AUDIO_PROPERTIES = [ - 'audioobjecttype', - 'channelcount', - 'samplerate', - 'samplingfrequencyindex', - 'samplesize' -]; - -module.exports = AUDIO_PROPERTIES; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/video-properties.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/video-properties.js deleted file mode 100644 index f09b20e3fa..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/constants/video-properties.js +++ /dev/null @@ -1,11 +0,0 @@ -var VIDEO_PROPERTIES = [ - 'width', - 'height', - 'profileIdc', - 'levelIdc', - 'profileCompatibility', - 'sarRatio' -]; - - -module.exports = VIDEO_PROPERTIES; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/data/silence.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/data/silence.js deleted file mode 100644 index 74be1b4ce2..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/data/silence.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var highPrefix = [33, 16, 5, 32, 164, 27]; -var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252]; -var zeroFill = function(count) { - var a = []; - while (count--) { - a.push(0); - } - return a; -}; - -var makeTable = function(metaTable) { - return Object.keys(metaTable).reduce(function(obj, key) { - obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) { - return arr.concat(part); - }, [])); - return obj; - }, {}); -}; - - -var silence; - -module.exports = function() { - if (!silence) { - // Frames-of-silence to use for filling in missing AAC frames - var coneOfSilence = { - 96000: [highPrefix, [227, 64], zeroFill(154), [56]], - 88200: [highPrefix, [231], zeroFill(170), [56]], - 64000: [highPrefix, [248, 192], zeroFill(240), [56]], - 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]], - 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]], - 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]], - 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]], - 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]], - 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]], - 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]], - 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]] - }; - silence = makeTable(coneOfSilence); - } - return silence; -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/coalesce-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/coalesce-stream.js deleted file mode 100644 index 4ac9632b1b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/coalesce-stream.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); - -/** - * The final stage of the transmuxer that emits the flv tags - * for audio, video, and metadata. Also tranlates in time and - * outputs caption data and id3 cues. - */ -var CoalesceStream = function(options) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = options.metadataStream; - - this.videoTags = []; - this.audioTags = []; - this.videoTrack = null; - this.audioTrack = null; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingTracks = 0; - this.processedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.videoTags = output.tags; - this.pendingTracks++; - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.audioTags = output.tags; - this.pendingTracks++; - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - id3, - caption, - i, - timelineStartPts, - event = { - tags: {}, - captions: [], - captionStreams: {}, - metadata: [] - }; - - if (this.pendingTracks < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.pendingTracks === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.processedTracks++; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - } - } - - this.processedTracks += this.pendingTracks; - this.pendingTracks = 0; - - if (this.processedTracks < this.numberOfTracks) { - return; - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - } - - event.tags.videoTags = this.videoTags; - event.tags.audioTags = this.audioTags; - - // Translate caption PTS times into second offsets into the - // video timeline for the segment, and add track info - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = caption.startPts - timelineStartPts; - caption.startTime /= 90e3; - caption.endTime = caption.endPts - timelineStartPts; - caption.endTime /= 90e3; - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets into the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = id3.pts - timelineStartPts; - id3.cueTime /= 90e3; - event.metadata.push(id3); - } - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.videoTrack = null; - this.audioTrack = null; - this.videoTags = []; - this.audioTags = []; - this.pendingCaptions.length = 0; - this.pendingMetadata.length = 0; - this.pendingTracks = 0; - this.processedTracks = 0; - - // Emit the final segment - this.trigger('data', event); - - this.trigger('done'); -}; - -module.exports = CoalesceStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-header.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-header.js deleted file mode 100644 index 81eebb3258..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-header.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var FlvTag = require('./flv-tag.js'); - -// For information on the FLV format, see -// http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf. -// Technically, this function returns the header and a metadata FLV tag -// if duration is greater than zero -// duration in seconds -// @return {object} the bytes of the FLV header as a Uint8Array -var getFlvHeader = function(duration, audio, video) { // :ByteArray { - var - headBytes = new Uint8Array(3 + 1 + 1 + 4), - head = new DataView(headBytes.buffer), - metadata, - result, - metadataLength; - - // default arguments - duration = duration || 0; - audio = audio === undefined ? true : audio; - video = video === undefined ? true : video; - - // signature - head.setUint8(0, 0x46); // 'F' - head.setUint8(1, 0x4c); // 'L' - head.setUint8(2, 0x56); // 'V' - - // version - head.setUint8(3, 0x01); - - // flags - head.setUint8(4, (audio ? 0x04 : 0x00) | (video ? 0x01 : 0x00)); - - // data offset, should be 9 for FLV v1 - head.setUint32(5, headBytes.byteLength); - - // init the first FLV tag - if (duration <= 0) { - // no duration available so just write the first field of the first - // FLV tag - result = new Uint8Array(headBytes.byteLength + 4); - result.set(headBytes); - result.set([0, 0, 0, 0], headBytes.byteLength); - return result; - } - - // write out the duration metadata tag - metadata = new FlvTag(FlvTag.METADATA_TAG); - metadata.pts = metadata.dts = 0; - metadata.writeMetaDataDouble('duration', duration); - metadataLength = metadata.finalize().length; - result = new Uint8Array(headBytes.byteLength + metadataLength); - result.set(headBytes); - result.set(head.byteLength, metadataLength); - - return result; -}; - -module.exports = getFlvHeader; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-tag.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-tag.js deleted file mode 100644 index d5b0d64848..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/flv-tag.js +++ /dev/null @@ -1,377 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * An object that stores the bytes of an FLV tag and methods for - * querying and manipulating that data. - * @see http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - */ -'use strict'; - -var FlvTag; - -// (type:uint, extraData:Boolean = false) extends ByteArray -FlvTag = function(type, extraData) { - var - // Counter if this is a metadata tag, nal start marker if this is a video - // tag. unused if this is an audio tag - adHoc = 0, // :uint - - // The default size is 16kb but this is not enough to hold iframe - // data and the resizing algorithm costs a bit so we create a larger - // starting buffer for video tags - bufferStartSize = 16384, - - // checks whether the FLV tag has enough capacity to accept the proposed - // write and re-allocates the internal buffers if necessary - prepareWrite = function(flv, count) { - var - bytes, - minLength = flv.position + count; - if (minLength < flv.bytes.byteLength) { - // there's enough capacity so do nothing - return; - } - - // allocate a new buffer and copy over the data that will not be modified - bytes = new Uint8Array(minLength * 2); - bytes.set(flv.bytes.subarray(0, flv.position), 0); - flv.bytes = bytes; - flv.view = new DataView(flv.bytes.buffer); - }, - - // commonly used metadata properties - widthBytes = FlvTag.widthBytes || new Uint8Array('width'.length), - heightBytes = FlvTag.heightBytes || new Uint8Array('height'.length), - videocodecidBytes = FlvTag.videocodecidBytes || new Uint8Array('videocodecid'.length), - i; - - if (!FlvTag.widthBytes) { - // calculating the bytes of common metadata names ahead of time makes the - // corresponding writes faster because we don't have to loop over the - // characters - // re-test with test/perf.html if you're planning on changing this - for (i = 0; i < 'width'.length; i++) { - widthBytes[i] = 'width'.charCodeAt(i); - } - for (i = 0; i < 'height'.length; i++) { - heightBytes[i] = 'height'.charCodeAt(i); - } - for (i = 0; i < 'videocodecid'.length; i++) { - videocodecidBytes[i] = 'videocodecid'.charCodeAt(i); - } - - FlvTag.widthBytes = widthBytes; - FlvTag.heightBytes = heightBytes; - FlvTag.videocodecidBytes = videocodecidBytes; - } - - this.keyFrame = false; // :Boolean - - switch (type) { - case FlvTag.VIDEO_TAG: - this.length = 16; - // Start the buffer at 256k - bufferStartSize *= 6; - break; - case FlvTag.AUDIO_TAG: - this.length = 13; - this.keyFrame = true; - break; - case FlvTag.METADATA_TAG: - this.length = 29; - this.keyFrame = true; - break; - default: - throw new Error('Unknown FLV tag type'); - } - - this.bytes = new Uint8Array(bufferStartSize); - this.view = new DataView(this.bytes.buffer); - this.bytes[0] = type; - this.position = this.length; - this.keyFrame = extraData; // Defaults to false - - // presentation timestamp - this.pts = 0; - // decoder timestamp - this.dts = 0; - - // ByteArray#writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0) - this.writeBytes = function(bytes, offset, length) { - var - start = offset || 0, - end; - length = length || bytes.byteLength; - end = start + length; - - prepareWrite(this, length); - this.bytes.set(bytes.subarray(start, end), this.position); - - this.position += length; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeByte(value:int):void - this.writeByte = function(byte) { - prepareWrite(this, 1); - this.bytes[this.position] = byte; - this.position++; - this.length = Math.max(this.length, this.position); - }; - - // ByteArray#writeShort(value:int):void - this.writeShort = function(short) { - prepareWrite(this, 2); - this.view.setUint16(this.position, short); - this.position += 2; - this.length = Math.max(this.length, this.position); - }; - - // Negative index into array - // (pos:uint):int - this.negIndex = function(pos) { - return this.bytes[this.length - pos]; - }; - - // The functions below ONLY work when this[0] == VIDEO_TAG. - // We are not going to check for that because we dont want the overhead - // (nal:ByteArray = null):int - this.nalUnitSize = function() { - if (adHoc === 0) { - return 0; - } - - return this.length - (adHoc + 4); - }; - - this.startNalUnit = function() { - // remember position and add 4 bytes - if (adHoc > 0) { - throw new Error('Attempted to create new NAL wihout closing the old one'); - } - - // reserve 4 bytes for nal unit size - adHoc = this.length; - this.length += 4; - this.position = this.length; - }; - - // (nal:ByteArray = null):void - this.endNalUnit = function(nalContainer) { - var - nalStart, // :uint - nalLength; // :uint - - // Rewind to the marker and write the size - if (this.length === adHoc + 4) { - // we started a nal unit, but didnt write one, so roll back the 4 byte size value - this.length -= 4; - } else if (adHoc > 0) { - nalStart = adHoc + 4; - nalLength = this.length - nalStart; - - this.position = adHoc; - this.view.setUint32(this.position, nalLength); - this.position = this.length; - - if (nalContainer) { - // Add the tag to the NAL unit - nalContainer.push(this.bytes.subarray(nalStart, nalStart + nalLength)); - } - } - - adHoc = 0; - }; - - /** - * Write out a 64-bit floating point valued metadata property. This method is - * called frequently during a typical parse and needs to be fast. - */ - // (key:String, val:Number):void - this.writeMetaDataDouble = function(key, val) { - var i; - prepareWrite(this, 2 + key.length + 9); - - // write size of property name - this.view.setUint16(this.position, key.length); - this.position += 2; - - // this next part looks terrible but it improves parser throughput by - // 10kB/s in my testing - - // write property name - if (key === 'width') { - this.bytes.set(widthBytes, this.position); - this.position += 5; - } else if (key === 'height') { - this.bytes.set(heightBytes, this.position); - this.position += 6; - } else if (key === 'videocodecid') { - this.bytes.set(videocodecidBytes, this.position); - this.position += 12; - } else { - for (i = 0; i < key.length; i++) { - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - } - - // skip null byte - this.position++; - - // write property value - this.view.setFloat64(this.position, val); - this.position += 8; - - // update flv tag length - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // (key:String, val:Boolean):void - this.writeMetaDataBoolean = function(key, val) { - var i; - prepareWrite(this, 2); - this.view.setUint16(this.position, key.length); - this.position += 2; - for (i = 0; i < key.length; i++) { - // if key.charCodeAt(i) >= 255, handle error - prepareWrite(this, 1); - this.bytes[this.position] = key.charCodeAt(i); - this.position++; - } - prepareWrite(this, 2); - this.view.setUint8(this.position, 0x01); - this.position++; - this.view.setUint8(this.position, val ? 0x01 : 0x00); - this.position++; - this.length = Math.max(this.length, this.position); - ++adHoc; - }; - - // ():ByteArray - this.finalize = function() { - var - dtsDelta, // :int - len; // :int - - switch (this.bytes[0]) { - // Video Data - case FlvTag.VIDEO_TAG: - // We only support AVC, 1 = key frame (for AVC, a seekable - // frame), 2 = inter frame (for AVC, a non-seekable frame) - this.bytes[11] = ((this.keyFrame || extraData) ? 0x10 : 0x20) | 0x07; - this.bytes[12] = extraData ? 0x00 : 0x01; - - dtsDelta = this.pts - this.dts; - this.bytes[13] = (dtsDelta & 0x00FF0000) >>> 16; - this.bytes[14] = (dtsDelta & 0x0000FF00) >>> 8; - this.bytes[15] = (dtsDelta & 0x000000FF) >>> 0; - break; - - case FlvTag.AUDIO_TAG: - this.bytes[11] = 0xAF; // 44 kHz, 16-bit stereo - this.bytes[12] = extraData ? 0x00 : 0x01; - break; - - case FlvTag.METADATA_TAG: - this.position = 11; - this.view.setUint8(this.position, 0x02); // String type - this.position++; - this.view.setUint16(this.position, 0x0A); // 10 Bytes - this.position += 2; - // set "onMetaData" - this.bytes.set([0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x61, 0x44, 0x61, - 0x74, 0x61], this.position); - this.position += 10; - this.bytes[this.position] = 0x08; // Array type - this.position++; - this.view.setUint32(this.position, adHoc); - this.position = this.length; - this.bytes.set([0, 0, 9], this.position); - this.position += 3; // End Data Tag - this.length = this.position; - break; - } - - len = this.length - 11; - - // write the DataSize field - this.bytes[ 1] = (len & 0x00FF0000) >>> 16; - this.bytes[ 2] = (len & 0x0000FF00) >>> 8; - this.bytes[ 3] = (len & 0x000000FF) >>> 0; - // write the Timestamp - this.bytes[ 4] = (this.dts & 0x00FF0000) >>> 16; - this.bytes[ 5] = (this.dts & 0x0000FF00) >>> 8; - this.bytes[ 6] = (this.dts & 0x000000FF) >>> 0; - this.bytes[ 7] = (this.dts & 0xFF000000) >>> 24; - // write the StreamID - this.bytes[ 8] = 0; - this.bytes[ 9] = 0; - this.bytes[10] = 0; - - // Sometimes we're at the end of the view and have one slot to write a - // uint32, so, prepareWrite of count 4, since, view is uint8 - prepareWrite(this, 4); - this.view.setUint32(this.length, this.length); - this.length += 4; - this.position += 4; - - // trim down the byte buffer to what is actually being used - this.bytes = this.bytes.subarray(0, this.length); - this.frameTime = FlvTag.frameTime(this.bytes); - // if bytes.bytelength isn't equal to this.length, handle error - return this; - }; -}; - -FlvTag.AUDIO_TAG = 0x08; // == 8, :uint -FlvTag.VIDEO_TAG = 0x09; // == 9, :uint -FlvTag.METADATA_TAG = 0x12; // == 18, :uint - -// (tag:ByteArray):Boolean { -FlvTag.isAudioFrame = function(tag) { - return FlvTag.AUDIO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isVideoFrame = function(tag) { - return FlvTag.VIDEO_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isMetaData = function(tag) { - return FlvTag.METADATA_TAG === tag[0]; -}; - -// (tag:ByteArray):Boolean { -FlvTag.isKeyFrame = function(tag) { - if (FlvTag.isVideoFrame(tag)) { - return tag[11] === 0x17; - } - - if (FlvTag.isAudioFrame(tag)) { - return true; - } - - if (FlvTag.isMetaData(tag)) { - return true; - } - - return false; -}; - -// (tag:ByteArray):uint { -FlvTag.frameTime = function(tag) { - var pts = tag[ 4] << 16; // :uint - pts |= tag[ 5] << 8; - pts |= tag[ 6] << 0; - pts |= tag[ 7] << 24; - return pts; -}; - -module.exports = FlvTag; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/index.js deleted file mode 100644 index 9cfbaf5c68..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - tag: require('./flv-tag'), - Transmuxer: require('./transmuxer'), - getFlvHeader: require('./flv-header') -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/tag-list.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/tag-list.js deleted file mode 100644 index 5b83cde6bf..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/tag-list.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var TagList = function() { - var self = this; - - this.list = []; - - this.push = function(tag) { - this.list.push({ - bytes: tag.bytes, - dts: tag.dts, - pts: tag.pts, - keyFrame: tag.keyFrame, - metaDataTag: tag.metaDataTag - }); - }; - - Object.defineProperty(this, 'length', { - get: function() { - return self.list.length; - } - }); -}; - -module.exports = TagList; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/transmuxer.js deleted file mode 100644 index 4a8a85dad4..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/flv/transmuxer.js +++ /dev/null @@ -1,453 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var FlvTag = require('./flv-tag.js'); -var m2ts = require('../m2ts/m2ts.js'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var CoalesceStream = require('./coalesce-stream.js'); -var TagList = require('./tag-list.js'); - -var - Transmuxer, - VideoSegmentStream, - AudioSegmentStream, - collectTimelineInfo, - metaDataTag, - extraDataTag; - -/** - * Store information about the start and end of the tracka and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -collectTimelineInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } else { - track.timelineStartInfo.pts = - Math.min(track.timelineStartInfo.pts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } else { - track.timelineStartInfo.dts = - Math.min(track.timelineStartInfo.dts, data.dts); - } - } -}; - -metaDataTag = function(track, pts) { - var - tag = new FlvTag(FlvTag.METADATA_TAG); // :FlvTag - - tag.dts = pts; - tag.pts = pts; - - tag.writeMetaDataDouble('videocodecid', 7); - tag.writeMetaDataDouble('width', track.width); - tag.writeMetaDataDouble('height', track.height); - - return tag; -}; - -extraDataTag = function(track, pts) { - var - i, - tag = new FlvTag(FlvTag.VIDEO_TAG, true); - - tag.dts = pts; - tag.pts = pts; - - tag.writeByte(0x01);// version - tag.writeByte(track.profileIdc);// profile - tag.writeByte(track.profileCompatibility);// compatibility - tag.writeByte(track.levelIdc);// level - tag.writeByte(0xFC | 0x03); // reserved (6 bits), NULA length size - 1 (2 bits) - tag.writeByte(0xE0 | 0x01); // reserved (3 bits), num of SPS (5 bits) - tag.writeShort(track.sps[0].length); // data of SPS - tag.writeBytes(track.sps[0]); // SPS - - tag.writeByte(track.pps.length); // num of PPS (will there ever be more that 1 PPS?) - for (i = 0; i < track.pps.length; ++i) { - tag.writeShort(track.pps[i].length); // 2 bytes for length of PPS - tag.writeBytes(track.pps[i]); // data of PPS - } - - return tag; -}; - -/** - * Constructs a single-track, media segment from AAC data - * events. The output of this stream can be fed to flash. - */ -AudioSegmentStream = function(track) { - var - adtsFrames = [], - videoKeyFrames = [], - oldExtraData; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - collectTimelineInfo(track, data); - - if (track) { - track.audioobjecttype = data.audioobjecttype; - track.channelcount = data.channelcount; - track.samplerate = data.samplerate; - track.samplingfrequencyindex = data.samplingfrequencyindex; - track.samplesize = data.samplesize; - track.extraData = (track.audioobjecttype << 11) | - (track.samplingfrequencyindex << 7) | - (track.channelcount << 3); - } - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.flush = function() { - var currentFrame, adtsFrame, lastMetaPts, tags = new TagList(); - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - lastMetaPts = -Infinity; - - while (adtsFrames.length) { - currentFrame = adtsFrames.shift(); - - // write out a metadata frame at every video key frame - if (videoKeyFrames.length && currentFrame.pts >= videoKeyFrames[0]) { - lastMetaPts = videoKeyFrames.shift(); - this.writeMetaDataTags(tags, lastMetaPts); - } - - // also write out metadata tags every 1 second so that the decoder - // is re-initialized quickly after seeking into a different - // audio configuration. - if (track.extraData !== oldExtraData || currentFrame.pts - lastMetaPts >= 1000) { - this.writeMetaDataTags(tags, currentFrame.pts); - oldExtraData = track.extraData; - lastMetaPts = currentFrame.pts; - } - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG); - adtsFrame.pts = currentFrame.pts; - adtsFrame.dts = currentFrame.dts; - - adtsFrame.writeBytes(currentFrame.data); - - tags.push(adtsFrame.finalize()); - } - - videoKeyFrames.length = 0; - oldExtraData = null; - this.trigger('data', {track: track, tags: tags.list}); - - this.trigger('done', 'AudioSegmentStream'); - }; - - this.writeMetaDataTags = function(tags, pts) { - var adtsFrame; - - adtsFrame = new FlvTag(FlvTag.METADATA_TAG); - // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - adtsFrame.pts = pts; - adtsFrame.dts = pts; - - // AAC is always 10 - adtsFrame.writeMetaDataDouble('audiocodecid', 10); - adtsFrame.writeMetaDataBoolean('stereo', track.channelcount === 2); - adtsFrame.writeMetaDataDouble('audiosamplerate', track.samplerate); - // Is AAC always 16 bit? - adtsFrame.writeMetaDataDouble('audiosamplesize', 16); - - tags.push(adtsFrame.finalize()); - - adtsFrame = new FlvTag(FlvTag.AUDIO_TAG, true); - // For audio, DTS is always the same as PTS. We want to set the DTS - // however so we can compare with video DTS to determine approximate - // packet order - adtsFrame.pts = pts; - adtsFrame.dts = pts; - - adtsFrame.view.setUint16(adtsFrame.position, track.extraData); - adtsFrame.position += 2; - adtsFrame.length = Math.max(adtsFrame.length, adtsFrame.position); - - tags.push(adtsFrame.finalize()); - }; - - this.onVideoKeyFrame = function(pts) { - videoKeyFrames.push(pts); - }; -}; -AudioSegmentStream.prototype = new Stream(); - -/** - * Store FlvTags for the h264 stream - * @param track {object} track metadata configuration - */ -VideoSegmentStream = function(track) { - var - nalUnits = [], - config, - h264Frame; - VideoSegmentStream.prototype.init.call(this); - - this.finishFrame = function(tags, frame) { - if (!frame) { - return; - } - // Check if keyframe and the length of tags. - // This makes sure we write metadata on the first frame of a segment. - if (config && track && track.newMetadata && - (frame.keyFrame || tags.length === 0)) { - // Push extra data on every IDR frame in case we did a stream change + seek - var metaTag = metaDataTag(config, frame.dts).finalize(); - var extraTag = extraDataTag(track, frame.dts).finalize(); - - metaTag.metaDataTag = extraTag.metaDataTag = true; - - tags.push(metaTag); - tags.push(extraTag); - track.newMetadata = false; - - this.trigger('keyframe', frame.dts); - } - - frame.endNalUnit(); - tags.push(frame.finalize()); - h264Frame = null; - }; - - this.push = function(data) { - collectTimelineInfo(track, data); - - data.pts = Math.round(data.pts / 90); - data.dts = Math.round(data.dts / 90); - - // buffer video until flush() is called - nalUnits.push(data); - }; - - this.flush = function() { - var - currentNal, - tags = new TagList(); - - // Throw away nalUnits at the start of the byte stream until we find - // the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // return early if no video data has been observed - if (nalUnits.length === 0) { - this.trigger('done', 'VideoSegmentStream'); - return; - } - - while (nalUnits.length) { - currentNal = nalUnits.shift(); - - // record the track config - if (currentNal.nalUnitType === 'seq_parameter_set_rbsp') { - track.newMetadata = true; - config = currentNal.config; - track.width = config.width; - track.height = config.height; - track.sps = [currentNal.data]; - track.profileIdc = config.profileIdc; - track.levelIdc = config.levelIdc; - track.profileCompatibility = config.profileCompatibility; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'pic_parameter_set_rbsp') { - track.newMetadata = true; - track.pps = [currentNal.data]; - h264Frame.endNalUnit(); - } else if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - h264Frame = new FlvTag(FlvTag.VIDEO_TAG); - h264Frame.pts = currentNal.pts; - h264Frame.dts = currentNal.dts; - } else { - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - // the current sample is a key frame - h264Frame.keyFrame = true; - } - h264Frame.endNalUnit(); - } - h264Frame.startNalUnit(); - h264Frame.writeBytes(currentNal.data); - } - if (h264Frame) { - this.finishFrame(tags, h264Frame); - } - - this.trigger('data', {track: track, tags: tags.list}); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * An object that incrementally transmuxes MPEG2 Trasport Stream - * chunks into an FLV. - */ -Transmuxer = function(options) { - var - self = this, - - packetStream, parseStream, elementaryStream, - videoTimestampRolloverStream, audioTimestampRolloverStream, - timedMetadataTimestampRolloverStream, - adtsStream, h264Stream, - videoSegmentStream, audioSegmentStream, captionStream, - coalesceStream; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - - // expose the metadata stream - this.metadataStream = new m2ts.MetadataStream(); - - options.metadataStream = this.metadataStream; - - // set up the parsing pipeline - packetStream = new m2ts.TransportPacketStream(); - parseStream = new m2ts.TransportParseStream(); - elementaryStream = new m2ts.ElementaryStream(); - videoTimestampRolloverStream = new m2ts.TimestampRolloverStream('video'); - audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - - adtsStream = new AdtsStream(); - h264Stream = new H264Stream(); - coalesceStream = new CoalesceStream(options); - - // disassemble MPEG2-TS packets into elementary streams - packetStream - .pipe(parseStream) - .pipe(elementaryStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - elementaryStream - .pipe(videoTimestampRolloverStream) - .pipe(h264Stream); - elementaryStream - .pipe(audioTimestampRolloverStream) - .pipe(adtsStream); - - elementaryStream - .pipe(timedMetadataTimestampRolloverStream) - .pipe(this.metadataStream) - .pipe(coalesceStream); - // if CEA-708 parsing is available, hook up a caption stream - captionStream = new m2ts.CaptionStream(options); - h264Stream.pipe(captionStream) - .pipe(coalesceStream); - - // hook up the segment streams once track metadata is delivered - elementaryStream.on('data', function(data) { - var i, videoTrack, audioTrack; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - } else if (data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !videoSegmentStream) { - coalesceStream.numberOfTracks++; - videoSegmentStream = new VideoSegmentStream(videoTrack); - - // Set up the final part of the video pipeline - h264Stream - .pipe(videoSegmentStream) - .pipe(coalesceStream); - } - - if (audioTrack && !audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - coalesceStream.numberOfTracks++; - audioSegmentStream = new AudioSegmentStream(audioTrack); - - // Set up the final part of the audio pipeline - adtsStream - .pipe(audioSegmentStream) - .pipe(coalesceStream); - - if (videoSegmentStream) { - videoSegmentStream.on('keyframe', audioSegmentStream.onVideoKeyFrame); - } - } - } - }); - - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - packetStream.push(data); - }; - - // flush any buffered data - this.flush = function() { - // Start at the top of the pipeline and flush all pending work - packetStream.flush(); - }; - - // Caption data has to be reset when seeking outside buffered range - this.resetCaptions = function() { - captionStream.reset(); - }; - - // Re-emit any data coming from the coalesce stream to the outside world - coalesceStream.on('data', function(event) { - self.trigger('data', event); - }); - - // Let the consumer know we have finished flushing the entire pipeline - coalesceStream.on('done', function() { - self.trigger('done'); - }); -}; -Transmuxer.prototype = new Stream(); - -// forward compatibility -module.exports = Transmuxer; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/index.js deleted file mode 100644 index 4f3fe20d33..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var muxjs = { - codecs: require('./codecs'), - mp4: require('./mp4'), - flv: require('./flv'), - mp2t: require('./m2ts'), - partial: require('./partial') -}; - -// include all the tools when the full library is required -muxjs.mp4.tools = require('./tools/mp4-inspector'); -muxjs.flv.tools = require('./tools/flv-inspector'); -muxjs.mp2t.tools = require('./tools/ts-inspector'); - - -module.exports = muxjs; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/caption-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/caption-stream.js deleted file mode 100644 index ef63334904..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/caption-stream.js +++ /dev/null @@ -1,1800 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - -'use strict'; - -// ----------------- -// Link To Transport -// ----------------- - -var Stream = require('../utils/stream'); -var cea708Parser = require('../tools/caption-packet-parser'); - -var CaptionStream = function(options) { - options = options || {}; - - CaptionStream.prototype.init.call(this); - - // parse708captions flag, default to true - this.parse708captions_ = typeof options.parse708captions === 'boolean' ? - options.parse708captions : - true; - - this.captionPackets_ = []; - - this.ccStreams_ = [ - new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define - new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define - ]; - - if (this.parse708captions_) { - this.cc708Stream_ = new Cea708Stream({captionServices: options.captionServices}); // eslint-disable-line no-use-before-define - } - - this.reset(); - - // forward data and done events from CCs to this CaptionStream - this.ccStreams_.forEach(function(cc) { - cc.on('data', this.trigger.bind(this, 'data')); - cc.on('partialdone', this.trigger.bind(this, 'partialdone')); - cc.on('done', this.trigger.bind(this, 'done')); - }, this); - - if (this.parse708captions_) { - this.cc708Stream_.on('data', this.trigger.bind(this, 'data')); - this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone')); - this.cc708Stream_.on('done', this.trigger.bind(this, 'done')); - } - -}; - -CaptionStream.prototype = new Stream(); -CaptionStream.prototype.push = function(event) { - var sei, userData, newCaptionPackets; - - // only examine SEI NALs - if (event.nalUnitType !== 'sei_rbsp') { - return; - } - - // parse the sei - sei = cea708Parser.parseSei(event.escapedRBSP); - - // no payload data, skip - if (!sei.payload) { - return; - } - - // ignore everything but user_data_registered_itu_t_t35 - if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) { - return; - } - - // parse out the user data payload - userData = cea708Parser.parseUserData(sei); - - // ignore unrecognized userData - if (!userData) { - return; - } - - // Sometimes, the same segment # will be downloaded twice. To stop the - // caption data from being processed twice, we track the latest dts we've - // received and ignore everything with a dts before that. However, since - // data for a specific dts can be split across packets on either side of - // a segment boundary, we need to make sure we *don't* ignore the packets - // from the *next* segment that have dts === this.latestDts_. By constantly - // tracking the number of packets received with dts === this.latestDts_, we - // know how many should be ignored once we start receiving duplicates. - if (event.dts < this.latestDts_) { - // We've started getting older data, so set the flag. - this.ignoreNextEqualDts_ = true; - return; - } else if ((event.dts === this.latestDts_) && (this.ignoreNextEqualDts_)) { - this.numSameDts_--; - if (!this.numSameDts_) { - // We've received the last duplicate packet, time to start processing again - this.ignoreNextEqualDts_ = false; - } - return; - } - - // parse out CC data packets and save them for later - newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData); - this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets); - if (this.latestDts_ !== event.dts) { - this.numSameDts_ = 0; - } - this.numSameDts_++; - this.latestDts_ = event.dts; -}; - -CaptionStream.prototype.flushCCStreams = function(flushType) { - this.ccStreams_.forEach(function(cc) { - return flushType === 'flush' ? cc.flush() : cc.partialFlush(); - }, this); -}; - -CaptionStream.prototype.flushStream = function(flushType) { - // make sure we actually parsed captions before proceeding - if (!this.captionPackets_.length) { - this.flushCCStreams(flushType); - return; - } - - // In Chrome, the Array#sort function is not stable so add a - // presortIndex that we can use to ensure we get a stable-sort - this.captionPackets_.forEach(function(elem, idx) { - elem.presortIndex = idx; - }); - - // sort caption byte-pairs based on their PTS values - this.captionPackets_.sort(function(a, b) { - if (a.pts === b.pts) { - return a.presortIndex - b.presortIndex; - } - return a.pts - b.pts; - }); - - this.captionPackets_.forEach(function(packet) { - if (packet.type < 2) { - // Dispatch packet to the right Cea608Stream - this.dispatchCea608Packet(packet); - } else { - // Dispatch packet to the Cea708Stream - this.dispatchCea708Packet(packet); - } - }, this); - - this.captionPackets_.length = 0; - this.flushCCStreams(flushType); -}; - -CaptionStream.prototype.flush = function() { - return this.flushStream('flush'); -}; - -// Only called if handling partial data -CaptionStream.prototype.partialFlush = function() { - return this.flushStream('partialFlush'); -}; - -CaptionStream.prototype.reset = function() { - this.latestDts_ = null; - this.ignoreNextEqualDts_ = false; - this.numSameDts_ = 0; - this.activeCea608Channel_ = [null, null]; - this.ccStreams_.forEach(function(ccStream) { - ccStream.reset(); - }); -}; - -// From the CEA-608 spec: -/* - * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed - * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is - * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair - * and subsequent data should then be processed according to the FCC rules. It may be necessary for the - * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD) - * to switch to captioning or Text. -*/ -// With that in mind, we ignore any data between an XDS control code and a -// subsequent closed-captioning control code. -CaptionStream.prototype.dispatchCea608Packet = function(packet) { - // NOTE: packet.type is the CEA608 field - if (this.setsTextOrXDSActive(packet)) { - this.activeCea608Channel_[packet.type] = null; - } else if (this.setsChannel1Active(packet)) { - this.activeCea608Channel_[packet.type] = 0; - } else if (this.setsChannel2Active(packet)) { - this.activeCea608Channel_[packet.type] = 1; - } - if (this.activeCea608Channel_[packet.type] === null) { - // If we haven't received anything to set the active channel, or the - // packets are Text/XDS data, discard the data; we don't want jumbled - // captions - return; - } - this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet); -}; - -CaptionStream.prototype.setsChannel1Active = function(packet) { - return ((packet.ccData & 0x7800) === 0x1000); -}; -CaptionStream.prototype.setsChannel2Active = function(packet) { - return ((packet.ccData & 0x7800) === 0x1800); -}; -CaptionStream.prototype.setsTextOrXDSActive = function(packet) { - return ((packet.ccData & 0x7100) === 0x0100) || - ((packet.ccData & 0x78fe) === 0x102a) || - ((packet.ccData & 0x78fe) === 0x182a); -}; - -CaptionStream.prototype.dispatchCea708Packet = function(packet) { - if (this.parse708captions_) { - this.cc708Stream_.push(packet); - } -}; - - -// ---------------------- -// Session to Application -// ---------------------- - -// This hash maps special and extended character codes to their -// proper Unicode equivalent. The first one-byte key is just a -// non-standard character code. The two-byte keys that follow are -// the extended CEA708 character codes, along with the preceding -// 0x10 extended character byte to distinguish these codes from -// non-extended character codes. Every CEA708 character code that -// is not in this object maps directly to a standard unicode -// character code. -// The transparent space and non-breaking transparent space are -// technically not fully supported since there is no code to -// make them transparent, so they have normal non-transparent -// stand-ins. -// The special closed caption (CC) character isn't a standard -// unicode character, so a fairly similar unicode character was -// chosen in it's place. -var CHARACTER_TRANSLATION_708 = { - 0x7f: 0x266a, // ♪ - 0x1020: 0x20, // Transparent Space - 0x1021: 0xa0, // Nob-breaking Transparent Space - 0x1025: 0x2026, // … - 0x102a: 0x0160, // Š - 0x102c: 0x0152, // Œ - 0x1030: 0x2588, // █ - 0x1031: 0x2018, // ‘ - 0x1032: 0x2019, // ’ - 0x1033: 0x201c, // “ - 0x1034: 0x201d, // ” - 0x1035: 0x2022, // • - 0x1039: 0x2122, // ™ - 0x103a: 0x0161, // š - 0x103c: 0x0153, // œ - 0x103d: 0x2120, // ℠ - 0x103f: 0x0178, // Ÿ - 0x1076: 0x215b, // ⅛ - 0x1077: 0x215c, // ⅜ - 0x1078: 0x215d, // ⅝ - 0x1079: 0x215e, // ⅞ - 0x107a: 0x23d0, // ⏐ - 0x107b: 0x23a4, // ⎤ - 0x107c: 0x23a3, // ⎣ - 0x107d: 0x23af, // ⎯ - 0x107e: 0x23a6, // ⎦ - 0x107f: 0x23a1, // ⎡ - 0x10a0: 0x3138 // ㄸ (CC char) -}; - -var get708CharFromCode = function(code) { - var newCode = CHARACTER_TRANSLATION_708[code] || code; - - if ((code & 0x1000) && code === newCode) { - // Invalid extended code - return ''; - } - return String.fromCharCode(newCode); -}; - -var within708TextBlock = function(b) { - return (0x20 <= b && b <= 0x7f) || (0xa0 <= b && b <= 0xff); -}; - -var Cea708Window = function(windowNum) { - this.windowNum = windowNum; - this.reset(); -}; - -Cea708Window.prototype.reset = function() { - this.clearText(); - this.pendingNewLine = false; - this.winAttr = {}; - this.penAttr = {}; - this.penLoc = {}; - this.penColor = {}; - - // These default values are arbitrary, - // defineWindow will usually override them - this.visible = 0; - this.rowLock = 0; - this.columnLock = 0; - this.priority = 0; - this.relativePositioning = 0; - this.anchorVertical = 0; - this.anchorHorizontal = 0; - this.anchorPoint = 0; - this.rowCount = 1; - this.virtualRowCount = this.rowCount + 1; - this.columnCount = 41; - this.windowStyle = 0; - this.penStyle = 0; -}; - -Cea708Window.prototype.getText = function() { - return this.rows.join('\n'); -}; - -Cea708Window.prototype.clearText = function() { - this.rows = ['']; - this.rowIdx = 0; -}; - -Cea708Window.prototype.newLine = function(pts) { - if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') { - this.beforeRowOverflow(pts); - } - - if (this.rows.length > 0) { - this.rows.push(''); - this.rowIdx++; - } - - // Show all virtual rows since there's no visible scrolling - while (this.rows.length > this.virtualRowCount) { - this.rows.shift(); - this.rowIdx--; - } -}; - -Cea708Window.prototype.isEmpty = function() { - if (this.rows.length === 0) { - return true; - } else if (this.rows.length === 1) { - return this.rows[0] === ''; - } - - return false; -}; - -Cea708Window.prototype.addText = function(text) { - this.rows[this.rowIdx] += text; -}; - -Cea708Window.prototype.backspace = function() { - if (!this.isEmpty()) { - var row = this.rows[this.rowIdx]; - - this.rows[this.rowIdx] = row.substr(0, row.length - 1); - } -}; - -var Cea708Service = function(serviceNum, encoding, stream) { - this.serviceNum = serviceNum; - this.text = ''; - this.currentWindow = new Cea708Window(-1); - this.windows = []; - this.stream = stream; - - // Try to setup a TextDecoder if an `encoding` value was provided - if (typeof encoding === 'string') { - this.createTextDecoder(encoding); - } -}; - -/** - * Initialize service windows - * Must be run before service use - * - * @param {Integer} pts PTS value - * @param {Function} beforeRowOverflow Function to execute before row overflow of a window - */ -Cea708Service.prototype.init = function(pts, beforeRowOverflow) { - this.startPts = pts; - - for (var win = 0; win < 8; win++) { - this.windows[win] = new Cea708Window(win); - - if (typeof beforeRowOverflow === 'function') { - this.windows[win].beforeRowOverflow = beforeRowOverflow; - } - } -}; - -/** - * Set current window of service to be affected by commands - * - * @param {Integer} windowNum Window number - */ -Cea708Service.prototype.setCurrentWindow = function(windowNum) { - this.currentWindow = this.windows[windowNum]; -}; - -/** - * Try to create a TextDecoder if it is natively supported - */ -Cea708Service.prototype.createTextDecoder = function(encoding) { - if (typeof TextDecoder === 'undefined') { - this.stream.trigger('log', { - level: 'warn', - message: 'The `encoding` option is unsupported without TextDecoder support' - }); - } else { - try { - this.textDecoder_ = new TextDecoder(encoding); - } catch (error) { - this.stream.trigger('log', { - level: 'warn', - message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error - }); - } - } -} - -var Cea708Stream = function(options) { - options = options || {}; - Cea708Stream.prototype.init.call(this); - - var self = this; - var captionServices = options.captionServices || {}; - var captionServiceEncodings = {}; - var serviceProps; - - // Get service encodings from captionServices option block - Object.keys(captionServices).forEach(serviceName => { - serviceProps = captionServices[serviceName]; - - if (/^SERVICE/.test(serviceName)) { - captionServiceEncodings[serviceName] = serviceProps.encoding; - } - }); - - this.serviceEncodings = captionServiceEncodings; - this.current708Packet = null; - this.services = {}; - - this.push = function(packet) { - if (packet.type === 3) { - // 708 packet start - self.new708Packet(); - self.add708Bytes(packet); - } else { - if (self.current708Packet === null) { - // This should only happen at the start of a file if there's no packet start. - self.new708Packet(); - } - - self.add708Bytes(packet); - } - }; -}; -Cea708Stream.prototype = new Stream(); - -/** - * Push current 708 packet, create new 708 packet. - */ -Cea708Stream.prototype.new708Packet = function() { - if (this.current708Packet !== null) { - this.push708Packet(); - } - - this.current708Packet = { - data: [], - ptsVals: [] - }; -}; - -/** - * Add pts and both bytes from packet into current 708 packet. - */ -Cea708Stream.prototype.add708Bytes = function(packet) { - var data = packet.ccData; - var byte0 = data >>> 8; - var byte1 = data & 0xff; - - // I would just keep a list of packets instead of bytes, but it isn't clear in the spec - // that service blocks will always line up with byte pairs. - this.current708Packet.ptsVals.push(packet.pts); - this.current708Packet.data.push(byte0); - this.current708Packet.data.push(byte1); -}; - -/** - * Parse completed 708 packet into service blocks and push each service block. - */ -Cea708Stream.prototype.push708Packet = function() { - var packet708 = this.current708Packet; - var packetData = packet708.data; - var serviceNum = null; - var blockSize = null; - var i = 0; - var b = packetData[i++]; - - packet708.seq = b >> 6; - packet708.sizeCode = b & 0x3f; // 0b00111111; - - for (; i < packetData.length; i++) { - b = packetData[i++]; - serviceNum = b >> 5; - blockSize = b & 0x1f; // 0b00011111 - - if (serviceNum === 7 && blockSize > 0) { - // Extended service num - b = packetData[i++]; - serviceNum = b; - } - - this.pushServiceBlock(serviceNum, i, blockSize); - - if (blockSize > 0) { - i += blockSize - 1; - } - } -}; - -/** - * Parse service block, execute commands, read text. - * - * Note: While many of these commands serve important purposes, - * many others just parse out the parameters or attributes, but - * nothing is done with them because this is not a full and complete - * implementation of the entire 708 spec. - * - * @param {Integer} serviceNum Service number - * @param {Integer} start Start index of the 708 packet data - * @param {Integer} size Block size - */ -Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start, size) { - var b; - var i = start; - var packetData = this.current708Packet.data; - var service = this.services[serviceNum]; - - if (!service) { - service = this.initService(serviceNum, i); - } - - for (; i < start + size && i < packetData.length; i++) { - b = packetData[i]; - - if (within708TextBlock(b)) { - i = this.handleText(i, service); - } else if (b === 0x18) { - i = this.multiByteCharacter(i, service); - } else if (b === 0x10) { - i = this.extendedCommands(i, service); - } else if (0x80 <= b && b <= 0x87) { - i = this.setCurrentWindow(i, service); - } else if (0x98 <= b && b <= 0x9f) { - i = this.defineWindow(i, service); - } else if (b === 0x88) { - i = this.clearWindows(i, service); - } else if (b === 0x8c) { - i = this.deleteWindows(i, service); - } else if (b === 0x89) { - i = this.displayWindows(i, service); - } else if (b === 0x8a) { - i = this.hideWindows(i, service); - } else if (b === 0x8b) { - i = this.toggleWindows(i, service); - } else if (b === 0x97) { - i = this.setWindowAttributes(i, service); - } else if (b === 0x90) { - i = this.setPenAttributes(i, service); - } else if (b === 0x91) { - i = this.setPenColor(i, service); - } else if (b === 0x92) { - i = this.setPenLocation(i, service); - } else if (b === 0x8f) { - service = this.reset(i, service); - } else if (b === 0x08) { - // BS: Backspace - service.currentWindow.backspace(); - } else if (b === 0x0c) { - // FF: Form feed - service.currentWindow.clearText(); - } else if (b === 0x0d) { - // CR: Carriage return - service.currentWindow.pendingNewLine = true; - } else if (b === 0x0e) { - // HCR: Horizontal carriage return - service.currentWindow.clearText(); - } else if (b === 0x8d) { - // DLY: Delay, nothing to do - i++; - } else if (b === 0x8e) { - // DLC: Delay cancel, nothing to do - } else if (b === 0x03) { - // ETX: End Text, don't need to do anything - } else if (b === 0x00) { - // Padding - } else { - // Unknown command - } - } -}; - -/** - * Execute an extended command - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.extendedCommands = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - if (within708TextBlock(b)) { - i = this.handleText(i, service, {isExtended: true}); - } else { - // Unknown command - } - - return i; -}; - -/** - * Get PTS value of a given byte index - * - * @param {Integer} byteIndex Index of the byte - * @return {Integer} PTS - */ -Cea708Stream.prototype.getPts = function(byteIndex) { - // There's 1 pts value per 2 bytes - return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)]; -}; - -/** - * Initializes a service - * - * @param {Integer} serviceNum Service number - * @return {Service} Initialized service object - */ -Cea708Stream.prototype.initService = function(serviceNum, i) { - var serviceName = 'SERVICE' + serviceNum; - var self = this; - var serviceName; - var encoding; - - if (serviceName in this.serviceEncodings) { - encoding = this.serviceEncodings[serviceName]; - } - - this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self); - this.services[serviceNum].init(this.getPts(i), function(pts) { - self.flushDisplayed(pts, self.services[serviceNum]); - }); - - return this.services[serviceNum]; -}; - -/** - * Execute text writing to current window - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.handleText = function(i, service, options) { - var isExtended = options && options.isExtended; - var isMultiByte = options && options.isMultiByte; - var packetData = this.current708Packet.data; - var extended = isExtended ? 0x1000 : 0x0000; - var currentByte = packetData[i]; - var nextByte = packetData[i + 1]; - var win = service.currentWindow; - var char; - var charCodeArray; - - // Use the TextDecoder if one was created for this service - if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); - } else { - char = get708CharFromCode(extended | currentByte); - } - - if (win.pendingNewLine && !win.isEmpty()) { - win.newLine(this.getPts(i)); - } - - win.pendingNewLine = false; - win.addText(char); - - return i; -}; - -/** - * Handle decoding of multibyte character - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.multiByteCharacter = function (i, service) { - var packetData = this.current708Packet.data; - var firstByte = packetData[i + 1]; - var secondByte = packetData[i + 2]; - - if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) { - i = this.handleText(++i, service, {isMultiByte: true}); - } else { - // Unknown command - } - - return i; -}; - -/** - * Parse and execute the CW# command. - * - * Set the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setCurrentWindow = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - - service.setCurrentWindow(windowNum); - - return i; -}; - -/** - * Parse and execute the DF# command. - * - * Define a window and set it as the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.defineWindow = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var windowNum = b & 0x07; - service.setCurrentWindow(windowNum); - var win = service.currentWindow; - - b = packetData[++i]; - win.visible = (b & 0x20) >> 5; // v - win.rowLock = (b & 0x10) >> 4; // rl - win.columnLock = (b & 0x08) >> 3; // cl - win.priority = b & 0x07; // p - - b = packetData[++i]; - win.relativePositioning = (b & 0x80) >> 7; // rp - win.anchorVertical = b & 0x7f; // av - - b = packetData[++i]; - win.anchorHorizontal = b; // ah - - b = packetData[++i]; - win.anchorPoint = (b & 0xf0) >> 4; // ap - win.rowCount = b & 0x0f; // rc - - b = packetData[++i]; - win.columnCount = b & 0x3f; // cc - - b = packetData[++i]; - win.windowStyle = (b & 0x38) >> 3; // ws - win.penStyle = b & 0x07; // ps - - // The spec says there are (rowCount+1) "virtual rows" - win.virtualRowCount = win.rowCount + 1; - - return i; -}; - -/** - * Parse and execute the SWA command. - * - * Set attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setWindowAttributes = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var winAttr = service.currentWindow.winAttr; - - b = packetData[++i]; - winAttr.fillOpacity = (b & 0xc0) >> 6; // fo - winAttr.fillRed = (b & 0x30) >> 4; // fr - winAttr.fillGreen = (b & 0x0c) >> 2; // fg - winAttr.fillBlue = b & 0x03; // fb - - b = packetData[++i]; - winAttr.borderType = (b & 0xc0) >> 6; // bt - winAttr.borderRed = (b & 0x30) >> 4; // br - winAttr.borderGreen = (b & 0x0c) >> 2; // bg - winAttr.borderBlue = b & 0x03; // bb - - b = packetData[++i]; - winAttr.borderType += (b & 0x80) >> 5; // bt - winAttr.wordWrap = (b & 0x40) >> 6; // ww - winAttr.printDirection = (b & 0x30) >> 4; // pd - winAttr.scrollDirection = (b & 0x0c) >> 2; // sd - winAttr.justify = b & 0x03; // j - - b = packetData[++i]; - winAttr.effectSpeed = (b & 0xf0) >> 4; // es - winAttr.effectDirection = (b & 0x0c) >> 2; // ed - winAttr.displayEffect = b & 0x03; // de - - return i; -}; - -/** - * Gather text from all displayed windows and push a caption to output. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - */ -Cea708Stream.prototype.flushDisplayed = function(pts, service) { - var displayedText = []; - - // TODO: Positioning not supported, displaying multiple windows will not necessarily - // display text in the correct order, but sample files so far have not shown any issue. - for (var winId = 0; winId < 8; winId++) { - if (service.windows[winId].visible && !service.windows[winId].isEmpty()) { - displayedText.push(service.windows[winId].getText()); - } - } - - service.endPts = pts; - service.text = displayedText.join('\n\n'); - this.pushCaption(service); - - service.startPts = pts; -}; - -/** - * Push a caption to output if the caption contains text. - * - * @param {Service} service The service object to be affected - */ -Cea708Stream.prototype.pushCaption = function(service) { - if (service.text !== '') { - this.trigger('data', { - startPts: service.startPts, - endPts: service.endPts, - text: service.text, - stream: 'cc708_' + service.serviceNum - }); - - service.text = ''; - service.startPts = service.endPts; - } -}; - -/** - * Parse and execute the DSW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.displayWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible = 1; - } - } - - return i; -}; - -/** - * Parse and execute the HDW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.hideWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible = 0; - } - } - - return i; -}; - -/** - * Parse and execute the TGW command. - * - * Set visible property of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.toggleWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].visible ^= 1; - } - } - - return i; -}; - -/** - * Parse and execute the CLW command. - * - * Clear text of windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.clearWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].clearText(); - } - } - - return i; -}; - -/** - * Parse and execute the DLW command. - * - * Re-initialize windows based on the parsed bitmask. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.deleteWindows = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[++i]; - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - for (var winId = 0; winId < 8; winId++) { - if (b & (0x01 << winId)) { - service.windows[winId].reset(); - } - } - - return i; -}; - -/** - * Parse and execute the SPA command. - * - * Set pen attributes of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenAttributes = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penAttr = service.currentWindow.penAttr; - - b = packetData[++i]; - penAttr.textTag = (b & 0xf0) >> 4; // tt - penAttr.offset = (b & 0x0c) >> 2; // o - penAttr.penSize = b & 0x03; // s - - b = packetData[++i]; - penAttr.italics = (b & 0x80) >> 7; // i - penAttr.underline = (b & 0x40) >> 6; // u - penAttr.edgeType = (b & 0x38) >> 3; // et - penAttr.fontStyle = b & 0x07; // fs - - return i; -}; - -/** - * Parse and execute the SPC command. - * - * Set pen color of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenColor = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penColor = service.currentWindow.penColor; - - b = packetData[++i]; - penColor.fgOpacity = (b & 0xc0) >> 6; // fo - penColor.fgRed = (b & 0x30) >> 4; // fr - penColor.fgGreen = (b & 0x0c) >> 2; // fg - penColor.fgBlue = b & 0x03; // fb - - b = packetData[++i]; - penColor.bgOpacity = (b & 0xc0) >> 6; // bo - penColor.bgRed = (b & 0x30) >> 4; // br - penColor.bgGreen = (b & 0x0c) >> 2; // bg - penColor.bgBlue = b & 0x03; // bb - - b = packetData[++i]; - penColor.edgeRed = (b & 0x30) >> 4; // er - penColor.edgeGreen = (b & 0x0c) >> 2; // eg - penColor.edgeBlue = b & 0x03; // eb - - return i; -}; - -/** - * Parse and execute the SPL command. - * - * Set pen location of the current window. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Integer} New index after parsing - */ -Cea708Stream.prototype.setPenLocation = function(i, service) { - var packetData = this.current708Packet.data; - var b = packetData[i]; - var penLoc = service.currentWindow.penLoc; - - // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak - service.currentWindow.pendingNewLine = true; - - b = packetData[++i]; - penLoc.row = b & 0x0f; // r - - b = packetData[++i]; - penLoc.column = b & 0x3f; // c - - return i; -}; - -/** - * Execute the RST command. - * - * Reset service to a clean slate. Re-initialize. - * - * @param {Integer} i Current index in the 708 packet - * @param {Service} service The service object to be affected - * @return {Service} Re-initialized service - */ -Cea708Stream.prototype.reset = function(i, service) { - var pts = this.getPts(i); - - this.flushDisplayed(pts, service); - - return this.initService(service.serviceNum, i); -}; - - -// This hash maps non-ASCII, special, and extended character codes to their -// proper Unicode equivalent. The first keys that are only a single byte -// are the non-standard ASCII characters, which simply map the CEA608 byte -// to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608 -// character codes, but have their MSB bitmasked with 0x03 so that a lookup -// can be performed regardless of the field and data channel on which the -// character code was received. -var CHARACTER_TRANSLATION = { - 0x2a: 0xe1, // á - 0x5c: 0xe9, // é - 0x5e: 0xed, // í - 0x5f: 0xf3, // ó - 0x60: 0xfa, // ú - 0x7b: 0xe7, // ç - 0x7c: 0xf7, // ÷ - 0x7d: 0xd1, // Ñ - 0x7e: 0xf1, // ñ - 0x7f: 0x2588, // █ - 0x0130: 0xae, // ® - 0x0131: 0xb0, // ° - 0x0132: 0xbd, // ½ - 0x0133: 0xbf, // ¿ - 0x0134: 0x2122, // ™ - 0x0135: 0xa2, // ¢ - 0x0136: 0xa3, // £ - 0x0137: 0x266a, // ♪ - 0x0138: 0xe0, // à - 0x0139: 0xa0, // - 0x013a: 0xe8, // è - 0x013b: 0xe2, // â - 0x013c: 0xea, // ê - 0x013d: 0xee, // î - 0x013e: 0xf4, // ô - 0x013f: 0xfb, // û - 0x0220: 0xc1, // Á - 0x0221: 0xc9, // É - 0x0222: 0xd3, // Ó - 0x0223: 0xda, // Ú - 0x0224: 0xdc, // Ü - 0x0225: 0xfc, // ü - 0x0226: 0x2018, // ‘ - 0x0227: 0xa1, // ¡ - 0x0228: 0x2a, // * - 0x0229: 0x27, // ' - 0x022a: 0x2014, // — - 0x022b: 0xa9, // © - 0x022c: 0x2120, // ℠ - 0x022d: 0x2022, // • - 0x022e: 0x201c, // “ - 0x022f: 0x201d, // ” - 0x0230: 0xc0, // À - 0x0231: 0xc2, //  - 0x0232: 0xc7, // Ç - 0x0233: 0xc8, // È - 0x0234: 0xca, // Ê - 0x0235: 0xcb, // Ë - 0x0236: 0xeb, // ë - 0x0237: 0xce, // Î - 0x0238: 0xcf, // Ï - 0x0239: 0xef, // ï - 0x023a: 0xd4, // Ô - 0x023b: 0xd9, // Ù - 0x023c: 0xf9, // ù - 0x023d: 0xdb, // Û - 0x023e: 0xab, // « - 0x023f: 0xbb, // » - 0x0320: 0xc3, // à - 0x0321: 0xe3, // ã - 0x0322: 0xcd, // Í - 0x0323: 0xcc, // Ì - 0x0324: 0xec, // ì - 0x0325: 0xd2, // Ò - 0x0326: 0xf2, // ò - 0x0327: 0xd5, // Õ - 0x0328: 0xf5, // õ - 0x0329: 0x7b, // { - 0x032a: 0x7d, // } - 0x032b: 0x5c, // \ - 0x032c: 0x5e, // ^ - 0x032d: 0x5f, // _ - 0x032e: 0x7c, // | - 0x032f: 0x7e, // ~ - 0x0330: 0xc4, // Ä - 0x0331: 0xe4, // ä - 0x0332: 0xd6, // Ö - 0x0333: 0xf6, // ö - 0x0334: 0xdf, // ß - 0x0335: 0xa5, // ¥ - 0x0336: 0xa4, // ¤ - 0x0337: 0x2502, // │ - 0x0338: 0xc5, // Å - 0x0339: 0xe5, // å - 0x033a: 0xd8, // Ø - 0x033b: 0xf8, // ø - 0x033c: 0x250c, // ┌ - 0x033d: 0x2510, // ┐ - 0x033e: 0x2514, // └ - 0x033f: 0x2518 // ┘ -}; - -var getCharFromCode = function(code) { - if (code === null) { - return ''; - } - code = CHARACTER_TRANSLATION[code] || code; - return String.fromCharCode(code); -}; - -// the index of the last row in a CEA-608 display buffer -var BOTTOM_ROW = 14; - -// This array is used for mapping PACs -> row #, since there's no way of -// getting it through bit logic. -var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, - 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; - -// CEA-608 captions are rendered onto a 34x15 matrix of character -// cells. The "bottom" row is the last element in the outer array. -// We keep track of positioning information as we go by storing the -// number of indentations and the tab offset in this buffer. -var createDisplayBuffer = function() { - var result = [], i = BOTTOM_ROW + 1; - while (i--) { - result.push({ text: '', indent: 0, offset: 0 }); - } - return result; -}; - -var Cea608Stream = function(field, dataChannel) { - Cea608Stream.prototype.init.call(this); - - this.field_ = field || 0; - this.dataChannel_ = dataChannel || 0; - - this.name_ = 'CC' + (((this.field_ << 1) | this.dataChannel_) + 1); - - this.setConstants(); - this.reset(); - - this.push = function(packet) { - var data, swap, char0, char1, text; - // remove the parity bits - data = packet.ccData & 0x7f7f; - - // ignore duplicate control codes; the spec demands they're sent twice - if (data === this.lastControlCode_) { - this.lastControlCode_ = null; - return; - } - - // Store control codes - if ((data & 0xf000) === 0x1000) { - this.lastControlCode_ = data; - } else if (data !== this.PADDING_) { - this.lastControlCode_ = null; - } - - char0 = data >>> 8; - char1 = data & 0xff; - - if (data === this.PADDING_) { - return; - - } else if (data === this.RESUME_CAPTION_LOADING_) { - this.mode_ = 'popOn'; - - } else if (data === this.END_OF_CAPTION_) { - // If an EOC is received while in paint-on mode, the displayed caption - // text should be swapped to non-displayed memory as if it was a pop-on - // caption. Because of that, we should explicitly switch back to pop-on - // mode - this.mode_ = 'popOn'; - this.clearFormatting(packet.pts); - // if a caption was being displayed, it's gone now - this.flushDisplayed(packet.pts); - - // flip memory - swap = this.displayed_; - this.displayed_ = this.nonDisplayed_; - this.nonDisplayed_ = swap; - - // start measuring the time to display the caption - this.startPts_ = packet.pts; - - } else if (data === this.ROLL_UP_2_ROWS_) { - this.rollUpRows_ = 2; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_3_ROWS_) { - this.rollUpRows_ = 3; - this.setRollUp(packet.pts); - } else if (data === this.ROLL_UP_4_ROWS_) { - this.rollUpRows_ = 4; - this.setRollUp(packet.pts); - } else if (data === this.CARRIAGE_RETURN_) { - this.clearFormatting(packet.pts); - this.flushDisplayed(packet.pts); - this.shiftRowsUp_(); - this.startPts_ = packet.pts; - - } else if (data === this.BACKSPACE_) { - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - } else if (data === this.ERASE_DISPLAYED_MEMORY_) { - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) { - this.nonDisplayed_ = createDisplayBuffer(); - - } else if (data === this.RESUME_DIRECT_CAPTIONING_) { - if (this.mode_ !== 'paintOn') { - // NOTE: This should be removed when proper caption positioning is - // implemented - this.flushDisplayed(packet.pts); - this.displayed_ = createDisplayBuffer(); - } - this.mode_ = 'paintOn'; - this.startPts_ = packet.pts; - - // Append special characters to caption text - } else if (this.isSpecialCharacter(char0, char1)) { - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; - - // Append extended characters to caption text - } else if (this.isExtCharacter(char0, char1)) { - // Extended characters always follow their "non-extended" equivalents. - // IE if a "è" is desired, you'll always receive "eè"; non-compliant - // decoders are supposed to drop the "è", while compliant decoders - // backspace the "e" and insert "è". - - // Delete the previous character - if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); - } else { - this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); - } - - // Bitmask char0 so that we can apply character transformations - // regardless of field and data channel. - // Then byte-shift to the left and OR with char1 so we can pass the - // entire character code to `getCharFromCode`. - char0 = (char0 & 0x03) << 8; - text = getCharFromCode(char0 | char1); - this[this.mode_](packet.pts, text); - this.column_++; - - // Process mid-row codes - } else if (this.isMidRowCode(char0, char1)) { - // Attributes are not additive, so clear all formatting - this.clearFormatting(packet.pts); - - // According to the standard, mid-row codes - // should be replaced with spaces, so add one now - this[this.mode_](packet.pts, ' '); - this.column_++; - - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - - if ((char1 & 0x1) === 0x1) { - this.addFormatting(packet.pts, ['u']); - } - - // Detect offset control codes and adjust cursor - } else if (this.isOffsetControlCode(char0, char1)) { - // Cursor position is set by indent PAC (see below) in 4-column - // increments, with an additional offset code of 1-3 to reach any - // of the 32 columns specified by CEA-608. So all we need to do - // here is increment the column cursor by the given offset. - const offset = (char1 & 0x03); - - // For an offest value 1-3, set the offset for that caption - // in the non-displayed array. - this.nonDisplayed_[this.row_].offset = offset; - - this.column_ += offset; - - // Detect PACs (Preamble Address Codes) - } else if (this.isPAC(char0, char1)) { - - // There's no logic for PAC -> row mapping, so we have to just - // find the row code in an array and use its index :( - var row = ROWS.indexOf(data & 0x1f20); - - // Configure the caption window if we're in roll-up mode - if (this.mode_ === 'rollUp') { - // This implies that the base row is incorrectly set. - // As per the recommendation in CEA-608(Base Row Implementation), defer to the number - // of roll-up rows set. - if (row - this.rollUpRows_ + 1 < 0) { - row = this.rollUpRows_ - 1; - } - - this.setRollUp(packet.pts, row); - } - - if (row !== this.row_) { - // formatting is only persistent for current row - this.clearFormatting(packet.pts); - this.row_ = row; - } - // All PACs can apply underline, so detect and apply - // (All odd-numbered second bytes set underline) - if ((char1 & 0x1) && (this.formatting_.indexOf('u') === -1)) { - this.addFormatting(packet.pts, ['u']); - } - - if ((data & 0x10) === 0x10) { - // We've got an indent level code. Each successive even number - // increments the column cursor by 4, so we can get the desired - // column position by bit-shifting to the right (to get n/2) - // and multiplying by 4. - const indentations = ((data & 0xe) >> 1); - - this.column_ = indentations * 4; - // add to the number of indentations for positioning - this.nonDisplayed_[this.row_].indent += indentations; - } - - if (this.isColorPAC(char1)) { - // it's a color code, though we only support white, which - // can be either normal or italicized. white italics can be - // either 0x4e or 0x6e depending on the row, so we just - // bitwise-and with 0xe to see if italics should be turned on - if ((char1 & 0xe) === 0xe) { - this.addFormatting(packet.pts, ['i']); - } - } - - // We have a normal character in char0, and possibly one in char1 - } else if (this.isNormalChar(char0)) { - if (char1 === 0x00) { - char1 = null; - } - text = getCharFromCode(char0); - text += getCharFromCode(char1); - this[this.mode_](packet.pts, text); - this.column_ += text.length; - - } // finish data processing - - }; -}; -Cea608Stream.prototype = new Stream(); -// Trigger a cue point that captures the current state of the -// display buffer -Cea608Stream.prototype.flushDisplayed = function(pts) { - const logWarning = (index) => { - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - }; - const content = []; - - this.displayed_.forEach((row, i) => { - if (row && row.text && row.text.length) { - - try { - // remove spaces from the start and end of the string - row.text = row.text.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - logWarning(i); - } - // See the below link for more details on the following fields: - // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 - if (row.text.length) { - content.push({ - // The text to be displayed in the caption from this specific row, with whitespace removed. - text: row.text, - // Value between 1 and 15 representing the PAC row used to calculate line height. - line: i + 1, - // A number representing the indent position by percentage (CEA-608 PAC indent code). - // The value will be a number between 10 and 80. Offset is used to add an aditional - // value to the position if necessary. - position: 10 + Math.min(70, row.indent * 10) + (row.offset * 2.5), - }); - } - } - else if (row === undefined || row === null) { - logWarning(i); - } - }); - - if (content.length) { - this.trigger('data', { - startPts: this.startPts_, - endPts: pts, - content, - stream: this.name_ - }); - } -}; - -/** - * Zero out the data, used for startup and on seek - */ -Cea608Stream.prototype.reset = function() { - this.mode_ = 'popOn'; - // When in roll-up mode, the index of the last row that will - // actually display captions. If a caption is shifted to a row - // with a lower index than this, it is cleared from the display - // buffer - this.topRow_ = 0; - this.startPts_ = 0; - this.displayed_ = createDisplayBuffer(); - this.nonDisplayed_ = createDisplayBuffer(); - this.lastControlCode_ = null; - - // Track row and column for proper line-breaking and spacing - this.column_ = 0; - this.row_ = BOTTOM_ROW; - this.rollUpRows_ = 2; - - // This variable holds currently-applied formatting - this.formatting_ = []; -}; - -/** - * Sets up control code and related constants for this instance - */ -Cea608Stream.prototype.setConstants = function() { - // The following attributes have these uses: - // ext_ : char0 for mid-row codes, and the base for extended - // chars (ext_+0, ext_+1, and ext_+2 are char0s for - // extended codes) - // control_: char0 for control codes, except byte-shifted to the - // left so that we can do this.control_ | CONTROL_CODE - // offset_: char0 for tab offset codes - // - // It's also worth noting that control codes, and _only_ control codes, - // differ between field 1 and field2. Field 2 control codes are always - // their field 1 value plus 1. That's why there's the "| field" on the - // control value. - if (this.dataChannel_ === 0) { - this.BASE_ = 0x10; - this.EXT_ = 0x11; - this.CONTROL_ = (0x14 | this.field_) << 8; - this.OFFSET_ = 0x17; - } else if (this.dataChannel_ === 1) { - this.BASE_ = 0x18; - this.EXT_ = 0x19; - this.CONTROL_ = (0x1c | this.field_) << 8; - this.OFFSET_ = 0x1f; - } - - // Constants for the LSByte command codes recognized by Cea608Stream. This - // list is not exhaustive. For a more comprehensive listing and semantics see - // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf - // Padding - this.PADDING_ = 0x0000; - // Pop-on Mode - this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20; - this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; - // Roll-up Mode - this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25; - this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26; - this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27; - this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; - // paint-on mode - this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; - // Erasure - this.BACKSPACE_ = this.CONTROL_ | 0x21; - this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c; - this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e; -}; - -/** - * Detects if the 2-byte packet data is a special character - * - * Special characters have a second byte in the range 0x30 to 0x3f, - * with the first byte being 0x11 (for data channel 1) or 0x19 (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an special character - */ -Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) { - return (char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f); -}; - -/** - * Detects if the 2-byte packet data is an extended character - * - * Extended characters have a second byte in the range 0x20 to 0x3f, - * with the first byte being 0x12 or 0x13 (for data channel 1) or - * 0x1a or 0x1b (for data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an extended character - */ -Cea608Stream.prototype.isExtCharacter = function(char0, char1) { - return ((char0 === (this.EXT_ + 1) || char0 === (this.EXT_ + 2)) && - (char1 >= 0x20 && char1 <= 0x3f)); -}; - -/** - * Detects if the 2-byte packet is a mid-row code - * - * Mid-row codes have a second byte in the range 0x20 to 0x2f, with - * the first byte being 0x11 (for data channel 1) or 0x19 (for data - * channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a mid-row code - */ -Cea608Stream.prototype.isMidRowCode = function(char0, char1) { - return (char0 === this.EXT_ && (char1 >= 0x20 && char1 <= 0x2f)); -}; - -/** - * Detects if the 2-byte packet is an offset control code - * - * Offset control codes have a second byte in the range 0x21 to 0x23, - * with the first byte being 0x17 (for data channel 1) or 0x1f (for - * data channel 2). - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are an offset control code - */ -Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) { - return (char0 === this.OFFSET_ && (char1 >= 0x21 && char1 <= 0x23)); -}; - -/** - * Detects if the 2-byte packet is a Preamble Address Code - * - * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1) - * or 0x18 to 0x1f (for data channel 2), with the second byte in the - * range 0x40 to 0x7f. - * - * @param {Integer} char0 The first byte - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the 2 bytes are a PAC - */ -Cea608Stream.prototype.isPAC = function(char0, char1) { - return (char0 >= this.BASE_ && char0 < (this.BASE_ + 8) && - (char1 >= 0x40 && char1 <= 0x7f)); -}; - -/** - * Detects if a packet's second byte is in the range of a PAC color code - * - * PAC color codes have the second byte be in the range 0x40 to 0x4f, or - * 0x60 to 0x6f. - * - * @param {Integer} char1 The second byte - * @return {Boolean} Whether the byte is a color PAC - */ -Cea608Stream.prototype.isColorPAC = function(char1) { - return ((char1 >= 0x40 && char1 <= 0x4f) || (char1 >= 0x60 && char1 <= 0x7f)); -}; - -/** - * Detects if a single byte is in the range of a normal character - * - * Normal text bytes are in the range 0x20 to 0x7f. - * - * @param {Integer} char The byte - * @return {Boolean} Whether the byte is a normal character - */ -Cea608Stream.prototype.isNormalChar = function(char) { - return (char >= 0x20 && char <= 0x7f); -}; - -/** - * Configures roll-up - * - * @param {Integer} pts Current PTS - * @param {Integer} newBaseRow Used by PACs to slide the current window to - * a new position - */ -Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) { - // Reset the base row to the bottom row when switching modes - if (this.mode_ !== 'rollUp') { - this.row_ = BOTTOM_ROW; - this.mode_ = 'rollUp'; - // Spec says to wipe memories when switching to roll-up - this.flushDisplayed(pts); - this.nonDisplayed_ = createDisplayBuffer(); - this.displayed_ = createDisplayBuffer(); - } - - if (newBaseRow !== undefined && newBaseRow !== this.row_) { - // move currently displayed captions (up or down) to the new base row - for (var i = 0; i < this.rollUpRows_; i++) { - this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = { text: '', indent: 0, offset: 0 }; - } - } - - if (newBaseRow === undefined) { - newBaseRow = this.row_; - } - - this.topRow_ = newBaseRow - this.rollUpRows_ + 1; -}; - -// Adds the opening HTML tag for the passed character to the caption text, -// and keeps track of it for later closing -Cea608Stream.prototype.addFormatting = function(pts, format) { - this.formatting_ = this.formatting_.concat(format); - var text = format.reduce(function(text, format) { - return text + '<' + format + '>'; - }, ''); - this[this.mode_](pts, text); -}; - -// Adds HTML closing tags for current formatting to caption text and -// clears remembered formatting -Cea608Stream.prototype.clearFormatting = function(pts) { - if (!this.formatting_.length) { - return; - } - var text = this.formatting_.reverse().reduce(function(text, format) { - return text + ''; - }, ''); - this.formatting_ = []; - this[this.mode_](pts, text); -}; - -// Mode Implementations -Cea608Stream.prototype.popOn = function(pts, text) { - var baseRow = this.nonDisplayed_[this.row_].text; - - // buffer characters - baseRow += text; - this.nonDisplayed_[this.row_].text = baseRow; -}; - -Cea608Stream.prototype.rollUp = function(pts, text) { - var baseRow = this.displayed_[this.row_].text; - - baseRow += text; - this.displayed_[this.row_].text = baseRow; - -}; - -Cea608Stream.prototype.shiftRowsUp_ = function() { - var i; - // clear out inactive rows - for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = { text: '', indent: 0, offset: 0 }; - } - for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = { text: '', indent: 0, offset: 0 }; - } - // shift displayed rows up - for (i = this.topRow_; i < this.row_; i++) { - this.displayed_[i] = this.displayed_[i + 1]; - } - // clear out the bottom row - this.displayed_[this.row_] = { text: '', indent: 0, offset: 0 }; -}; - -Cea608Stream.prototype.paintOn = function(pts, text) { - var baseRow = this.displayed_[this.row_].text; - - baseRow += text; - this.displayed_[this.row_].text = baseRow; -}; - -// exports -module.exports = { - CaptionStream: CaptionStream, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/index.js deleted file mode 100644 index f73b1e4ee1..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = require('./m2ts'); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/m2ts.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/m2ts.js deleted file mode 100644 index 4f4a97b3a0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/m2ts.js +++ /dev/null @@ -1,586 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; -var Stream = require('../utils/stream.js'), - CaptionStream = require('./caption-stream'), - StreamTypes = require('./stream-types'), - TimestampRolloverStream = require('./timestamp-rollover-stream').TimestampRolloverStream; - -// object types -var TransportPacketStream, TransportParseStream, ElementaryStream; - -// constants -var - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -/** - * Splits an incoming stream of binary data into MPEG-2 Transport - * Stream packets. - */ -TransportPacketStream = function() { - var - buffer = new Uint8Array(MP2T_PACKET_LENGTH), - bytesInBuffer = 0; - - TransportPacketStream.prototype.init.call(this); - - // Deliver new bytes to the stream. - - /** - * Split a stream of data into M2TS packets - **/ - this.push = function(bytes) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - everything; - - // If there are bytes remaining from the last segment, prepend them to the - // bytes that were pushed in - if (bytesInBuffer) { - everything = new Uint8Array(bytes.byteLength + bytesInBuffer); - everything.set(buffer.subarray(0, bytesInBuffer)); - everything.set(bytes, bytesInBuffer); - bytesInBuffer = 0; - } else { - everything = bytes; - } - - // While we have enough data for a packet - while (endIndex < everything.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (everything[startIndex] === SYNC_BYTE && everything[endIndex] === SYNC_BYTE) { - // We found a packet so emit it and jump one whole packet forward in - // the stream - this.trigger('data', everything.subarray(startIndex, endIndex)); - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // If there was some data left over at the end of the segment that couldn't - // possibly be a whole packet, keep it because it might be the start of a packet - // that continues in the next segment - if (startIndex < everything.byteLength) { - buffer.set(everything.subarray(startIndex), 0); - bytesInBuffer = everything.byteLength - startIndex; - } - }; - - /** - * Passes identified M2TS packets to the TransportParseStream to be parsed - **/ - this.flush = function() { - // If the buffer contains a whole packet when we are being flushed, emit it - // and empty the buffer. Otherwise hold onto the data because it may be - // important for decoding the next segment - if (bytesInBuffer === MP2T_PACKET_LENGTH && buffer[0] === SYNC_BYTE) { - this.trigger('data', buffer); - bytesInBuffer = 0; - } - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.reset = function() { - bytesInBuffer = 0; - this.trigger('reset'); - }; -}; -TransportPacketStream.prototype = new Stream(); - -/** - * Accepts an MP2T TransportPacketStream and emits data events with parsed - * forms of the individual transport stream packets. - */ -TransportParseStream = function() { - var parsePsi, parsePat, parsePmt, self; - TransportParseStream.prototype.init.call(this); - self = this; - - this.packetsWaitingForPmt = []; - this.programMapTable = undefined; - - parsePsi = function(payload, psi) { - var offset = 0; - - // PSI packets may be split into multiple sections and those - // sections may be split into multiple packets. If a PSI - // section starts in this packet, the payload_unit_start_indicator - // will be true and the first byte of the payload will indicate - // the offset from the current position to the start of the - // section. - if (psi.payloadUnitStartIndicator) { - offset += payload[offset] + 1; - } - - if (psi.type === 'pat') { - parsePat(payload.subarray(offset), psi); - } else { - parsePmt(payload.subarray(offset), psi); - } - }; - - parsePat = function(payload, pat) { - pat.section_number = payload[7]; // eslint-disable-line camelcase - pat.last_section_number = payload[8]; // eslint-disable-line camelcase - - // skip the PSI header and parse the first PMT entry - self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; - pat.pmtPid = self.pmtPid; - }; - - /** - * Parse out the relevant fields of a Program Map Table (PMT). - * @param payload {Uint8Array} the PMT-specific portion of an MP2T - * packet. The first byte in this array should be the table_id - * field. - * @param pmt {object} the object that should be decorated with - * fields parsed from the PMT. - */ - parsePmt = function(payload, pmt) { - var sectionLength, tableEnd, programInfoLength, offset; - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(payload[5] & 0x01)) { - return; - } - - // overwrite any existing program map table - self.programMapTable = { - video: null, - audio: null, - 'timed-metadata': {} - }; - - // the mapping table ends at the end of the current section - sectionLength = (payload[1] & 0x0f) << 8 | payload[2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; - - // advance the offset to the first entry in the mapping table - offset = 12 + programInfoLength; - while (offset < tableEnd) { - var streamType = payload[offset]; - var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; - - // only map a single elementary_pid for audio and video stream types - // TODO: should this be done for metadata too? for now maintain behavior of - // multiple metadata streams - if (streamType === StreamTypes.H264_STREAM_TYPE && - self.programMapTable.video === null) { - self.programMapTable.video = pid; - } else if (streamType === StreamTypes.ADTS_STREAM_TYPE && - self.programMapTable.audio === null) { - self.programMapTable.audio = pid; - } else if (streamType === StreamTypes.METADATA_STREAM_TYPE) { - // map pid to stream type for metadata streams - self.programMapTable['timed-metadata'][pid] = streamType; - } - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5; - } - - // record the map on the packet as well - pmt.programMapTable = self.programMapTable; - }; - - /** - * Deliver a new MP2T packet to the next stream in the pipeline. - */ - this.push = function(packet) { - var - result = {}, - offset = 4; - - result.payloadUnitStartIndicator = !!(packet[1] & 0x40); - - // pid is a 13-bit field starting at the last bit of packet[1] - result.pid = packet[1] & 0x1f; - result.pid <<= 8; - result.pid |= packet[2]; - - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[offset] + 1; - } - - // parse the rest of the packet based on the type - if (result.pid === 0) { - result.type = 'pat'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - } else if (result.pid === this.pmtPid) { - result.type = 'pmt'; - parsePsi(packet.subarray(offset), result); - this.trigger('data', result); - - // if there are any packets waiting for a PMT to be found, process them now - while (this.packetsWaitingForPmt.length) { - this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); - } - } else if (this.programMapTable === undefined) { - // When we have not seen a PMT yet, defer further processing of - // PES packets until one has been parsed - this.packetsWaitingForPmt.push([packet, offset, result]); - } else { - this.processPes_(packet, offset, result); - } - }; - - this.processPes_ = function(packet, offset, result) { - // set the appropriate stream type - if (result.pid === this.programMapTable.video) { - result.streamType = StreamTypes.H264_STREAM_TYPE; - } else if (result.pid === this.programMapTable.audio) { - result.streamType = StreamTypes.ADTS_STREAM_TYPE; - } else { - // if not video or audio, it is timed-metadata or unknown - // if unknown, streamType will be undefined - result.streamType = this.programMapTable['timed-metadata'][result.pid]; - } - - result.type = 'pes'; - result.data = packet.subarray(offset); - this.trigger('data', result); - }; -}; -TransportParseStream.prototype = new Stream(); -TransportParseStream.STREAM_TYPES = { - h264: 0x1b, - adts: 0x0f -}; - -/** - * Reconsistutes program elementary stream (PES) packets from parsed - * transport stream packets. That is, if you pipe an - * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output - * events will be events which capture the bytes for individual PES - * packets plus relevant metadata that has been extracted from the - * container. - */ -ElementaryStream = function() { - var - self = this, - segmentHadPmt = false, - // PES packet fragments - video = { - data: [], - size: 0 - }, - audio = { - data: [], - size: 0 - }, - timedMetadata = { - data: [], - size: 0 - }, - programMapTable, - parsePes = function(payload, pes) { - var ptsDtsFlags; - const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2] - // default to an empty array - pes.data = new Uint8Array() - // In certain live streams, the start of a TS fragment has ts packets - // that are frame data that is continuing from the previous fragment. This - // is to check that the pes data is the start of a new pes payload - if (startPrefix !== 1) { - return; - } - // get the packet length, this will be 0 for video - pes.packetLength = 6 + ((payload[4] << 8) | payload[5]); - - // find out if this packets starts a new keyframe - pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = payload[7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (payload[9] & 0x0E) << 27 | - (payload[10] & 0xFF) << 20 | - (payload[11] & 0xFE) << 12 | - (payload[12] & 0xFF) << 5 | - (payload[13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (payload[14] & 0x0E) << 27 | - (payload[15] & 0xFF) << 20 | - (payload[16] & 0xFE) << 12 | - (payload[17] & 0xFF) << 5 | - (payload[18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs - } - } - // the data section starts immediately after the PES header. - // pes_header_data_length specifies the number of header bytes - // that follow the last byte of the field. - pes.data = payload.subarray(9 + payload[8]); - }, - /** - * Pass completely parsed PES packets to the next stream in the pipeline - **/ - flushStream = function(stream, type, forceFlush) { - var - packetData = new Uint8Array(stream.size), - event = { - type: type - }, - i = 0, - offset = 0, - packetFlushable = false, - fragment; - - // do nothing if there is not enough buffered data for a complete - // PES header - if (!stream.data.length || stream.size < 9) { - return; - } - event.trackId = stream.data[0].pid; - - // reassemble the packet - for (i = 0; i < stream.data.length; i++) { - fragment = stream.data[i]; - - packetData.set(fragment.data, offset); - offset += fragment.data.byteLength; - } - - // parse assembled packet's PES header - parsePes(packetData, event); - - // non-video PES packets MUST have a non-zero PES_packet_length - // check that there is enough stream data to fill the packet - packetFlushable = type === 'video' || event.packetLength <= stream.size; - - // flush pending packets if the conditions are right - if (forceFlush || packetFlushable) { - stream.size = 0; - stream.data.length = 0; - } - - // only emit packets that are complete. this is to avoid assembling - // incomplete PES packets due to poor segmentation - if (packetFlushable) { - self.trigger('data', event); - } - }; - - ElementaryStream.prototype.init.call(this); - - /** - * Identifies M2TS packet types and parses PES packets using metadata - * parsed from the PMT - **/ - this.push = function(data) { - ({ - pat: function() { - // we have to wait for the PMT to arrive as well before we - // have any meaningful metadata - }, - pes: function() { - var stream, streamType; - - switch (data.streamType) { - case StreamTypes.H264_STREAM_TYPE: - stream = video; - streamType = 'video'; - break; - case StreamTypes.ADTS_STREAM_TYPE: - stream = audio; - streamType = 'audio'; - break; - case StreamTypes.METADATA_STREAM_TYPE: - stream = timedMetadata; - streamType = 'timed-metadata'; - break; - default: - // ignore unknown stream types - return; - } - - // if a new packet is starting, we can flush the completed - // packet - if (data.payloadUnitStartIndicator) { - flushStream(stream, streamType, true); - } - - // buffer this fragment until we are sure we've received the - // complete payload - stream.data.push(data); - stream.size += data.data.byteLength; - }, - pmt: function() { - var - event = { - type: 'metadata', - tracks: [] - }; - - programMapTable = data.programMapTable; - - // translate audio and video streams to tracks - if (programMapTable.video !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - if (programMapTable.audio !== null) { - event.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - segmentHadPmt = true; - - self.trigger('data', event); - } - })[data.type](); - }; - - this.reset = function() { - video.size = 0; - video.data.length = 0; - audio.size = 0; - audio.data.length = 0; - this.trigger('reset'); - }; - - /** - * Flush any remaining input. Video PES packets may be of variable - * length. Normally, the start of a new video packet can trigger the - * finalization of the previous packet. That is not possible if no - * more video is forthcoming, however. In that case, some other - * mechanism (like the end of the file) has to be employed. When it is - * clear that no additional data is forthcoming, calling this method - * will flush the buffered packets. - */ - this.flushStreams_ = function() { - // !!THIS ORDER IS IMPORTANT!! - // video first then audio - flushStream(video, 'video'); - flushStream(audio, 'audio'); - flushStream(timedMetadata, 'timed-metadata'); - }; - - this.flush = function() { - // if on flush we haven't had a pmt emitted - // and we have a pmt to emit. emit the pmt - // so that we trigger a trackinfo downstream. - if (!segmentHadPmt && programMapTable) { - var - pmt = { - type: 'metadata', - tracks: [] - }; - // translate audio and video streams to tracks - if (programMapTable.video !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.video, - codec: 'avc', - type: 'video' - }); - } - - if (programMapTable.audio !== null) { - pmt.tracks.push({ - timelineStartInfo: { - baseMediaDecodeTime: 0 - }, - id: +programMapTable.audio, - codec: 'adts', - type: 'audio' - }); - } - - self.trigger('data', pmt); - } - - segmentHadPmt = false; - this.flushStreams_(); - this.trigger('done'); - }; -}; -ElementaryStream.prototype = new Stream(); - -var m2ts = { - PAT_PID: 0x0000, - MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH, - TransportPacketStream: TransportPacketStream, - TransportParseStream: TransportParseStream, - ElementaryStream: ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: CaptionStream.CaptionStream, - Cea608Stream: CaptionStream.Cea608Stream, - Cea708Stream: CaptionStream.Cea708Stream, - MetadataStream: require('./metadata-stream') -}; - -for (var type in StreamTypes) { - if (StreamTypes.hasOwnProperty(type)) { - m2ts[type] = StreamTypes[type]; - } -} - -module.exports = m2ts; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/metadata-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/metadata-stream.js deleted file mode 100644 index 8787006255..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/metadata-stream.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and parses out - * ID3 metadata from them, if present. - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; -var - Stream = require('../utils/stream'), - StreamTypes = require('./stream-types'), - id3 = require('../tools/parse-id3'), - MetadataStream; - -MetadataStream = function(options) { - var - settings = { - // the bytes of the program-level descriptor field in MP2T - // see ISO/IEC 13818-1:2013 (E), section 2.6 "Program and - // program element descriptors" - descriptor: options && options.descriptor - }, - // the total size in bytes of the ID3 tag being parsed - tagSize = 0, - // tag data that is not complete enough to be parsed - buffer = [], - // the total number of bytes currently in the buffer - bufferSize = 0, - i; - - MetadataStream.prototype.init.call(this); - - // calculate the text track in-band metadata track dispatch type - // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track - this.dispatchType = StreamTypes.METADATA_STREAM_TYPE.toString(16); - if (settings.descriptor) { - for (i = 0; i < settings.descriptor.length; i++) { - this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2); - } - } - - this.push = function(chunk) { - var tag, frameStart, frameSize, frame, i, frameHeader; - if (chunk.type !== 'timed-metadata') { - return; - } - - // if data_alignment_indicator is set in the PES header, - // we must have the start of a new ID3 tag. Assume anything - // remaining in the buffer was malformed and throw it out - if (chunk.dataAlignmentIndicator) { - bufferSize = 0; - buffer.length = 0; - } - - // ignore events that don't look like ID3 data - if (buffer.length === 0 && - (chunk.data.length < 10 || - chunk.data[0] !== 'I'.charCodeAt(0) || - chunk.data[1] !== 'D'.charCodeAt(0) || - chunk.data[2] !== '3'.charCodeAt(0))) { - this.trigger('log', { - level: 'warn', - message: 'Skipping unrecognized metadata packet' - }); - return; - } - - // add this chunk to the data we've collected so far - - buffer.push(chunk); - bufferSize += chunk.data.byteLength; - - // grab the size of the entire frame from the ID3 header - if (buffer.length === 1) { - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); - - // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - tagSize += 10; - } - - // if the entire frame has not arrived, wait for more data - if (bufferSize < tagSize) { - return; - } - - // collect the entire frame so it can be parsed - tag = { - data: new Uint8Array(tagSize), - frames: [], - pts: buffer[0].pts, - dts: buffer[0].dts - }; - for (i = 0; i < tagSize;) { - tag.data.set(buffer[0].data.subarray(0, tagSize - i), i); - i += buffer[0].data.byteLength; - bufferSize -= buffer[0].data.byteLength; - buffer.shift(); - } - - // find the start of the first frame and the end of the tag - frameStart = 10; - if (tag.data[5] & 0x40) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14)); - - // clip any padding off the end - tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20)); - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - this.trigger('log', { - level: 'warn', - message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.' - }); - // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames - // to be sent along. - break; - } - frameHeader = String.fromCharCode(tag.data[frameStart], - tag.data[frameStart + 1], - tag.data[frameStart + 2], - tag.data[frameStart + 3]); - - - frame = { - id: frameHeader, - data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - // parse frame values - if (id3.frameParsers[frame.id]) { - // use frame specific parser - id3.frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - id3.frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - id3.frameParsers['W*'](frame); - } - - // handle the special PRIV frame used to indicate the start - // time for raw AAC data - if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') { - var - d = frame.data, - size = ((d[3] & 0x01) << 30) | - (d[4] << 22) | - (d[5] << 14) | - (d[6] << 6) | - (d[7] >>> 2); - - size *= 4; - size += d[7] & 0x03; - frame.timeStamp = size; - // in raw AAC, all subsequent data will be timestamped based - // on the value of this frame - // we couldn't have known the appropriate pts and dts before - // parsing this ID3 tag so set those values now - if (tag.pts === undefined && tag.dts === undefined) { - tag.pts = frame.timeStamp; - tag.dts = frame.timeStamp; - } - this.trigger('timestamp', frame); - } - - tag.frames.push(frame); - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - this.trigger('data', tag); - }; -}; -MetadataStream.prototype = new Stream(); - -module.exports = MetadataStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/probe.js deleted file mode 100644 index 12a055cfe9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/probe.js +++ /dev/null @@ -1,287 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about TS Segments. - */ -'use strict'; - -var StreamTypes = require('./stream-types.js'); - -var parsePid = function(packet) { - var pid = packet[1] & 0x1f; - pid <<= 8; - pid |= packet[2]; - return pid; -}; - -var parsePayloadUnitStartIndicator = function(packet) { - return !!(packet[1] & 0x40); -}; - -var parseAdaptionField = function(packet) { - var offset = 0; - // if an adaption field is present, its length is specified by the - // fifth byte of the TS packet header. The adaptation field is - // used to add stuffing to PES packets that don't fill a complete - // TS packet, and to specify some forms of timing and control data - // that we do not currently use. - if (((packet[3] & 0x30) >>> 4) > 0x01) { - offset += packet[4] + 1; - } - return offset; -}; - -var parseType = function(packet, pmtPid) { - var pid = parsePid(packet); - if (pid === 0) { - return 'pat'; - } else if (pid === pmtPid) { - return 'pmt'; - } else if (pmtPid) { - return 'pes'; - } - return null; -}; - -var parsePat = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - var offset = 4 + parseAdaptionField(packet); - - if (pusi) { - offset += packet[offset] + 1; - } - - return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11]; -}; - -var parsePmt = function(packet) { - var programMapTable = {}; - var pusi = parsePayloadUnitStartIndicator(packet); - var payloadOffset = 4 + parseAdaptionField(packet); - - if (pusi) { - payloadOffset += packet[payloadOffset] + 1; - } - - // PMTs can be sent ahead of the time when they should actually - // take effect. We don't believe this should ever be the case - // for HLS but we'll ignore "forward" PMT declarations if we see - // them. Future PMT declarations have the current_next_indicator - // set to zero. - if (!(packet[payloadOffset + 5] & 0x01)) { - return; - } - - var sectionLength, tableEnd, programInfoLength; - // the mapping table ends at the end of the current section - sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2]; - tableEnd = 3 + sectionLength - 4; - - // to determine where the table is, we have to figure out how - // long the program info descriptors are - programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; - - // advance the offset to the first entry in the mapping table - var offset = 12 + programInfoLength; - while (offset < tableEnd) { - var i = payloadOffset + offset; - // add an entry that maps the elementary_pid to the stream_type - programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; - - // move to the next table entry - // skip past the elementary stream descriptors, if present - offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5; - } - return programMapTable; -}; - -var parsePesType = function(packet, programMapTable) { - var pid = parsePid(packet); - var type = programMapTable[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - return 'video'; - case StreamTypes.ADTS_STREAM_TYPE: - return 'audio'; - case StreamTypes.METADATA_STREAM_TYPE: - return 'timed-metadata'; - default: - return null; - } -}; - -var parsePesTime = function(packet) { - var pusi = parsePayloadUnitStartIndicator(packet); - if (!pusi) { - return null; - } - - var offset = 4 + parseAdaptionField(packet); - - if (offset >= packet.byteLength) { - // From the H 222.0 MPEG-TS spec - // "For transport stream packets carrying PES packets, stuffing is needed when there - // is insufficient PES packet data to completely fill the transport stream packet - // payload bytes. Stuffing is accomplished by defining an adaptation field longer than - // the sum of the lengths of the data elements in it, so that the payload bytes - // remaining after the adaptation field exactly accommodates the available PES packet - // data." - // - // If the offset is >= the length of the packet, then the packet contains no data - // and instead is just adaption field stuffing bytes - return null; - } - - var pes = null; - var ptsDtsFlags; - - // PES packets may be annotated with a PTS value, or a PTS value - // and a DTS value. Determine what combination of values is - // available to work with. - ptsDtsFlags = packet[offset + 7]; - - // PTS and DTS are normally stored as a 33-bit number. Javascript - // performs all bitwise operations on 32-bit integers but javascript - // supports a much greater range (52-bits) of integer using standard - // mathematical operations. - // We construct a 31-bit value using bitwise operators over the 31 - // most significant bits and then multiply by 4 (equal to a left-shift - // of 2) before we add the final 2 least significant bits of the - // timestamp (equal to an OR.) - if (ptsDtsFlags & 0xC0) { - pes = {}; - // the PTS and DTS are not written out directly. For information - // on how they are encoded, see - // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html - pes.pts = (packet[offset + 9] & 0x0E) << 27 | - (packet[offset + 10] & 0xFF) << 20 | - (packet[offset + 11] & 0xFE) << 12 | - (packet[offset + 12] & 0xFF) << 5 | - (packet[offset + 13] & 0xFE) >>> 3; - pes.pts *= 4; // Left shift by 2 - pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs - pes.dts = pes.pts; - if (ptsDtsFlags & 0x40) { - pes.dts = (packet[offset + 14] & 0x0E) << 27 | - (packet[offset + 15] & 0xFF) << 20 | - (packet[offset + 16] & 0xFE) << 12 | - (packet[offset + 17] & 0xFF) << 5 | - (packet[offset + 18] & 0xFE) >>> 3; - pes.dts *= 4; // Left shift by 2 - pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs - } - } - return pes; -}; - -var parseNalUnitType = function(type) { - switch (type) { - case 0x05: - return 'slice_layer_without_partitioning_rbsp_idr'; - case 0x06: - return 'sei_rbsp'; - case 0x07: - return 'seq_parameter_set_rbsp'; - case 0x08: - return 'pic_parameter_set_rbsp'; - case 0x09: - return 'access_unit_delimiter_rbsp'; - default: - return null; - } -}; - -var videoPacketContainsKeyFrame = function(packet) { - var offset = 4 + parseAdaptionField(packet); - var frameBuffer = packet.subarray(offset); - var frameI = 0; - var frameSyncPoint = 0; - var foundKeyFrame = false; - var nalType; - - // advance the sync point to a NAL start, if necessary - for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) { - if (frameBuffer[frameSyncPoint + 2] === 1) { - // the sync point is properly aligned - frameI = frameSyncPoint + 5; - break; - } - } - - while (frameI < frameBuffer.byteLength) { - // look at the current byte to determine if we've hit the end of - // a NAL unit boundary - switch (frameBuffer[frameI]) { - case 0: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0) { - frameI += 2; - break; - } else if (frameBuffer[frameI - 2] !== 0) { - frameI++; - break; - } - - if (frameSyncPoint + 3 !== frameI - 2) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - // drop trailing zeroes - do { - frameI++; - } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length); - frameSyncPoint = frameI - 2; - frameI += 3; - break; - case 1: - // skip past non-sync sequences - if (frameBuffer[frameI - 1] !== 0 || - frameBuffer[frameI - 2] !== 0) { - frameI += 3; - break; - } - - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - frameSyncPoint = frameI - 2; - frameI += 3; - break; - default: - // the current byte isn't a one or zero, so it cannot be part - // of a sync sequence - frameI += 3; - break; - } - } - frameBuffer = frameBuffer.subarray(frameSyncPoint); - frameI -= frameSyncPoint; - frameSyncPoint = 0; - // parse the final nal - if (frameBuffer && frameBuffer.byteLength > 3) { - nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f); - if (nalType === 'slice_layer_without_partitioning_rbsp_idr') { - foundKeyFrame = true; - } - } - - return foundKeyFrame; -}; - - -module.exports = { - parseType: parseType, - parsePat: parsePat, - parsePmt: parsePmt, - parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator, - parsePesType: parsePesType, - parsePesTime: parsePesTime, - videoPacketContainsKeyFrame: videoPacketContainsKeyFrame -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/stream-types.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/stream-types.js deleted file mode 100644 index 62a2f5a149..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/stream-types.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -module.exports = { - H264_STREAM_TYPE: 0x1B, - ADTS_STREAM_TYPE: 0x0F, - METADATA_STREAM_TYPE: 0x15 -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js deleted file mode 100644 index ffd1408501..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/m2ts/timestamp-rollover-stream.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Accepts program elementary stream (PES) data events and corrects - * decode and presentation time stamps to account for a rollover - * of the 33 bit value. - */ - -'use strict'; - -var Stream = require('../utils/stream'); - -var MAX_TS = 8589934592; - -var RO_THRESH = 4294967296; - -var TYPE_SHARED = 'shared'; - -var handleRollover = function(value, reference) { - var direction = 1; - - if (value > reference) { - // If the current timestamp value is greater than our reference timestamp and we detect a - // timestamp rollover, this means the roll over is happening in the opposite direction. - // Example scenario: Enter a long stream/video just after a rollover occurred. The reference - // point will be set to a small number, e.g. 1. The user then seeks backwards over the - // rollover point. In loading this segment, the timestamp values will be very large, - // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust - // the time stamp to be `value - 2^33`. - direction = -1; - } - - // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will - // cause an incorrect adjustment. - while (Math.abs(reference - value) > RO_THRESH) { - value += (direction * MAX_TS); - } - - return value; -}; - -var TimestampRolloverStream = function(type) { - var lastDTS, referenceDTS; - - TimestampRolloverStream.prototype.init.call(this); - - // The "shared" type is used in cases where a stream will contain muxed - // video and audio. We could use `undefined` here, but having a string - // makes debugging a little clearer. - this.type_ = type || TYPE_SHARED; - - this.push = function(data) { - - // Any "shared" rollover streams will accept _all_ data. Otherwise, - // streams will only accept data that matches their type. - if (this.type_ !== TYPE_SHARED && data.type !== this.type_) { - return; - } - - if (referenceDTS === undefined) { - referenceDTS = data.dts; - } - - data.dts = handleRollover(data.dts, referenceDTS); - data.pts = handleRollover(data.pts, referenceDTS); - - lastDTS = data.dts; - - this.trigger('data', data); - }; - - this.flush = function() { - referenceDTS = lastDTS; - this.trigger('done'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline'); - }; - - this.discontinuity = function() { - referenceDTS = void 0; - lastDTS = void 0; - }; - - this.reset = function() { - this.discontinuity(); - this.trigger('reset'); - }; -}; - -TimestampRolloverStream.prototype = new Stream(); - -module.exports = { - TimestampRolloverStream: TimestampRolloverStream, - handleRollover: handleRollover -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/audio-frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/audio-frame-utils.js deleted file mode 100644 index 58e93b2e6f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/audio-frame-utils.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var coneOfSilence = require('../data/silence'); -var clock = require('../utils/clock'); - -/** - * Sum the `byteLength` properties of the data in each AAC frame - */ -var sumFrameByteLengths = function(array) { - var - i, - currentObj, - sum = 0; - - // sum the byteLength's all each nal unit in the frame - for (i = 0; i < array.length; i++) { - currentObj = array[i]; - sum += currentObj.data.byteLength; - } - - return sum; -}; - -// Possibly pad (prefix) the audio track with silence if appending this track -// would lead to the introduction of a gap in the audio buffer -var prefixWithSilence = function( - track, - frames, - audioAppendStartTs, - videoBaseMediaDecodeTime -) { - var - baseMediaDecodeTimeTs, - frameDuration = 0, - audioGapDuration = 0, - audioFillFrameCount = 0, - audioFillDuration = 0, - silentFrame, - i, - firstFrame; - - if (!frames.length) { - return; - } - - baseMediaDecodeTimeTs = - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); - // determine frame clock duration based on sample rate, round up to avoid overfills - frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)); - - if (audioAppendStartTs && videoBaseMediaDecodeTime) { - // insert the shortest possible amount (audio gap or audio to video gap) - audioGapDuration = - baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); - // number of full frames in the audio gap - audioFillFrameCount = Math.floor(audioGapDuration / frameDuration); - audioFillDuration = audioFillFrameCount * frameDuration; - } - - // don't attempt to fill gaps smaller than a single frame or larger - // than a half second - if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) { - return; - } - - silentFrame = coneOfSilence()[track.samplerate]; - - if (!silentFrame) { - // we don't have a silent frame pregenerated for the sample rate, so use a frame - // from the content instead - silentFrame = frames[0].data; - } - - for (i = 0; i < audioFillFrameCount; i++) { - firstFrame = frames[0]; - - frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - } - - track.baseMediaDecodeTime -= - Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)); - - return audioFillDuration; -}; - -// If the audio segment extends before the earliest allowed dts -// value, remove AAC frames until starts at or after the earliest -// allowed DTS so that we don't end up with a negative baseMedia- -// DecodeTime for the audio track -var trimAdtsFramesByEarliestDts = function(adtsFrames, track, earliestAllowedDts) { - if (track.minSegmentDts >= earliestAllowedDts) { - return adtsFrames; - } - - // We will need to recalculate the earliest segment Dts - track.minSegmentDts = Infinity; - - return adtsFrames.filter(function(currentFrame) { - // If this is an allowed frame, keep it and record it's Dts - if (currentFrame.dts >= earliestAllowedDts) { - track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); - track.minSegmentPts = track.minSegmentDts; - return true; - } - // Otherwise, discard it - return false; - }); -}; - -// generate the track's raw mdat data from an array of frames -var generateSampleTable = function(frames) { - var - i, - currentFrame, - samples = []; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - samples.push({ - size: currentFrame.data.byteLength, - duration: 1024 // For AAC audio, all samples contain 1024 samples - }); - } - return samples; -}; - -// generate the track's sample table from an array of frames -var concatenateFrameData = function(frames) { - var - i, - currentFrame, - dataOffset = 0, - data = new Uint8Array(sumFrameByteLengths(frames)); - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - data.set(currentFrame.data, dataOffset); - dataOffset += currentFrame.data.byteLength; - } - return data; -}; - -module.exports = { - prefixWithSilence: prefixWithSilence, - trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts, - generateSampleTable: generateSampleTable, - concatenateFrameData: concatenateFrameData -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/caption-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/caption-parser.js deleted file mode 100644 index 8c4e39573b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/caption-parser.js +++ /dev/null @@ -1,488 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band CEA-708 captions out of FMP4 segments. - * @see https://en.wikipedia.org/wiki/CEA-708 - */ -'use strict'; - -var discardEmulationPreventionBytes = require('../tools/caption-packet-parser').discardEmulationPreventionBytes; -var CaptionStream = require('../m2ts/caption-stream').CaptionStream; -var findBox = require('../mp4/find-box.js'); -var parseTfdt = require('../tools/parse-tfdt.js'); -var parseTrun = require('../tools/parse-trun.js'); -var parseTfhd = require('../tools/parse-tfhd.js'); -var window = require('global/window'); - -/** - * Maps an offset in the mdat to a sample based on the the size of the samples. - * Assumes that `parseSamples` has been called first. - * - * @param {Number} offset - The offset into the mdat - * @param {Object[]} samples - An array of samples, parsed using `parseSamples` - * @return {?Object} The matching sample, or null if no match was found. - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ -var mapToSample = function(offset, samples) { - var approximateOffset = offset; - - for (var i = 0; i < samples.length; i++) { - var sample = samples[i]; - - if (approximateOffset < sample.size) { - return sample; - } - - approximateOffset -= sample.size; - } - - return null; -}; - -/** - * Finds SEI nal units contained in a Media Data Box. - * Assumes that `parseSamples` has been called first. - * - * @param {Uint8Array} avcStream - The bytes of the mdat - * @param {Object[]} samples - The samples parsed out by `parseSamples` - * @param {Number} trackId - The trackId of this video track - * @return {Object[]} seiNals - the parsed SEI NALUs found. - * The contents of the seiNal should match what is expected by - * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts) - * - * @see ISO-BMFF-12/2015, Section 8.1.1 - * @see Rec. ITU-T H.264, 7.3.2.3.1 - **/ -var findSeiNals = function(avcStream, samples, trackId) { - var - avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = { - logs: [], - seiNals: [] - }, - seiNal, - i, - length, - lastMatchedSample; - - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; - - // Bail if this doesn't appear to be an H264 stream - if (length <= 0) { - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x06: - var data = avcStream.subarray(i + 1, i + 1 + length); - var matchingSample = mapToSample(i, samples); - - seiNal = { - nalUnitType: 'sei_rbsp', - size: length, - data: data, - escapedRBSP: discardEmulationPreventionBytes(data), - trackId: trackId - }; - - if (matchingSample) { - seiNal.pts = matchingSample.pts; - seiNal.dts = matchingSample.dts; - lastMatchedSample = matchingSample; - } else if (lastMatchedSample) { - // If a matching sample cannot be found, use the last - // sample's values as they should be as close as possible - seiNal.pts = lastMatchedSample.pts; - seiNal.dts = lastMatchedSample.dts; - } else { - result.logs.push({ - level: 'warn', - message: 'We\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.' - }); - break; - } - - result.seiNals.push(seiNal); - break; - default: - break; - } - } - - return result; -}; - -/** - * Parses sample information out of Track Run Boxes and calculates - * the absolute presentation and decode timestamps of each sample. - * - * @param {Array} truns - The Trun Run boxes to be parsed - * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt - @see ISO-BMFF-12/2015, Section 8.8.12 - * @param {Object} tfhd - The parsed Track Fragment Header - * @see inspect.parseTfhd - * @return {Object[]} the parsed samples - * - * @see ISO-BMFF-12/2015, Section 8.8.8 - **/ -var parseSamples = function(truns, baseMediaDecodeTime, tfhd) { - var currentDts = baseMediaDecodeTime; - var defaultSampleDuration = tfhd.defaultSampleDuration || 0; - var defaultSampleSize = tfhd.defaultSampleSize || 0; - var trackId = tfhd.trackId; - var allSamples = []; - - truns.forEach(function(trun) { - // Note: We currently do not parse the sample table as well - // as the trun. It's possible some sources will require this. - // moov > trak > mdia > minf > stbl - var trackRun = parseTrun(trun); - var samples = trackRun.samples; - - samples.forEach(function(sample) { - if (sample.duration === undefined) { - sample.duration = defaultSampleDuration; - } - if (sample.size === undefined) { - sample.size = defaultSampleSize; - } - sample.trackId = trackId; - sample.dts = currentDts; - if (sample.compositionTimeOffset === undefined) { - sample.compositionTimeOffset = 0; - } - - if (typeof currentDts === 'bigint') { - sample.pts = currentDts + window.BigInt(sample.compositionTimeOffset); - currentDts += window.BigInt(sample.duration); - - } else { - sample.pts = currentDts + sample.compositionTimeOffset; - currentDts += sample.duration; - } - }); - - allSamples = allSamples.concat(samples); - }); - - return allSamples; -}; - -/** - * Parses out caption nals from an FMP4 segment's video tracks. - * - * @param {Uint8Array} segment - The bytes of a single segment - * @param {Number} videoTrackId - The trackId of a video track in the segment - * @return {Object.} A mapping of video trackId to - * a list of seiNals found in that track - **/ -var parseCaptionNals = function(segment, videoTrackId) { - // To get the samples - var trafs = findBox(segment, ['moof', 'traf']); - // To get SEI NAL units - var mdats = findBox(segment, ['mdat']); - var captionNals = {}; - var mdatTrafPairs = []; - - // Pair up each traf with a mdat as moofs and mdats are in pairs - mdats.forEach(function(mdat, index) { - var matchingTraf = trafs[index]; - mdatTrafPairs.push({ - mdat: mdat, - traf: matchingTraf - }); - }); - - mdatTrafPairs.forEach(function(pair) { - var mdat = pair.mdat; - var traf = pair.traf; - var tfhd = findBox(traf, ['tfhd']); - // Exactly 1 tfhd per traf - var headerInfo = parseTfhd(tfhd[0]); - var trackId = headerInfo.trackId; - var tfdt = findBox(traf, ['tfdt']); - // Either 0 or 1 tfdt per traf - var baseMediaDecodeTime = (tfdt.length > 0) ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0; - var truns = findBox(traf, ['trun']); - var samples; - var result; - - // Only parse video data for the chosen video track - if (videoTrackId === trackId && truns.length > 0) { - samples = parseSamples(truns, baseMediaDecodeTime, headerInfo); - - result = findSeiNals(mdat, samples, trackId); - - if (!captionNals[trackId]) { - captionNals[trackId] = {seiNals: [], logs: []}; - } - - captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals); - captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs); - } - }); - - return captionNals; -}; - -/** - * Parses out inband captions from an MP4 container and returns - * caption objects that can be used by WebVTT and the TextTrack API. - * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack - * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number} trackId - The id of the video track to parse - * @param {Number} timescale - The timescale for the video track from the init segment - * - * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks - * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds - * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {Object[]} parsedCaptions[].content - A list of individual caption segments - * @return {String} parsedCaptions[].content.text - The visible content of the caption segment - * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment - * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 - **/ -var parseEmbeddedCaptions = function(segment, trackId, timescale) { - var captionNals; - - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - if (trackId === null) { - return null; - } - - captionNals = parseCaptionNals(segment, trackId); - - var trackNals = captionNals[trackId] || {}; - - return { - seiNals: trackNals.seiNals, - logs: trackNals.logs, - timescale: timescale - }; -}; - -/** - * Converts SEI NALUs into captions that can be used by video.js - **/ -var CaptionParser = function() { - var isInitialized = false; - var captionStream; - - // Stores segments seen before trackId and timescale are set - var segmentCache; - // Stores video track ID of the track being parsed - var trackId; - // Stores the timescale of the track being parsed - var timescale; - // Stores captions parsed so far - var parsedCaptions; - // Stores whether we are receiving partial data or not - var parsingPartial; - - /** - * A method to indicate whether a CaptionParser has been initalized - * @returns {Boolean} - **/ - this.isInitialized = function() { - return isInitialized; - }; - - /** - * Initializes the underlying CaptionStream, SEI NAL parsing - * and management, and caption collection - **/ - this.init = function(options) { - captionStream = new CaptionStream(); - isInitialized = true; - parsingPartial = options ? options.isPartial : false; - - // Collect dispatched captions - captionStream.on('data', function(event) { - // Convert to seconds in the source's timescale - event.startTime = event.startPts / timescale; - event.endTime = event.endPts / timescale; - - parsedCaptions.captions.push(event); - parsedCaptions.captionStreams[event.stream] = true; - }); - - captionStream.on('log', function(log) { - parsedCaptions.logs.push(log); - }); - }; - - /** - * Determines if a new video track will be selected - * or if the timescale changed - * @return {Boolean} - **/ - this.isNewInit = function(videoTrackIds, timescales) { - if ((videoTrackIds && videoTrackIds.length === 0) || - (timescales && typeof timescales === 'object' && - Object.keys(timescales).length === 0)) { - return false; - } - - return trackId !== videoTrackIds[0] || - timescale !== timescales[trackId]; - }; - - /** - * Parses out SEI captions and interacts with underlying - * CaptionStream to return dispatched captions - * - * @param {Uint8Array} segment - The fmp4 segment containing embedded captions - * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment - * @param {Object.} timescales - The timescales found in the init segment - * @see parseEmbeddedCaptions - * @see m2ts/caption-stream.js - **/ - this.parse = function(segment, videoTrackIds, timescales) { - var parsedData; - - if (!this.isInitialized()) { - return null; - - // This is not likely to be a video segment - } else if (!videoTrackIds || !timescales) { - return null; - - } else if (this.isNewInit(videoTrackIds, timescales)) { - // Use the first video track only as there is no - // mechanism to switch to other video tracks - trackId = videoTrackIds[0]; - timescale = timescales[trackId]; - - // If an init segment has not been seen yet, hold onto segment - // data until we have one. - // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there - } else if (trackId === null || !timescale) { - segmentCache.push(segment); - return null; - } - - // Now that a timescale and trackId is set, parse cached segments - while (segmentCache.length > 0) { - var cachedSegment = segmentCache.shift(); - - this.parse(cachedSegment, videoTrackIds, timescales); - } - - parsedData = parseEmbeddedCaptions(segment, trackId, timescale); - - if (parsedData && parsedData.logs) { - parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs); - } - - if (parsedData === null || !parsedData.seiNals) { - if (parsedCaptions.logs.length) { - return {logs: parsedCaptions.logs, captions: [], captionStreams: []}; - } - - return null; - } - - this.pushNals(parsedData.seiNals); - // Force the parsed captions to be dispatched - this.flushStream(); - - return parsedCaptions; - }; - - /** - * Pushes SEI NALUs onto CaptionStream - * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals` - * Assumes that `parseCaptionNals` has been called first - * @see m2ts/caption-stream.js - **/ - this.pushNals = function(nals) { - if (!this.isInitialized() || !nals || nals.length === 0) { - return null; - } - - nals.forEach(function(nal) { - captionStream.push(nal); - }); - }; - - /** - * Flushes underlying CaptionStream to dispatch processed, displayable captions - * @see m2ts/caption-stream.js - **/ - this.flushStream = function() { - if (!this.isInitialized()) { - return null; - } - - if (!parsingPartial) { - captionStream.flush(); - } else { - captionStream.partialFlush(); - } - }; - - /** - * Reset caption buckets for new data - **/ - this.clearParsedCaptions = function() { - parsedCaptions.captions = []; - parsedCaptions.captionStreams = {}; - parsedCaptions.logs = []; - }; - - /** - * Resets underlying CaptionStream - * @see m2ts/caption-stream.js - **/ - this.resetCaptionStream = function() { - if (!this.isInitialized()) { - return null; - } - - captionStream.reset(); - }; - - /** - * Convenience method to clear all captions flushed from the - * CaptionStream and still being parsed - * @see m2ts/caption-stream.js - **/ - this.clearAllCaptions = function() { - this.clearParsedCaptions(); - this.resetCaptionStream(); - }; - - /** - * Reset caption parser - **/ - this.reset = function() { - segmentCache = []; - trackId = null; - timescale = null; - - if (!parsedCaptions) { - parsedCaptions = { - captions: [], - // CC1, CC2, CC3, CC4 - captionStreams: {}, - logs: [] - }; - } else { - this.clearParsedCaptions(); - } - - this.resetCaptionStream(); - }; - - this.reset(); -}; - -module.exports = CaptionParser; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/emsg.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/emsg.js deleted file mode 100644 index 687ed93e35..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/emsg.js +++ /dev/null @@ -1,105 +0,0 @@ -var uint8ToCString = require('../utils/string.js').uint8ToCString; -var getUint64 = require('../utils/numbers.js').getUint64; - -/** - * Based on: ISO/IEC 23009 Section: 5.10.3.3 - * References: - * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format - * https://aomediacodec.github.io/id3-emsg/ - * - * Takes emsg box data as a uint8 array and returns a emsg box object - * @param {UInt8Array} boxData data from emsg box - * @returns A parsed emsg box object - */ -var parseEmsgBox = function(boxData) { - // version + flags - var offset = 4; - var version = boxData[0]; - var scheme_id_uri, - value, - timescale, - presentation_time, - presentation_time_delta, - event_duration, - id, - message_data; - if (version === 0) { - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time_delta = dv.getUint32(offset); - offset += 4; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - } else if (version === 1) { - var dv = new DataView(boxData.buffer); - timescale = dv.getUint32(offset); - offset += 4; - presentation_time = getUint64(boxData.subarray(offset)); - offset += 8; - event_duration = dv.getUint32(offset); - offset += 4; - id = dv.getUint32(offset); - offset += 4; - scheme_id_uri = uint8ToCString(boxData.subarray(offset)); - offset += scheme_id_uri.length; - value = uint8ToCString(boxData.subarray(offset)); - offset += value.length; - } - - message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength)); - var emsgBox = { - scheme_id_uri, - value, - // if timescale is undefined or 0 set to 1 - timescale: timescale ? timescale : 1, - presentation_time, - presentation_time_delta, - event_duration, - id, - message_data }; - - return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined; -}; - -/** - * Scales a presentation time or time delta with an offset with a provided timescale - * @param {number} presentationTime - * @param {number} timescale - * @param {number} timeDelta - * @param {number} offset - * @returns the scaled time as a number - */ -var scaleTime = function(presentationTime, timescale, timeDelta, offset) { - return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale; -}; - -/** - * Checks the emsg box data for validity based on the version - * @param {number} version of the emsg box to validate - * @param {Object} emsg the emsg data to validate - * @returns if the box is valid as a boolean - */ -var isValidEmsgBox = function(version, emsg) { - var hasScheme = emsg.scheme_id_uri !== '\0' - var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme; - var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; - // Only valid versions of emsg are 0 and 1 - return !(version > 1) && isValidV0Box || isValidV1Box; -}; - -// Utility function to check if an object is defined -var isDefined = function(data) { - return data !== undefined || data !== null; -}; - -module.exports = { - parseEmsgBox: parseEmsgBox, - scaleTime: scaleTime -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/find-box.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/find-box.js deleted file mode 100644 index eced28d12e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/find-box.js +++ /dev/null @@ -1,44 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; -var parseType = require('./parse-type.js'); - -var findBox = function(data, path) { - var results = [], - i, size, type, end, subresults; - - if (!path.length) { - // short-circuit the search for empty paths - return null; - } - - for (i = 0; i < data.byteLength;) { - size = toUnsigned(data[i] << 24 | - data[i + 1] << 16 | - data[i + 2] << 8 | - data[i + 3]); - - type = parseType(data.subarray(i + 4, i + 8)); - - end = size > 1 ? i + size : data.byteLength; - - if (type === path[0]) { - if (path.length === 1) { - // this is the end of the path and we've found the box we were - // looking for - results.push(data.subarray(i + 8, end)); - } else { - // recursively search for the next box along the path - subresults = findBox(data.subarray(i + 8, end), path.slice(1)); - if (subresults.length) { - results = results.concat(subresults); - } - } - } - i = end; - } - - // we've finished searching all of data - return results; -}; - -module.exports = findBox; - diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/frame-utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/frame-utils.js deleted file mode 100644 index c7d98ec0f8..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/frame-utils.js +++ /dev/null @@ -1,319 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -// Convert an array of nal units into an array of frames with each frame being -// composed of the nal units that make up that frame -// Also keep track of cummulative data about the frame from the nal units such -// as the frame duration, starting pts, etc. -var groupNalsIntoFrames = function(nalUnits) { - var - i, - currentNal, - currentFrame = [], - frames = []; - - // TODO added for LHLS, make sure this is OK - frames.byteLength = 0; - frames.nalCount = 0; - frames.duration = 0; - - currentFrame.byteLength = 0; - - for (i = 0; i < nalUnits.length; i++) { - currentNal = nalUnits[i]; - - // Split on 'aud'-type nal units - if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') { - // Since the very first nal unit is expected to be an AUD - // only push to the frames array when currentFrame is not empty - if (currentFrame.length) { - currentFrame.duration = currentNal.dts - currentFrame.dts; - // TODO added for LHLS, make sure this is OK - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - frames.push(currentFrame); - } - currentFrame = [currentNal]; - currentFrame.byteLength = currentNal.data.byteLength; - currentFrame.pts = currentNal.pts; - currentFrame.dts = currentNal.dts; - } else { - // Specifically flag key frames for ease of use later - if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') { - currentFrame.keyFrame = true; - } - currentFrame.duration = currentNal.dts - currentFrame.dts; - currentFrame.byteLength += currentNal.data.byteLength; - currentFrame.push(currentNal); - } - } - - // For the last frame, use the duration of the previous frame if we - // have nothing better to go on - if (frames.length && - (!currentFrame.duration || - currentFrame.duration <= 0)) { - currentFrame.duration = frames[frames.length - 1].duration; - } - - // Push the final frame - // TODO added for LHLS, make sure this is OK - frames.byteLength += currentFrame.byteLength; - frames.nalCount += currentFrame.length; - frames.duration += currentFrame.duration; - - frames.push(currentFrame); - return frames; -}; - -// Convert an array of frames into an array of Gop with each Gop being composed -// of the frames that make up that Gop -// Also keep track of cummulative data about the Gop from the frames such as the -// Gop duration, starting pts, etc. -var groupFramesIntoGops = function(frames) { - var - i, - currentFrame, - currentGop = [], - gops = []; - - // We must pre-set some of the values on the Gop since we - // keep running totals of these values - currentGop.byteLength = 0; - currentGop.nalCount = 0; - currentGop.duration = 0; - currentGop.pts = frames[0].pts; - currentGop.dts = frames[0].dts; - - // store some metadata about all the Gops - gops.byteLength = 0; - gops.nalCount = 0; - gops.duration = 0; - gops.pts = frames[0].pts; - gops.dts = frames[0].dts; - - for (i = 0; i < frames.length; i++) { - currentFrame = frames[i]; - - if (currentFrame.keyFrame) { - // Since the very first frame is expected to be an keyframe - // only push to the gops array when currentGop is not empty - if (currentGop.length) { - gops.push(currentGop); - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - } - - currentGop = [currentFrame]; - currentGop.nalCount = currentFrame.length; - currentGop.byteLength = currentFrame.byteLength; - currentGop.pts = currentFrame.pts; - currentGop.dts = currentFrame.dts; - currentGop.duration = currentFrame.duration; - } else { - currentGop.duration += currentFrame.duration; - currentGop.nalCount += currentFrame.length; - currentGop.byteLength += currentFrame.byteLength; - currentGop.push(currentFrame); - } - } - - if (gops.length && currentGop.duration <= 0) { - currentGop.duration = gops[gops.length - 1].duration; - } - gops.byteLength += currentGop.byteLength; - gops.nalCount += currentGop.nalCount; - gops.duration += currentGop.duration; - - // push the final Gop - gops.push(currentGop); - return gops; -}; - -/* - * Search for the first keyframe in the GOPs and throw away all frames - * until that keyframe. Then extend the duration of the pulled keyframe - * and pull the PTS and DTS of the keyframe so that it covers the time - * range of the frames that were disposed. - * - * @param {Array} gops video GOPs - * @returns {Array} modified video GOPs - */ -var extendFirstKeyFrame = function(gops) { - var currentGop; - - if (!gops[0][0].keyFrame && gops.length > 1) { - // Remove the first GOP - currentGop = gops.shift(); - - gops.byteLength -= currentGop.byteLength; - gops.nalCount -= currentGop.nalCount; - - // Extend the first frame of what is now the - // first gop to cover the time period of the - // frames we just removed - gops[0][0].dts = currentGop.dts; - gops[0][0].pts = currentGop.pts; - gops[0][0].duration += currentGop.duration; - } - - return gops; -}; - -/** - * Default sample object - * see ISO/IEC 14496-12:2012, section 8.6.4.3 - */ -var createDefaultSample = function() { - return { - size: 0, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - degradationPriority: 0, - isNonSyncSample: 1 - } - }; -}; - -/* - * Collates information from a video frame into an object for eventual - * entry into an MP4 sample table. - * - * @param {Object} frame the video frame - * @param {Number} dataOffset the byte offset to position the sample - * @return {Object} object containing sample table info for a frame - */ -var sampleForFrame = function(frame, dataOffset) { - var sample = createDefaultSample(); - - sample.dataOffset = dataOffset; - sample.compositionTimeOffset = frame.pts - frame.dts; - sample.duration = frame.duration; - sample.size = 4 * frame.length; // Space for nal unit size - sample.size += frame.byteLength; - - if (frame.keyFrame) { - sample.flags.dependsOn = 2; - sample.flags.isNonSyncSample = 0; - } - - return sample; -}; - -// generate the track's sample table from an array of gops -var generateSampleTable = function(gops, baseDataOffset) { - var - h, i, - sample, - currentGop, - currentFrame, - dataOffset = baseDataOffset || 0, - samples = []; - - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - sample = sampleForFrame(currentFrame, dataOffset); - - dataOffset += sample.size; - - samples.push(sample); - } - } - return samples; -}; - -// generate the track's raw mdat data from an array of gops -var concatenateNalData = function(gops) { - var - h, i, j, - currentGop, - currentFrame, - currentNal, - dataOffset = 0, - nalsByteLength = gops.byteLength, - numberOfNals = gops.nalCount, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); - - // For each Gop.. - for (h = 0; h < gops.length; h++) { - currentGop = gops[h]; - - // For each Frame.. - for (i = 0; i < currentGop.length; i++) { - currentFrame = currentGop[i]; - - // For each NAL.. - for (j = 0; j < currentFrame.length; j++) { - currentNal = currentFrame[j]; - - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - } - } - return data; -}; - -// generate the track's sample table from a frame -var generateSampleTableForFrame = function(frame, baseDataOffset) { - var - sample, - dataOffset = baseDataOffset || 0, - samples = []; - - sample = sampleForFrame(frame, dataOffset); - samples.push(sample); - - return samples; -}; - -// generate the track's raw mdat data from a frame -var concatenateNalDataForFrame = function(frame) { - var - i, - currentNal, - dataOffset = 0, - nalsByteLength = frame.byteLength, - numberOfNals = frame.length, - totalByteLength = nalsByteLength + 4 * numberOfNals, - data = new Uint8Array(totalByteLength), - view = new DataView(data.buffer); - - // For each NAL.. - for (i = 0; i < frame.length; i++) { - currentNal = frame[i]; - - view.setUint32(dataOffset, currentNal.data.byteLength); - dataOffset += 4; - data.set(currentNal.data, dataOffset); - dataOffset += currentNal.data.byteLength; - } - - return data; -}; - -module.exports = { - groupNalsIntoFrames: groupNalsIntoFrames, - groupFramesIntoGops: groupFramesIntoGops, - extendFirstKeyFrame: extendFirstKeyFrame, - generateSampleTable: generateSampleTable, - concatenateNalData: concatenateNalData, - generateSampleTableForFrame: generateSampleTableForFrame, - concatenateNalDataForFrame: concatenateNalDataForFrame -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/index.js deleted file mode 100644 index 15b9123e82..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -module.exports = { - generator: require('./mp4-generator'), - probe: require('./probe'), - Transmuxer: require('./transmuxer').Transmuxer, - AudioSegmentStream: require('./transmuxer').AudioSegmentStream, - VideoSegmentStream: require('./transmuxer').VideoSegmentStream, - CaptionParser: require('./caption-parser') -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/mp4-generator.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/mp4-generator.js deleted file mode 100644 index a44781a8a4..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/mp4-generator.js +++ /dev/null @@ -1,800 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Functions that generate fragmented MP4s suitable for use with Media - * Source Extensions. - */ -'use strict'; - -var MAX_UINT32 = require('../utils/numbers.js').MAX_UINT32; - - -var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, - trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, - trun, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, - AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; - -// pre-calculate constants -(function() { - var i; - types = { - avc1: [], // codingname - avcC: [], - btrt: [], - dinf: [], - dref: [], - esds: [], - ftyp: [], - hdlr: [], - mdat: [], - mdhd: [], - mdia: [], - mfhd: [], - minf: [], - moof: [], - moov: [], - mp4a: [], // codingname - mvex: [], - mvhd: [], - pasp: [], - sdtp: [], - smhd: [], - stbl: [], - stco: [], - stsc: [], - stsd: [], - stsz: [], - stts: [], - styp: [], - tfdt: [], - tfhd: [], - traf: [], - trak: [], - trun: [], - trex: [], - tkhd: [], - vmhd: [] - }; - - // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we - // don't throw an error - if (typeof Uint8Array === 'undefined') { - return; - } - - for (i in types) { - if (types.hasOwnProperty(i)) { - types[i] = [ - i.charCodeAt(0), - i.charCodeAt(1), - i.charCodeAt(2), - i.charCodeAt(3) - ]; - } - } - - MAJOR_BRAND = new Uint8Array([ - 'i'.charCodeAt(0), - 's'.charCodeAt(0), - 'o'.charCodeAt(0), - 'm'.charCodeAt(0) - ]); - AVC1_BRAND = new Uint8Array([ - 'a'.charCodeAt(0), - 'v'.charCodeAt(0), - 'c'.charCodeAt(0), - '1'.charCodeAt(0) - ]); - MINOR_VERSION = new Uint8Array([0, 0, 0, 1]); - VIDEO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x56, 0x69, 0x64, 0x65, - 0x6f, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler' - ]); - AUDIO_HDLR = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun' - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x53, 0x6f, 0x75, 0x6e, - 0x64, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler' - ]); - HDLR_TYPES = { - video: VIDEO_HDLR, - audio: AUDIO_HDLR - }; - DREF = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x0c, // entry_size - 0x75, 0x72, 0x6c, 0x20, // 'url' type - 0x00, // version 0 - 0x00, 0x00, 0x01 // entry_flags - ]); - SMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // balance, 0 means centered - 0x00, 0x00 // reserved - ]); - STCO = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00 // entry_count - ]); - STSC = STCO; - STSZ = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x00 // sample_count - ]); - STTS = STCO; - VMHD = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x01, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 // opcolor - ]); -}()); - -box = function(type) { - var - payload = [], - size = 0, - i, - result, - view; - - for (i = 1; i < arguments.length; i++) { - payload.push(arguments[i]); - } - - i = payload.length; - - // calculate the total size we need to allocate - while (i--) { - size += payload[i].byteLength; - } - result = new Uint8Array(size + 8); - view = new DataView(result.buffer, result.byteOffset, result.byteLength); - view.setUint32(0, result.byteLength); - result.set(type, 4); - - // copy the payload into the result - for (i = 0, size = 8; i < payload.length; i++) { - result.set(payload[i], size); - size += payload[i].byteLength; - } - return result; -}; - -dinf = function() { - return box(types.dinf, box(types.dref, DREF)); -}; - -esds = function(track) { - return box(types.esds, new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, // flags - - // ES_Descriptor - 0x03, // tag, ES_DescrTag - 0x19, // length - 0x00, 0x00, // ES_ID - 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority - - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x11, // length - 0x40, // object type - 0x15, // streamType - 0x00, 0x06, 0x00, // bufferSizeDB - 0x00, 0x00, 0xda, 0xc0, // maxBitrate - 0x00, 0x00, 0xda, 0xc0, // avgBitrate - - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // ISO/IEC 14496-3, AudioSpecificConfig - // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35 - (track.audioobjecttype << 3) | (track.samplingfrequencyindex >>> 1), - (track.samplingfrequencyindex << 7) | (track.channelcount << 3), - 0x06, 0x01, 0x02 // GASpecificConfig - ])); -}; - -ftyp = function() { - return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND); -}; - -hdlr = function(type) { - return box(types.hdlr, HDLR_TYPES[type]); -}; -mdat = function(data) { - return box(types.mdat, data); -}; -mdhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - - (track.duration >>> 24) & 0xFF, - (track.duration >>> 16) & 0xFF, - (track.duration >>> 8) & 0xFF, - track.duration & 0xFF, // duration - 0x55, 0xc4, // 'und' language (undetermined) - 0x00, 0x00 - ]); - - // Use the sample rate from the track metadata, when it is - // defined. The sample rate can be parsed out of an ADTS header, for - // instance. - if (track.samplerate) { - result[12] = (track.samplerate >>> 24) & 0xFF; - result[13] = (track.samplerate >>> 16) & 0xFF; - result[14] = (track.samplerate >>> 8) & 0xFF; - result[15] = (track.samplerate) & 0xFF; - } - - return box(types.mdhd, result); -}; -mdia = function(track) { - return box(types.mdia, mdhd(track), hdlr(track.type), minf(track)); -}; -mfhd = function(sequenceNumber) { - return box(types.mfhd, new Uint8Array([ - 0x00, - 0x00, 0x00, 0x00, // flags - (sequenceNumber & 0xFF000000) >> 24, - (sequenceNumber & 0xFF0000) >> 16, - (sequenceNumber & 0xFF00) >> 8, - sequenceNumber & 0xFF // sequence_number - ])); -}; -minf = function(track) { - return box(types.minf, - track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), - dinf(), - stbl(track)); -}; -moof = function(sequenceNumber, tracks) { - var - trackFragments = [], - i = tracks.length; - // build traf boxes for each track fragment - while (i--) { - trackFragments[i] = traf(tracks[i]); - } - return box.apply(null, [ - types.moof, - mfhd(sequenceNumber) - ].concat(trackFragments)); -}; -/** - * Returns a movie box. - * @param tracks {array} the tracks associated with this movie - * @see ISO/IEC 14496-12:2012(E), section 8.2.1 - */ -moov = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trak(tracks[i]); - } - - return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks))); -}; -mvex = function(tracks) { - var - i = tracks.length, - boxes = []; - - while (i--) { - boxes[i] = trex(tracks[i]); - } - return box.apply(null, [types.mvex].concat(boxes)); -}; -mvhd = function(duration) { - var - bytes = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 "ticks" per second - (duration & 0xFF000000) >> 24, - (duration & 0xFF0000) >> 16, - (duration & 0xFF00) >> 8, - duration & 0xFF, // duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0xff, 0xff, 0xff, 0xff // next_track_ID - ]); - return box(types.mvhd, bytes); -}; - -sdtp = function(track) { - var - samples = track.samples || [], - bytes = new Uint8Array(4 + samples.length), - flags, - i; - - // leave the full box header (4 bytes) all zero - - // write the sample table - for (i = 0; i < samples.length; i++) { - flags = samples[i].flags; - - bytes[i + 4] = (flags.dependsOn << 4) | - (flags.isDependedOn << 2) | - (flags.hasRedundancy); - } - - return box(types.sdtp, - bytes); -}; - -stbl = function(track) { - return box(types.stbl, - stsd(track), - box(types.stts, STTS), - box(types.stsc, STSC), - box(types.stsz, STSZ), - box(types.stco, STCO)); -}; - -(function() { - var videoSample, audioSample; - - stsd = function(track) { - - return box(types.stsd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01 - ]), track.type === 'video' ? videoSample(track) : audioSample(track)); - }; - - videoSample = function(track) { - var - sps = track.sps || [], - pps = track.pps || [], - sequenceParameterSets = [], - pictureParameterSets = [], - i, - avc1Box; - - // assemble the SPSs - for (i = 0; i < sps.length; i++) { - sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8); - sequenceParameterSets.push((sps[i].byteLength & 0xFF)); // sequenceParameterSetLength - sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS - } - - // assemble the PPSs - for (i = 0; i < pps.length; i++) { - pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8); - pictureParameterSets.push((pps[i].byteLength & 0xFF)); - pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i])); - } - - avc1Box = [ - types.avc1, new Uint8Array([ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - (track.width & 0xff00) >> 8, - track.width & 0xff, // width - (track.height & 0xff00) >> 8, - track.height & 0xff, // height - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x13, - 0x76, 0x69, 0x64, 0x65, - 0x6f, 0x6a, 0x73, 0x2d, - 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x69, 0x62, 0x2d, - 0x68, 0x6c, 0x73, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11 // pre_defined = -1 - ]), - box(types.avcC, new Uint8Array([ - 0x01, // configurationVersion - track.profileIdc, // AVCProfileIndication - track.profileCompatibility, // profile_compatibility - track.levelIdc, // AVCLevelIndication - 0xff // lengthSizeMinusOne, hard-coded to 4 bytes - ].concat( - [sps.length], // numOfSequenceParameterSets - sequenceParameterSets, // "SPS" - [pps.length], // numOfPictureParameterSets - pictureParameterSets // "PPS" - ))), - box(types.btrt, new Uint8Array([ - 0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB - 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate - 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate - ])) - ]; - - if (track.sarRatio) { - var - hSpacing = track.sarRatio[0], - vSpacing = track.sarRatio[1]; - - avc1Box.push( - box(types.pasp, new Uint8Array([ - (hSpacing & 0xFF000000) >> 24, - (hSpacing & 0xFF0000) >> 16, - (hSpacing & 0xFF00) >> 8, - hSpacing & 0xFF, - (vSpacing & 0xFF000000) >> 24, - (vSpacing & 0xFF0000) >> 16, - (vSpacing & 0xFF00) >> 8, - vSpacing & 0xFF - ])) - ); - } - - return box.apply(null, avc1Box); - }; - - audioSample = function(track) { - return box(types.mp4a, new Uint8Array([ - - // SampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - - // AudioSampleEntry, ISO/IEC 14496-12 - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - (track.channelcount & 0xff00) >> 8, - (track.channelcount & 0xff), // channelcount - - (track.samplesize & 0xff00) >> 8, - (track.samplesize & 0xff), // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - - (track.samplerate & 0xff00) >> 8, - (track.samplerate & 0xff), - 0x00, 0x00 // samplerate, 16.16 - - // MP4AudioSampleEntry, ISO/IEC 14496-14 - ]), esds(track)); - }; -}()); - -tkhd = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x07, // flags - 0x00, 0x00, 0x00, 0x00, // creation_time - 0x00, 0x00, 0x00, 0x00, // modification_time - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - track.id & 0xFF, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - (track.duration & 0xFF000000) >> 24, - (track.duration & 0xFF0000) >> 16, - (track.duration & 0xFF00) >> 8, - track.duration & 0xFF, // duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x01, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix - (track.width & 0xFF00) >> 8, - track.width & 0xFF, - 0x00, 0x00, // width - (track.height & 0xFF00) >> 8, - track.height & 0xFF, - 0x00, 0x00 // height - ]); - - return box(types.tkhd, result); -}; - -/** - * Generate a track fragment (traf) box. A traf box collects metadata - * about tracks in a movie fragment (moof) box. - */ -traf = function(track) { - var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, - sampleDependencyTable, dataOffset, - upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime; - - trackFragmentHeader = box(types.tfhd, new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x3a, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00 // default_sample_flags - ])); - - upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / (MAX_UINT32)); - lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % (MAX_UINT32)); - - trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([ - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // baseMediaDecodeTime - (upperWordBaseMediaDecodeTime >>> 24) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 16) & 0xFF, - (upperWordBaseMediaDecodeTime >>> 8) & 0xFF, - upperWordBaseMediaDecodeTime & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 24) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 16) & 0xFF, - (lowerWordBaseMediaDecodeTime >>> 8) & 0xFF, - lowerWordBaseMediaDecodeTime & 0xFF - ])); - - // the data offset specifies the number of bytes from the start of - // the containing moof to the first payload byte of the associated - // mdat - dataOffset = (32 + // tfhd - 20 + // tfdt - 8 + // traf header - 16 + // mfhd - 8 + // moof header - 8); // mdat header - - // audio tracks require less metadata - if (track.type === 'audio') { - trackFragmentRun = trun(track, dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun); - } - - // video tracks should contain an independent and disposable samples - // box (sdtp) - // generate one and adjust offsets to match - sampleDependencyTable = sdtp(track); - trackFragmentRun = trun(track, - sampleDependencyTable.length + dataOffset); - return box(types.traf, - trackFragmentHeader, - trackFragmentDecodeTime, - trackFragmentRun, - sampleDependencyTable); -}; - -/** - * Generate a track box. - * @param track {object} a track definition - * @return {Uint8Array} the track box - */ -trak = function(track) { - track.duration = track.duration || 0xffffffff; - return box(types.trak, - tkhd(track), - mdia(track)); -}; - -trex = function(track) { - var result = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - (track.id & 0xFF000000) >> 24, - (track.id & 0xFF0000) >> 16, - (track.id & 0xFF00) >> 8, - (track.id & 0xFF), // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x01, 0x00, 0x01 // default_sample_flags - ]); - // the last two bytes of default_sample_flags is the sample - // degradation priority, a hint about the importance of this sample - // relative to others. Lower the degradation priority for all sample - // types other than video. - if (track.type !== 'video') { - result[result.length - 1] = 0x00; - } - - return box(types.trex, result); -}; - -(function() { - var audioTrun, videoTrun, trunHeader; - - // This method assumes all samples are uniform. That is, if a - // duration is present for the first sample, it will be present for - // all subsequent samples. - // see ISO/IEC 14496-12:2012, Section 8.8.8.1 - trunHeader = function(samples, offset) { - var durationPresent = 0, sizePresent = 0, - flagsPresent = 0, compositionTimeOffset = 0; - - // trun flag constants - if (samples.length) { - if (samples[0].duration !== undefined) { - durationPresent = 0x1; - } - if (samples[0].size !== undefined) { - sizePresent = 0x2; - } - if (samples[0].flags !== undefined) { - flagsPresent = 0x4; - } - if (samples[0].compositionTimeOffset !== undefined) { - compositionTimeOffset = 0x8; - } - } - - return [ - 0x00, // version 0 - 0x00, - durationPresent | sizePresent | flagsPresent | compositionTimeOffset, - 0x01, // flags - (samples.length & 0xFF000000) >>> 24, - (samples.length & 0xFF0000) >>> 16, - (samples.length & 0xFF00) >>> 8, - samples.length & 0xFF, // sample_count - (offset & 0xFF000000) >>> 24, - (offset & 0xFF0000) >>> 16, - (offset & 0xFF00) >>> 8, - offset & 0xFF // data_offset - ]; - }; - - videoTrun = function(track, offset) { - var bytesOffest, bytes, header, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (16 * samples.length); - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 16); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - bytes[bytesOffest++] = (sample.flags.isLeading << 2) | sample.flags.dependsOn; - bytes[bytesOffest++] = (sample.flags.isDependedOn << 6) | - (sample.flags.hasRedundancy << 4) | - (sample.flags.paddingValue << 1) | - sample.flags.isNonSyncSample; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8; - bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset - } - return box(types.trun, bytes); - }; - - audioTrun = function(track, offset) { - var bytes, bytesOffest, header, samples, sample, i; - - samples = track.samples || []; - offset += 8 + 12 + (8 * samples.length); - - header = trunHeader(samples, offset); - bytes = new Uint8Array(header.length + samples.length * 8); - bytes.set(header); - bytesOffest = header.length; - - for (i = 0; i < samples.length; i++) { - sample = samples[i]; - bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration - bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24; - bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16; - bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8; - bytes[bytesOffest++] = sample.size & 0xFF; // sample_size - } - - return box(types.trun, bytes); - }; - - trun = function(track, offset) { - if (track.type === 'audio') { - return audioTrun(track, offset); - } - - return videoTrun(track, offset); - }; -}()); - -module.exports = { - ftyp: ftyp, - mdat: mdat, - moof: moof, - moov: moov, - initSegment: function(tracks) { - var - fileType = ftyp(), - movie = moov(tracks), - result; - - result = new Uint8Array(fileType.byteLength + movie.byteLength); - result.set(fileType); - result.set(movie, fileType.byteLength); - return result; - } -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/parse-type.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/parse-type.js deleted file mode 100644 index c39d67d904..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/parse-type.js +++ /dev/null @@ -1,11 +0,0 @@ -var parseType = function(buffer) { - var result = ''; - result += String.fromCharCode(buffer[0]); - result += String.fromCharCode(buffer[1]); - result += String.fromCharCode(buffer[2]); - result += String.fromCharCode(buffer[3]); - return result; -}; - - -module.exports = parseType; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/probe.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/probe.js deleted file mode 100644 index a7045a38c9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/probe.js +++ /dev/null @@ -1,409 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Utilities to detect basic properties and metadata about MP4s. - */ -'use strict'; - -var toUnsigned = require('../utils/bin').toUnsigned; -var toHexString = require('../utils/bin').toHexString; -var findBox = require('../mp4/find-box.js'); -var parseType = require('../mp4/parse-type.js'); -var emsg = require('../mp4/emsg.js'); -var parseTfhd = require('../tools/parse-tfhd.js'); -var parseTrun = require('../tools/parse-trun.js'); -var parseTfdt = require('../tools/parse-tfdt.js'); -var getUint64 = require('../utils/numbers.js').getUint64; -var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, - getTimescaleFromMediaHeader, getEmsgID3; -var window = require('global/window'); -var parseId3Frames = require('../tools/parse-id3.js').parseId3Frames; - - -/** - * Parses an MP4 initialization segment and extracts the timescale - * values for any declared tracks. Timescale values indicate the - * number of clock ticks per second to assume for time-based values - * elsewhere in the MP4. - * - * To determine the start time of an MP4, you need two pieces of - * information: the timescale unit and the earliest base media decode - * time. Multiple timescales can be specified within an MP4 but the - * base media decode time is always expressed in the timescale from - * the media header box for the track: - * ``` - * moov > trak > mdia > mdhd.timescale - * ``` - * @param init {Uint8Array} the bytes of the init segment - * @return {object} a hash of track ids to timescale values or null if - * the init segment is malformed. - */ -timescale = function(init) { - var - result = {}, - traks = findBox(init, ['moov', 'trak']); - - // mdhd timescale - return traks.reduce(function(result, trak) { - var tkhd, version, index, id, mdhd; - - tkhd = findBox(trak, ['tkhd'])[0]; - if (!tkhd) { - return null; - } - version = tkhd[0]; - index = version === 0 ? 12 : 20; - id = toUnsigned(tkhd[index] << 24 | - tkhd[index + 1] << 16 | - tkhd[index + 2] << 8 | - tkhd[index + 3]); - - mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - if (!mdhd) { - return null; - } - version = mdhd[0]; - index = version === 0 ? 12 : 20; - result[id] = toUnsigned(mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3]); - return result; - }, result); -}; - -/** - * Determine the base media decode start time, in seconds, for an MP4 - * fragment. If multiple fragments are specified, the earliest time is - * returned. - * - * The base media decode time can be parsed from track fragment - * metadata: - * ``` - * moof > traf > tfdt.baseMediaDecodeTime - * ``` - * It requires the timescale value from the mdhd to interpret. - * - * @param timescale {object} a hash of track ids to timescale values. - * @return {number} the earliest base media decode start time for the - * fragment, in seconds - */ -startTime = function(timescale, fragment) { - var trafs, result; - - // we need info from two childrend of each track fragment box - trafs = findBox(fragment, ['moof', 'traf']); - - // determine the start times for each track - var lowestTime = trafs.reduce(function(acc, traf) { - var tfhd = findBox(traf, ['tfhd'])[0]; - - // get the track id from the tfhd - var id = toUnsigned(tfhd[4] << 24 | - tfhd[5] << 16 | - tfhd[6] << 8 | - tfhd[7]); - // assume a 90kHz clock if no timescale was specified - var scale = timescale[id] || 90e3; - - // get the base media decode time from the tfdt - var tfdt = findBox(traf, ['tfdt'])[0]; - var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength); - var baseTime; - - // version 1 is 64 bit - if (tfdt[0] === 1) { - baseTime = getUint64(tfdt.subarray(4, 12)); - } else { - baseTime = dv.getUint32(4); - } - - // convert base time to seconds if it is a valid number. - let seconds; - if (typeof baseTime === 'bigint') { - seconds = baseTime / window.BigInt(scale); - } else if (typeof baseTime === 'number' && !isNaN(baseTime)) { - seconds = baseTime / scale; - } - - if (seconds < Number.MAX_SAFE_INTEGER) { - seconds = Number(seconds); - } - - if (seconds < acc) { - acc = seconds; - } - - return acc; - }, Infinity); - - return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0; -}; - -/** - * Determine the composition start, in seconds, for an MP4 - * fragment. - * - * The composition start time of a fragment can be calculated using the base - * media decode time, composition time offset, and timescale, as follows: - * - * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale - * - * All of the aforementioned information is contained within a media fragment's - * `traf` box, except for timescale info, which comes from the initialization - * segment, so a track id (also contained within a `traf`) is also necessary to - * associate it with a timescale - * - * - * @param timescales {object} - a hash of track ids to timescale values. - * @param fragment {Unit8Array} - the bytes of a media segment - * @return {number} the composition start time for the fragment, in seconds - **/ -compositionStartTime = function(timescales, fragment) { - var trafBoxes = findBox(fragment, ['moof', 'traf']); - var baseMediaDecodeTime = 0; - var compositionTimeOffset = 0; - var trackId; - - if (trafBoxes && trafBoxes.length) { - // The spec states that track run samples contained within a `traf` box are contiguous, but - // it does not explicitly state whether the `traf` boxes themselves are contiguous. - // We will assume that they are, so we only need the first to calculate start time. - var tfhd = findBox(trafBoxes[0], ['tfhd'])[0]; - var trun = findBox(trafBoxes[0], ['trun'])[0]; - var tfdt = findBox(trafBoxes[0], ['tfdt'])[0]; - - if (tfhd) { - var parsedTfhd = parseTfhd(tfhd); - - trackId = parsedTfhd.trackId; - } - - if (tfdt) { - var parsedTfdt = parseTfdt(tfdt); - - baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime; - } - - if (trun) { - var parsedTrun = parseTrun(trun); - - if (parsedTrun.samples && parsedTrun.samples.length) { - compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0; - } - } - } - - // Get timescale for this specific track. Assume a 90kHz clock if no timescale was - // specified. - var timescale = timescales[trackId] || 90e3; - - // return the composition start time, in seconds - if (typeof baseMediaDecodeTime === 'bigint') { - compositionTimeOffset = window.BigInt(compositionTimeOffset); - timescale = window.BigInt(timescale); - } - - var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale; - - if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) { - result = Number(result); - } - - return result; -}; - -/** - * Find the trackIds of the video tracks in this source. - * Found by parsing the Handler Reference and Track Header Boxes: - * moov > trak > mdia > hdlr - * moov > trak > tkhd - * - * @param {Uint8Array} init - The bytes of the init segment for this source - * @return {Number[]} A list of trackIds - * - * @see ISO-BMFF-12/2015, Section 8.4.3 - **/ -getVideoTrackIds = function(init) { - var traks = findBox(init, ['moov', 'trak']); - var videoTrackIds = []; - - traks.forEach(function(trak) { - var hdlrs = findBox(trak, ['mdia', 'hdlr']); - var tkhds = findBox(trak, ['tkhd']); - - hdlrs.forEach(function(hdlr, index) { - var handlerType = parseType(hdlr.subarray(8, 12)); - var tkhd = tkhds[index]; - var view; - var version; - var trackId; - - if (handlerType === 'vide') { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - version = view.getUint8(0); - trackId = (version === 0) ? view.getUint32(12) : view.getUint32(20); - - videoTrackIds.push(trackId); - } - }); - }); - - return videoTrackIds; -}; - -getTimescaleFromMediaHeader = function(mdhd) { - // mdhd is a FullBox, meaning it will have its own version as the first byte - var version = mdhd[0]; - var index = version === 0 ? 12 : 20; - - return toUnsigned( - mdhd[index] << 24 | - mdhd[index + 1] << 16 | - mdhd[index + 2] << 8 | - mdhd[index + 3] - ); -}; - -/** - * Get all the video, audio, and hint tracks from a non fragmented - * mp4 segment - */ -getTracks = function(init) { - var traks = findBox(init, ['moov', 'trak']); - var tracks = []; - - traks.forEach(function(trak) { - var track = {}; - var tkhd = findBox(trak, ['tkhd'])[0]; - var view, tkhdVersion; - - // id - if (tkhd) { - view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength); - tkhdVersion = view.getUint8(0); - - track.id = (tkhdVersion === 0) ? view.getUint32(12) : view.getUint32(20); - } - - var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; - - // type - if (hdlr) { - var type = parseType(hdlr.subarray(8, 12)); - - if (type === 'vide') { - track.type = 'video'; - } else if (type === 'soun') { - track.type = 'audio'; - } else { - track.type = type; - } - } - - - // codec - var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0]; - - if (stsd) { - var sampleDescriptions = stsd.subarray(8); - // gives the codec type string - track.codec = parseType(sampleDescriptions.subarray(4, 8)); - - var codecBox = findBox(sampleDescriptions, [track.codec])[0]; - var codecConfig, codecConfigType; - - if (codecBox) { - // https://tools.ietf.org/html/rfc6381#section-3.3 - if ((/^[asm]vc[1-9]$/i).test(track.codec)) { - // we don't need anything but the "config" parameter of the - // avc1 codecBox - codecConfig = codecBox.subarray(78); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'avcC' && codecConfig.length > 11) { - track.codec += '.'; - - // left padded with zeroes for single digit hex - // profile idc - track.codec += toHexString(codecConfig[9]); - // the byte containing the constraint_set flags - track.codec += toHexString(codecConfig[10]); - // level idc - track.codec += toHexString(codecConfig[11]); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'avc1.4d400d'; - } - } else if ((/^mp4[a,v]$/i).test(track.codec)) { - // we do not need anything but the streamDescriptor of the mp4a codecBox - codecConfig = codecBox.subarray(28); - codecConfigType = parseType(codecConfig.subarray(4, 8)); - - if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) { - track.codec += '.' + toHexString(codecConfig[19]); - // this value is only a single digit - track.codec += '.' + toHexString((codecConfig[20] >>> 2) & 0x3f).replace(/^0/, ''); - } else { - // TODO: show a warning that we couldn't parse the codec - // and are using the default - track.codec = 'mp4a.40.2'; - } - } else { - // flac, opus, etc - track.codec = track.codec.toLowerCase(); - } - } - } - - var mdhd = findBox(trak, ['mdia', 'mdhd'])[0]; - - if (mdhd) { - track.timescale = getTimescaleFromMediaHeader(mdhd); - } - - tracks.push(track); - }); - - return tracks; -}; - -/** - * Returns an array of emsg ID3 data from the provided segmentData. - * An offset can also be provided as the Latest Arrival Time to calculate - * the Event Start Time of v0 EMSG boxes. - * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing - * - * @param {Uint8Array} segmentData the segment byte array. - * @param {number} offset the segment start time or Latest Arrival Time, - * @return {Object[]} an array of ID3 parsed from EMSG boxes - */ -getEmsgID3 = function(segmentData, offset = 0) { - var emsgBoxes = findBox(segmentData, ['emsg']); - return emsgBoxes.map((data) => { - var parsedBox = emsg.parseEmsgBox(new Uint8Array(data)); - var parsedId3Frames = parseId3Frames(parsedBox.message_data); - return { - cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset), - duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale), - frames: parsedId3Frames - }; - }); -}; - -module.exports = { - // export mp4 inspector's findBox and parseType for backwards compatibility - findBox: findBox, - parseType: parseType, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader, - getEmsgID3: getEmsgID3, -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/track-decode-info.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/track-decode-info.js deleted file mode 100644 index 49c4af2ee7..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/track-decode-info.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -/** - * Store information about the start and end of the track and the - * duration for each frame/sample we process in order to calculate - * the baseMediaDecodeTime - */ -var collectDtsInfo = function(track, data) { - if (typeof data.pts === 'number') { - if (track.timelineStartInfo.pts === undefined) { - track.timelineStartInfo.pts = data.pts; - } - - if (track.minSegmentPts === undefined) { - track.minSegmentPts = data.pts; - } else { - track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); - } - - if (track.maxSegmentPts === undefined) { - track.maxSegmentPts = data.pts; - } else { - track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); - } - } - - if (typeof data.dts === 'number') { - if (track.timelineStartInfo.dts === undefined) { - track.timelineStartInfo.dts = data.dts; - } - - if (track.minSegmentDts === undefined) { - track.minSegmentDts = data.dts; - } else { - track.minSegmentDts = Math.min(track.minSegmentDts, data.dts); - } - - if (track.maxSegmentDts === undefined) { - track.maxSegmentDts = data.dts; - } else { - track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts); - } - } -}; - -/** - * Clear values used to calculate the baseMediaDecodeTime between - * tracks - */ -var clearDtsInfo = function(track) { - delete track.minSegmentDts; - delete track.maxSegmentDts; - delete track.minSegmentPts; - delete track.maxSegmentPts; -}; - -/** - * Calculate the track's baseMediaDecodeTime based on the earliest - * DTS the transmuxer has ever seen and the minimum DTS for the - * current track - * @param track {object} track metadata configuration - * @param keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -var calculateTrackBaseMediaDecodeTime = function(track, keepOriginalTimestamps) { - var - baseMediaDecodeTime, - scale, - minSegmentDts = track.minSegmentDts; - - // Optionally adjust the time so the first segment starts at zero. - if (!keepOriginalTimestamps) { - minSegmentDts -= track.timelineStartInfo.dts; - } - - // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where - // we want the start of the first segment to be placed - baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; - - // Add to that the distance this segment is from the very first - baseMediaDecodeTime += minSegmentDts; - - // baseMediaDecodeTime must not become negative - baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime); - - if (track.type === 'audio') { - // Audio has a different clock equal to the sampling_rate so we need to - // scale the PTS values into the clock rate of the track - scale = track.samplerate / ONE_SECOND_IN_TS; - baseMediaDecodeTime *= scale; - baseMediaDecodeTime = Math.floor(baseMediaDecodeTime); - } - - return baseMediaDecodeTime; -}; - -module.exports = { - clearDtsInfo: clearDtsInfo, - calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime, - collectDtsInfo: collectDtsInfo -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/transmuxer.js deleted file mode 100644 index a248585856..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/mp4/transmuxer.js +++ /dev/null @@ -1,1249 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A stream-based mp2t to mp4 converter. This utility can be used to - * deliver mp4s to a SourceBuffer on platforms that support native - * Media Source Extensions. - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('./mp4-generator.js'); -var frameUtils = require('./frame-utils'); -var audioFrameUtils = require('./audio-frame-utils'); -var trackDecodeInfo = require('./track-decode-info'); -var m2ts = require('../m2ts/m2ts.js'); -var clock = require('../utils/clock'); -var AdtsStream = require('../codecs/adts.js'); -var H264Stream = require('../codecs/h264').H264Stream; -var AacStream = require('../aac'); -var isLikelyAacData = require('../aac/utils').isLikelyAacData; -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -// object types -var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream; - -var retriggerForStream = function(key, event) { - event.stream = key; - this.trigger('log', event); -}; - -var addPipelineLogRetriggers = function(transmuxer, pipeline) { - var keys = Object.keys(pipeline); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - // skip non-stream keys and headOfPipeline - // which is just a duplicate - if (key === 'headOfPipeline' || !pipeline[key].on) { - continue; - } - - pipeline[key].on('log', retriggerForStream.bind(transmuxer, key)); - } -}; - -/** - * Compare two arrays (even typed) for same-ness - */ -var arrayEquals = function(a, b) { - var - i; - - if (a.length !== b.length) { - return false; - } - - // compare the value of each element in the array - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; -}; - -var generateSegmentTimingInfo = function( - baseMediaDecodeTime, - startDts, - startPts, - endDts, - endPts, - prependedContentDuration -) { - var - ptsOffsetFromDts = startPts - startDts, - decodeDuration = endDts - startDts, - presentationDuration = endPts - startPts; - - // The PTS and DTS values are based on the actual stream times from the segment, - // however, the player time values will reflect a start from the baseMediaDecodeTime. - // In order to provide relevant values for the player times, base timing info on the - // baseMediaDecodeTime and the DTS and PTS durations of the segment. - return { - start: { - dts: baseMediaDecodeTime, - pts: baseMediaDecodeTime + ptsOffsetFromDts - }, - end: { - dts: baseMediaDecodeTime + decodeDuration, - pts: baseMediaDecodeTime + presentationDuration - }, - prependedContentDuration: prependedContentDuration, - baseMediaDecodeTime: baseMediaDecodeTime - }; -}; - -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -AudioSegmentStream = function(track, options) { - var - adtsFrames = [], - sequenceNumber, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity; - - options = options || {}; - - sequenceNumber = options.firstSequenceNumber || 0; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - trackDecodeInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function(prop) { - track[prop] = data[prop]; - }); - } - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.setEarliestDts = function(earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function(timestamp) { - audioAppendStartTs = timestamp; - }; - - this.flush = function() { - var - frames, - moof, - mdat, - boxes, - frameDuration, - segmentDuration, - videoClockCyclesOfSilencePrefixed; - - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - this.trigger('done', 'AudioSegmentStream'); - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts( - adtsFrames, track, earliestAllowedDts); - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - // amount of audio filled but the value is in video clock rather than audio clock - videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence( - track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); - - // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - track.samples = audioFrameUtils.generateSampleTable(frames); - - // concatenate the audio data to constuct the mdat - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - - adtsFrames = []; - - moof = mp4.moof(sequenceNumber, [track]); - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - trackDecodeInfo.clearDtsInfo(track); - - frameDuration = Math.ceil(ONE_SECOND_IN_TS * 1024 / track.samplerate); - - // TODO this check was added to maintain backwards compatibility (particularly with - // tests) on adding the timingInfo event. However, it seems unlikely that there's a - // valid use-case where an init segment/data should be triggered without associated - // frames. Leaving for now, but should be looked into. - if (frames.length) { - segmentDuration = frames.length * frameDuration; - - this.trigger( - 'segmentTimingInfo', - generateSegmentTimingInfo( - // The audio track's baseMediaDecodeTime is in audio clock cycles, but the - // frame info is in video clock cycles. Convert to match expectation of - // listeners (that all timestamps will be based on video clock cycles). - clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), - // frame times are already in video clock, as is segment duration - frames[0].dts, - frames[0].pts, - frames[0].dts + segmentDuration, - frames[0].pts + segmentDuration, - videoClockCyclesOfSilencePrefixed || 0 - ) - ); - - this.trigger('timingInfo', { - start: frames[0].pts, - end: frames[0].pts + segmentDuration - }); - } - this.trigger('data', {track: track, boxes: boxes}); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.reset = function() { - trackDecodeInfo.clearDtsInfo(track); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); - -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at 0. - */ -VideoSegmentStream = function(track, options) { - var - sequenceNumber, - nalUnits = [], - gopsToAlignWith = [], - config, - pps; - - options = options || {}; - - sequenceNumber = options.firstSequenceNumber || 0; - - VideoSegmentStream.prototype.init.call(this); - - delete track.minPTS; - - this.gopCache_ = []; - - /** - * Constructs a ISO BMFF segment given H264 nalUnits - * @param {Object} nalUnit A data event representing a nalUnit - * @param {String} nalUnit.nalUnitType - * @param {Object} nalUnit.config Properties for a mp4 track - * @param {Uint8Array} nalUnit.data The nalUnit bytes - * @see lib/codecs/h264.js - **/ - this.push = function(nalUnit) { - trackDecodeInfo.collectDtsInfo(track, nalUnit); - - // record the track config - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - - VIDEO_PROPERTIES.forEach(function(prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && - !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } - - // buffer video until flush() is called - nalUnits.push(nalUnit); - }; - - /** - * Pass constructed ISO BMFF track and boxes on to the - * next stream in the pipeline - **/ - this.flush = function() { - var - frames, - gopForFusion, - gops, - moof, - mdat, - boxes, - prependedContentDuration = 0, - firstGop, - lastGop; - - // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // Return early if no video data has been observed - if (nalUnits.length === 0) { - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } - - // Organize the raw nal-units into arrays that represent - // higher-level constructs such as frames and gops - // (group-of-pictures) - frames = frameUtils.groupNalsIntoFrames(nalUnits); - gops = frameUtils.groupFramesIntoGops(frames); - - // If the first frame of this fragment is not a keyframe we have - // a problem since MSE (on Chrome) requires a leading keyframe. - // - // We have two approaches to repairing this situation: - // 1) GOP-FUSION: - // This is where we keep track of the GOPS (group-of-pictures) - // from previous fragments and attempt to find one that we can - // prepend to the current fragment in order to create a valid - // fragment. - // 2) KEYFRAME-PULLING: - // Here we search for the first keyframe in the fragment and - // throw away all the frames between the start of the fragment - // and that keyframe. We then extend the duration and pull the - // PTS of the keyframe forward so that it covers the time range - // of the frames that were disposed of. - // - // #1 is far prefereable over #2 which can cause "stuttering" but - // requires more things to be just right. - if (!gops[0][0].keyFrame) { - // Search for a gop for fusion from our gopCache - gopForFusion = this.getGopForFusion_(nalUnits[0], track); - - if (gopForFusion) { - // in order to provide more accurate timing information about the segment, save - // the number of seconds prepended to the original segment due to GOP fusion - prependedContentDuration = gopForFusion.duration; - - gops.unshift(gopForFusion); - // Adjust Gops' metadata to account for the inclusion of the - // new gop at the beginning - gops.byteLength += gopForFusion.byteLength; - gops.nalCount += gopForFusion.nalCount; - gops.pts = gopForFusion.pts; - gops.dts = gopForFusion.dts; - gops.duration += gopForFusion.duration; - } else { - // If we didn't find a candidate gop fall back to keyframe-pulling - gops = frameUtils.extendFirstKeyFrame(gops); - } - } - - // Trim gops to align with gopsToAlignWith - if (gopsToAlignWith.length) { - var alignedGops; - - if (options.alignGopsAtEnd) { - alignedGops = this.alignGopsAtEnd_(gops); - } else { - alignedGops = this.alignGopsAtStart_(gops); - } - - if (!alignedGops) { - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); - - // Keep a maximum of 6 GOPs in the cache - this.gopCache_.length = Math.min(6, this.gopCache_.length); - - // Clear nalUnits - nalUnits = []; - - // return early no gops can be aligned with desired gopsToAlignWith - this.resetStream_(); - this.trigger('done', 'VideoSegmentStream'); - return; - } - - // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct - // when recalculated before sending off to CoalesceStream - trackDecodeInfo.clearDtsInfo(track); - - gops = alignedGops; - } - - trackDecodeInfo.collectDtsInfo(track, gops); - - // First, we have to build the index from byte locations to - // samples (that is, frames) in the video data - track.samples = frameUtils.generateSampleTable(gops); - - // Concatenate the video data and construct the mdat - mdat = mp4.mdat(frameUtils.concatenateNalData(gops)); - - track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - this.trigger('processedGopsInfo', gops.map(function(gop) { - return { - pts: gop.pts, - dts: gop.dts, - byteLength: gop.byteLength - }; - })); - - firstGop = gops[0]; - lastGop = gops[gops.length - 1]; - - this.trigger( - 'segmentTimingInfo', - generateSegmentTimingInfo( - track.baseMediaDecodeTime, - firstGop.dts, - firstGop.pts, - lastGop.dts + lastGop.duration, - lastGop.pts + lastGop.duration, - prependedContentDuration)); - - this.trigger('timingInfo', { - start: gops[0].pts, - end: gops[gops.length - 1].pts + gops[gops.length - 1].duration - }); - - // save all the nals in the last GOP into the gop cache - this.gopCache_.unshift({ - gop: gops.pop(), - pps: track.pps, - sps: track.sps - }); - - // Keep a maximum of 6 GOPs in the cache - this.gopCache_.length = Math.min(6, this.gopCache_.length); - - // Clear nalUnits - nalUnits = []; - - this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime); - this.trigger('timelineStartInfo', track.timelineStartInfo); - - moof = mp4.moof(sequenceNumber, [track]); - - // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - // Bump the sequence number for next time - sequenceNumber++; - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - this.trigger('data', {track: track, boxes: boxes}); - - this.resetStream_(); - - // Continue with the flush process now - this.trigger('done', 'VideoSegmentStream'); - }; - - this.reset = function() { - this.resetStream_(); - nalUnits = []; - this.gopCache_.length = 0; - gopsToAlignWith.length = 0; - this.trigger('reset'); - }; - - this.resetStream_ = function() { - trackDecodeInfo.clearDtsInfo(track); - - // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - config = undefined; - pps = undefined; - }; - - // Search for a candidate Gop for gop-fusion from the gop cache and - // return it or return null if no good candidate was found - this.getGopForFusion_ = function(nalUnit) { - var - halfSecond = 45000, // Half-a-second in a 90khz clock - allowableOverlap = 10000, // About 3 frames @ 30fps - nearestDistance = Infinity, - dtsDistance, - nearestGopObj, - currentGop, - currentGopObj, - i; - - // Search for the GOP nearest to the beginning of this nal unit - for (i = 0; i < this.gopCache_.length; i++) { - currentGopObj = this.gopCache_[i]; - currentGop = currentGopObj.gop; - - // Reject Gops with different SPS or PPS - if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || - !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) { - continue; - } - - // Reject Gops that would require a negative baseMediaDecodeTime - if (currentGop.dts < track.timelineStartInfo.dts) { - continue; - } - - // The distance between the end of the gop and the start of the nalUnit - dtsDistance = (nalUnit.dts - currentGop.dts) - currentGop.duration; - - // Only consider GOPS that start before the nal unit and end within - // a half-second of the nal unit - if (dtsDistance >= -allowableOverlap && - dtsDistance <= halfSecond) { - - // Always use the closest GOP we found if there is more than - // one candidate - if (!nearestGopObj || - nearestDistance > dtsDistance) { - nearestGopObj = currentGopObj; - nearestDistance = dtsDistance; - } - } - } - - if (nearestGopObj) { - return nearestGopObj.gop; - } - return null; - }; - - // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the START of the list - this.alignGopsAtStart_ = function(gops) { - var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops; - - byteLength = gops.byteLength; - nalCount = gops.nalCount; - duration = gops.duration; - alignIndex = gopIndex = 0; - - while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - break; - } - - if (gop.pts > align.pts) { - // this current gop starts after the current gop we want to align on, so increment - // align index - alignIndex++; - continue; - } - - // current gop starts before the current gop we want to align on. so increment gop - // index - gopIndex++; - byteLength -= gop.byteLength; - nalCount -= gop.nalCount; - duration -= gop.duration; - } - - if (gopIndex === 0) { - // no gops to trim - return gops; - } - - if (gopIndex === gops.length) { - // all gops trimmed, skip appending all gops - return null; - } - - alignedGops = gops.slice(gopIndex); - alignedGops.byteLength = byteLength; - alignedGops.duration = duration; - alignedGops.nalCount = nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - - return alignedGops; - }; - - // trim gop list to the first gop found that has a matching pts with a gop in the list - // of gopsToAlignWith starting from the END of the list - this.alignGopsAtEnd_ = function(gops) { - var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound; - - alignIndex = gopsToAlignWith.length - 1; - gopIndex = gops.length - 1; - alignEndIndex = null; - matchFound = false; - - while (alignIndex >= 0 && gopIndex >= 0) { - align = gopsToAlignWith[alignIndex]; - gop = gops[gopIndex]; - - if (align.pts === gop.pts) { - matchFound = true; - break; - } - - if (align.pts > gop.pts) { - alignIndex--; - continue; - } - - if (alignIndex === gopsToAlignWith.length - 1) { - // gop.pts is greater than the last alignment candidate. If no match is found - // by the end of this loop, we still want to append gops that come after this - // point - alignEndIndex = gopIndex; - } - - gopIndex--; - } - - if (!matchFound && alignEndIndex === null) { - return null; - } - - var trimIndex; - - if (matchFound) { - trimIndex = gopIndex; - } else { - trimIndex = alignEndIndex; - } - - if (trimIndex === 0) { - return gops; - } - - var alignedGops = gops.slice(trimIndex); - var metadata = alignedGops.reduce(function(total, gop) { - total.byteLength += gop.byteLength; - total.duration += gop.duration; - total.nalCount += gop.nalCount; - return total; - }, { byteLength: 0, duration: 0, nalCount: 0 }); - - alignedGops.byteLength = metadata.byteLength; - alignedGops.duration = metadata.duration; - alignedGops.nalCount = metadata.nalCount; - alignedGops.pts = alignedGops[0].pts; - alignedGops.dts = alignedGops[0].dts; - - return alignedGops; - }; - - this.alignGopsWith = function(newGopsToAlignWith) { - gopsToAlignWith = newGopsToAlignWith; - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -/** - * A Stream that can combine multiple streams (ie. audio & video) - * into a single output segment for MSE. Also supports audio-only - * and video-only streams. - * @param options {object} transmuxer options object - * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps - * in the source; false to adjust the first segment to start at media timeline start. - */ -CoalesceStream = function(options, metadataStream) { - // Number of Tracks per output segment - // If greater than 1, we combine multiple - // tracks into a single segment - this.numberOfTracks = 0; - this.metadataStream = metadataStream; - - options = options || {}; - - if (typeof options.remux !== 'undefined') { - this.remuxTracks = !!options.remux; - } else { - this.remuxTracks = true; - } - - if (typeof options.keepOriginalTimestamps === 'boolean') { - this.keepOriginalTimestamps = options.keepOriginalTimestamps; - } else { - this.keepOriginalTimestamps = false; - } - - this.pendingTracks = []; - this.videoTrack = null; - this.pendingBoxes = []; - this.pendingCaptions = []; - this.pendingMetadata = []; - this.pendingBytes = 0; - this.emittedTracks = 0; - - CoalesceStream.prototype.init.call(this); - - // Take output from multiple - this.push = function(output) { - // buffer incoming captions until the associated video segment - // finishes - if (output.content || output.text) { - return this.pendingCaptions.push(output); - } - // buffer incoming id3 tags until the final flush - if (output.frames) { - return this.pendingMetadata.push(output); - } - - // Add this track to the list of pending tracks and store - // important information required for the construction of - // the final segment - this.pendingTracks.push(output.track); - this.pendingBytes += output.boxes.byteLength; - - // TODO: is there an issue for this against chrome? - // We unshift audio and push video because - // as of Chrome 75 when switching from - // one init segment to another if the video - // mdat does not appear after the audio mdat - // only audio will play for the duration of our transmux. - if (output.track.type === 'video') { - this.videoTrack = output.track; - this.pendingBoxes.push(output.boxes); - } - if (output.track.type === 'audio') { - this.audioTrack = output.track; - this.pendingBoxes.unshift(output.boxes); - } - }; -}; - -CoalesceStream.prototype = new Stream(); -CoalesceStream.prototype.flush = function(flushSource) { - var - offset = 0, - event = { - captions: [], - captionStreams: {}, - metadata: [], - info: {} - }, - caption, - id3, - initSegment, - timelineStartPts = 0, - i; - - if (this.pendingTracks.length < this.numberOfTracks) { - if (flushSource !== 'VideoSegmentStream' && - flushSource !== 'AudioSegmentStream') { - // Return because we haven't received a flush from a data-generating - // portion of the segment (meaning that we have only recieved meta-data - // or captions.) - return; - } else if (this.remuxTracks) { - // Return until we have enough tracks from the pipeline to remux (if we - // are remuxing audio and video into a single MP4) - return; - } else if (this.pendingTracks.length === 0) { - // In the case where we receive a flush without any data having been - // received we consider it an emitted track for the purposes of coalescing - // `done` events. - // We do this for the case where there is an audio and video track in the - // segment but no audio data. (seen in several playlists with alternate - // audio tracks and no audio present in the main TS segments.) - this.emittedTracks++; - - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } - return; - } - } - - if (this.videoTrack) { - timelineStartPts = this.videoTrack.timelineStartInfo.pts; - VIDEO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.videoTrack[prop]; - }, this); - } else if (this.audioTrack) { - timelineStartPts = this.audioTrack.timelineStartInfo.pts; - AUDIO_PROPERTIES.forEach(function(prop) { - event.info[prop] = this.audioTrack[prop]; - }, this); - } - - if (this.videoTrack || this.audioTrack) { - if (this.pendingTracks.length === 1) { - event.type = this.pendingTracks[0].type; - } else { - event.type = 'combined'; - } - - this.emittedTracks += this.pendingTracks.length; - - initSegment = mp4.initSegment(this.pendingTracks); - - // Create a new typed array to hold the init segment - event.initSegment = new Uint8Array(initSegment.byteLength); - - // Create an init segment containing a moov - // and track definitions - event.initSegment.set(initSegment); - - // Create a new typed array to hold the moof+mdats - event.data = new Uint8Array(this.pendingBytes); - - // Append each moof+mdat (one per track) together - for (i = 0; i < this.pendingBoxes.length; i++) { - event.data.set(this.pendingBoxes[i], offset); - offset += this.pendingBoxes[i].byteLength; - } - - // Translate caption PTS times into second offsets to match the - // video timeline for the segment, and add track info - for (i = 0; i < this.pendingCaptions.length; i++) { - caption = this.pendingCaptions[i]; - caption.startTime = clock.metadataTsToSeconds( - caption.startPts, timelineStartPts, this.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds( - caption.endPts, timelineStartPts, this.keepOriginalTimestamps); - - event.captionStreams[caption.stream] = true; - event.captions.push(caption); - } - - // Translate ID3 frame PTS times into second offsets to match the - // video timeline for the segment - for (i = 0; i < this.pendingMetadata.length; i++) { - id3 = this.pendingMetadata[i]; - id3.cueTime = clock.metadataTsToSeconds( - id3.pts, timelineStartPts, this.keepOriginalTimestamps); - - event.metadata.push(id3); - } - - // We add this to every single emitted segment even though we only need - // it for the first - event.metadata.dispatchType = this.metadataStream.dispatchType; - - // Reset stream state - this.pendingTracks.length = 0; - this.videoTrack = null; - this.pendingBoxes.length = 0; - this.pendingCaptions.length = 0; - this.pendingBytes = 0; - this.pendingMetadata.length = 0; - - // Emit the built segment - // We include captions and ID3 tags for backwards compatibility, - // ideally we should send only video and audio in the data event - this.trigger('data', event); - // Emit each caption to the outside world - // Ideally, this would happen immediately on parsing captions, - // but we need to ensure that video data is sent back first - // so that caption timing can be adjusted to match video timing - for (i = 0; i < event.captions.length; i++) { - caption = event.captions[i]; - - this.trigger('caption', caption); - } - // Emit each id3 tag to the outside world - // Ideally, this would happen immediately on parsing the tag, - // but we need to ensure that video data is sent back first - // so that ID3 frame timing can be adjusted to match video timing - for (i = 0; i < event.metadata.length; i++) { - id3 = event.metadata[i]; - - this.trigger('id3Frame', id3); - } - } - - // Only emit `done` if all tracks have been flushed and emitted - if (this.emittedTracks >= this.numberOfTracks) { - this.trigger('done'); - this.emittedTracks = 0; - } -}; - -CoalesceStream.prototype.setRemux = function(val) { - this.remuxTracks = val; -}; -/** - * A Stream that expects MP2T binary data as input and produces - * corresponding media segments, suitable for use with Media Source - * Extension (MSE) implementations that support the ISO BMFF byte - * stream format, like Chrome. - */ -Transmuxer = function(options) { - var - self = this, - hasFlushed = true, - videoTrack, - audioTrack; - - Transmuxer.prototype.init.call(this); - - options = options || {}; - this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - this.transmuxPipeline_ = {}; - - this.setupAacPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'aac'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.aacStream = new AacStream(); - pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio'); - pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata'); - pipeline.adtsStream = new AdtsStream(); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.aacStream; - - pipeline.aacStream - .pipe(pipeline.audioTimestampRolloverStream) - .pipe(pipeline.adtsStream); - pipeline.aacStream - .pipe(pipeline.timedMetadataTimestampRolloverStream) - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - pipeline.metadataStream.on('timestamp', function(frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - - pipeline.aacStream.on('data', function(data) { - if ((data.type !== 'timed-metadata' && data.type !== 'audio') || pipeline.audioSegmentStream) { - return; - } - - audioTrack = audioTrack || { - timelineStartInfo: { - baseMediaDecodeTime: self.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options); - - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - - pipeline.audioSegmentStream.on('timingInfo', - self.trigger.bind(self, 'audioTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - - // emit pmt info - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - - addPipelineLogRetriggers(this, pipeline); - }; - - this.setupTsPipeline = function() { - var pipeline = {}; - this.transmuxPipeline_ = pipeline; - - pipeline.type = 'ts'; - pipeline.metadataStream = new m2ts.MetadataStream(); - - // set up the parsing pipeline - pipeline.packetStream = new m2ts.TransportPacketStream(); - pipeline.parseStream = new m2ts.TransportParseStream(); - pipeline.elementaryStream = new m2ts.ElementaryStream(); - pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(); - pipeline.adtsStream = new AdtsStream(); - pipeline.h264Stream = new H264Stream(); - pipeline.captionStream = new m2ts.CaptionStream(options); - pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream); - pipeline.headOfPipeline = pipeline.packetStream; - - // disassemble MPEG2-TS packets into elementary streams - pipeline.packetStream - .pipe(pipeline.parseStream) - .pipe(pipeline.elementaryStream) - .pipe(pipeline.timestampRolloverStream); - - // !!THIS ORDER IS IMPORTANT!! - // demux the streams - pipeline.timestampRolloverStream - .pipe(pipeline.h264Stream); - - pipeline.timestampRolloverStream - .pipe(pipeline.adtsStream); - - pipeline.timestampRolloverStream - .pipe(pipeline.metadataStream) - .pipe(pipeline.coalesceStream); - - // Hook up CEA-608/708 caption stream - pipeline.h264Stream.pipe(pipeline.captionStream) - .pipe(pipeline.coalesceStream); - - pipeline.elementaryStream.on('data', function(data) { - var i; - - if (data.type === 'metadata') { - i = data.tracks.length; - - // scan the tracks listed in the metadata - while (i--) { - if (!videoTrack && data.tracks[i].type === 'video') { - videoTrack = data.tracks[i]; - videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } else if (!audioTrack && data.tracks[i].type === 'audio') { - audioTrack = data.tracks[i]; - audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime; - } - } - - // hook up the video segment stream to the first track with h264 data - if (videoTrack && !pipeline.videoSegmentStream) { - pipeline.coalesceStream.numberOfTracks++; - pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options); - pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream')); - - pipeline.videoSegmentStream.on('timelineStartInfo', function(timelineStartInfo) { - // When video emits timelineStartInfo data after a flush, we forward that - // info to the AudioSegmentStream, if it exists, because video timeline - // data takes precedence. Do not do this if keepOriginalTimestamps is set, - // because this is a particularly subtle form of timestamp alteration. - if (audioTrack && !options.keepOriginalTimestamps) { - audioTrack.timelineStartInfo = timelineStartInfo; - // On the first segment we trim AAC frames that exist before the - // very earliest DTS we have seen in video because Chrome will - // interpret any video track with a baseMediaDecodeTime that is - // non-zero as a gap. - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('processedGopsInfo', - self.trigger.bind(self, 'gopInfo')); - pipeline.videoSegmentStream.on('segmentTimingInfo', - self.trigger.bind(self, 'videoSegmentTimingInfo')); - - pipeline.videoSegmentStream.on('baseMediaDecodeTime', function(baseMediaDecodeTime) { - if (audioTrack) { - pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('timingInfo', - self.trigger.bind(self, 'videoTimingInfo')); - - // Set up the final part of the video pipeline - pipeline.h264Stream - .pipe(pipeline.videoSegmentStream) - .pipe(pipeline.coalesceStream); - } - - if (audioTrack && !pipeline.audioSegmentStream) { - // hook up the audio segment stream to the first track with aac data - pipeline.coalesceStream.numberOfTracks++; - pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options); - pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream')); - - pipeline.audioSegmentStream.on('timingInfo', - self.trigger.bind(self, 'audioTimingInfo')); - pipeline.audioSegmentStream.on('segmentTimingInfo', - self.trigger.bind(self, 'audioSegmentTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream) - .pipe(pipeline.coalesceStream); - } - - // emit pmt info - self.trigger('trackinfo', { - hasAudio: !!audioTrack, - hasVideo: !!videoTrack - }); - } - }); - - // Re-emit any data coming from the coalesce stream to the outside world - pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); - pipeline.coalesceStream.on('id3Frame', function(id3Frame) { - id3Frame.dispatchType = pipeline.metadataStream.dispatchType; - - self.trigger('id3Frame', id3Frame); - }); - pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); - // Let the consumer know we have finished flushing the entire pipeline - pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done')); - - addPipelineLogRetriggers(this, pipeline); - }; - - // hook up the segment streams once track metadata is delivered - this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) { - var pipeline = this.transmuxPipeline_; - - if (!options.keepOriginalTimestamps) { - this.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (audioTrack) { - audioTrack.timelineStartInfo.dts = undefined; - audioTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(audioTrack); - if (pipeline.audioTimestampRolloverStream) { - pipeline.audioTimestampRolloverStream.discontinuity(); - } - } - if (videoTrack) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - videoTrack.timelineStartInfo.dts = undefined; - videoTrack.timelineStartInfo.pts = undefined; - trackDecodeInfo.clearDtsInfo(videoTrack); - pipeline.captionStream.reset(); - } - - if (pipeline.timestampRolloverStream) { - pipeline.timestampRolloverStream.discontinuity(); - } - }; - - this.setAudioAppendStart = function(timestamp) { - if (audioTrack) { - this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp); - } - }; - - this.setRemux = function(val) { - var pipeline = this.transmuxPipeline_; - - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - this.alignGopsWith = function(gopsToAlignWith) { - if (videoTrack && this.transmuxPipeline_.videoSegmentStream) { - this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith); - } - }; - - this.getLogTrigger_ = function(key) { - var self = this; - - return function(event) { - event.stream = key; - self.trigger('log', event); - }; - }; - // feed incoming data to the front of the parsing pipeline - this.push = function(data) { - if (hasFlushed) { - var isAac = isLikelyAacData(data); - - if (isAac && this.transmuxPipeline_.type !== 'aac') { - this.setupAacPipeline(); - } else if (!isAac && this.transmuxPipeline_.type !== 'ts') { - this.setupTsPipeline(); - } - - hasFlushed = false; - } - this.transmuxPipeline_.headOfPipeline.push(data); - }; - - // flush any buffered data - this.flush = function() { - hasFlushed = true; - // Start at the top of the pipeline and flush all pending work - this.transmuxPipeline_.headOfPipeline.flush(); - }; - - this.endTimeline = function() { - this.transmuxPipeline_.headOfPipeline.endTimeline(); - }; - - this.reset = function() { - if (this.transmuxPipeline_.headOfPipeline) { - this.transmuxPipeline_.headOfPipeline.reset(); - } - }; - - // Caption data has to be reset when seeking outside buffered range - this.resetCaptions = function() { - if (this.transmuxPipeline_.captionStream) { - this.transmuxPipeline_.captionStream.reset(); - } - }; - -}; -Transmuxer.prototype = new Stream(); - -module.exports = { - Transmuxer: Transmuxer, - VideoSegmentStream: VideoSegmentStream, - AudioSegmentStream: AudioSegmentStream, - AUDIO_PROPERTIES: AUDIO_PROPERTIES, - VIDEO_PROPERTIES: VIDEO_PROPERTIES, - // exported for testing - generateSegmentTimingInfo: generateSegmentTimingInfo -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/audio-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/audio-segment-stream.js deleted file mode 100644 index c4c1787553..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/audio-segment-stream.js +++ /dev/null @@ -1,154 +0,0 @@ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('../mp4/mp4-generator.js'); -var audioFrameUtils = require('../mp4/audio-frame-utils'); -var trackInfo = require('../mp4/track-decode-info.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; -var AUDIO_PROPERTIES = require('../constants/audio-properties.js'); - -/** - * Constructs a single-track, ISO BMFF media segment from AAC data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - */ -var AudioSegmentStream = function(track, options) { - var - adtsFrames = [], - sequenceNumber = 0, - earliestAllowedDts = 0, - audioAppendStartTs = 0, - videoBaseMediaDecodeTime = Infinity, - segmentStartPts = null, - segmentEndPts = null; - - options = options || {}; - - AudioSegmentStream.prototype.init.call(this); - - this.push = function(data) { - trackInfo.collectDtsInfo(track, data); - - if (track) { - AUDIO_PROPERTIES.forEach(function(prop) { - track[prop] = data[prop]; - }); - } - - // buffer audio data until end() is called - adtsFrames.push(data); - }; - - this.setEarliestDts = function(earliestDts) { - earliestAllowedDts = earliestDts; - }; - - this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) { - videoBaseMediaDecodeTime = baseMediaDecodeTime; - }; - - this.setAudioAppendStart = function(timestamp) { - audioAppendStartTs = timestamp; - }; - - this.processFrames_ = function() { - var - frames, - moof, - mdat, - boxes, - timingInfo; - - // return early if no audio data has been observed - if (adtsFrames.length === 0) { - return; - } - - frames = audioFrameUtils.trimAdtsFramesByEarliestDts( - adtsFrames, track, earliestAllowedDts); - if (frames.length === 0) { - // return early if the frames are all after the earliest allowed DTS - // TODO should we clear the adtsFrames? - return; - } - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - audioFrameUtils.prefixWithSilence( - track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); - - // we have to build the index from byte locations to - // samples (that is, adts frames) in the audio data - track.samples = audioFrameUtils.generateSampleTable(frames); - - // concatenate the audio data to constuct the mdat - mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames)); - - adtsFrames = []; - - moof = mp4.moof(sequenceNumber, [track]); - - // bump the sequence number for next time - sequenceNumber++; - - track.initSegment = mp4.initSegment([track]); - - // it would be great to allocate this array up front instead of - // throwing away hundreds of media segment fragments - boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - trackInfo.clearDtsInfo(track); - - if (segmentStartPts === null) { - segmentEndPts = segmentStartPts = frames[0].pts; - } - - segmentEndPts += frames.length * (ONE_SECOND_IN_TS * 1024 / track.samplerate); - - timingInfo = { start: segmentStartPts }; - - this.trigger('timingInfo', timingInfo); - this.trigger('data', {track: track, boxes: boxes}); - }; - - this.flush = function() { - this.processFrames_(); - // trigger final timing info - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - this.resetTiming_(); - this.trigger('done', 'AudioSegmentStream'); - }; - - this.partialFlush = function() { - this.processFrames_(); - this.trigger('partialdone', 'AudioSegmentStream'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline', 'AudioSegmentStream'); - }; - - this.resetTiming_ = function() { - trackInfo.clearDtsInfo(track); - segmentStartPts = null; - segmentEndPts = null; - }; - - this.reset = function() { - this.resetTiming_(); - adtsFrames = []; - this.trigger('reset'); - }; -}; - -AudioSegmentStream.prototype = new Stream(); - -module.exports = AudioSegmentStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/index.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/index.js deleted file mode 100644 index bfc3438ba9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - Transmuxer: require('./transmuxer') -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/transmuxer.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/transmuxer.js deleted file mode 100644 index feb667182e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/transmuxer.js +++ /dev/null @@ -1,378 +0,0 @@ -var Stream = require('../utils/stream.js'); -var m2ts = require('../m2ts/m2ts.js'); -var codecs = require('../codecs/index.js'); -var AudioSegmentStream = require('./audio-segment-stream.js'); -var VideoSegmentStream = require('./video-segment-stream.js'); -var trackInfo = require('../mp4/track-decode-info.js'); -var isLikelyAacData = require('../aac/utils').isLikelyAacData; -var AdtsStream = require('../codecs/adts'); -var AacStream = require('../aac/index'); -var clock = require('../utils/clock'); - -var createPipeline = function(object) { - object.prototype = new Stream(); - object.prototype.init.call(object); - - return object; -}; - -var tsPipeline = function(options) { - var - pipeline = { - type: 'ts', - tracks: { - audio: null, - video: null - }, - packet: new m2ts.TransportPacketStream(), - parse: new m2ts.TransportParseStream(), - elementary: new m2ts.ElementaryStream(), - timestampRollover: new m2ts.TimestampRolloverStream(), - adts: new codecs.Adts(), - h264: new codecs.h264.H264Stream(), - captionStream: new m2ts.CaptionStream(options), - metadataStream: new m2ts.MetadataStream() - }; - - pipeline.headOfPipeline = pipeline.packet; - - // Transport Stream - pipeline.packet - .pipe(pipeline.parse) - .pipe(pipeline.elementary) - .pipe(pipeline.timestampRollover); - - // H264 - pipeline.timestampRollover - .pipe(pipeline.h264); - - // Hook up CEA-608/708 caption stream - pipeline.h264 - .pipe(pipeline.captionStream); - - pipeline.timestampRollover - .pipe(pipeline.metadataStream); - - // ADTS - pipeline.timestampRollover - .pipe(pipeline.adts); - - pipeline.elementary.on('data', function(data) { - if (data.type !== 'metadata') { - return; - } - - for (var i = 0; i < data.tracks.length; i++) { - if (!pipeline.tracks[data.tracks[i].type]) { - pipeline.tracks[data.tracks[i].type] = data.tracks[i]; - pipeline.tracks[data.tracks[i].type].timelineStartInfo.baseMediaDecodeTime = options.baseMediaDecodeTime; - } - } - - if (pipeline.tracks.video && !pipeline.videoSegmentStream) { - pipeline.videoSegmentStream = new VideoSegmentStream(pipeline.tracks.video, options); - - pipeline.videoSegmentStream.on('timelineStartInfo', function(timelineStartInfo) { - if (pipeline.tracks.audio && !options.keepOriginalTimestamps) { - pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - options.baseMediaDecodeTime); - } - }); - - pipeline.videoSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'videoTimingInfo')); - - pipeline.videoSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'video', - data: data - }); - }); - - pipeline.videoSegmentStream.on('done', - pipeline.trigger.bind(pipeline, 'done')); - pipeline.videoSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.videoSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - - pipeline.h264 - .pipe(pipeline.videoSegmentStream); - } - - if (pipeline.tracks.audio && !pipeline.audioSegmentStream) { - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - - pipeline.audioSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - - pipeline.audioSegmentStream.on('done', - pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - - pipeline.audioSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - - pipeline.adts - .pipe(pipeline.audioSegmentStream); - } - - // emit pmt info - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - - pipeline.captionStream.on('data', function(caption) { - var timelineStartPts; - - if (pipeline.tracks.video) { - timelineStartPts = pipeline.tracks.video.timelineStartInfo.pts || 0; - } else { - // This will only happen if we encounter caption packets before - // video data in a segment. This is an unusual/unlikely scenario, - // so we assume the timeline starts at zero for now. - timelineStartPts = 0; - } - - // Translate caption PTS times into second offsets into the - // video timeline for the segment - caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, options.keepOriginalTimestamps); - caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, options.keepOriginalTimestamps); - - pipeline.trigger('caption', caption); - }); - - pipeline = createPipeline(pipeline); - - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - - return pipeline; -}; - -var aacPipeline = function(options) { - var - pipeline = { - type: 'aac', - tracks: { - audio: null - }, - metadataStream: new m2ts.MetadataStream(), - aacStream: new AacStream(), - audioRollover: new m2ts.TimestampRolloverStream('audio'), - timedMetadataRollover: new m2ts.TimestampRolloverStream('timed-metadata'), - adtsStream: new AdtsStream(true) - }; - - // set up the parsing pipeline - pipeline.headOfPipeline = pipeline.aacStream; - - pipeline.aacStream - .pipe(pipeline.audioRollover) - .pipe(pipeline.adtsStream); - pipeline.aacStream - .pipe(pipeline.timedMetadataRollover) - .pipe(pipeline.metadataStream); - - pipeline.metadataStream.on('timestamp', function(frame) { - pipeline.aacStream.setTimestamp(frame.timeStamp); - }); - - pipeline.aacStream.on('data', function(data) { - if ((data.type !== 'timed-metadata' && data.type !== 'audio') || pipeline.audioSegmentStream) { - return; - } - - pipeline.tracks.audio = pipeline.tracks.audio || { - timelineStartInfo: { - baseMediaDecodeTime: options.baseMediaDecodeTime - }, - codec: 'adts', - type: 'audio' - }; - - // hook up the audio segment stream to the first track with aac data - pipeline.audioSegmentStream = new AudioSegmentStream(pipeline.tracks.audio, options); - - pipeline.audioSegmentStream.on('data', function(data) { - pipeline.trigger('data', { - type: 'audio', - data: data - }); - }); - - pipeline.audioSegmentStream.on('partialdone', - pipeline.trigger.bind(pipeline, 'partialdone')); - pipeline.audioSegmentStream.on('done', pipeline.trigger.bind(pipeline, 'done')); - pipeline.audioSegmentStream.on('endedtimeline', - pipeline.trigger.bind(pipeline, 'endedtimeline')); - pipeline.audioSegmentStream.on('timingInfo', - pipeline.trigger.bind(pipeline, 'audioTimingInfo')); - - // Set up the final part of the audio pipeline - pipeline.adtsStream - .pipe(pipeline.audioSegmentStream); - - pipeline.trigger('trackinfo', { - hasAudio: !!pipeline.tracks.audio, - hasVideo: !!pipeline.tracks.video - }); - }); - - // set the pipeline up as a stream before binding to get access to the trigger function - pipeline = createPipeline(pipeline); - - pipeline.metadataStream.on('data', pipeline.trigger.bind(pipeline, 'id3Frame')); - - return pipeline; -}; - -var setupPipelineListeners = function(pipeline, transmuxer) { - pipeline.on('data', transmuxer.trigger.bind(transmuxer, 'data')); - pipeline.on('done', transmuxer.trigger.bind(transmuxer, 'done')); - pipeline.on('partialdone', transmuxer.trigger.bind(transmuxer, 'partialdone')); - pipeline.on('endedtimeline', transmuxer.trigger.bind(transmuxer, 'endedtimeline')); - pipeline.on('audioTimingInfo', transmuxer.trigger.bind(transmuxer, 'audioTimingInfo')); - pipeline.on('videoTimingInfo', transmuxer.trigger.bind(transmuxer, 'videoTimingInfo')); - pipeline.on('trackinfo', transmuxer.trigger.bind(transmuxer, 'trackinfo')); - pipeline.on('id3Frame', function(event) { - // add this to every single emitted segment even though it's only needed for the first - event.dispatchType = pipeline.metadataStream.dispatchType; - // keep original time, can be adjusted if needed at a higher level - event.cueTime = clock.videoTsToSeconds(event.pts); - - transmuxer.trigger('id3Frame', event); - }); - pipeline.on('caption', function(event) { - transmuxer.trigger('caption', event); - }); -}; - -var Transmuxer = function(options) { - var - pipeline = null, - hasFlushed = true; - - options = options || {}; - - Transmuxer.prototype.init.call(this); - options.baseMediaDecodeTime = options.baseMediaDecodeTime || 0; - - this.push = function(bytes) { - if (hasFlushed) { - var isAac = isLikelyAacData(bytes); - - if (isAac && (!pipeline || pipeline.type !== 'aac')) { - pipeline = aacPipeline(options); - setupPipelineListeners(pipeline, this); - } else if (!isAac && (!pipeline || pipeline.type !== 'ts')) { - pipeline = tsPipeline(options); - setupPipelineListeners(pipeline, this); - } - hasFlushed = false; - } - - pipeline.headOfPipeline.push(bytes); - }; - - this.flush = function() { - if (!pipeline) { - return; - } - - hasFlushed = true; - pipeline.headOfPipeline.flush(); - }; - - this.partialFlush = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.partialFlush(); - }; - - this.endTimeline = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.endTimeline(); - }; - - this.reset = function() { - if (!pipeline) { - return; - } - - pipeline.headOfPipeline.reset(); - }; - - this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) { - if (!options.keepOriginalTimestamps) { - options.baseMediaDecodeTime = baseMediaDecodeTime; - } - - if (!pipeline) { - return; - } - - if (pipeline.tracks.audio) { - pipeline.tracks.audio.timelineStartInfo.dts = undefined; - pipeline.tracks.audio.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.audio); - if (pipeline.audioRollover) { - pipeline.audioRollover.discontinuity(); - } - } - if (pipeline.tracks.video) { - if (pipeline.videoSegmentStream) { - pipeline.videoSegmentStream.gopCache_ = []; - } - pipeline.tracks.video.timelineStartInfo.dts = undefined; - pipeline.tracks.video.timelineStartInfo.pts = undefined; - trackInfo.clearDtsInfo(pipeline.tracks.video); - // pipeline.captionStream.reset(); - } - - if (pipeline.timestampRollover) { - pipeline.timestampRollover.discontinuity(); - - } - }; - - this.setRemux = function(val) { - options.remux = val; - - if (pipeline && pipeline.coalesceStream) { - pipeline.coalesceStream.setRemux(val); - } - }; - - - this.setAudioAppendStart = function(audioAppendStart) { - if (!pipeline || !pipeline.tracks.audio || !pipeline.audioSegmentStream) { - return; - } - - pipeline.audioSegmentStream.setAudioAppendStart(audioAppendStart); - }; - - // TODO GOP alignment support - // Support may be a bit trickier than with full segment appends, as GOPs may be split - // and processed in a more granular fashion - this.alignGopsWith = function(gopsToAlignWith) { - return; - }; -}; - -Transmuxer.prototype = new Stream(); - -module.exports = Transmuxer; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/video-segment-stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/video-segment-stream.js deleted file mode 100644 index 53241c4388..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/partial/video-segment-stream.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Constructs a single-track, ISO BMFF media segment from H264 data - * events. The output of this stream can be fed to a SourceBuffer - * configured with a suitable initialization segment. - * @param track {object} track metadata configuration - * @param options {object} transmuxer options object - * @param options.alignGopsAtEnd {boolean} If true, start from the end of the - * gopsToAlignWith list when attempting to align gop pts - */ -'use strict'; - -var Stream = require('../utils/stream.js'); -var mp4 = require('../mp4/mp4-generator.js'); -var trackInfo = require('../mp4/track-decode-info.js'); -var frameUtils = require('../mp4/frame-utils'); -var VIDEO_PROPERTIES = require('../constants/video-properties.js'); - -var VideoSegmentStream = function(track, options) { - var - sequenceNumber = 0, - nalUnits = [], - frameCache = [], - // gopsToAlignWith = [], - config, - pps, - segmentStartPts = null, - segmentEndPts = null, - gops, - ensureNextFrameIsKeyFrame = true; - - options = options || {}; - - VideoSegmentStream.prototype.init.call(this); - - this.push = function(nalUnit) { - trackInfo.collectDtsInfo(track, nalUnit); - if (typeof track.timelineStartInfo.dts === 'undefined') { - track.timelineStartInfo.dts = nalUnit.dts; - } - - // record the track config - if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) { - config = nalUnit.config; - track.sps = [nalUnit.data]; - - VIDEO_PROPERTIES.forEach(function(prop) { - track[prop] = config[prop]; - }, this); - } - - if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && - !pps) { - pps = nalUnit.data; - track.pps = [nalUnit.data]; - } - - // buffer video until flush() is called - nalUnits.push(nalUnit); - }; - - this.processNals_ = function(cacheLastFrame) { - var i; - - nalUnits = frameCache.concat(nalUnits); - - // Throw away nalUnits at the start of the byte stream until - // we find the first AUD - while (nalUnits.length) { - if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') { - break; - } - nalUnits.shift(); - } - - // Return early if no video data has been observed - if (nalUnits.length === 0) { - return; - } - - var frames = frameUtils.groupNalsIntoFrames(nalUnits); - - if (!frames.length) { - return; - } - - // note that the frame cache may also protect us from cases where we haven't - // pushed data for the entire first or last frame yet - frameCache = frames[frames.length - 1]; - - if (cacheLastFrame) { - frames.pop(); - frames.duration -= frameCache.duration; - frames.nalCount -= frameCache.length; - frames.byteLength -= frameCache.byteLength; - } - - if (!frames.length) { - nalUnits = []; - return; - } - - this.trigger('timelineStartInfo', track.timelineStartInfo); - - if (ensureNextFrameIsKeyFrame) { - gops = frameUtils.groupFramesIntoGops(frames); - - if (!gops[0][0].keyFrame) { - gops = frameUtils.extendFirstKeyFrame(gops); - - if (!gops[0][0].keyFrame) { - // we haven't yet gotten a key frame, so reset nal units to wait for more nal - // units - nalUnits = ([].concat.apply([], frames)).concat(frameCache); - frameCache = []; - return; - } - - frames = [].concat.apply([], gops); - frames.duration = gops.duration; - } - ensureNextFrameIsKeyFrame = false; - } - - if (segmentStartPts === null) { - segmentStartPts = frames[0].pts; - segmentEndPts = segmentStartPts; - } - - segmentEndPts += frames.duration; - - this.trigger('timingInfo', { - start: segmentStartPts, - end: segmentEndPts - }); - - for (i = 0; i < frames.length; i++) { - var frame = frames[i]; - - track.samples = frameUtils.generateSampleTableForFrame(frame); - - var mdat = mp4.mdat(frameUtils.concatenateNalDataForFrame(frame)); - - trackInfo.clearDtsInfo(track); - trackInfo.collectDtsInfo(track, frame); - - track.baseMediaDecodeTime = trackInfo.calculateTrackBaseMediaDecodeTime( - track, options.keepOriginalTimestamps); - - var moof = mp4.moof(sequenceNumber, [track]); - - sequenceNumber++; - - track.initSegment = mp4.initSegment([track]); - - var boxes = new Uint8Array(moof.byteLength + mdat.byteLength); - - boxes.set(moof); - boxes.set(mdat, moof.byteLength); - - this.trigger('data', { - track: track, - boxes: boxes, - sequence: sequenceNumber, - videoFrameDts: frame.dts, - videoFramePts: frame.pts - }); - } - - nalUnits = []; - }; - - this.resetTimingAndConfig_ = function() { - config = undefined; - pps = undefined; - segmentStartPts = null; - segmentEndPts = null; - }; - - this.partialFlush = function() { - this.processNals_(true); - this.trigger('partialdone', 'VideoSegmentStream'); - }; - - this.flush = function() { - this.processNals_(false); - // reset config and pps because they may differ across segments - // for instance, when we are rendition switching - this.resetTimingAndConfig_(); - this.trigger('done', 'VideoSegmentStream'); - }; - - this.endTimeline = function() { - this.flush(); - this.trigger('endedtimeline', 'VideoSegmentStream'); - }; - - this.reset = function() { - this.resetTimingAndConfig_(); - frameCache = []; - nalUnits = []; - ensureNextFrameIsKeyFrame = true; - this.trigger('reset'); - }; -}; - -VideoSegmentStream.prototype = new Stream(); - -module.exports = VideoSegmentStream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/caption-packet-parser.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/caption-packet-parser.js deleted file mode 100644 index b188c478a1..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/caption-packet-parser.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Reads in-band caption information from a video elementary - * stream. Captions must follow the CEA-708 standard for injection - * into an MPEG-2 transport streams. - * @see https://en.wikipedia.org/wiki/CEA-708 - * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf - */ - -'use strict'; - -// Supplemental enhancement information (SEI) NAL units have a -// payload type field to indicate how they are to be -// interpreted. CEAS-708 caption content is always transmitted with -// payload type 0x04. -var USER_DATA_REGISTERED_ITU_T_T35 = 4, - RBSP_TRAILING_BITS = 128; - -/** - * Parse a supplemental enhancement information (SEI) NAL unit. - * Stops parsing once a message of type ITU T T35 has been found. - * - * @param bytes {Uint8Array} the bytes of a SEI NAL unit - * @return {object} the parsed SEI payload - * @see Rec. ITU-T H.264, 7.3.2.3.1 - */ -var parseSei = function(bytes) { - var - i = 0, - result = { - payloadType: -1, - payloadSize: 0 - }, - payloadType = 0, - payloadSize = 0; - - // go through the sei_rbsp parsing each each individual sei_message - while (i < bytes.byteLength) { - // stop once we have hit the end of the sei_rbsp - if (bytes[i] === RBSP_TRAILING_BITS) { - break; - } - - // Parse payload type - while (bytes[i] === 0xFF) { - payloadType += 255; - i++; - } - payloadType += bytes[i++]; - - // Parse payload size - while (bytes[i] === 0xFF) { - payloadSize += 255; - i++; - } - payloadSize += bytes[i++]; - - // this sei_message is a 608/708 caption so save it and break - // there can only ever be one caption message in a frame's sei - if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) { - var userIdentifier = String.fromCharCode( - bytes[i + 3], - bytes[i + 4], - bytes[i + 5], - bytes[i + 6]); - - if (userIdentifier === 'GA94') { - result.payloadType = payloadType; - result.payloadSize = payloadSize; - result.payload = bytes.subarray(i, i + payloadSize); - break; - } else { - result.payload = void 0; - } - } - - // skip the payload and parse the next message - i += payloadSize; - payloadType = 0; - payloadSize = 0; - } - - return result; -}; - -// see ANSI/SCTE 128-1 (2013), section 8.1 -var parseUserData = function(sei) { - // itu_t_t35_contry_code must be 181 (United States) for - // captions - if (sei.payload[0] !== 181) { - return null; - } - - // itu_t_t35_provider_code should be 49 (ATSC) for captions - if (((sei.payload[1] << 8) | sei.payload[2]) !== 49) { - return null; - } - - // the user_identifier should be "GA94" to indicate ATSC1 data - if (String.fromCharCode(sei.payload[3], - sei.payload[4], - sei.payload[5], - sei.payload[6]) !== 'GA94') { - return null; - } - - // finally, user_data_type_code should be 0x03 for caption data - if (sei.payload[7] !== 0x03) { - return null; - } - - // return the user_data_type_structure and strip the trailing - // marker bits - return sei.payload.subarray(8, sei.payload.length - 1); -}; - -// see CEA-708-D, section 4.4 -var parseCaptionPackets = function(pts, userData) { - var results = [], i, count, offset, data; - - // if this is just filler, return immediately - if (!(userData[0] & 0x40)) { - return results; - } - - // parse out the cc_data_1 and cc_data_2 fields - count = userData[0] & 0x1f; - for (i = 0; i < count; i++) { - offset = i * 3; - data = { - type: userData[offset + 2] & 0x03, - pts: pts - }; - - // capture cc data when cc_valid is 1 - if (userData[offset + 2] & 0x04) { - data.ccData = (userData[offset + 3] << 8) | userData[offset + 4]; - results.push(data); - } - } - return results; -}; - -var discardEmulationPreventionBytes = function(data) { - var - length = data.byteLength, - emulationPreventionBytesPositions = [], - i = 1, - newLength, newData; - - // Find all `Emulation Prevention Bytes` - while (i < length - 2) { - if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) { - emulationPreventionBytesPositions.push(i + 2); - i += 2; - } else { - i++; - } - } - - // If no Emulation Prevention Bytes were found just return the original - // array - if (emulationPreventionBytesPositions.length === 0) { - return data; - } - - // Create a new array to hold the NAL unit data - newLength = length - emulationPreventionBytesPositions.length; - newData = new Uint8Array(newLength); - var sourceIndex = 0; - - for (i = 0; i < newLength; sourceIndex++, i++) { - if (sourceIndex === emulationPreventionBytesPositions[0]) { - // Skip this byte - sourceIndex++; - // Remove this position index - emulationPreventionBytesPositions.shift(); - } - newData[i] = data[sourceIndex]; - } - - return newData; -}; - -// exports -module.exports = { - parseSei: parseSei, - parseUserData: parseUserData, - parseCaptionPackets: parseCaptionPackets, - discardEmulationPreventionBytes: discardEmulationPreventionBytes, - USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35 -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/flv-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/flv-inspector.js deleted file mode 100644 index 97b8e427eb..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/flv-inspector.js +++ /dev/null @@ -1,172 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var - tagTypes = { - 0x08: 'audio', - 0x09: 'video', - 0x12: 'metadata' - }, - hex = function(val) { - return '0x' + ('00' + val.toString(16)).slice(-2).toUpperCase(); - }, - hexStringList = function(data) { - var arr = [], i; - - while (data.byteLength > 0) { - i = 0; - arr.push(hex(data[i++])); - data = data.subarray(i); - } - return arr.join(' '); - }, - parseAVCTag = function(tag, obj) { - var - avcPacketTypes = [ - 'AVC Sequence Header', - 'AVC NALU', - 'AVC End-of-Sequence' - ], - compositionTime = (tag[1] & parseInt('01111111', 2) << 16) | (tag[2] << 8) | tag[3]; - - obj = obj || {}; - - obj.avcPacketType = avcPacketTypes[tag[0]]; - obj.CompositionTime = (tag[1] & parseInt('10000000', 2)) ? -compositionTime : compositionTime; - - if (tag[0] === 1) { - obj.nalUnitTypeRaw = hexStringList(tag.subarray(4, 100)); - } else { - obj.data = hexStringList(tag.subarray(4)); - } - - return obj; - }, - parseVideoTag = function(tag, obj) { - var - frameTypes = [ - 'Unknown', - 'Keyframe (for AVC, a seekable frame)', - 'Inter frame (for AVC, a nonseekable frame)', - 'Disposable inter frame (H.263 only)', - 'Generated keyframe (reserved for server use only)', - 'Video info/command frame' - ], - codecID = tag[0] & parseInt('00001111', 2); - - obj = obj || {}; - - obj.frameType = frameTypes[(tag[0] & parseInt('11110000', 2)) >>> 4]; - obj.codecID = codecID; - - if (codecID === 7) { - return parseAVCTag(tag.subarray(1), obj); - } - return obj; - }, - parseAACTag = function(tag, obj) { - var packetTypes = [ - 'AAC Sequence Header', - 'AAC Raw' - ]; - - obj = obj || {}; - - obj.aacPacketType = packetTypes[tag[0]]; - obj.data = hexStringList(tag.subarray(1)); - - return obj; - }, - parseAudioTag = function(tag, obj) { - var - formatTable = [ - 'Linear PCM, platform endian', - 'ADPCM', - 'MP3', - 'Linear PCM, little endian', - 'Nellymoser 16-kHz mono', - 'Nellymoser 8-kHz mono', - 'Nellymoser', - 'G.711 A-law logarithmic PCM', - 'G.711 mu-law logarithmic PCM', - 'reserved', - 'AAC', - 'Speex', - 'MP3 8-Khz', - 'Device-specific sound' - ], - samplingRateTable = [ - '5.5-kHz', - '11-kHz', - '22-kHz', - '44-kHz' - ], - soundFormat = (tag[0] & parseInt('11110000', 2)) >>> 4; - - obj = obj || {}; - - obj.soundFormat = formatTable[soundFormat]; - obj.soundRate = samplingRateTable[(tag[0] & parseInt('00001100', 2)) >>> 2]; - obj.soundSize = ((tag[0] & parseInt('00000010', 2)) >>> 1) ? '16-bit' : '8-bit'; - obj.soundType = (tag[0] & parseInt('00000001', 2)) ? 'Stereo' : 'Mono'; - - if (soundFormat === 10) { - return parseAACTag(tag.subarray(1), obj); - } - return obj; - }, - parseGenericTag = function(tag) { - return { - tagType: tagTypes[tag[0]], - dataSize: (tag[1] << 16) | (tag[2] << 8) | tag[3], - timestamp: (tag[7] << 24) | (tag[4] << 16) | (tag[5] << 8) | tag[6], - streamID: (tag[8] << 16) | (tag[9] << 8) | tag[10] - }; - }, - inspectFlvTag = function(tag) { - var header = parseGenericTag(tag); - switch (tag[0]) { - case 0x08: - parseAudioTag(tag.subarray(11), header); - break; - case 0x09: - parseVideoTag(tag.subarray(11), header); - break; - case 0x12: - } - return header; - }, - inspectFlv = function(bytes) { - var i = 9, // header - dataSize, - parsedResults = [], - tag; - - // traverse the tags - i += 4; // skip previous tag size - while (i < bytes.byteLength) { - dataSize = bytes[i + 1] << 16; - dataSize |= bytes[i + 2] << 8; - dataSize |= bytes[i + 3]; - dataSize += 11; - - tag = bytes.subarray(i, i + dataSize); - parsedResults.push(inspectFlvTag(tag)); - i += dataSize + 4; - } - return parsedResults; - }, - textifyFlv = function(flvTagArray) { - return JSON.stringify(flvTagArray, null, 2); - }; - -module.exports = { - inspectTag: inspectFlvTag, - inspect: inspectFlv, - textify: textifyFlv -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/mp4-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/mp4-inspector.js deleted file mode 100644 index 0acecb46a3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/mp4-inspector.js +++ /dev/null @@ -1,756 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse the internal MP4 structure into an equivalent javascript - * object. - */ -'use strict'; - -var numberHelpers = require('../utils/numbers.js'); -var MAX_UINT32 = numberHelpers.MAX_UINT32; -var getUint64 = numberHelpers.getUint64; - -var - inspectMp4, - textifyMp4, - parseMp4Date = function(seconds) { - return new Date(seconds * 1000 - 2082844800000); - }, - parseType = require('../mp4/parse-type'), - findBox = require('../mp4/find-box'), - nalParse = function(avcStream) { - var - avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), - result = [], - i, - length; - for (i = 0; i + 4 < avcStream.length; i += length) { - length = avcView.getUint32(i); - i += 4; - - // bail if this doesn't appear to be an H264 stream - if (length <= 0) { - result.push('MALFORMED DATA'); - continue; - } - - switch (avcStream[i] & 0x1F) { - case 0x01: - result.push('slice_layer_without_partitioning_rbsp'); - break; - case 0x05: - result.push('slice_layer_without_partitioning_rbsp_idr'); - break; - case 0x06: - result.push('sei_rbsp'); - break; - case 0x07: - result.push('seq_parameter_set_rbsp'); - break; - case 0x08: - result.push('pic_parameter_set_rbsp'); - break; - case 0x09: - result.push('access_unit_delimiter_rbsp'); - break; - default: - result.push('UNKNOWN NAL - ' + avcStream[i] & 0x1F); - break; - } - } - return result; - }, - - // registry of handlers for individual mp4 box types - parse = { - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - avc1: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - dataReferenceIndex: view.getUint16(6), - width: view.getUint16(24), - height: view.getUint16(26), - horizresolution: view.getUint16(28) + (view.getUint16(30) / 16), - vertresolution: view.getUint16(32) + (view.getUint16(34) / 16), - frameCount: view.getUint16(40), - depth: view.getUint16(74), - config: inspectMp4(data.subarray(78, data.byteLength)) - }; - }, - avcC: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - configurationVersion: data[0], - avcProfileIndication: data[1], - profileCompatibility: data[2], - avcLevelIndication: data[3], - lengthSizeMinusOne: data[4] & 0x03, - sps: [], - pps: [] - }, - numOfSequenceParameterSets = data[5] & 0x1f, - numOfPictureParameterSets, - nalSize, - offset, - i; - - // iterate past any SPSs - offset = 6; - for (i = 0; i < numOfSequenceParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.sps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - // iterate past any PPSs - numOfPictureParameterSets = data[offset]; - offset++; - for (i = 0; i < numOfPictureParameterSets; i++) { - nalSize = view.getUint16(offset); - offset += 2; - result.pps.push(new Uint8Array(data.subarray(offset, offset + nalSize))); - offset += nalSize; - } - return result; - }, - btrt: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - bufferSizeDB: view.getUint32(0), - maxBitrate: view.getUint32(4), - avgBitrate: view.getUint32(8) - }; - }, - edts: function edts(data) { - return { - boxes: inspectMp4(data) - }; - }, - elst: function elst(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - edits: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; entryCount--) { - if (result.version === 0) { - result.edits.push({ - segmentDuration: view.getUint32(i), - mediaTime: view.getInt32(i + 4), - mediaRate: view.getUint16(i + 8) + view.getUint16(i + 10) / (256 * 256) - }); - i += 12; - } else { - result.edits.push({ - segmentDuration: getUint64(data.subarray(i)), - mediaTime: getUint64(data.subarray(i + 8)), - mediaRate: view.getUint16(i + 16) + view.getUint16(i + 18) / (256 * 256) - }); - i += 20; - } - } - return result; - }, - esds: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - esId: (data[6] << 8) | data[7], - streamPriority: data[8] & 0x1f, - decoderConfig: { - objectProfileIndication: data[11], - streamType: (data[12] >>> 2) & 0x3f, - bufferSize: (data[13] << 16) | (data[14] << 8) | data[15], - maxBitrate: (data[16] << 24) | - (data[17] << 16) | - (data[18] << 8) | - data[19], - avgBitrate: (data[20] << 24) | - (data[21] << 16) | - (data[22] << 8) | - data[23], - decoderConfigDescriptor: { - tag: data[24], - length: data[25], - audioObjectType: (data[26] >>> 3) & 0x1f, - samplingFrequencyIndex: ((data[26] & 0x07) << 1) | - ((data[27] >>> 7) & 0x01), - channelConfiguration: (data[27] >>> 3) & 0x0f - } - } - }; - }, - ftyp: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - majorBrand: parseType(data.subarray(0, 4)), - minorVersion: view.getUint32(4), - compatibleBrands: [] - }, - i = 8; - while (i < data.byteLength) { - result.compatibleBrands.push(parseType(data.subarray(i, i + 4))); - i += 4; - } - return result; - }, - dinf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - dref: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - dataReferences: inspectMp4(data.subarray(8)) - }; - }, - hdlr: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - handlerType: parseType(data.subarray(8, 12)), - name: '' - }, - i = 8; - - // parse out the name field - for (i = 24; i < data.byteLength; i++) { - if (data[i] === 0x00) { - // the name field is null-terminated - i++; - break; - } - result.name += String.fromCharCode(data[i]); - } - // decode UTF-8 to javascript's internal representation - // see http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html - result.name = decodeURIComponent(escape(result.name)); - - return result; - }, - mdat: function(data) { - return { - byteLength: data.byteLength, - nals: nalParse(data) - }; - }, - mdhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - language, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - language: '' - }; - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - // language is stored as an ISO-639-2/T code in an array of three 5-bit fields - // each field is the packed difference between its ASCII value and 0x60 - language = view.getUint16(i); - result.language += String.fromCharCode((language >> 10) + 0x60); - result.language += String.fromCharCode(((language & 0x03e0) >> 5) + 0x60); - result.language += String.fromCharCode((language & 0x1f) + 0x60); - - return result; - }, - mdia: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mfhd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sequenceNumber: (data[4] << 24) | - (data[5] << 16) | - (data[6] << 8) | - (data[7]) - }; - }, - minf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - // codingname, not a first-class box type. stsd entries share the - // same format as real boxes so the parsing infrastructure can be - // shared - mp4a: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - // 6 bytes reserved - dataReferenceIndex: view.getUint16(6), - // 4 + 4 bytes reserved - channelcount: view.getUint16(16), - samplesize: view.getUint16(18), - // 2 bytes pre_defined - // 2 bytes reserved - samplerate: view.getUint16(24) + (view.getUint16(26) / 65536) - }; - - // if there are more bytes to process, assume this is an ISO/IEC - // 14496-14 MP4AudioSampleEntry and parse the ESDBox - if (data.byteLength > 28) { - result.streamDescriptor = inspectMp4(data.subarray(28))[0]; - } - return result; - }, - moof: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - moov: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvex: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - mvhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.timescale = view.getUint32(i); - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.timescale = view.getUint32(i); - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - - // convert fixed-point, base 16 back to a number - result.rate = view.getUint16(i) + (view.getUint16(i + 2) / 16); - i += 4; - result.volume = view.getUint8(i) + (view.getUint8(i + 1) / 8); - i += 2; - i += 2; - i += 2 * 4; - result.matrix = new Uint32Array(data.subarray(i, i + (9 * 4))); - i += 9 * 4; - i += 6 * 4; - result.nextTrackId = view.getUint32(i); - return result; - }, - pdin: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - rate: view.getUint32(4), - initialDelay: view.getUint32(8) - }; - }, - sdtp: function(data) { - var - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, i; - - for (i = 4; i < data.byteLength; i++) { - result.samples.push({ - dependsOn: (data[i] & 0x30) >> 4, - isDependedOn: (data[i] & 0x0c) >> 2, - hasRedundancy: data[i] & 0x03 - }); - } - return result; - }, - sidx: require('./parse-sidx.js'), - smhd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - balance: data[4] + (data[5] / 256) - }; - }, - stbl: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - ctts: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - compositionOffsets: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 8, entryCount--) { - result.compositionOffsets.push({ - sampleCount: view.getUint32(i), - sampleOffset: view[(result.version === 0 ? 'getUint32' :'getInt32')](i + 4) - }); - } - return result; - }, - stss: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)), - syncSamples: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 4, entryCount--) { - result.syncSamples.push(view.getUint32(i)); - } - return result; - }, - stco: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - chunkOffsets: [] - }, - entryCount = view.getUint32(4), - i; - for (i = 8; entryCount; i += 4, entryCount--) { - result.chunkOffsets.push(view.getUint32(i)); - } - return result; - }, - stsc: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - entryCount = view.getUint32(4), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleToChunks: [] - }, - i; - for (i = 8; entryCount; i += 12, entryCount--) { - result.sampleToChunks.push({ - firstChunk: view.getUint32(i), - samplesPerChunk: view.getUint32(i + 4), - sampleDescriptionIndex: view.getUint32(i + 8) - }); - } - return result; - }, - stsd: function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleDescriptions: inspectMp4(data.subarray(8)) - }; - }, - stsz: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - sampleSize: view.getUint32(4), - entries: [] - }, - i; - for (i = 12; i < data.byteLength; i += 4) { - result.entries.push(view.getUint32(i)); - } - return result; - }, - stts: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - timeToSamples: [] - }, - entryCount = view.getUint32(4), - i; - - for (i = 8; entryCount; i += 8, entryCount--) { - result.timeToSamples.push({ - sampleCount: view.getUint32(i), - sampleDelta: view.getUint32(i + 4) - }); - } - return result; - }, - styp: function(data) { - return parse.ftyp(data); - }, - tfdt: require('./parse-tfdt.js'), - tfhd: require('./parse-tfhd.js'), - tkhd: function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - i = 4, - result = { - version: view.getUint8(0), - flags: new Uint8Array(data.subarray(1, 4)) - }; - if (result.version === 1) { - i += 4; - result.creationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 8; - result.modificationTime = parseMp4Date(view.getUint32(i)); // truncating top 4 bytes - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 8; - result.duration = view.getUint32(i); // truncating top 4 bytes - } else { - result.creationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.modificationTime = parseMp4Date(view.getUint32(i)); - i += 4; - result.trackId = view.getUint32(i); - i += 4; - i += 4; - result.duration = view.getUint32(i); - } - i += 4; - i += 2 * 4; - result.layer = view.getUint16(i); - i += 2; - result.alternateGroup = view.getUint16(i); - i += 2; - // convert fixed-point, base 16 back to a number - result.volume = view.getUint8(i) + (view.getUint8(i + 1) / 8); - i += 2; - i += 2; - result.matrix = new Uint32Array(data.subarray(i, i + (9 * 4))); - i += 9 * 4; - result.width = view.getUint16(i) + (view.getUint16(i + 2) / 65536); - i += 4; - result.height = view.getUint16(i) + (view.getUint16(i + 2) / 65536); - return result; - }, - traf: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - trak: function(data) { - return { - boxes: inspectMp4(data) - }; - }, - trex: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4), - defaultSampleDescriptionIndex: view.getUint32(8), - defaultSampleDuration: view.getUint32(12), - defaultSampleSize: view.getUint32(16), - sampleDependsOn: data[20] & 0x03, - sampleIsDependedOn: (data[21] & 0xc0) >> 6, - sampleHasRedundancy: (data[21] & 0x30) >> 4, - samplePaddingValue: (data[21] & 0x0e) >> 1, - sampleIsDifferenceSample: !!(data[21] & 0x01), - sampleDegradationPriority: view.getUint16(22) - }; - }, - trun: require('./parse-trun.js'), - 'url ': function(data) { - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)) - }; - }, - vmhd: function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength); - return { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - graphicsmode: view.getUint16(4), - opcolor: new Uint16Array([view.getUint16(6), - view.getUint16(8), - view.getUint16(10)]) - }; - } - }; - - -/** - * Return a javascript array of box objects parsed from an ISO base - * media file. - * @param data {Uint8Array} the binary data of the media to be inspected - * @return {array} a javascript array of potentially nested box objects - */ -inspectMp4 = function(data) { - var - i = 0, - result = [], - view, - size, - type, - end, - box; - - // Convert data from Uint8Array to ArrayBuffer, to follow Dataview API - var ab = new ArrayBuffer(data.length); - var v = new Uint8Array(ab); - for (var z = 0; z < data.length; ++z) { - v[z] = data[z]; - } - view = new DataView(ab); - - while (i < data.byteLength) { - // parse box data - size = view.getUint32(i); - type = parseType(data.subarray(i + 4, i + 8)); - end = size > 1 ? i + size : data.byteLength; - - // parse type-specific data - box = (parse[type] || function(data) { - return { - data: data - }; - })(data.subarray(i + 8, end)); - box.size = size; - box.type = type; - - // store this box and move to the next - result.push(box); - i = end; - } - return result; -}; - -/** - * Returns a textual representation of the javascript represtentation - * of an MP4 file. You can use it as an alternative to - * JSON.stringify() to compare inspected MP4s. - * @param inspectedMp4 {array} the parsed array of boxes in an MP4 - * file - * @param depth {number} (optional) the number of ancestor boxes of - * the elements of inspectedMp4. Assumed to be zero if unspecified. - * @return {string} a text representation of the parsed MP4 - */ -textifyMp4 = function(inspectedMp4, depth) { - var indent; - depth = depth || 0; - indent = new Array(depth * 2 + 1).join(' '); - - // iterate over all the boxes - return inspectedMp4.map(function(box, index) { - - // list the box type first at the current indentation level - return indent + box.type + '\n' + - - // the type is already included and handle child boxes separately - Object.keys(box).filter(function(key) { - return key !== 'type' && key !== 'boxes'; - - // output all the box properties - }).map(function(key) { - var prefix = indent + ' ' + key + ': ', - value = box[key]; - - // print out raw bytes as hexademical - if (value instanceof Uint8Array || value instanceof Uint32Array) { - var bytes = Array.prototype.slice.call(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)) - .map(function(byte) { - return ' ' + ('00' + byte.toString(16)).slice(-2); - }).join('').match(/.{1,24}/g); - if (!bytes) { - return prefix + '<>'; - } - if (bytes.length === 1) { - return prefix + '<' + bytes.join('').slice(1) + '>'; - } - return prefix + '<\n' + bytes.map(function(line) { - return indent + ' ' + line; - }).join('\n') + '\n' + indent + ' >'; - } - - // stringify generic objects - return prefix + - JSON.stringify(value, null, 2) - .split('\n').map(function(line, index) { - if (index === 0) { - return line; - } - return indent + ' ' + line; - }).join('\n'); - }).join('\n') + - - // recursively textify the child boxes - (box.boxes ? '\n' + textifyMp4(box.boxes, depth + 1) : ''); - }).join('\n'); -}; - -module.exports = { - inspect: inspectMp4, - textify: textifyMp4, - parseType: parseType, - findBox: findBox, - parseTraf: parse.traf, - parseTfdt: parse.tfdt, - parseHdlr: parse.hdlr, - parseTfhd: parse.tfhd, - parseTrun: parse.trun, - parseSidx: parse.sidx -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-id3.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-id3.js deleted file mode 100644 index d1d49cc605..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-id3.js +++ /dev/null @@ -1,252 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Tools for parsing ID3 frame data - * @see http://id3.org/id3v2.3.0 - */ -'use strict'; - -var - typedArrayIndexOf = require('../utils/typed-array').typedArrayIndexOf, - // Frames that allow different types of text encoding contain a text - // encoding description byte [ID3v2.4.0 section 4.] - textEncodingDescriptionByte = { - Iso88591: 0x00, // ISO-8859-1, terminated with \0. - Utf16: 0x01, // UTF-16 encoded Unicode BOM, terminated with \0\0 - Utf16be: 0x02, // UTF-16BE encoded Unicode, without BOM, terminated with \0\0 - Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \0 - }, - // return a percent-encoded representation of the specified byte range - // @see http://en.wikipedia.org/wiki/Percent-encoding - percentEncode = function(bytes, start, end) { - var i, result = ''; - for (i = start; i < end; i++) { - result += '%' + ('00' + bytes[i].toString(16)).slice(-2); - } - return result; - }, - // return the string representation of the specified byte range, - // interpreted as UTf-8. - parseUtf8 = function(bytes, start, end) { - return decodeURIComponent(percentEncode(bytes, start, end)); - }, - // return the string representation of the specified byte range, - // interpreted as ISO-8859-1. - parseIso88591 = function(bytes, start, end) { - return unescape(percentEncode(bytes, start, end)); // jshint ignore:line - }, - parseSyncSafeInteger = function(data) { - return (data[0] << 21) | - (data[1] << 14) | - (data[2] << 7) | - (data[3]); - }, - frameParsers = { - 'APIC': function(frame) { - var - i = 1, - mimeTypeEndIndex, - descriptionEndIndex, - LINK_MIME_TYPE = '-->'; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - // parsing fields [ID3v2.4.0 section 4.14.] - mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i); - if (mimeTypeEndIndex < 0) { - // malformed frame - return; - } - - // parsing Mime type field (terminated with \0) - frame.mimeType = parseIso88591(frame.data, i, mimeTypeEndIndex); - i = mimeTypeEndIndex + 1; - - // parsing 1-byte Picture Type field - frame.pictureType = frame.data[i]; - i++ - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i); - if (descriptionEndIndex < 0) { - // malformed frame - return; - } - - // parsing Description field (terminated with \0) - frame.description = parseUtf8(frame.data, i, descriptionEndIndex); - i = descriptionEndIndex + 1; - - if (frame.mimeType === LINK_MIME_TYPE) { - // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.]) - frame.url = parseIso88591(frame.data, i, frame.data.length) - } else { - // parsing Picture Data field as binary data - frame.pictureData = frame.data.subarray(i, frame.data.length); - } - }, - 'T*': function(frame) { - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - // parse text field, do not include null terminator in the frame value - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, ''); - // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - frame.values = frame.value.split('\0'); - }, - 'TXXX': function(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } - - // parse the text fields - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); - // do not include the null terminator in the tag value - // frames that allow different types of encoding contain terminated text - // [ID3v2.4.0 section 4.] - frame.value = parseUtf8( - frame.data, - descriptionEndIndex + 1, - frame.data.length - ).replace(/\0*$/, ''); - frame.data = frame.value; - }, - 'W*': function(frame) { - // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591(frame.data, 0, frame.data.length).replace(/\0.*$/, ''); - }, - 'WXXX': function(frame) { - var descriptionEndIndex; - - if (frame.data[0] !== textEncodingDescriptionByte.Utf8) { - // ignore frames with unrecognized character encodings - return; - } - - descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1); - - if (descriptionEndIndex === -1) { - return; - } - - // parse the description and URL fields - frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); - // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.] - // if the value is followed by a string termination all the following information - // should be ignored [ID3v2.4.0 section 4.3] - frame.url = parseIso88591( - frame.data, - descriptionEndIndex + 1, - frame.data.length - ).replace(/\0.*$/, ''); - }, - 'PRIV': function(frame) { - var i; - - for (i = 0; i < frame.data.length; i++) { - if (frame.data[i] === 0) { - // parse the description and URL fields - frame.owner = parseIso88591(frame.data, 0, i); - break; - } - } - frame.privateData = frame.data.subarray(i + 1); - frame.data = frame.privateData; - } - }; - -var parseId3Frames = function(data) { - var frameSize, frameHeader, - frameStart = 10, - tagSize = 0, - frames = []; - - // If we don't have enough data for a header, 10 bytes, - // or 'ID3' in the first 3 bytes this is not a valid ID3 tag. - if (data.length < 10 || - data[0] !== 'I'.charCodeAt(0) || - data[1] !== 'D'.charCodeAt(0) || - data[2] !== '3'.charCodeAt(0)) { - return; - } - // the frame size is transmitted as a 28-bit integer in the - // last four bytes of the ID3 header. - // The most significant bit of each byte is dropped and the - // results concatenated to recover the actual value. - tagSize = parseSyncSafeInteger(data.subarray(6, 10)); - - // ID3 reports the tag size excluding the header but it's more - // convenient for our comparisons to include it - tagSize += 10; - // check bit 6 of byte 5 for the extended header flag. - var hasExtendedHeader = data[5] & 0x40; - if (hasExtendedHeader) { - // advance the frame start past the extended header - frameStart += 4; // header size field - frameStart += parseSyncSafeInteger(data.subarray(10, 14)); - tagSize -= parseSyncSafeInteger(data.subarray(16, 20)); // clip any padding off the end - } - - // parse one or more ID3 frames - // http://id3.org/id3v2.3.0#ID3v2_frame_overview - do { - // determine the number of bytes in this frame - frameSize = parseSyncSafeInteger(data.subarray(frameStart + 4, frameStart + 8)); - if (frameSize < 1) { - break; - } - frameHeader = String.fromCharCode(data[frameStart], - data[frameStart + 1], - data[frameStart + 2], - data[frameStart + 3]); - - var frame = { - id: frameHeader, - data: data.subarray(frameStart + 10, frameStart + frameSize + 10) - }; - frame.key = frame.id; - - // parse frame values - if (frameParsers[frame.id]) { - // use frame specific parser - frameParsers[frame.id](frame); - } else if (frame.id[0] === 'T') { - // use text frame generic parser - frameParsers['T*'](frame); - } else if (frame.id[0] === 'W') { - // use URL link frame generic parser - frameParsers['W*'](frame); - } - - frames.push(frame); - - frameStart += 10; // advance past the frame header - frameStart += frameSize; // advance past the frame body - } while (frameStart < tagSize); - - return frames; -} - -module.exports = { - parseId3Frames: parseId3Frames, - parseSyncSafeInteger: parseSyncSafeInteger, - frameParsers: frameParsers, -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sample-flags.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sample-flags.js deleted file mode 100644 index 6899dde83a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sample-flags.js +++ /dev/null @@ -1,13 +0,0 @@ -var parseSampleFlags = function(flags) { - return { - isLeading: (flags[0] & 0x0c) >>> 2, - dependsOn: flags[0] & 0x03, - isDependedOn: (flags[1] & 0xc0) >>> 6, - hasRedundancy: (flags[1] & 0x30) >>> 4, - paddingValue: (flags[1] & 0x0e) >>> 1, - isNonSyncSample: flags[1] & 0x01, - degradationPriority: (flags[2] << 8) | flags[3] - }; -}; - -module.exports = parseSampleFlags; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sidx.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sidx.js deleted file mode 100644 index 7e1b25a16f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-sidx.js +++ /dev/null @@ -1,46 +0,0 @@ -var getUint64 = require('../utils/numbers.js').getUint64; - -var parseSidx = function(data) { - var view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - references: [], - referenceId: view.getUint32(4), - timescale: view.getUint32(8) - }, - i = 12; - - if (result.version === 0) { - result.earliestPresentationTime = view.getUint32(i); - result.firstOffset = view.getUint32(i + 4); - i += 8; - } else { - // read 64 bits - result.earliestPresentationTime = getUint64(data.subarray(i)); - result.firstOffset = getUint64(data.subarray(i + 8)); - i += 16; - } - - i += 2; // reserved - - var referenceCount = view.getUint16(i); - - i += 2; // start of references - - for (; referenceCount > 0; i += 12, referenceCount--) { - result.references.push({ - referenceType: (data[i] & 0x80) >>> 7, - referencedSize: view.getUint32(i) & 0x7FFFFFFF, - subsegmentDuration: view.getUint32(i + 4), - startsWithSap: !!(data[i + 8] & 0x80), - sapType: (data[i + 8] & 0x70) >>> 4, - sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF - }); - } - - return result; -}; - - -module.exports = parseSidx; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfdt.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfdt.js deleted file mode 100644 index b12b26f372..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfdt.js +++ /dev/null @@ -1,20 +0,0 @@ -var toUnsigned = require('../utils/bin').toUnsigned; -var getUint64 = require('../utils/numbers.js').getUint64; - -var tfdt = function(data) { - var result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - }; - - - if (result.version === 1) { - result.baseMediaDecodeTime = getUint64(data.subarray(4)); - } else { - result.baseMediaDecodeTime = toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) - } - return result; -}; - -module.exports = tfdt; - diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfhd.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfhd.js deleted file mode 100644 index e9350c3ef6..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-tfhd.js +++ /dev/null @@ -1,49 +0,0 @@ -var tfhd = function(data) { - var - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - trackId: view.getUint32(4) - }, - baseDataOffsetPresent = result.flags[2] & 0x01, - sampleDescriptionIndexPresent = result.flags[2] & 0x02, - defaultSampleDurationPresent = result.flags[2] & 0x08, - defaultSampleSizePresent = result.flags[2] & 0x10, - defaultSampleFlagsPresent = result.flags[2] & 0x20, - durationIsEmpty = result.flags[0] & 0x010000, - defaultBaseIsMoof = result.flags[0] & 0x020000, - i; - - i = 8; - if (baseDataOffsetPresent) { - i += 4; // truncate top 4 bytes - // FIXME: should we read the full 64 bits? - result.baseDataOffset = view.getUint32(12); - i += 4; - } - if (sampleDescriptionIndexPresent) { - result.sampleDescriptionIndex = view.getUint32(i); - i += 4; - } - if (defaultSampleDurationPresent) { - result.defaultSampleDuration = view.getUint32(i); - i += 4; - } - if (defaultSampleSizePresent) { - result.defaultSampleSize = view.getUint32(i); - i += 4; - } - if (defaultSampleFlagsPresent) { - result.defaultSampleFlags = view.getUint32(i); - } - if (durationIsEmpty) { - result.durationIsEmpty = true; - } - if (!baseDataOffsetPresent && defaultBaseIsMoof) { - result.baseDataOffsetIsMoof = true; - } - return result; -}; - -module.exports = tfhd; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-trun.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-trun.js deleted file mode 100644 index 8baee5cd35..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/parse-trun.js +++ /dev/null @@ -1,82 +0,0 @@ -var parseSampleFlags = require('./parse-sample-flags.js'); - -var trun = function(data) { - var - result = { - version: data[0], - flags: new Uint8Array(data.subarray(1, 4)), - samples: [] - }, - view = new DataView(data.buffer, data.byteOffset, data.byteLength), - // Flag interpretation - dataOffsetPresent = result.flags[2] & 0x01, // compare with 2nd byte of 0x1 - firstSampleFlagsPresent = result.flags[2] & 0x04, // compare with 2nd byte of 0x4 - sampleDurationPresent = result.flags[1] & 0x01, // compare with 2nd byte of 0x100 - sampleSizePresent = result.flags[1] & 0x02, // compare with 2nd byte of 0x200 - sampleFlagsPresent = result.flags[1] & 0x04, // compare with 2nd byte of 0x400 - sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08, // compare with 2nd byte of 0x800 - sampleCount = view.getUint32(4), - offset = 8, - sample; - - if (dataOffsetPresent) { - // 32 bit signed integer - result.dataOffset = view.getInt32(offset); - offset += 4; - } - - // Overrides the flags for the first sample only. The order of - // optional values will be: duration, size, compositionTimeOffset - if (firstSampleFlagsPresent && sampleCount) { - sample = { - flags: parseSampleFlags(data.subarray(offset, offset + 4)) - }; - offset += 4; - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - offset += 4; - } - result.samples.push(sample); - sampleCount--; - } - - while (sampleCount--) { - sample = {}; - if (sampleDurationPresent) { - sample.duration = view.getUint32(offset); - offset += 4; - } - if (sampleSizePresent) { - sample.size = view.getUint32(offset); - offset += 4; - } - if (sampleFlagsPresent) { - sample.flags = parseSampleFlags(data.subarray(offset, offset + 4)); - offset += 4; - } - if (sampleCompositionTimeOffsetPresent) { - if (result.version === 1) { - sample.compositionTimeOffset = view.getInt32(offset); - } else { - sample.compositionTimeOffset = view.getUint32(offset); - } - offset += 4; - } - result.samples.push(sample); - } - return result; -}; - -module.exports = trun; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/ts-inspector.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/ts-inspector.js deleted file mode 100644 index d3b500a1bf..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/tools/ts-inspector.js +++ /dev/null @@ -1,519 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * Parse mpeg2 transport stream packets to extract basic timing information - */ -'use strict'; - -var StreamTypes = require('../m2ts/stream-types.js'); -var handleRollover = require('../m2ts/timestamp-rollover-stream.js').handleRollover; -var probe = {}; -probe.ts = require('../m2ts/probe.js'); -probe.aac = require('../aac/utils.js'); -var ONE_SECOND_IN_TS = require('../utils/clock').ONE_SECOND_IN_TS; - -var - MP2T_PACKET_LENGTH = 188, // bytes - SYNC_BYTE = 0x47; - -/** - * walks through segment data looking for pat and pmt packets to parse out - * program map table information - */ -var parsePsi_ = function(bytes, pmt) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type; - - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pat': - pmt.pid = probe.ts.parsePat(packet); - break; - case 'pmt': - var table = probe.ts.parsePmt(packet); - - pmt.table = pmt.table || {}; - - Object.keys(table).forEach(function(key) { - pmt.table[key] = table[key]; - }); - - break; - default: - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last audio pes packets - */ -var parseAudioPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed; - - var endLoop = false; - - // Start walking from start of segment to get first audio packet - while (endIndex <= bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && - (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last audio packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && - (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'audio' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'audio'; - result.audio.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * walks through the segment data from the start and end to get timing information - * for the first and last video pes packets as well as timing information for the first - * key frame. - */ -var parseVideoPes_ = function(bytes, pmt, result) { - var - startIndex = 0, - endIndex = MP2T_PACKET_LENGTH, - packet, type, pesType, pusi, parsed, frame, i, pes; - - var endLoop = false; - - var currentFrame = { - data: [], - size: 0 - }; - - // Start walking from start of segment to get first video packet - while (endIndex < bytes.byteLength) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video') { - if (pusi && !endLoop) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - if (!result.firstKeyFrame) { - if (pusi) { - if (currentFrame.size !== 0) { - frame = new Uint8Array(currentFrame.size); - i = 0; - while (currentFrame.data.length) { - pes = currentFrame.data.shift(); - frame.set(pes, i); - i += pes.byteLength; - } - if (probe.ts.videoPacketContainsKeyFrame(frame)) { - var firstKeyFrame = probe.ts.parsePesTime(frame); - - // PTS/DTS may not be available. Simply *not* setting - // the keyframe seems to work fine with HLS playback - // and definitely preferable to a crash with TypeError... - if (firstKeyFrame) { - result.firstKeyFrame = firstKeyFrame; - result.firstKeyFrame.type = 'video'; - } else { - // eslint-disable-next-line - console.warn( - 'Failed to extract PTS/DTS from PES at first keyframe. ' + - 'This could be an unusual TS segment, or else mux.js did not ' + - 'parse your TS segment correctly. If you know your TS ' + - 'segments do contain PTS/DTS on keyframes please file a bug ' + - 'report! You can try ffprobe to double check for yourself.' - ); - } - } - currentFrame.size = 0; - } - } - currentFrame.data.push(packet); - currentFrame.size += packet.byteLength; - } - } - break; - default: - break; - } - - if (endLoop && result.firstKeyFrame) { - break; - } - - startIndex += MP2T_PACKET_LENGTH; - endIndex += MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex++; - endIndex++; - } - - // Start walking from end of segment to get last video packet - endIndex = bytes.byteLength; - startIndex = endIndex - MP2T_PACKET_LENGTH; - endLoop = false; - while (startIndex >= 0) { - // Look for a pair of start and end sync bytes in the data.. - if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) { - // We found a packet - packet = bytes.subarray(startIndex, endIndex); - type = probe.ts.parseType(packet, pmt.pid); - - switch (type) { - case 'pes': - pesType = probe.ts.parsePesType(packet, pmt.table); - pusi = probe.ts.parsePayloadUnitStartIndicator(packet); - if (pesType === 'video' && pusi) { - parsed = probe.ts.parsePesTime(packet); - if (parsed) { - parsed.type = 'video'; - result.video.push(parsed); - endLoop = true; - } - } - break; - default: - break; - } - - if (endLoop) { - break; - } - - startIndex -= MP2T_PACKET_LENGTH; - endIndex -= MP2T_PACKET_LENGTH; - continue; - } - - // If we get here, we have somehow become de-synchronized and we need to step - // forward one byte at a time until we find a pair of sync bytes that denote - // a packet - startIndex--; - endIndex--; - } -}; - -/** - * Adjusts the timestamp information for the segment to account for - * rollover and convert to seconds based on pes packet timescale (90khz clock) - */ -var adjustTimestamp_ = function(segmentInfo, baseTimestamp) { - if (segmentInfo.audio && segmentInfo.audio.length) { - var audioBaseTimestamp = baseTimestamp; - if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) { - audioBaseTimestamp = segmentInfo.audio[0].dts; - } - segmentInfo.audio.forEach(function(info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp); - info.pts = handleRollover(info.pts, audioBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - } - - if (segmentInfo.video && segmentInfo.video.length) { - var videoBaseTimestamp = baseTimestamp; - if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) { - videoBaseTimestamp = segmentInfo.video[0].dts; - } - segmentInfo.video.forEach(function(info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp); - info.pts = handleRollover(info.pts, videoBaseTimestamp); - // time in seconds - info.dtsTime = info.dts / ONE_SECOND_IN_TS; - info.ptsTime = info.pts / ONE_SECOND_IN_TS; - }); - if (segmentInfo.firstKeyFrame) { - var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp); - frame.pts = handleRollover(frame.pts, videoBaseTimestamp); - // time in seconds - frame.dtsTime = frame.dts / ONE_SECOND_IN_TS; - frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; - } - } -}; - -/** - * inspects the aac data stream for start and end time information - */ -var inspectAac_ = function(bytes) { - var - endLoop = false, - audioCount = 0, - sampleRate = null, - timestamp = null, - frameSize = 0, - byteIndex = 0, - packet; - - while (bytes.length - byteIndex >= 3) { - var type = probe.aac.parseType(bytes, byteIndex); - switch (type) { - case 'timed-metadata': - // Exit early because we don't have enough to parse - // the ID3 tag header - if (bytes.length - byteIndex < 10) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (timestamp === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - timestamp = probe.aac.parseAacTimestamp(packet); - } - byteIndex += frameSize; - break; - case 'audio': - // Exit early because we don't have enough to parse - // the ADTS frame header - if (bytes.length - byteIndex < 7) { - endLoop = true; - break; - } - - frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); - - // Exit early if we don't have enough in the buffer - // to emit a full packet - if (frameSize > bytes.length) { - endLoop = true; - break; - } - if (sampleRate === null) { - packet = bytes.subarray(byteIndex, byteIndex + frameSize); - sampleRate = probe.aac.parseSampleRate(packet); - } - audioCount++; - byteIndex += frameSize; - break; - default: - byteIndex++; - break; - } - if (endLoop) { - return null; - } - } - if (sampleRate === null || timestamp === null) { - return null; - } - - var audioTimescale = ONE_SECOND_IN_TS / sampleRate; - - var result = { - audio: [ - { - type: 'audio', - dts: timestamp, - pts: timestamp - }, - { - type: 'audio', - dts: timestamp + (audioCount * 1024 * audioTimescale), - pts: timestamp + (audioCount * 1024 * audioTimescale) - } - ] - }; - - return result; -}; - -/** - * inspects the transport stream segment data for start and end time information - * of the audio and video tracks (when present) as well as the first key frame's - * start time. - */ -var inspectTs_ = function(bytes) { - var pmt = { - pid: null, - table: null - }; - - var result = {}; - - parsePsi_(bytes, pmt); - - for (var pid in pmt.table) { - if (pmt.table.hasOwnProperty(pid)) { - var type = pmt.table[pid]; - switch (type) { - case StreamTypes.H264_STREAM_TYPE: - result.video = []; - parseVideoPes_(bytes, pmt, result); - if (result.video.length === 0) { - delete result.video; - } - break; - case StreamTypes.ADTS_STREAM_TYPE: - result.audio = []; - parseAudioPes_(bytes, pmt, result); - if (result.audio.length === 0) { - delete result.audio; - } - break; - default: - break; - } - } - } - return result; -}; - -/** - * Inspects segment byte data and returns an object with start and end timing information - * - * @param {Uint8Array} bytes The segment byte data - * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame - * timestamps for rollover. This value must be in 90khz clock. - * @return {Object} Object containing start and end frame timing info of segment. - */ -var inspect = function(bytes, baseTimestamp) { - var isAacData = probe.aac.isLikelyAacData(bytes); - - var result; - - if (isAacData) { - result = inspectAac_(bytes); - } else { - result = inspectTs_(bytes); - } - - if (!result || (!result.audio && !result.video)) { - return null; - } - - adjustTimestamp_(result, baseTimestamp); - - return result; -}; - -module.exports = { - inspect: inspect, - parseAudioPes_: parseAudioPes_ -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/bin.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/bin.js deleted file mode 100644 index 2b878c8ecd..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/bin.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var toUnsigned = function(value) { - return value >>> 0; -}; - -var toHexString = function(value) { - return ('00' + value.toString(16)).slice(-2); -}; - -module.exports = { - toUnsigned: toUnsigned, - toHexString: toHexString -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/clock.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/clock.js deleted file mode 100644 index 58e35bbba6..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/clock.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -var - ONE_SECOND_IN_TS = 90000, // 90kHz clock - secondsToVideoTs, - secondsToAudioTs, - videoTsToSeconds, - audioTsToSeconds, - audioTsToVideoTs, - videoTsToAudioTs, - metadataTsToSeconds; - -secondsToVideoTs = function(seconds) { - return seconds * ONE_SECOND_IN_TS; -}; - -secondsToAudioTs = function(seconds, sampleRate) { - return seconds * sampleRate; -}; - -videoTsToSeconds = function(timestamp) { - return timestamp / ONE_SECOND_IN_TS; -}; - -audioTsToSeconds = function(timestamp, sampleRate) { - return timestamp / sampleRate; -}; - -audioTsToVideoTs = function(timestamp, sampleRate) { - return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate)); -}; - -videoTsToAudioTs = function(timestamp, sampleRate) { - return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate); -}; - -/** - * Adjust ID3 tag or caption timing information by the timeline pts values - * (if keepOriginalTimestamps is false) and convert to seconds - */ -metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) { - return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts); -}; - -module.exports = { - ONE_SECOND_IN_TS: ONE_SECOND_IN_TS, - secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, - videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, - audioTsToVideoTs: audioTsToVideoTs, - videoTsToAudioTs: videoTsToAudioTs, - metadataTsToSeconds: metadataTsToSeconds -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/exp-golomb.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/exp-golomb.js deleted file mode 100644 index 358cba2cf2..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/exp-golomb.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - */ -'use strict'; - -var ExpGolomb; - -/** - * Parser for exponential Golomb codes, a variable-bitwidth number encoding - * scheme used by h264. - */ -ExpGolomb = function(workingData) { - var - // the number of bytes left to examine in workingData - workingBytesAvailable = workingData.byteLength, - - // the current word being examined - workingWord = 0, // :uint - - // the number of bits left to examine in the current word - workingBitsAvailable = 0; // :uint; - - // ():uint - this.length = function() { - return (8 * workingBytesAvailable); - }; - - // ():uint - this.bitsAvailable = function() { - return (8 * workingBytesAvailable) + workingBitsAvailable; - }; - - // ():void - this.loadWord = function() { - var - position = workingData.byteLength - workingBytesAvailable, - workingBytes = new Uint8Array(4), - availableBytes = Math.min(4, workingBytesAvailable); - - if (availableBytes === 0) { - throw new Error('no bytes available'); - } - - workingBytes.set(workingData.subarray(position, - position + availableBytes)); - workingWord = new DataView(workingBytes.buffer).getUint32(0); - - // track the amount of workingData that has been processed - workingBitsAvailable = availableBytes * 8; - workingBytesAvailable -= availableBytes; - }; - - // (count:int):void - this.skipBits = function(count) { - var skipBytes; // :int - if (workingBitsAvailable > count) { - workingWord <<= count; - workingBitsAvailable -= count; - } else { - count -= workingBitsAvailable; - skipBytes = Math.floor(count / 8); - - count -= (skipBytes * 8); - workingBytesAvailable -= skipBytes; - - this.loadWord(); - - workingWord <<= count; - workingBitsAvailable -= count; - } - }; - - // (size:int):uint - this.readBits = function(size) { - var - bits = Math.min(workingBitsAvailable, size), // :uint - valu = workingWord >>> (32 - bits); // :uint - // if size > 31, handle error - workingBitsAvailable -= bits; - if (workingBitsAvailable > 0) { - workingWord <<= bits; - } else if (workingBytesAvailable > 0) { - this.loadWord(); - } - - bits = size - bits; - if (bits > 0) { - return valu << bits | this.readBits(bits); - } - return valu; - }; - - // ():uint - this.skipLeadingZeros = function() { - var leadingZeroCount; // :uint - for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) { - if ((workingWord & (0x80000000 >>> leadingZeroCount)) !== 0) { - // the first bit of working word is 1 - workingWord <<= leadingZeroCount; - workingBitsAvailable -= leadingZeroCount; - return leadingZeroCount; - } - } - - // we exhausted workingWord and still have not found a 1 - this.loadWord(); - return leadingZeroCount + this.skipLeadingZeros(); - }; - - // ():void - this.skipUnsignedExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():void - this.skipExpGolomb = function() { - this.skipBits(1 + this.skipLeadingZeros()); - }; - - // ():uint - this.readUnsignedExpGolomb = function() { - var clz = this.skipLeadingZeros(); // :uint - return this.readBits(clz + 1) - 1; - }; - - // ():int - this.readExpGolomb = function() { - var valu = this.readUnsignedExpGolomb(); // :int - if (0x01 & valu) { - // the number is odd if the low order bit is set - return (1 + valu) >>> 1; // add 1 to make it even, and divide by 2 - } - return -1 * (valu >>> 1); // divide by two then make it negative - }; - - // Some convenience functions - // :Boolean - this.readBoolean = function() { - return this.readBits(1) === 1; - }; - - // ():int - this.readUnsignedByte = function() { - return this.readBits(8); - }; - - this.loadWord(); -}; - -module.exports = ExpGolomb; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/numbers.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/numbers.js deleted file mode 100644 index 7f80916715..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/numbers.js +++ /dev/null @@ -1,23 +0,0 @@ -var MAX_UINT32 = Math.pow(2, 32); - -var getUint64 = function(uint8) { - var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength); - var value; - - if (dv.getBigUint64) { - value = dv.getBigUint64(0); - - if (value < Number.MAX_SAFE_INTEGER) { - return Number(value); - } - - return value; - } - - return (dv.getUint32(0) * MAX_UINT32) + dv.getUint32(4); -}; - -module.exports = { - getUint64: getUint64, - MAX_UINT32: MAX_UINT32 -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/stream.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/stream.js deleted file mode 100644 index f40cc83e32..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/stream.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * mux.js - * - * Copyright (c) Brightcove - * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE - * - * A lightweight readable stream implemention that handles event dispatching. - * Objects that inherit from streams should call init in their constructors. - */ -'use strict'; - -var Stream = function() { - this.init = function() { - var listeners = {}; - /** - * Add a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} the callback to be invoked when an event of - * the specified type occurs - */ - this.on = function(type, listener) { - if (!listeners[type]) { - listeners[type] = []; - } - listeners[type] = listeners[type].concat(listener); - }; - /** - * Remove a listener for a specified event type. - * @param type {string} the event name - * @param listener {function} a function previously registered for this - * type of event through `on` - */ - this.off = function(type, listener) { - var index; - if (!listeners[type]) { - return false; - } - index = listeners[type].indexOf(listener); - listeners[type] = listeners[type].slice(); - listeners[type].splice(index, 1); - return index > -1; - }; - /** - * Trigger an event of the specified type on this stream. Any additional - * arguments to this function are passed as parameters to event listeners. - * @param type {string} the event name - */ - this.trigger = function(type) { - var callbacks, i, length, args; - callbacks = listeners[type]; - if (!callbacks) { - return; - } - // Slicing the arguments on every invocation of this method - // can add a significant amount of overhead. Avoid the - // intermediate object creation for the common case of a - // single callback argument - if (arguments.length === 2) { - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].call(this, arguments[1]); - } - } else { - args = []; - i = arguments.length; - for (i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - length = callbacks.length; - for (i = 0; i < length; ++i) { - callbacks[i].apply(this, args); - } - } - }; - /** - * Destroys the stream and cleans up. - */ - this.dispose = function() { - listeners = {}; - }; - }; -}; - -/** - * Forwards all `data` events on this stream to the destination stream. The - * destination stream should provide a method `push` to receive the data - * events as they arrive. - * @param destination {stream} the stream that will receive all `data` events - * @param autoFlush {boolean} if false, we will not call `flush` on the destination - * when the current stream emits a 'done' event - * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options - */ -Stream.prototype.pipe = function(destination) { - this.on('data', function(data) { - destination.push(data); - }); - - this.on('done', function(flushSource) { - destination.flush(flushSource); - }); - - this.on('partialdone', function(flushSource) { - destination.partialFlush(flushSource); - }); - - this.on('endedtimeline', function(flushSource) { - destination.endTimeline(flushSource); - }); - - this.on('reset', function(flushSource) { - destination.reset(flushSource); - }); - - return destination; -}; - -// Default stream functions that are expected to be overridden to perform -// actual work. These are provided by the prototype as a sort of no-op -// implementation so that we don't have to check for their existence in the -// `pipe` function above. -Stream.prototype.push = function(data) { - this.trigger('data', data); -}; - -Stream.prototype.flush = function(flushSource) { - this.trigger('done', flushSource); -}; - -Stream.prototype.partialFlush = function(flushSource) { - this.trigger('partialdone', flushSource); -}; - -Stream.prototype.endTimeline = function(flushSource) { - this.trigger('endedtimeline', flushSource); -}; - -Stream.prototype.reset = function(flushSource) { - this.trigger('reset', flushSource); -}; - -module.exports = Stream; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/string.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/string.js deleted file mode 100644 index 65ad2c181e..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/string.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Returns the first string in the data array ending with a null char '\0' - * @param {UInt8} data - * @returns the string with the null char - */ -var uint8ToCString = function(data) { - var index = 0; - var curChar = String.fromCharCode(data[index]); - var retString = ''; - while (curChar !== '\0') { - retString += curChar; - index++; - curChar = String.fromCharCode(data[index]); - } - // Add nullChar - retString += curChar; - return retString; -}; - -module.exports = { uint8ToCString }; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/typed-array.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/typed-array.js deleted file mode 100644 index 244ea27f6d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/lib/utils/typed-array.js +++ /dev/null @@ -1,19 +0,0 @@ -// IE11 doesn't support indexOf for TypedArrays. -// Once IE11 support is dropped, this function should be removed. -var typedArrayIndexOf = (typedArray, element, fromIndex) => { - if (!typedArray) { - return -1; - } - - var currentIndex = fromIndex; - - for (; currentIndex < typedArray.length; currentIndex++) { - if (typedArray[currentIndex] === element) { - return currentIndex; - } - } - - return -1; -}; - -module.exports = { typedArrayIndexOf }; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/package.json b/node_modules/@videojs/http-streaming/node_modules/mux.js/package.json deleted file mode 100644 index 2566230590..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/package.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "name": "mux.js", - "version": "7.0.0", - "description": "A collection of lightweight utilities for inspecting and manipulating video container formats.", - "repository": { - "type": "git", - "url": "https://github.com/videojs/mux.js.git" - }, - "main": "./cjs/index.js", - "module": "es/index.js", - "browser": "dist/mux.js", - "bin": { - "muxjs-transmux": "bin/transmux.js" - }, - "generator-videojs-plugin": { - "version": "7.7.3" - }, - "browserslist": [ - "defaults", - "ie 11" - ], - "scripts": { - "netlify": "node scripts/netlify.js", - "build": "npm-run-all -s clean -p build:*", - "build-prod": "cross-env-shell NO_TEST_BUNDLE=1 'npm run build'", - "build-test": "cross-env-shell TEST_BUNDLE_ONLY=1 'npm run build'", - "build:cjs": "babel-config-cjs -d ./cjs ./lib", - "build:es": "babel-config-es -d ./es ./lib", - "build:js": "rollup -c scripts/rollup.config.js", - "clean": "shx rm -rf ./dist ./test/dist ./cjs ./es && shx mkdir -p ./dist ./test/dist ./cjs ./es", - "docs": "npm-run-all docs:*", - "docs:toc": "doctoc --notitle README.md", - "lint": ": vjsstandard", - "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", - "start": "npm-run-all -p server watch", - "test": "npm-run-all lint build-test test:*", - "test:browser": "karma start scripts/karma.conf.js", - "test:node": "node scripts/node-test.js", - "update-changelog": "conventional-changelog -p videojs -i CHANGELOG.md -s", - "version": "is-prerelease || npm run update-changelog && git add CHANGELOG.md", - "watch": "npm-run-all -p watch:*", - "watch:cjs": "npm run build:cjs -- -w", - "watch:es": "npm run build:es -- -w", - "watch:js": "npm run build:js -- -w", - "prepublishOnly": "npm ci && npm-run-all build-prod && vjsverify --verbose" - }, - "engines": { - "node": ">=8", - "npm": ">=5" - }, - "keywords": [ - "video", - "container", - "transmux", - "mux", - "player", - "hls", - "mp4", - "flv", - "aac", - "h264" - ], - "author": "Brightcove", - "license": "Apache-2.0", - "vjsstandard": { - "ignore": [ - "es", - "cjs", - "dist", - "docs", - "test/dist" - ] - }, - "files": [ - "bin/", - "CONTRIBUTING.md", - "cjs/", - "dist/", - "docs/", - "es/", - "lib/", - "index.html", - "scripts/", - "src/", - "test/" - ], - "husky": { - "hooks": { - "pre-commit": ": lint-staged" - } - }, - "lint-staged": { - "*.js": "vjsstandard --fix", - "README.md": "doctoc --notitle" - }, - "dependencies": { - "@babel/runtime": "^7.11.2", - "global": "^4.4.0" - }, - "devDependencies": { - "@babel/cli": "^7.11.6", - "@videojs/babel-config": "^0.2.0", - "@videojs/generator-helpers": "~2.0.1", - "@videojs/vhs-utils": "^3.0.0", - "karma": "^5.0.0", - "qunit": "^2.16.0", - "rollup": "^2.37.1", - "rollup-plugin-data-files": "^0.1.0", - "rollup-plugin-worker-factory": "^0.5.6", - "sinon": "^8.1.1", - "videojs-generate-karma-config": "~7.1.0", - "videojs-generate-rollup-config": "~6.2.0", - "videojs-generator-verify": "~3.0.2", - "videojs-standard": "^8.0.4" - } -} diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/karma.conf.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/karma.conf.js deleted file mode 100644 index ce98aab735..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/karma.conf.js +++ /dev/null @@ -1,25 +0,0 @@ -const generate = require('videojs-generate-karma-config'); - -module.exports = function(config) { - - // see https://github.com/videojs/videojs-generate-karma-config - // for options - const options = { - coverage: false, - browsers(aboutToRun) { - return aboutToRun.filter(function(launcherName) { - return !(/^Safari/).test(launcherName); - }); - }, - browserstackLaunchers(defaults) { - delete defaults.bsSafariMojave; - delete defaults.bsSafariElCapitan; - - return defaults; - } - }; - - config = generate(config, options); - - // any other custom stuff not supported by options here! -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/netlify.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/netlify.js deleted file mode 100644 index a22bbbf949..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/netlify.js +++ /dev/null @@ -1,20 +0,0 @@ -const shell = require('shelljs'); - -// clone vhs -shell.exec('git clone https://github.com/videojs/http-streaming'); -shell.cd('http-streaming'); - -// install vhs and link in the local version of mux.js -shell.exec('npm ci'); -shell.exec('npm link ../'); - -// run the vhs netlify script so that we can use -// the vhs netlify page with this local mux.js -shell.exec('npm run netlify'); - -// move the vhs deploy directory to the project root -shell.cp('-R', 'deploy', '../'); - -// cleanup by removing the cloned vhs directory -shell.cd('..'); -shell.rm('-rf', 'http-streaming'); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/node-test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/node-test.js deleted file mode 100644 index 99b25d5473..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/node-test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable no-console */ -const path = require('path'); -const spawn = require('child_process').spawn; -const major = parseInt(process.versions.node.split('.')[0], 10); -const qunitBinary = require.resolve('qunit/bin/qunit.js'); - -if (major < 10) { - console.error('Cannot run tests on node < 10, please update'); - process.exit(1); -} - -let args = [qunitBinary, 'test/dist/bundle.js']; - -if (major === 10) { - args = ['node', '--experimental-worker'].concat(args); -} - -const child = spawn(args[0], args.slice(1), { - cwd: path.join(__dirname, '..'), - stdio: 'inherit' -}); - -child.on('close', (code) => { - process.exit(code); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/rollup.config.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/rollup.config.js deleted file mode 100644 index 5653988bc3..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/scripts/rollup.config.js +++ /dev/null @@ -1,54 +0,0 @@ -const generate = require('videojs-generate-rollup-config'); -const dataFiles = require('rollup-plugin-data-files'); -const worker = require('rollup-plugin-worker-factory'); - -// see https://github.com/videojs/videojs-generate-rollup-config -// for options - -const shared = { - primedPlugins(defaults) { - defaults = Object.assign(defaults, { - dataFiles: dataFiles({ - segments: {include: 'test/segments/**'} - }) - }); - - defaults.worker = worker({plugins: [ - defaults.resolve, - defaults.json, - defaults.commonjs, - defaults.babel - ]}); - - return defaults; - }, - plugins(defaults) { - defaults.module.splice(2, 0, 'worker'); - defaults.browser.splice(2, 0, 'worker'); - defaults.test.splice(3, 0, 'worker'); - defaults.test.splice(0, 0, 'dataFiles'); - - // istanbul is only in the list for regular builds and not watch - if (defaults.test.indexOf('istanbul') !== -1) { - defaults.test.splice(defaults.test.indexOf('istanbul'), 1); - } - - return defaults; - } -}; -const mainBuilds = generate(Object.assign({input: 'lib/index.js', distName: 'mux', exportName: 'muxjs'}, shared)).builds; -const mp4Builds = generate({input: 'lib/mp4/index.js', distName: 'mux-mp4', exportName: 'muxjs'}).builds; -const flvBuilds = generate({input: 'lib/flv/index.js', distName: 'mux-flv', exportName: 'muxjs'}).builds; - -const allBuilds = []; - -if (mainBuilds.test) { - allBuilds.push(mainBuilds.test); -} - -if (mainBuilds.browser) { - allBuilds.push(mainBuilds.browser, mp4Builds.browser, flvBuilds.browser); -} - -// export the builds to rollup -export default allBuilds; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/.eslintrc.json b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/.eslintrc.json deleted file mode 100644 index 99022c703d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "qunit": true - } -} diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-stream.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-stream.test.js deleted file mode 100644 index c238c9b88b..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-stream.test.js +++ /dev/null @@ -1,289 +0,0 @@ -'use strict'; - -var - aacStream, - AacStream = require('../lib/aac'), - QUnit = require('qunit'), - utils = require('./utils'), - createId3Header, - createId3FrameHeader, - createAdtsHeader; - -createId3Header = function(tagSize) { - var header = []; - - header[0] = 'I'.charCodeAt(0); - header[1] = 'D'.charCodeAt(0); - header[2] = '3'.charCodeAt(0); - // 2 version bytes, ID3v2.4.0 (major 4, revision 0) - header[3] = 4; - header[4] = 0; - // unsynchronization, extended header, experimental indicator, footer present flags - header[5] = 0; - // "The ID3v2 tag size is the sum of the byte length of the extended - // header, the padding and the frames after unsynchronisation. If a - // footer is present this equals to ('total size' - 20) bytes, otherwise - // ('total size' - 10) bytes." - // http://id3.org/id3v2.4.0-structure - header[6] = 0; - header[7] = 0; - header[8] = 0; - header[9] = tagSize; - - return header; -}; - -createId3FrameHeader = function() { - var header = []; - - // four byte frame ID, XYZ are experimental - header[0] = 'X'.charCodeAt(0); - header[1] = 'Y'.charCodeAt(0); - header[2] = 'Z'.charCodeAt(0); - header[3] = '0'.charCodeAt(0); - // four byte sync safe integer size (excluding frame header) - header[4] = 0; - header[5] = 0; - header[6] = 0; - header[7] = 10; - // two bytes for flags - header[8] = 0; - header[9] = 0; - - return header; -}; - -createAdtsHeader = function(frameLength) { - // Header consists of 7 or 9 bytes (without or with CRC). - // see: https://wiki.multimedia.cx/index.php/ADTS - return utils.binaryStringToArrayOfBytes(''.concat( - // 12 bits for syncword (0xFFF) - '111111111111', - // 1 bit MPEG version - '0', - // 2 bit layer (always 0) - '00', - // 1 bit protection absent (1 for no CRC) - '1', - // 2 bit profile - '10', - // 4 bit sampling frequency index - '0110', - // 1 bit private bit - '0', - // 3 bit channel config - '100', - // 2 bit (ignore) - '00', - // 2 bit (copright bits) - '00', - // 13 bit frame length (includes header length) - utils.leftPad(frameLength.toString(2), 13), - // 11 bit buffer fullness - '11111111111', - // 2 bit number of AAC frames minus 1 - '00' - // 16 bit CRC (if present) - )); -}; - -QUnit.module('AAC Stream', { - beforeEach: function() { - aacStream = new AacStream(); - } -}); - -QUnit.test('parses ID3 tag', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag)); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('parses two ID3 tags in sequence', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag.concat(id3Tag))); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 2, 'two id3 chunks'); -}); - -QUnit.test('does not parse second ID3 tag if it\'s incomplete', function(assert) { - var - id3Count = 0, - adtsCount = 0, - frameHeader = createId3FrameHeader(), - id3Tag = createId3Header(frameHeader.length).concat(frameHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(id3Tag.concat(id3Tag.slice(0, id3Tag.length - 1)))); - - assert.equal(adtsCount, 0, 'no adts frames'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('handles misaligned adts header', function(assert) { - var - id3Count = 0, - adtsCount = 0, - // fake adts frame - adtsFrame = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - packetStream = createAdtsHeader(adtsFrame.length).concat(adtsFrame); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - // misalign by two bytes specific to a bug related to detecting sync bytes - // (where we were only properly checking the second byte) - aacStream.push(new Uint8Array([0x01, 0xf0].concat(packetStream))); - - assert.equal(adtsCount, 1, 'one adts frames'); - assert.equal(id3Count, 0, 'no id3 chunk'); -}); - -QUnit.test('handles incomplete adts frame after id3 frame', function(assert) { - var - id3Count = 0, - adtsCount = 0, - id3FrameHeader = createId3FrameHeader(), - id3Tag = createId3Header(id3FrameHeader.length).concat(id3FrameHeader), - // in this case: - // id3 tag = 20 bytes - // adts header = 7 bytes - // total = 27 bytes - // report the ADTS frame size as 20 bytes - adtsHeader = createAdtsHeader(20), - // no adts frame, stream was cut off - packetStream = id3Tag.concat(adtsHeader); - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - - aacStream.push(new Uint8Array(packetStream)); - - assert.equal(adtsCount, 0, 'no adts frame'); - assert.equal(id3Count, 1, 'one id3 chunk'); -}); - -QUnit.test('emits data after receiving push', function(assert) { - var - array = new Uint8Array(109), - count = 0; - - array[0] = 255; - array[1] = 241; - array[2] = 92; - array[3] = 128; - array[4] = 13; - array[5] = 191; - array[6] = 252; - array[7] = 33; - array[8] = 32; - array[9] = 3; - array[10] = 64; - array[11] = 104; - array[12] = 27; - array[13] = 212; - aacStream.setTimestamp(90); - aacStream.on('data', function(frame) { - if (frame.pts === 90 && frame.dts === 90) { - count += 1; - } - }); - aacStream.push(array); - assert.equal(count, 1); -}); - -QUnit.test('continues parsing after corrupted stream', function(assert) { - var - array = new Uint8Array(10000), - adtsCount = 0, - id3Count = 0; - - // an ID3 frame - array[0] = 73; - array[1] = 68; - array[2] = 51; - array[3] = 4; - array[4] = 0; - array[5] = 0; - array[6] = 0; - array[7] = 0; - array[8] = 0; - array[9] = 63; - array[10] = 80; - array[11] = 82; - array[12] = 73; - array[13] = 86; - - // an atds frame - array[1020] = 255; - array[1021] = 241; - array[1022] = 92; - array[1023] = 128; - array[1024] = 13; - array[1025] = 191; - array[1026] = 252; - array[1027] = 33; - array[1028] = 32; - array[1029] = 3; - array[1030] = 64; - array[1031] = 104; - array[1032] = 27; - array[1033] = 212; - - aacStream.on('data', function(frame) { - if (frame.type === 'timed-metadata') { - id3Count += 1; - } else if (frame.type === 'audio') { - adtsCount += 1; - } - }); - aacStream.push(array); - assert.equal(adtsCount, 1); - assert.equal(id3Count, 1); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-utils.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-utils.test.js deleted file mode 100644 index 88d4ac62ac..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/aac-utils.test.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - utils = require('../lib/aac/utils.js'), - testSegment = segments['test-aac-segment.aac'](); - -var id3TagOffset = 0; -var audioFrameOffset = 73; - - -QUnit.module('AAC Utils'); - -QUnit.test('correctly determines aac data', function(assert) { - assert.ok(utils.isLikelyAacData(testSegment), 'test segment is aac'); - - - var id3Offset = utils.parseId3TagSize(testSegment, 0); - var id3 = Array.prototype.slice.call(testSegment, 0, id3Offset); - var segmentOnly = testSegment.subarray(id3Offset); - var multipleId3 = new Uint8Array([] - .concat(id3) - .concat(id3) - .concat(id3) - .concat(id3) - .concat(Array.prototype.slice.call(segmentOnly)) - ); - - assert.ok(utils.isLikelyAacData(segmentOnly), 'test segment is aac without id3'); - assert.notOk(utils.isLikelyAacData(testSegment.subarray(id3Offset + 25)), 'non aac data not recognized'); - assert.notOk(utils.isLikelyAacData(testSegment.subarray(0, 5)), 'not enough aac data is not recognized'); - assert.ok(utils.isLikelyAacData(multipleId3), 'test segment with multilpe id3'); -}); - - -QUnit.test('correctly parses aac packet type', function(assert) { - assert.equal(utils.parseType(testSegment, id3TagOffset), 'timed-metadata', - 'parsed timed-metadata type'); - assert.equal(utils.parseType(testSegment, 1), null, - 'parsed unknown type'); - assert.equal(utils.parseType(testSegment, audioFrameOffset), 'audio', - 'parsed audio type'); -}); - -QUnit.test('correctly parses ID3 tag size', function(assert) { - assert.equal(utils.parseId3TagSize(testSegment, id3TagOffset), 73, - 'correct id3 tag size'); -}); - -QUnit.test('correctly parses timestamp from ID3 metadata', function(assert) { - var frameSize = utils.parseId3TagSize(testSegment, id3TagOffset); - var frame = testSegment.subarray(id3TagOffset, id3TagOffset + frameSize); - - assert.equal(utils.parseAacTimestamp(frame), 895690, 'correct aac timestamp'); -}); - -QUnit.test('correctly parses adts frame size', function(assert) { - assert.equal(utils.parseAdtsSize(testSegment, audioFrameOffset), 13, - 'correct adts frame size'); -}); - -QUnit.test('correctly parses packet sample rate', function(assert) { - var frameSize = utils.parseAdtsSize(testSegment, audioFrameOffset); - var frame = testSegment.subarray(audioFrameOffset, audioFrameOffset + frameSize); - - assert.equal(utils.parseSampleRate(frame), 44100, 'correct sample rate'); -}); - -QUnit.test('parses correct ID3 tag size', function(assert) { - var packetStream = new Uint8Array(10); - - packetStream[9] = 63; - - assert.equal(utils.parseId3TagSize(packetStream, 0), - 73, - 'correctly parsed a header without a footer'); -}); - -QUnit.test('parses correct ADTS Frame size', function(assert) { - var packetStream = new Uint8Array(6); - - packetStream[3] = 128; - packetStream[4] = 29; - packetStream[5] = 255; - - assert.equal(utils.parseAdtsSize(packetStream, 0), 239, 'correctly parsed framesize'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/base64-to-uint8-array.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/base64-to-uint8-array.js deleted file mode 100644 index 13f166e365..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/base64-to-uint8-array.js +++ /dev/null @@ -1,17 +0,0 @@ -var window = require('global/window'); -// TODO: use vhs-utils here - -var atob = (s) => window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary'); - -var base64ToUint8Array = function(base64) { - var decoded = atob(base64); - var uint8Array = new Uint8Array(new ArrayBuffer(decoded.length)); - - for (var i = 0; i < decoded.length; i++) { - uint8Array[i] = decoded.charCodeAt(i); - } - - return uint8Array; -}; - -module.exports = base64ToUint8Array; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-parser.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-parser.test.js deleted file mode 100644 index c02365abd0..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-parser.test.js +++ /dev/null @@ -1,271 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var probe = require('../lib/mp4/probe'); -var CaptionParser = require('../lib/mp4').CaptionParser; -var captionParser; - -var dashInit = segments['dash-608-captions-init.mp4'](); -// This file includes 2 segments data to force a flush -// of the first caption. The second caption is at 200s -var dashSegment = segments['dash-608-captions-seg.m4s'](); -var malformedSei = segments['malformed-sei.m4s'](); -var malformedSeiInit = segments['malformed-sei-init.mp4'](); - -var mp4Helpers = require('./utils/mp4-helpers'); -var box = mp4Helpers.box; -var seiNalUnitGenerator = require('./utils/sei-nal-unit-generator'); -var makeMdatFromCaptionPackets = seiNalUnitGenerator.makeMdatFromCaptionPackets; -var characters = seiNalUnitGenerator.characters; - -var packets0; -var version0Moof; -var version0Segment; - -var packets1; -var version1Moof; -var version1Segment; - -QUnit.module('MP4 Caption Parser', { - beforeEach: function() { - captionParser = new CaptionParser(); - captionParser.init(); - }, - - afterEach: function() { - captionParser.reset(); - } -}); - -QUnit.test('parse captions from real segment', function(assert) { - var trackIds; - var timescales; - var cc; - - trackIds = probe.videoTrackIds(dashInit); - timescales = probe.timescale(dashInit); - - cc = captionParser.parse(dashSegment, trackIds, timescales); - - assert.equal(cc.captions.length, 1); - assert.equal(cc.captions[0].content[0].text, '00:00:00', - 'real segment caption has correct text'); - assert.equal(cc.captions[0].stream, 'CC1', - 'real segment caption has correct stream'); - assert.equal(cc.captions[0].startTime, 0, - 'real segment caption has correct startTime'); - assert.equal(cc.captions[0].endTime, 119, - 'real segment caption has correct endTime'); - assert.equal(cc.captionStreams.CC1, true, - 'real segment caption streams have correct settings'); -}); - -QUnit.test('parse captions when init segment received late', function(assert) { - var trackIds; - var timescales; - var cc; - - trackIds = probe.videoTrackIds(dashInit); - timescales = probe.timescale(dashInit); - - cc = captionParser.parse(dashSegment, [], {}); - assert.ok(!cc, 'there should not be any parsed captions yet'); - - cc = captionParser.parse(dashSegment, trackIds, timescales); - assert.equal(cc.captions.length, 1); -}); - -QUnit.test('parseTrackId for version 0 and version 1 boxes', function(assert) { - var v0Captions; - var v1Captions; - - v0Captions = captionParser.parse( - new Uint8Array(version0Segment), // segment - [1], // trackIds - { 1: 90000 }); // timescales); - - assert.equal(v0Captions.captions.length, 1, 'got 1 version0 caption'); - assert.equal(v0Captions.captions[0].content[0].text, 'test string #1', - 'got the expected version0 caption text'); - assert.equal(v0Captions.captions[0].stream, 'CC1', - 'returned the correct caption stream CC1'); - assert.equal(v0Captions.captions[0].startTime, 10 / 90000, - 'the start time for version0 caption is correct'); - assert.equal(v0Captions.captions[0].endTime, 10 / 90000, - 'the end time for version0 caption is correct'); - assert.equal(v0Captions.captionStreams.CC1, true, - 'stream is CC1'); - assert.ok(!v0Captions.captionStreams.CC4, - 'stream is not CC4'); - - // Clear parsed captions - captionParser.clearParsedCaptions(); - - v1Captions = captionParser.parse( - new Uint8Array(version1Segment), - [2], // trackIds - { 2: 90000 }); // timescales - - assert.equal(v1Captions.captions.length, 1, 'got version1 caption'); - assert.equal(v1Captions.captions[0].content[0].text, 'test string #2', - 'got the expected version1 caption text'); - assert.equal(v1Captions.captions[0].stream, 'CC4', - 'returned the correct caption stream CC4'); - assert.equal(v1Captions.captions[0].startTime, 30 / 90000, - 'the start time for version1 caption is correct'); - assert.equal(v1Captions.captions[0].endTime, 30 / 90000, - 'the end time for version1 caption is correct'); - assert.equal(v1Captions.captionStreams.CC4, true, - 'stream is CC4'); - assert.ok(!v1Captions.captionStreams.CC1, - 'stream is not CC1'); -}); - -QUnit.test('returns log on invalid sei nal parse', function(assert) { - var trackIds; - var timescales; - var result; - var logs = []; - - trackIds = probe.videoTrackIds(malformedSeiInit); - timescales = probe.timescale(malformedSeiInit); - - result = captionParser.parse(malformedSei, trackIds, timescales); - - assert.deepEqual(result.logs, [ - {level: 'warn', message: 'We\'ve encountered a nal unit without data at 189975 for trackId 1. See mux.js#223.'} - ], 'logged invalid sei nal'); -}); - -// --------- -// Test Data -// --------- - -// "test string #1", channel 1, field 1 -packets0 = [ - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'test string #1' - { ccData: characters('te'), type: 0 }, - { ccData: characters('st'), type: 0 }, - { ccData: characters(' s'), type: 0 }, - // 'test string #1' continued - { ccData: characters('tr'), type: 0 }, - { ccData: characters('in'), type: 0 }, - { ccData: characters('g '), type: 0 }, - { ccData: characters('#1'), type: 0 }, - // EOC, End of Caption. End display - { ccData: 0x142f, type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { ccData: 0x142f, type: 0 } -]; - -// "test string #2", channel 2, field 2 -packets1 = [ - // Send another command so that the second EOC isn't ignored - { ccData: 0x1d20, type: 1 }, - // RCL, resume caption loading - { ccData: 0x1d20, type: 1 }, - // 'test string #2' - { ccData: characters('te'), type: 1 }, - { ccData: characters('st'), type: 1 }, - { ccData: characters(' s'), type: 1 }, - // 'test string #2' continued - { ccData: characters('tr'), type: 1 }, - { ccData: characters('in'), type: 1 }, - { ccData: characters('g '), type: 1 }, - { ccData: characters('#2'), type: 1 }, - // EOC, End of Caption. End display - { ccData: 0x1d2f, type: 1 }, - // EOC, End of Caption. Finished transmitting, begin display - { ccData: 0x1d2f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1d20, type: 1 }, - // EOC, End of Caption. End display - { ccData: 0x1d2f, type: 1 } -]; - -/** - * version 0: - * Uses version 0 boxes, no first sample flags - * sample size, flags, duration, composition time offset included. -**/ -version0Moof = - box('moof', - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // base_data_offset - 0x00, 0x00, 0x00, 0x00, // sample_description_index - 0x00, 0x00, 0x00, 0x00, // default_sample_duration - 0x00, 0x00, 0x00, 0x00, // default_sample_size - 0x00, 0x00, 0x00, 0x00), // default_sample_flags - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00), // baseMediaDecodeTime, - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -version0Segment = version0Moof.concat(makeMdatFromCaptionPackets(packets0)); - -/** - * version 1: - * Uses version 1 boxes, has first sample flags, - * other samples include flags and composition time offset only. -**/ -version1Moof = - box('moof', - box('traf', - box('tfhd', - 0x01, // version - 0x00, 0x00, 0x18, // flags - 0x00, 0x00, 0x00, 0x02, // track_ID - // no base_data_offset, sample_description_index - 0x00, 0x00, 0x00, 0x0a, // default_sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a), // default_sample_size = 10 - box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x14), // baseMediaDecodeTime = 20, - box('trun', - 0x01, // version - 0x00, 0x0c, 0x05, // flags: dataOffsetPresent, sampleFlagsPresent, - // firstSampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, has first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -version1Segment = version1Moof.concat(makeMdatFromCaptionPackets(packets1)); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-stream.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-stream.test.js deleted file mode 100644 index b60041a80a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/caption-stream.test.js +++ /dev/null @@ -1,3353 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - window = require('global/window'), - captionStream, - m2ts = require('../lib/m2ts'), - mp4 = require('../lib/mp4'), - QUnit = require('qunit'), - seiNalUnitGenerator = require('./utils/sei-nal-unit-generator'), - makeSeiFromCaptionPacket = seiNalUnitGenerator.makeSeiFromCaptionPacket, - makeSeiFromMultipleCaptionPackets = seiNalUnitGenerator.makeSeiFromMultipleCaptionPackets, - characters = seiNalUnitGenerator.characters, - packetHeader708 = seiNalUnitGenerator.packetHeader708, - displayWindows708 = seiNalUnitGenerator.displayWindows708, - cc708PinkUnderscore = require('./utils/cc708-pink-underscore'), - cc708Korean = require('./utils/cc708-korean'), - sintelCaptions = segments['sintel-captions.ts'](), - mixed608708Captions = require('./utils/mixed-608-708-captions.js'), - multiChannel608Captions = segments['multi-channel-608-captions.ts'](); - -QUnit.module('Caption Stream', { - beforeEach: function() { - captionStream = new m2ts.CaptionStream(); - } -}); - -QUnit.test('parses SEIs messages larger than 255 bytes', function(assert) { - var packets = [], data; - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - data = new Uint8Array(268); - data[0] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[1] = 0xff; // payload_size - data[2] = 0x0d; // payload_size - data[3] = 181; // itu_t_t35_country_code - data[4] = 0x00; - data[5] = 0x31; // itu_t_t35_provider_code - data[6] = 0x47; - data[7] = 0x41; - data[8] = 0x39; - data[9] = 0x34; // user_identifier, "GA94" - data[10] = 0x03; // user_data_type_code, 0x03 is cc_data - data[11] = 0xc1; // process_cc_data, cc_count - data[12] = 0xff; // reserved - data[13] = 0xfc; // cc_valid, cc_type (608, field 1) - data[14] = 0xff; // cc_data_1 with parity bit set - data[15] = 0x0e; // cc_data_2 without parity bit set - data[16] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption'); -}); - -QUnit.test('parses SEIs containing multiple messages', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(22); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x0d; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x47; - data[12] = 0x41; - data[13] = 0x39; - data[14] = 0x34; // user_identifier, "GA94" - data[15] = 0x03; // user_data_type_code, 0x03 is cc_data - data[16] = 0xc1; // process_cc_data, cc_count - data[17] = 0xff; // reserved - data[18] = 0xfc; // cc_valid, cc_type (608, field 1) - data[19] = 0xff; // cc_data_1 with parity bit set - data[20] = 0x0e; // cc_data_2 without parity bit set - data[21] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption'); -}); - -QUnit.test('parses SEIs containing multiple messages of type user_data_registered_itu_t_t35', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(33); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - - // https://www.etsi.org/deliver/etsi_ts/101100_101199/101154/01.11.01_60/ts_101154v011101p.pdf#page=117 - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x09; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x44; - data[12] = 0x54; - data[13] = 0x47; - data[14] = 0x31; // user_identifier, "DTG1" - data[15] = 0x11; // zero_bit (b7), active_format_flag (b6), reserved (b5-b0) - data[16] = 0xF0; // reserved (b7-b4), active_format (b3-b0) - - data[17] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[18] = 0x0d; // payload_size - data[19] = 181; // itu_t_t35_country_code - data[20] = 0x00; - data[21] = 0x31; // itu_t_t35_provider_code - data[22] = 0x47; - data[23] = 0x41; - data[24] = 0x39; - data[25] = 0x34; // user_identifier, "GA94" - data[26] = 0x03; // user_data_type_code, 0x03 is cc_data - data[27] = 0xc1; // process_cc_data, cc_count - data[28] = 0xff; // reserved - data[29] = 0xfc; // cc_valid, cc_type (608, field 1) - data[30] = 0xff; // cc_data_1 with parity bit set - data[31] = 0x0e; // cc_data_2 without parity bit set - data[32] = 0xff; // marker_bits - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'ignored DTG1 payload, parsed a GA94 caption'); -}); - -QUnit.test('does not throw error if only invalid payloads', function(assert) { - var packets = [], data; - - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - - data = new Uint8Array(33); - data[0] = 0x01; // payload_type !== user_data_registered_itu_t_t35 - data[1] = 0x04; // payload_size - - // https://www.etsi.org/deliver/etsi_ts/101100_101199/101154/01.11.01_60/ts_101154v011101p.pdf#page=117 - data[6] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[7] = 0x09; // payload_size - data[8] = 181; // itu_t_t35_country_code - data[9] = 0x00; - data[10] = 0x31; // itu_t_t35_provider_code - data[11] = 0x44; - data[12] = 0x54; - data[13] = 0x47; - data[14] = 0x31; // user_identifier, "DTG1" - data[15] = 0x11; // zero_bit (b7), active_format_flag (b6), reserved (b5-b0) - data[16] = 0xF0; // reserved (b7-b4), active_format (b3-b0) - - data[17] = 0x04; // payload_type === user_data_registered_itu_t_t35 - data[18] = 0x0d; // payload_size - data[19] = 181; // itu_t_t35_country_code - data[20] = 0x00; - data[21] = 0x31; // itu_t_t35_provider_code - data[22] = 0x47; - data[23] = 0x41; - data[24] = 0x39; - - - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: data - }); - captionStream.flush(); - assert.equal(packets.length, 0, 'ignored DTG1 payload'); -}); - - -QUnit.test('ignores SEIs that do not have type user_data_registered_itu_t_t35', function(assert) { - var captions = []; - captionStream.on('data', function(caption) { - captions.push(caption); - }); - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x05 // payload_type !== user_data_registered_itu_t_t35 - ]) - }); - - assert.equal(captions.length, 0, 'ignored the unknown payload type'); -}); - -QUnit.test('parses a minimal example of caption data', function(assert) { - var packets = []; - captionStream.ccStreams_[0].push = function(packet) { - packets.push(packet); - }; - // set data channel 1 active for field 1 - captionStream.activeCea608Channel_[0] = 0; - captionStream.push({ - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - 0x0d, // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - 0xc1, // process_cc_data, cc_count - 0xff, // reserved - // 1111 1100 - 0xfc, // cc_valid, cc_type (608, field 1) - 0xff, // cc_data_1 with parity bit set - 0x0e, // cc_data_2 without parity bit set - - 0xff // marker_bits - ]) - }); - captionStream.flush(); - assert.equal(packets.length, 1, 'parsed a caption packet'); -}); - -QUnit.test('can be parsed from a segment', function(assert) { - var transmuxer = new mp4.Transmuxer(), - captions = []; - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(100000); - - transmuxer.on('data', function(data) { - if (data.captions) { - captions = captions.concat(data.captions); - } - }); - - transmuxer.push(sintelCaptions); - transmuxer.flush(); - - assert.equal(captions.length, 2, 'parsed two captions'); - assert.equal(captions[0].content[0].text.indexOf('ASUKA'), 0, 'parsed the start of the first caption'); - assert.ok(captions[0].content[0].text.indexOf('Japanese') > 0, 'parsed the end of the first caption'); - assert.equal(captions[0].startTime, 1, 'parsed the start time'); - assert.equal(captions[0].endTime, 4, 'parsed the end time'); -}); - -QUnit.test('dispatches caption track information', function(assert) { - var transmuxer = new mp4.Transmuxer(), - captions = [], - captionStreams = {}; - - // Setting the BMDT to ensure that captions and id3 tags are not - // time-shifted by this value when they are output and instead are - // zero-based - transmuxer.setBaseMediaDecodeTime(100000); - - transmuxer.on('data', function(data) { - if (data.captions) { - captions = captions.concat(data.captions); - for (var trackId in data.captionStreams) { - captionStreams[trackId] = true; - } - } - }); - - transmuxer.push(multiChannel608Captions); - transmuxer.flush(); - - assert.deepEqual(captionStreams, {CC1: true, CC3: true}, 'found captions in CC1 and CC3'); - assert.equal(captions.length, 4, 'parsed eight captions'); - assert.equal(captions[0].content[0].text, 'être une période de questions', 'parsed the text of the first caption in CC3'); - assert.equal(captions[1].content[0].text, 'PERIOD, FOLKS.', 'parsed the text of the first caption in CC1'); -}); - -QUnit.test('sorting is fun', function(assert) { - var packets, captions, seiNals; - packets = [ - // Send another command so that the second EOC isn't ignored - { pts: 10 * 1000, ccData: 0x1420, type: 0 }, - // RCL, resume caption loading - { pts: 1000, ccData: 0x1420, type: 0 }, - // 'test string #1' - { pts: 1000, ccData: characters('te'), type: 0 }, - { pts: 1000, ccData: characters('st'), type: 0 }, - { pts: 1000, ccData: characters(' s'), type: 0 }, - // 'test string #2' - { pts: 10 * 1000, ccData: characters('te'), type: 0 }, - { pts: 10 * 1000, ccData: characters('st'), type: 0 }, - { pts: 10 * 1000, ccData: characters(' s'), type: 0 }, - // 'test string #1' continued - { pts: 1000, ccData: characters('tr'), type: 0 }, - { pts: 1000, ccData: characters('in'), type: 0 }, - { pts: 1000, ccData: characters('g '), type: 0 }, - { pts: 1000, ccData: characters('#1'), type: 0 }, - // 'test string #2' continued - { pts: 10 * 1000, ccData: characters('tr'), type: 0 }, - { pts: 10 * 1000, ccData: characters('in'), type: 0 }, - { pts: 10 * 1000, ccData: characters('g '), type: 0 }, - { pts: 10 * 1000, ccData: characters('#2'), type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { pts: 20 * 1000, ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 20 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromCaptionPacket); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].content[0].text, 'test string #1', 'parsed caption 1'); - assert.equal(captions[1].content[0].text, 'test string #2', 'parsed caption 2'); -}); - -QUnit.test('drops duplicate segments', function(assert) { - var packets, captions, seiNals; - packets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicate as per spec - {ccData: characters('te'), type: 0 }, - {ccData: characters('st'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicate as per spec - {ccData: 0x142f, type: 0 }, // EOC, mark display end and flush - {ccData: 0x142f, type: 0 } // EOC, duplicate as per spec - ] - } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].content[0].text, 'test string data', 'parsed caption properly'); -}); - -QUnit.test('drops duplicate segments with multi-segment DTS values', function(assert) { - var packets, captions, seiNals; - packets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicate as per spec - {ccData: characters('te'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('st'), type: 0 }, - {ccData: characters(' s'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters(' s'), type: 0 }, - {ccData: characters('tu'), type: 0 }, - {ccData: characters('ff'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption) - // EOC not duplicated for robustness testing - {ccData: 0x1420, type: 0 } // RCL (resume caption loading) - ] - }, - { - pts: 5000, dts: 5000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters(' a'), type: 0 }, - {ccData: characters('nd'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters(' e'), type: 0 }, - {ccData: characters('ve'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('n '), type: 0 }, - {ccData: characters('mo'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('re'), type: 0 }, - {ccData: characters(' t'), type: 0 } - ] - }, - { - pts: 5000, dts: 5000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters(' a'), type: 0 }, - {ccData: characters('nd'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters(' e'), type: 0 }, - {ccData: characters('ve'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('n '), type: 0 }, - {ccData: characters('mo'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('re'), type: 0 }, - {ccData: characters(' t'), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('ex'), type: 0 }, - {ccData: characters('t '), type: 0 } - ] - }, - { - pts: 6000, dts: 6000, captions: [ - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - }, - { - pts: 7000, dts: 7000, captions: [ - {ccData: characters(' h'), type: 0 }, - {ccData: characters('er'), type: 0 } - ] - }, - { - pts: 8000, dts: 8000, captions: [ - {ccData: characters('e!'), type: 0 }, - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicated as per spec - {ccData: 0x142f, type: 0 } // EOC, mark display end and flush - // EOC not duplicated for robustness testing - ] - } - ]; - captions = []; - - seiNals = packets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].content[0].text, 'test string data stuff', 'parsed caption properly'); - assert.equal(captions[1].content[0].text, 'and even more text data here!', 'parsed caption properly'); -}); - -QUnit.test('doesn\'t ignore older segments if reset', function(assert) { - var firstPackets, secondPackets, captions, seiNals1, seiNals2; - firstPackets = [ - { - pts: 11000, dts: 11000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters('te'), type: 0 } - ] - }, - { - pts: 12000, dts: 12000, captions: [ - {ccData: characters('st'), type: 0 }, - {ccData: characters(' s'), type: 0 } - ] - }, - { - pts: 12000, dts: 12000, captions: [ - {ccData: characters('tr'), type: 0 }, - {ccData: characters('in'), type: 0 } - ] - }, - { - pts: 13000, dts: 13000, captions: [ - {ccData: characters('g '), type: 0 }, - {ccData: characters('da'), type: 0 }, - {ccData: characters('ta'), type: 0 } - ] - } - ]; - secondPackets = [ - { - pts: 1000, dts: 1000, captions: [ - {ccData: 0x1420, type: 0 }, // RCL (resume caption loading) - {ccData: 0x1420, type: 0 }, // RCL, duplicated as per spec - {ccData: characters('af'), type: 0 } - ] - }, - { - pts: 2000, dts: 2000, captions: [ - {ccData: characters('te'), type: 0 }, - {ccData: characters('r '), type: 0 }, - {ccData: characters('re'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('se'), type: 0 }, - {ccData: characters('t '), type: 0 }, - {ccData: characters('da'), type: 0 } - ] - }, - { - pts: 3000, dts: 3000, captions: [ - {ccData: characters('ta'), type: 0 }, - {ccData: characters('!!'), type: 0 } - ] - }, - { - pts: 4000, dts: 4000, captions: [ - {ccData: 0x142f, type: 0 }, // EOC (end of caption), mark display start - {ccData: 0x142f, type: 0 }, // EOC, duplicated as per spec - {ccData: 0x142f, type: 0 } // EOC, mark display end and flush - // EOC not duplicated for robustness testing - ] - } - ]; - captions = []; - - seiNals1 = firstPackets.map(makeSeiFromMultipleCaptionPackets); - seiNals2 = secondPackets.map(makeSeiFromMultipleCaptionPackets); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals1.forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.latestDts_, 13000, 'DTS is tracked correctly'); - - captionStream.reset(); - assert.equal(captionStream.latestDts_, null, 'DTS tracking was reset'); - - seiNals2.forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.latestDts_, 4000, 'DTS is tracked correctly'); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].content[0].text, 'after reset data!!', 'parsed caption properly'); -}); - -QUnit.test('extracts all theoretical caption channels', function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - // RU2 = roll-up, 2 rows - // CR = carriage return - var packets = [ - { pts: 1000, type: 0, ccData: 0x1425 }, // RU2 (sets CC1) - { pts: 2000, type: 0, ccData: characters('1a') }, // CC1 - { pts: 3000, type: 0, ccData: 0x1c25 }, // RU2 (sets CC2) - { pts: 4000, type: 1, ccData: 0x1525 }, // RU2 (sets CC3) - { pts: 5000, type: 1, ccData: characters('3a') }, // CC3 - // this next one tests if active channel is tracked per-field - // instead of globally - { pts: 6000, type: 0, ccData: characters('2a') }, // CC2 - { pts: 7000, type: 1, ccData: 0x1d25 }, // RU2 (sets CC4) - { pts: 8000, type: 1, ccData: characters('4a') }, // CC4 - { pts: 9000, type: 1, ccData: characters('4b') }, // CC4 - { pts: 10000, type: 0, ccData: 0x142d }, // CR (sets + flushes CC1) - { pts: 11000, type: 0, ccData: 0x1c2d }, // CR (sets + flushes CC2) - { pts: 12000, type: 0, ccData: 0x1425 }, // RU2 (sets CC1) - { pts: 13000, type: 0, ccData: characters('1b') }, // CC1 - { pts: 14000, type: 0, ccData: characters('1c') }, // CC1 - { pts: 15000, type: 0, ccData: 0x142d }, // CR (sets + flushes CC1) - { pts: 16000, type: 1, ccData: 0x152d }, // CR (sets + flushes CC3) - { pts: 17000, type: 1, ccData: 0x1d2d }, // CR (sets + flushes CC4) - { pts: 18000, type: 0, ccData: 0x1c25 }, // RU2 (sets CC2) - { pts: 19000, type: 0, ccData: characters('2b') }, // CC2 - { pts: 20000, type: 0, ccData: 0x1c2d } // CR (sets + flushes CC2) - ]; - - var seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 6, 'got all captions'); - assert.equal(captions[0].content[0].text, '1a', 'cc1 first row'); - assert.equal(captions[1].content[0].text, '2a', 'cc2 first row'); - assert.equal(captions[2].content[0].text, '1a', 'cc1 first row'); - assert.equal(captions[2].content[1].text, '1b1c', 'cc1 second row'); - assert.equal(captions[3].content[0].text, '3a', 'cc3 first row'); - assert.equal(captions[4].content[0].text, '4a4b', 'cc4 first row'); - assert.equal(captions[5].content[0].text, '2a', 'cc2 first row'); - assert.equal(captions[5].content[1].text, '2b', 'cc2 second row'); -}); - -QUnit.test('drops data until first command that sets activeChannel for a field', function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - var packets = [ - // test that packets in same field and same data channel are dropped - // before a control code that sets the data channel - { pts: 0 * 1000, ccData: characters('no'), type: 0 }, - { pts: 0 * 1000, ccData: characters('t '), type: 0 }, - { pts: 0 * 1000, ccData: characters('th'), type: 0 }, - { pts: 0 * 1000, ccData: characters('is'), type: 0 }, - // EOC (end of caption), sets CC1 - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading) - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - // EOC, if data wasn't dropped this would dispatch a caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // RCL - { pts: 3 * 1000, ccData: 0x1420, type: 0 }, - { pts: 4 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 4 * 1000, ccData: characters('el'), type: 0 }, - { pts: 4 * 1000, ccData: characters('d0'), type: 0 }, - // EOC, mark display start - { pts: 5 * 1000, ccData: 0x142f, type: 0 }, - // EOC, duplicated as per spec - { pts: 5 * 1000, ccData: 0x142f, type: 0 }, - // EOC, mark display end and flush - { pts: 6 * 1000, ccData: 0x142f, type: 0 }, - // EOC not duplicated cuz not necessary - // now switch to field 1 and test that packets in the same field - // but DIFFERENT data channel are dropped - { pts: 7 * 1000, ccData: characters('or'), type: 1 }, - { pts: 7 * 1000, ccData: characters(' t'), type: 1 }, - { pts: 7 * 1000, ccData: characters('hi'), type: 1 }, - { pts: 7 * 1000, ccData: characters('s.'), type: 1 }, - // EOC (end of caption, sets CC4) - { pts: 8 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL (resume caption loading) - { pts: 8 * 1000, ccData: 0x1d20, type: 1 }, - // EOC, if data wasn't dropped this would dispatch a caption - { pts: 9 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL - { pts: 10 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 11 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 11 * 1000, ccData: characters('el'), type: 1 }, - { pts: 11 * 1000, ccData: characters('d1'), type: 1 }, - // EOC, mark display start - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, duplicated as per spec - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, mark display end and flush - { pts: 13 * 1000, ccData: 0x1d2f, type: 1 } - // EOC not duplicated cuz not necessary - ]; - - var seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'received 2 captions'); - assert.equal(captions[0].content[0].text, 'field0', 'received only confirmed field0 data'); - assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].content[0].text, 'field1', 'received only confirmed field1 data'); - assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); -}); - -QUnit.test('clears buffer and drops data until first command that sets activeChannel after reset', function(assert) { - var firstPackets, secondPackets, captions, seiNals1, seiNals2; - captions = []; - - firstPackets = [ - // RCL (resume caption loading), CC1 - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - { pts: 2 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 2 * 1000, ccData: characters('el'), type: 0 }, - { pts: 2 * 1000, ccData: characters('d0'), type: 0 }, - // EOC (end of caption), swap text to displayed memory - { pts: 3 * 1000, ccData: 0x142f, type: 0 }, - { pts: 4 * 1000, ccData: characters('fi'), type: 0 }, - { pts: 4 * 1000, ccData: characters('el'), type: 0 }, - { pts: 4 * 1000, ccData: characters('d0'), type: 0 }, - // RCL (resume caption loading), CC4 - { pts: 5 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 6 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 6 * 1000, ccData: characters('el'), type: 1 }, - { pts: 6 * 1000, ccData: characters('d1'), type: 1 }, - // EOC (end of caption), swap text to displayed memory - { pts: 7 * 1000, ccData: 0x1d2f, type: 1 }, - { pts: 8 * 1000, ccData: characters('fi'), type: 1 }, - { pts: 8 * 1000, ccData: characters('el'), type: 1 }, - { pts: 8 * 1000, ccData: characters('d1'), type: 1 } - ]; - secondPackets = [ - // following packets are dropped - { pts: 9 * 1000, ccData: characters('no'), type: 0 }, - { pts: 9 * 1000, ccData: characters('t '), type: 0 }, - { pts: 9 * 1000, ccData: characters('th'), type: 0 }, - { pts: 9 * 1000, ccData: characters('is'), type: 0 }, - { pts: 10 * 1000, ccData: characters('or'), type: 1 }, - { pts: 10 * 1000, ccData: characters(' t'), type: 1 }, - { pts: 10 * 1000, ccData: characters('hi'), type: 1 }, - { pts: 10 * 1000, ccData: characters('s.'), type: 1 }, - // EOC (end of caption), sets CC1 - { pts: 11 * 1000, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading), CC1 - { pts: 11 * 1000, ccData: 0x1420, type: 0 }, - // EOC, sets CC4 - { pts: 12 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL, CC4 - { pts: 12 * 1000, ccData: 0x1d20, type: 1 }, - // EOC, CC1, would dispatch caption if packets weren't ignored - { pts: 13 * 1000, ccData: 0x142f, type: 0 }, - // RCL, CC1 - { pts: 13 * 1000, ccData: 0x1420, type: 0 }, - // EOC, CC4, would dispatch caption if packets weren't ignored - { pts: 14 * 1000, ccData: 0x1d2f, type: 1 }, - // RCL, CC4 - { pts: 14 * 1000, ccData: 0x1d20, type: 1 }, - { pts: 18 * 1000, ccData: characters('bu'), type: 0 }, - { pts: 18 * 1000, ccData: characters('t '), type: 0 }, - { pts: 18 * 1000, ccData: characters('th'), type: 0 }, - { pts: 18 * 1000, ccData: characters('is'), type: 0 }, - { pts: 19 * 1000, ccData: characters('an'), type: 1 }, - { pts: 19 * 1000, ccData: characters('d '), type: 1 }, - { pts: 19 * 1000, ccData: characters('th'), type: 1 }, - { pts: 19 * 1000, ccData: characters('is'), type: 1 }, - // EOC (end of caption), CC1, mark caption 1 start - { pts: 20 * 1000, ccData: 0x142f, type: 0 }, - // EOC, CC1, duplicated as per spec - { pts: 20 * 1000, ccData: 0x142f, type: 0 }, - // EOC, CC1, mark caption 1 end and dispatch - { pts: 21 * 1000, ccData: 0x142f, type: 0 }, - // No duplicate EOC cuz not necessary - // EOC, CC4, mark caption 2 start - { pts: 22 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, CC4, duplicated as per spec - { pts: 22 * 1000, ccData: 0x1d2f, type: 1 }, - // EOC, CC4, mark caption 2 end and dispatch - { pts: 23 * 1000, ccData: 0x1d2f, type: 1 } - // No duplicate EOC cuz not necessary - ]; - - seiNals1 = firstPackets.map(makeSeiFromCaptionPacket); - seiNals2 = secondPackets.map(makeSeiFromCaptionPacket); - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals1.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14].text, 'field0', - 'there is data in non-displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14].text, 'field1', - 'there is data in non-displayed memory for field 1 before reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14].text, 'field0', - 'there is data in displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14].text, 'field1', - 'there is data in displayed memory for field 1 before reset'); - - captionStream.reset(); - - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14].text, '', - 'there is no data in non-displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14].text, '', - 'there is no data in non-displayed memory for field 1 after reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14].text, '', - 'there is no data in displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14].text, '', - 'there is no data in displayed memory for field 1 after reset'); - - seiNals2.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].content[0].text, 'but this', 'parsed caption properly'); - assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].content[0].text, 'and this', 'parsed caption properly'); - assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); -}); - -QUnit.test("don't mess up 608 captions when 708 are present", function(assert) { - var captions = []; - captionStream.ccStreams_.forEach(function(cc) { - cc.on('data', function(caption) { - captions.push(caption); - }); - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 3, 'parsed three captions'); - // first caption stream - assert.equal(captions[0].content[0].text, 'BUT IT\'S NOT SUFFERING', 'first stream: parsed first content text correctly'); - assert.equal(captions[0].content[1].text, 'RIGHW.', 'first stream: parsed second content text correctly'); - // there is also bad data in the captions, but the null ascii character is removed - // second caption stream - assert.equal(captions[1].content[0].text, 'IT\'S NOT A THREAT TO ANYBODY.', 'second stream: parsed content text correctly'); - // third stream - assert.equal(captions[2].content[0].text, 'WE TRY NOT TO PUT AN ANIMAL DOWN', 'third stream: parsed first content text correctly'); - assert.equal(captions[2].content[1].text, 'IF WE DON\'T HAVE TO.', 'third stream: parsed second content text correctly'); -}); - -QUnit.test("both 608 and 708 captions are available by default", function(assert) { - var cc608 = []; - var cc708 = []; - captionStream.on('data', function(caption) { - if (caption.stream === 'CC1') { - cc608.push(caption); - } else { - cc708.push(caption); - } - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(cc608.length, 3, 'parsed three 608 cues'); - assert.equal(cc708.length, 3, 'parsed three 708 cues'); -}); - -QUnit.test("708 parsing can be turned off", function(assert) { - captionStream.reset(); - captionStream = new m2ts.CaptionStream({ - parse708captions: false - }); - var cc608 = []; - var cc708 = []; - captionStream.on('data', function(caption) { - if (caption.stream === 'CC1') { - cc608.push(caption); - } else { - cc708.push(caption); - } - }); - - var seiNals = mixed608708Captions.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(cc608.length, 3, 'parsed three 608 cues'); - assert.equal(cc708.length, 0, 'did not parse any 708 cues'); -}); - -QUnit.test('ignores XDS and Text packets', function(assert) { - var captions = []; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL, resume caption loading, CC3 - { pts: 1000, ccData: 0x1520, type: 1 }, - { pts: 2000, ccData: characters('hi'), type: 1 }, - // EOC, End of Caption - { pts: 3000, ccData: 0x152f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { pts: 3000, ccData: 0x152f, type: 1 }, - // EOC, End of Caption - { pts: 4000, ccData: 0x152f, type: 1 }, - // ENM, Erase Non-Displayed Memory - { pts: 4000, ccData: 0x152e, type: 1 }, - // RCL, resume caption loading, CC1 - { pts: 5000, ccData: 0x1420, type: 0 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], 0, 'field 1: CC1 is active'); - assert.equal(captionStream.activeCea608Channel_[1], 0, 'field 2: CC3 is active'); - - [ - // TR, text restart, CC1 - { pts: 5000, ccData: 0x142a, type: 0 }, - { pts: 6000, ccData: characters('tx'), type: 0 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], null, 'field 1: disabled'); - assert.equal(captionStream.activeCea608Channel_[1], 0, 'field 2: CC3 is active'); - - [ - // EOC, End of Caption - { pts: 7000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { pts: 7000, ccData: 0x142f, type: 0 }, - // EOC, End of Caption - { pts: 8000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading, CC3 - { pts: 9000, ccData: 0x1520, type: 1 }, - // XDS start, "current" class, program identification number type - { pts: 10000, ccData: 0x0101, type: 1 }, - { pts: 11000, ccData: characters('oh'), type: 1 }, - // XDS end - { pts: 12000, ccData: 0x0f00, type: 1 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - assert.equal(captionStream.activeCea608Channel_[0], 0, 'field 1: CC1 is active'); - assert.equal(captionStream.activeCea608Channel_[1], null, 'field 2: disabled'); - - [ - // EOC, End of Caption - { pts: 13000, ccData: 0x152f, type: 1 }, - // Send another command so that the second EOC isn't ignored - { pts: 13000, ccData: 0x152f, type: 1 } - ].map(makeSeiFromCaptionPacket).forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.equal(captions.length, 1, 'only parsed real caption'); - assert.equal(captions[0].content[0].text, 'hi', 'caption is correct'); - -}); - -// Full character translation tests are below for Cea608Stream, they just only -// test support for CC1. See those tests and the source code for more about the -// mechanics of special and extended characters. -QUnit.test('special and extended character codes work regardless of field and data channel', function(assert) { - var packets, seiNals, captions = []; - packets = [ - // RU2 (roll-up, 2 rows), CC2 - { ccData: 0x1c25, type: 0 }, - // ® - { ccData: 0x1930, type: 0 }, - // CR (carriage return), CC2, flush caption - { ccData: 0x1c2d, type: 0 }, - // RU2, CC3 - { ccData: 0x1525, type: 1 }, - // " - { ccData: 0x2200, type: 1 }, - // « - { ccData: 0x123e, type: 1 }, - // CR, CC3, flush caption - { ccData: 0x152d, type: 1 }, - // RU2, CC4 - { ccData: 0x1d25, type: 1 }, - // " - { ccData: 0x2200, type: 1 }, - // » - { ccData: 0x1a3f, type: 1 }, - // CR, CC4, flush caption - { ccData: 0x1d2d, type: 1 } - ]; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seiNals = packets.map(makeSeiFromCaptionPacket); - seiNals.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[0].content[0].text, String.fromCharCode(0xae), 'CC2 special character correct'); - assert.deepEqual(captions[1].content[0].text, String.fromCharCode(0xab), 'CC3 extended character correct'); - assert.deepEqual(captions[2].content[0].text, String.fromCharCode(0xbb), 'CC4 extended character correct'); -}); - -QUnit.test('number of roll up rows takes precedence over base row command', function(assert) { - var captions = []; - var packets = [ - - // RU2 (roll-up, 2 rows), CC1 - { type: 0, ccData: 0x1425 }, - // RU2, CC1 - { type: 0, ccData: 0x1425 }, - // PAC: row 1 (sets base row to row 1) - { type: 0, ccData: 0x1170 }, - // PAC: row 1 - { type: 0, ccData: 0x1170 }, - // - - { type: 0, ccData: 0x2d00 }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad }, - // RU3 (roll-up, 3 rows), CC1 - { type: 0, ccData: 0x1426 }, - // RU3, CC1 - { type: 0, ccData: 0x1426 }, - // PAC, row 11 - { type: 0, ccData: 0x13d0 }, - // PAC, row 11 - { type: 0, ccData: 0x13d0 }, - // so - { type: 0, ccData: 0x736f }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad } - ]; - var seis; - - captionStream.on('data', function(caption) { - captions.push(caption); - }); - - seis = packets.map(makeSeiFromCaptionPacket); - - seis.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[0].content[0].text, '-', 'RU2 caption is correct'); - assert.deepEqual(captions[1].content[0].text, '-', 'first RU3 caption is correct'); - assert.deepEqual(captions[1].content[1].text, 'so', 'second RU3 caption is correct'); - - packets = [ - // switching from row 11 to 0 - // PAC: row 0 (sets base row to row 0) - { type: 0, ccData: 0x1140 }, - // PAC: row 0 - { type: 0, ccData: 0x1140 }, - // CR - { type: 0, ccData: 0x14ad }, - // CR - { type: 0, ccData: 0x14ad } - ]; - - seis = packets.map(makeSeiFromCaptionPacket); - seis.forEach(captionStream.push, captionStream); - captionStream.flush(); - - assert.deepEqual(captions[2].content[0].text, '-', 'first RU3 caption is correct'); - assert.deepEqual(captions[2].content[1].text, 'so', 'second RU3 caption is correct'); -}); - -var cea608Stream; - -QUnit.module('CEA 608 Stream', { - beforeEach: function() { - cea608Stream = new m2ts.Cea608Stream(); - } -}); - -QUnit.skip('filters null data', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.skip('removes parity bits', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.test('converts non-ASCII character codes to ASCII', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // ASCII exceptions - { ccData: 0x2a5c, type: 0 }, - { ccData: 0x5e5f, type: 0 }, - { ccData: 0x607b, type: 0 }, - { ccData: 0x7c7d, type: 0 }, - { ccData: 0x7e7f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, - String.fromCharCode(0xe1, 0xe9, 0xed, 0xf3, 0xfa, 0xe7, 0xf7, 0xd1, 0xf1, 0x2588), - 'translated non-standard characters'); -}); - -QUnit.test('properly handles special character codes', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // Special characters as defined by CEA-608 - // see the CHARACTER_TRANSLATION hash in lib/m2ts/caption-stream for the - // mapping table - { ccData: 0x1130, type: 0 }, - { ccData: 0x1131, type: 0 }, - { ccData: 0x1132, type: 0 }, - { ccData: 0x1133, type: 0 }, - { ccData: 0x1134, type: 0 }, - { ccData: 0x1135, type: 0 }, - { ccData: 0x1136, type: 0 }, - { ccData: 0x1137, type: 0 }, - { ccData: 0x1138, type: 0 }, - { ccData: 0x1139, type: 0 }, - { ccData: 0x113a, type: 0 }, - { ccData: 0x113b, type: 0 }, - { ccData: 0x113c, type: 0 }, - { ccData: 0x113d, type: 0 }, - { ccData: 0x113e, type: 0 }, - { ccData: 0x113f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, CC1, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].content[0].text, - String.fromCharCode(0xae, 0xb0, 0xbd, 0xbf, 0x2122, 0xa2, 0xa3, 0x266a, - 0xe0, 0xa0, 0xe8, 0xe2, 0xea, 0xee, 0xf4, 0xfb), - 'translated special characters'); -}); - -QUnit.test('properly handles extended character codes', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // Extended characters are defined in CEA-608 as a standard character, - // which is followed by an extended character, and the standard character - // gets deleted. - // see the CHARACTER_TRANSLATION hash in lib/m2ts/caption-stream for the - // mapping table - { ccData: 0x2200, type: 0 }, - { ccData: 0x123e, type: 0 }, - { ccData: 0x4c41, type: 0 }, - { ccData: 0x1230, type: 0 }, - { ccData: 0x2d4c, type: 0 }, - { ccData: 0x4100, type: 0 }, - { ccData: 0x1338, type: 0 }, - { ccData: 0x204c, type: 0 }, - { ccData: 0x417d, type: 0 }, - { ccData: 0x4400, type: 0 }, - { ccData: 0x1137, type: 0 }, - { ccData: 0x2200, type: 0 }, - { ccData: 0x123f, type: 0 }, - // EOC, End of Caption - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, clear the display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].content[0].text, '«LÀ-LÅ LAÑD♪»', - 'translated special characters'); -}); - -QUnit.test('pop-on mode', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'hi' - { ccData: characters('hi'), type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 10 * 1000, - content: [{ - line: 15, - position: 10, - text: 'hi' - }], - stream: 'CC1' - }, 'parsed the caption'); -}); - -QUnit.test('ignores null characters', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // 'mu' - { ccData: characters('mu'), type: 0 }, - // null characters - { ccData: 0x0000, type: 0 }, - // ' x' - { ccData: characters(' x'), type: 0 }, - // EOC, End of Caption. Finished transmitting, begin display - { pts: 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption. End display - { pts: 10 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 10 * 1000, - content: [{ - line: 15, - position: 10, - text: 'mu x' - }], - stream: 'CC1' - }, 'ignored null characters'); -}); - -QUnit.test('recognizes the Erase Displayed Memory command', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // EOC, End of Caption. Finished transmitting, display '01' - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EDM, Erase Displayed Memory - { pts: 1.5 * 1000, ccData: 0x142c, type: 0 }, - // '23' - { ccData: characters('23'), type: 0 }, - // EOC, End of Caption. Display '23' - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // '34' - { ccData: characters('34'), type: 0 }, - // EOC, End of Caption. Display '34' - { pts: 3 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0}, - // EOC, End of Caption - { pts: 4 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 3, 'detected three captions'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 1.5 * 1000, - content: [{ - line: 15, - position: 10, - text: '01' - }], - stream: 'CC1' - }, 'parsed the first caption'); - assert.deepEqual(captions[1], { - startPts: 2 * 1000, - endPts: 3 * 1000, - content: [{ - line: 15, - position: 10, - text: '23' - }], - stream: 'CC1' - }, 'parsed the second caption'); - assert.deepEqual(captions[2], { - startPts: 3 * 1000, - endPts: 4 * 1000, - content: [{ - line: 15, - position: 10, - text: '34' - }], - stream: 'CC1' - }, 'parsed the third caption'); -}); - -QUnit.test('correct content text is added to non-displayed memory for pop-on mode', function(assert) { - var captions = [], packets; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - { ccData: characters('23'), type: 0 }, - // PAC: row 13, no indent - { pts: 1 * 1000, ccData: 0x1370, type: 0 }, - { pts: 1 * 1000, ccData: characters('32'), type: 0 }, - // backspace - { pts: 2 * 1000, ccData: 0x1421, type: 0 }, - { pts: 3 * 1000, ccData: characters('10'), type: 0 }, - // EOC, End of Caption - { pts: 4 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption, flush caption - { pts: 5 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].content[0].text, '310', 'first content text'); - assert.equal(captions[0].content[1].text, '023', 'second content text'); -}); - -QUnit.test('backspaces on cleared memory are no-ops', function(assert) { - var captions = [], packets; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - packets = [ - // RCL, resume caption loading - { ccData: 0x1420 }, - // backspace - { ccData: 0x1421 }, - // EOC, End of Caption. Finished transmitting, display '01' - { pts: 1 * 1000, ccData: 0x142f } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no captions detected'); -}); - -QUnit.test('recognizes the Erase Non-Displayed Memory command', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // ENM, Erase Non-Displayed Memory - { ccData: 0x142e, type: 0 }, - { ccData: characters('23'), type: 0 }, - // EOC, End of Caption. Finished transmitting, display '23' - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - - packets.forEach(cea608Stream.push, cea608Stream); - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 2 * 1000, - content: [{ - line: 15, - position: 10, - text: '23' - }], - stream: 'CC1' - }, 'cleared the non-displayed memory'); -}); - -QUnit.test('ignores unrecognized commands', function(assert) { - var packets, captions; - packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // a row-9 magenta command, which is not supported - { ccData: 0x1f4c, type: 0 }, - // '01' - { ccData: characters('01'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions[0].content[0].text, '01', 'skipped the unrecognized commands'); -}); - -QUnit.skip('applies preamble address codes', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.skip('applies mid-row colors', function(assert) { - assert.ok(false, 'not implemented'); -}); - -QUnit.test('applies mid-row underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, white underline - { ccData: 0x1121, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies mid-row italics', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, italics - { ccData: 0x112e, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies mid-row italics underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row, italics underline - { ccData: 0x112f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -// NOTE: With the exception of white italics PACs (the following two test -// cases), PACs only have their underline attribute extracted and used -QUnit.test('applies PAC underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white underline - { ccData: 0x1461, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies PAC white italics', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white italics - { ccData: 0x146e, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('applies PAC white italics underline', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - // PAC: row 15, white italics underline - { ccData: 0x146f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // CR (carriage return), dispatches caption - { ccData: 0x142d, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('includes all caption text at PAC row change', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC: row 14, white italics underlime - { ccData: 0x144f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - { ccData: characters('no'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'yes.', 'first content text'); - assert.equal(captions[0].content[1].text, 'no', 'second content text'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('closes formatting at EOC', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC: row 15, white italics underline - { ccData: 0x146f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // Send another command so that the second EOC isn't ignored - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by EOC'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('closes formatting at negating mid-row code', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { ccData: 0x1425, type: 0 }, - { ccData: characters('no'), type: 0 }, - // mid-row: italics underline - { ccData: 0x112f, type: 0 }, - { ccData: characters('ye'), type: 0 }, - { ccData: characters('s.'), type: 0 }, - // mid-row: white - { ccData: 0x1120, type: 0 }, - { ccData: characters('no'), type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - cea608Stream.flushDisplayed(); - assert.equal(captions[0].content[0].text, 'no yes. no', 'properly closed by negating mid-row code'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); -}); - -QUnit.test('roll-up display mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0}, - // '01' - { - pts: 1 * 1000, - ccData: characters('01'), - type: 0 - }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected one caption'); - assert.deepEqual(captions[0], { - startPts: 0 * 1000, - endPts: 3 * 1000, - content: [{ - line: 15, - position: 10, - text: '01' - }], - stream: 'CC1' - }, 'parsed the caption'); - captions = []; - - [ // RU4, roll-up captions 4 rows - { ccdata: 0x1427, type: 0 }, - // '23' - { - pts: 4 * 1000, - ccData: characters('23'), - type: 0, - stream: 'CC1' - }, - // CR - { pts: 5 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected another caption'); - assert.deepEqual(captions[0], { - startPts: 3 * 1000, - endPts: 5 * 1000, - content: [ - { - line: 14, - position: 10, - text: '01' - }, - { - line: 15, - position: 10, - text: '23' - } - ], - stream: 'CC1' - }, 'parsed the new caption and kept the caption up after the new caption'); -}); - -QUnit.test('roll-up displays multiple rows simultaneously', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 0 * 1000, - endPts: 1 * 1000, - content: [{ - line: 15, - position: 10, - text: '01' - }], - stream: 'CC1' - }, 'created a caption for the first period'); - captions = []; - - [ // '23' - { - pts: 2 * 1000, - ccData: characters('23'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected another caption'); - assert.deepEqual(captions[0], { - startPts: 1 * 1000, - endPts: 3 * 1000, - content: [ - { - line: 14, - position: 10, - text: '01' - }, - { - line: 15, - position: 10, - text: '23' - } - ], - stream: 'CC1' - }, 'created the top and bottom rows after the shift up'); - captions = []; - - [ // '45' - { - pts: 4 * 1000, - ccData: characters('45'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 5 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected third caption'); - assert.deepEqual(captions[0], { - startPts: 3 * 1000, - endPts: 5 * 1000, - "content": [ - { - line: 14, - position: 10, - text: '23' - }, - { - line: 15, - position: 10, - text: '45' - } - ], - stream: 'CC1' - }, 'created the top and bottom rows after the shift up'); -}); - -QUnit.test('the roll-up count can be changed on-the-fly', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0, - stream: 'CC1' - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - captions = []; - - [ // RU3, roll-up captions 3 rows - { ccData: 0x1426, type: 0 }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'still displaying a caption'); - captions = []; - - [ // RU4, roll-up captions 4 rows - { ccData: 0x1427, type: 0 }, - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'still displaying a caption'); - captions = []; - - // RU3, roll-up captions 3 rows - cea608Stream.push({ ccdata: 0x1426, type: 0 }); - assert.equal(captions.length, 0, 'cleared the caption'); -}); - -QUnit.test('switching to roll-up from pop-on wipes memories and flushes captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL (resume caption loading) - { pts: 0 * 1000, ccData: 0x1420, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // EOC (end of caption), mark 1st caption start - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - { pts: 2 * 1000, ccData: characters('oh'), type: 0 }, - // EOC, mark 2nd caption start and flush 1st caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 }, - // RU2 (roll-up, 2 rows), flush 2nd caption - { pts: 3 * 1000, ccData: 0x1425, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val.text; - return acc; - }, ''); - var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val.text; - return acc; - }, ''); - - assert.equal(captions.length, 2, 'both captions flushed'); - assert.equal(displayed, '', 'displayed memory is wiped'); - assert.equal(nonDisplayed, '', 'non-displayed memory is wiped'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 2000, - content: [{ - line: 15, - position: 10, - text: 'hi', - }], - stream: 'CC1' - }, 'first caption correct'); - assert.deepEqual(captions[1], { - startPts: 2000, - endPts: 3000, - content: [{ - line: 15, - position: 10, - text: 'oh', - }], - stream: 'CC1' - }, 'second caption correct'); -}); - -QUnit.test('switching to roll-up from paint-on wipes memories and flushes captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RDC (resume direct captioning) - { pts: 0 * 1000, ccData: 0x1429, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // RU2 (roll-up, 2 rows), flush displayed caption - { pts: 1 * 1000, ccData: 0x1425, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val.text; - return acc; - }, ''); - var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val.text; - return acc; - }, ''); - - assert.equal(captions.length, 1, 'flushed caption'); - assert.equal(displayed, '', 'displayed memory is wiped'); - assert.equal(nonDisplayed, '', 'non-displayed memory is wiped'); - assert.deepEqual(captions[0], { - startPts: 0, - endPts: 1000, - content: [{ - line: 15, - position: 10, - text: 'hi', - }], - stream: 'CC1' - }, 'caption correct'); -}); - -// NOTE: This should change to not wiping the display when caption -// positioning is properly implemented -QUnit.test('switching to paint-on from pop-on flushes display', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL (resume caption loading) - { pts: 0 * 1000, ccData: 0x1420, type: 0 }, - // PAC: row 14, indent 0 - { pts: 0 * 1000, ccData: 0x1450, type: 0 }, - { pts: 0 * 1000, ccData: characters('hi'), type: 0 }, - // EOC (end of caption), mark caption start - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL - { pts: 1 * 1000, ccData: 0x1420, type: 0 }, - // RDC (resume direct captioning), flush caption - { pts: 2 * 1000, ccData: 0x1429, type: 0 }, - // PAC: row 14, indent 0 - { pts: 2 * 1000, ccData: 0x1450, type: 0 }, - // TO1 (tab offset 1 column) - { pts: 2 * 1000, ccData: 0x1721, type: 0 }, - { pts: 3 * 1000, ccData: characters('io'), type: 0 }, - // EDM (erase displayed memory), flush paint-on caption - { pts: 4 * 1000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 2, 'detected 2 captions'); - assert.equal(captions[0].content[0].text, 'hi', 'pop-on caption received'); - assert.equal(captions[0].startPts, 1000, 'proper start pts'); - assert.equal(captions[0].endPts, 2000, 'proper end pts'); - assert.equal(captions[1].content[0].text, 'io', 'paint-on caption received'); - assert.equal(captions[1].startPts, 2000, 'proper start pts'); - assert.equal(captions[1].endPts, 4000, 'proper end pts'); -}); - -QUnit.test('backspaces are reflected in the generated captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - { - pts: 1 * 1000, - ccData: characters('23'), - type: 0 - }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].content[0].text, '023', 'applied the backspace'); -}); - -QUnit.test('backspaces can remove a caption entirely', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no caption emitted'); -}); - -QUnit.test('a second identical control code immediately following the first is ignored', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, // duplicate is ignored - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].content[0].text, '01', 'only two backspaces processed'); -}); - -QUnit.test('a second identical control code separated by only padding from the first is ignored', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // padding - { ccData: 0x0000, type: 0 }, - { ccData: 0x0000, type: 0 }, - { ccData: 0x0000, type: 0 }, - // backspace - { pts: 2 * 1000, ccData: 0x1421, type: 0 }, // duplicate is ignored - // CR, carriage return - { pts: 3 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].content[0].text, '010', 'only one backspace processed'); -}); - -QUnit.test('preamble address codes on same row are NOT converted into spaces', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - // '02' - { - pts: 1 * 1000, - ccData: characters('02'), - type: 0 - }, - // CR, carriage return - { pts: 2 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].content[0].text, '0102', 'PACs were NOT converted to space'); -}); - -QUnit.test('generates correct content with PACs in pop-on mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // ENM, erase non-displayed memory - { ccData: 0x142e, type: 0 }, - // PAC: row 12, indent 0 - { ccData: 0x1350, type: 0 }, - // text: TEST - { ccData: 0x5445, type: 0 }, - { ccData: 0x5354, type: 0 }, - // PAC: row 14, indent 0 - { ccData: 0x1450, type: 0 }, - // text: STRING - { ccData: 0x5354, type: 0 }, - { ccData: 0x5249, type: 0 }, - { ccData: 0x4e47, type: 0 }, - // PAC: row 15, indent 0 - { ccData: 0x1470, type: 0 }, - // text: DATA - { ccData: 0x4441, type: 0 }, - { ccData: 0x5441, type: 0 }, - // EOC, end of caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EOC, duplicated as per spec - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // EOC, dispatch caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].content[0].text, 'TEST', 'first content text'); - assert.equal(captions[0].content[1].text, 'STRING', 'second content text'); - assert.equal(captions[0].content[2].text, 'DATA', 'third content text'); -}); - -QUnit.test('extracts real-world cc1 and cc3 channels', function(assert) { - var cea608Stream1 = cea608Stream; - var cea608Stream3 = new m2ts.Cea608Stream(1, 0); - var captions = []; - cea608Stream1.on('data', function(caption) { - captions.push(caption); - }); - cea608Stream3.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - { pts: 425316, type: 0, ccData: 5158 }, // RU3 - { pts: 431322, type: 0, ccData: 5165 }, // CR - { pts: 440331, type: 0, ccData: 4944 }, // position 11,0 - { pts: 443334, type: 0, ccData: 20549 }, // PE - { pts: 449340, type: 0, ccData: 21065 }, // RI - { pts: 449340, type: 0, ccData: 0 }, // padding - { pts: 452343, type: 0, ccData: 20292 }, // OD - { pts: 458349, type: 0, ccData: 11264 }, // , - { pts: 458349, type: 0, ccData: 0 }, // padding - { pts: 461352, type: 0, ccData: 0 }, // padding - { pts: 467358, type: 0, ccData: 8192 }, // (space) - { pts: 467358, type: 0, ccData: 17920 }, // F - { pts: 470361, type: 0, ccData: 0 }, // padding - { pts: 476367, type: 0, ccData: 0 }, // padding - { pts: 476367, type: 0, ccData: 20300 }, // OL - { pts: 479370, type: 0, ccData: 19283 }, // KS - { pts: 485376, type: 0, ccData: 0 }, // padding - { pts: 485376, type: 0, ccData: 11776 }, // . - { pts: 674565, type: 0, ccData: 5158 }, // RU3 - { pts: 677568, type: 0, ccData: 5165 }, // CR - { pts: 371262, type: 1, ccData: 5414 }, // RU3 - { pts: 377268, type: 1, ccData: 0 }, // padding - { pts: 377268, type: 1, ccData: 4944 }, // position 11,0 - { pts: 380271, type: 1, ccData: 0 }, // padding - { pts: 386277, type: 1, ccData: 4412 }, // ê - { pts: 386277, type: 1, ccData: 0 }, // padding - { pts: 389280, type: 1, ccData: 29810 }, // tr - { pts: 395286, type: 1, ccData: 25888 }, // e(space) - { pts: 395286, type: 1, ccData: 30062 }, // un - { pts: 398289, type: 1, ccData: 25888 }, // e(space) - { pts: 404295, type: 1, ccData: 28764 }, // pé - { pts: 404295, type: 1, ccData: 29289 }, // ri - { pts: 407298, type: 1, ccData: 28516 }, // od - { pts: 413304, type: 1, ccData: 25856 }, // e - { pts: 413304, type: 1, ccData: 0 }, // padding - { pts: 443334, type: 1, ccData: 8292 }, // (space)d - { pts: 449340, type: 1, ccData: 25888 }, // e(space) - { pts: 449340, type: 1, ccData: 29045 }, // qu - { pts: 452343, type: 1, ccData: 25971 }, // es - { pts: 458349, type: 1, ccData: 29801 }, // ti - { pts: 458349, type: 1, ccData: 28526 }, // on - { pts: 461352, type: 1, ccData: 29440 }, // s - { pts: 467358, type: 1, ccData: 5421 }, // CR - { pts: 467358, type: 1, ccData: 0 }, // padding - { pts: 470361, type: 1, ccData: 5414 }, // RU3 - { pts: 476367, type: 1, ccData: 0 } // padding - ]; - - packets.forEach(function(packet) { - cea608Stream1.push(packet); - cea608Stream3.push(packet); - }); - - var cc1 = {stream: 'CC1', content: [{ text: 'PERIOD, FOLKS.'}] }; - var cc3 = {stream: 'CC3', content: [{ text: 'être une période de questions' }] }; - - assert.equal(captions.length, 2, 'caption emitted'); - assert.equal(captions[0].stream, cc1.stream, 'cc1 stream detected'); - assert.equal(captions[0].content[0].text, cc1.content[0].text, 'cc1 stream extracted successfully'); - assert.equal(captions[1].stream, cc3.stream, 'cc3 stream detected'); - assert.equal(captions[1].content[0].text, cc3.content[0].text, 'cc3 stream extracted successfully'); -}); - -QUnit.test('backspaces stop at the beginning of the line', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RU2, roll-up captions 2 rows - { ccData: 0x1425, type: 0 }, - // '01' - { - pts: 0 * 1000, - ccData: characters('01'), - type: 0 - }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // Send another command so that the backspace isn't - // ignored as a duplicate command - { ccData: 0x1425, type: 0 }, - // backspace - { ccData: 0x1421, type: 0 }, - // CR, carriage return - { pts: 1 * 1000, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 0, 'no caption emitted'); -}); - -QUnit.test('reset works', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - [ // RU2, roll-up captions 2 rows - { pts: 0, ccData: 0x1425, type: 0 }, - // mid-row: white underline - { pts: 0, ccData: 0x1121, type: 0 }, - { pts: 0, ccData: characters('01'), type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - var buffer = cea608Stream.displayed_.map(function(row) { - return row.text.trim(); - }).join('\n') - .replace(/^\n+|\n+$/g, ''); - - assert.equal(buffer, '01', 'buffer is as expected'); - - cea608Stream.reset(); - buffer = cea608Stream.displayed_ - .map(function(row) { - return row.text.trim(); - }) - .join('\n') - .replace(/^\n+|\n+$/g, ''); - assert.equal(buffer, '', 'displayed buffer reset successfully'); - assert.equal(cea608Stream.lastControlCode_, null, 'last control code reset successfully'); - assert.deepEqual(cea608Stream.formatting_, [], 'formatting was reset'); - -}); - - -QUnit.test('paint-on mode', function(assert) { - var packets, captions; - packets = [ - // RDC, resume direct captioning, begin display - { pts: 1000, ccData: 0x1429, type: 0 }, - { pts: 2000, ccData: characters('hi'), type: 0 }, - // EDM, erase displayed memory. Finish display, flush caption - { pts: 3000, ccData: 0x142c, type: 0 } - ]; - captions = []; - - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - packets.forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.deepEqual(captions[0], { - startPts: 1000, - endPts: 3000, - content: [{ - line: 15, - position: 10, - text: 'hi', - }], - stream: 'CC1' - }, 'parsed the caption'); -}); - -QUnit.test('generates correct text from PACs in paint-on mode', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RDC, resume direct captioning - { pts: 1000, ccData: 0x1429, type: 0 }, - // PAC: row 12, indent 0 - { pts: 1000, ccData: 0x1350, type: 0 }, - // text: TEST - { pts: 2000, ccData: 0x5445, type: 0 }, - { pts: 2000, ccData: 0x5354, type: 0 }, - // PAC: row 14, indent 0 - { pts: 3000, ccData: 0x1450, type: 0 }, - // text: STRING - { pts: 3000, ccData: 0x5354, type: 0 }, - { pts: 4000, ccData: 0x5249, type: 0 }, - { pts: 4000, ccData: 0x4e47, type: 0 }, - // PAC: row 15, indent 0 - { pts: 5000, ccData: 0x1470, type: 0 }, - // text: DATA - { pts: 5000, ccData: 0x4441, type: 0 }, - { pts: 6000, ccData: 0x5441, type: 0 }, - // EDM, erase displayed memory. Finish display, flush caption - { pts: 6000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].content[0].text, 'TEST', 'first content text'); - assert.equal(captions[0].content[1].text, 'STRING', 'second content text'); - assert.equal(captions[0].content[2].text, 'DATA', 'third content text'); -}); - -QUnit.test('multiple caption texts are generated (paint-on)', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ // RDC, resume direct captioning - { ccData: 0x1429, type: 0 }, - // '01', default row 15 - { pts: 0 * 1000, ccData: characters('01'), type: 0 }, - // backspace - { pts: 0 * 1000, ccData: 0x1421, type: 0 }, - { pts: 1 * 1000, ccData: characters('23'), type: 0 }, - // PAC: row 13, indent 0 - { pts: 2 * 1000, ccData: 0x1370, type: 0 }, - { pts: 2 * 1000, ccData: characters('32'), type: 0 }, - // backspace - { pts: 3 * 1000, ccData: 0x1421, type: 0 }, - { pts: 4 * 1000, ccData: characters('10'), type: 0 }, - // EDM, erase displayed memory, flush caption - { pts: 5 * 1000, ccData: 0x142c, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].content[0].text, '310', 'first caption text'); - assert.equal(captions[0].content[1].text, '023', 'second caption text'); -}); - -QUnit.test('PAC indent code increases the position', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC indent code representing 4 indentations. - { ccData: 5240, type: 0 }, - { ccData: characters('te'), type: 0 }, - { ccData: characters('st'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'test', 'content text'); - assert.equal(captions[0].content[0].line, 15, 'positions the caption to the bottom of the screen'); - assert.equal(captions[0].content[0].position, 50, 'positions the caption to the right of the screen'); -}); - -QUnit.test('PAC offset code increases the position', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // PAC: row 1, indent 0 - { pts: 6750, ccData: 0x1150, type: 0 }, - // TO2 (tab offset 2 columns) - { pts: 6755, ccData: 0x1722, type: 0 }, - { ccData: characters('te'), type: 0 }, - { ccData: characters('st'), type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'test', 'content text'); - assert.equal(captions[0].content[0].line, 1, 'positions the caption to the bottom of the screen'); - // Two tab offset columns adds 5 to the position (2 * 2.5) - assert.equal(captions[0].content[0].position, 15, 'positions the caption to the right'); -}); - -QUnit.test('PAC row command ensures we have the correct line property for captions', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - var packets = [ - // RU2 (roll-up, 2 rows) - { pts: 6675, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush nothing - { pts: 6675, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - // This should ensure the captions are at the top of the screen. - { pts: 6675, ccData: 0x1170, type: 0 }, - // text: YEAR. - { pts: 6676, ccData: 0x5945, type: 0 }, - { pts: 6676, ccData: 0x4152, type: 0 }, - { pts: 6676, ccData: 0x2e00, type: 0 }, - // RU2 (roll-up, 2 rows) - { pts: 6677, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush 1 row - { pts: 6677, ccData: 0x142d, type: 0 }, - // EDM (erase displayed memory), flush 2 displayed roll-up rows - { pts: 6697, ccData: 0x142c, type: 0 }, - // RDC (resume direct captioning), wipes memories, flushes nothing - { pts: 6749, ccData: 0x1429, type: 0 }, - // PAC: row 1, indent 0 - { pts: 6750, ccData: 0x1150, type: 0 }, - // EOC, End of Caption - { pts: 1 * 1000, ccData: 0x142f, type: 0 }, - // RCL, resume caption loading - { ccData: 0x1420, type: 0 }, - // EOC, End of Caption - { pts: 2 * 1000, ccData: 0x142f, type: 0 } - ]; - - // First caption stream is at the second most bottom row. - packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].content[0].text, 'YEAR.', 'content text'); - assert.equal(captions[0].content[0].line, 2, 'positions the caption in the second most bottom row'); - assert.equal(captions[0].content[0].position, 10, 'position of the caption'); - - // Second caption stream is at the most bottom row. - assert.equal(captions[1].content[0].text, 'YEAR.', 'content text'); - assert.equal(captions[1].content[0].line, 1, 'positions the caption in the most bottom row'); - assert.equal(captions[1].content[0].position, 10, 'position of the caption'); -}); - -QUnit.test('mix of all modes (extract from CNN)', function(assert) { - var captions = []; - cea608Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // RU2 (roll-up, 2 rows) - { pts: 6675, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush nothing - { pts: 6675, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6675, ccData: 0x1170, type: 0 }, - // text: YEAR. - { pts: 6676, ccData: 0x5945, type: 0 }, - { pts: 6676, ccData: 0x4152, type: 0 }, - { pts: 6676, ccData: 0x2e00, type: 0 }, - // RU2 (roll-up, 2 rows) - { pts: 6677, ccData: 0x1425, type: 0 }, - // CR (carriange return), flush 1 row - { pts: 6677, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6677, ccData: 0x1170, type: 0 }, - // text: GO TO CNNHEROS.COM. - { pts: 6677, ccData: 0x474f, type: 0 }, - { pts: 6678, ccData: 0x2054, type: 0 }, - { pts: 6678, ccData: 0x4f00, type: 0 }, - { pts: 6678, ccData: 0x2043, type: 0 }, - { pts: 6679, ccData: 0x4e4e, type: 0 }, - { pts: 6679, ccData: 0x4845, type: 0 }, - { pts: 6679, ccData: 0x524f, type: 0 }, - { pts: 6680, ccData: 0x532e, type: 0 }, - { pts: 6680, ccData: 0x434f, type: 0 }, - { pts: 6680, ccData: 0x4d2e, type: 0 }, - // EDM (erase displayed memory), flush 2 displayed roll-up rows - { pts: 6697, ccData: 0x142c, type: 0 }, - // RDC (resume direct captioning), wipes memories, flushes nothing - { pts: 6749, ccData: 0x1429, type: 0 }, - // PAC: row 1, indent 0 - { pts: 6750, ccData: 0x1150, type: 0 }, - // text: Did your Senator or Congressman - { pts: 6750, ccData: 0x4469, type: 0 }, - { pts: 6750, ccData: 0x6420, type: 0 }, - { pts: 6750, ccData: 0x796f, type: 0 }, - { pts: 6751, ccData: 0x7572, type: 0 }, - { pts: 6751, ccData: 0x2053, type: 0 }, - { pts: 6751, ccData: 0x656e, type: 0 }, - { pts: 6752, ccData: 0x6174, type: 0 }, - { pts: 6752, ccData: 0x6f72, type: 0 }, - { pts: 6752, ccData: 0x206f, type: 0 }, - { pts: 6753, ccData: 0x7220, type: 0 }, - { pts: 6753, ccData: 0x436f, type: 0 }, - { pts: 6753, ccData: 0x6e67, type: 0 }, - { pts: 6753, ccData: 0x7265, type: 0 }, - { pts: 6754, ccData: 0x7373, type: 0 }, - { pts: 6754, ccData: 0x6d61, type: 0 }, - { pts: 6754, ccData: 0x6e00, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6755, ccData: 0x1170, type: 0 }, - // TO2 (tab offset 2 columns) - { pts: 6755, ccData: 0x1722, type: 0 }, - // text: get elected by talking tough - { pts: 6755, ccData: 0x6765, type: 0 }, - { pts: 6756, ccData: 0x7420, type: 0 }, - { pts: 6756, ccData: 0x656c, type: 0 }, - { pts: 6756, ccData: 0x6563, type: 0 }, - { pts: 6756, ccData: 0x7465, type: 0 }, - { pts: 6757, ccData: 0x6420, type: 0 }, - { pts: 6757, ccData: 0x6279, type: 0 }, - { pts: 6757, ccData: 0x2074, type: 0 }, - { pts: 6758, ccData: 0x616c, type: 0 }, - { pts: 6758, ccData: 0x6b69, type: 0 }, - { pts: 6758, ccData: 0x6e67, type: 0 }, - { pts: 6759, ccData: 0x2074, type: 0 }, - { pts: 6759, ccData: 0x6f75, type: 0 }, - { pts: 6759, ccData: 0x6768, type: 0 }, - // RCL (resume caption loading) - { pts: 6759, ccData: 0x1420, type: 0 }, - // PAC: row 1, indent 4 - { pts: 6760, ccData: 0x1152, type: 0 }, - // TO1 (tab offset 1 column) - { pts: 6760, ccData: 0x1721, type: 0 }, - // text: on the national debt? - { pts: 6760, ccData: 0x6f6e, type: 0 }, - { pts: 6761, ccData: 0x2074, type: 0 }, - { pts: 6761, ccData: 0x6865, type: 0 }, - { pts: 6761, ccData: 0x206e, type: 0 }, - { pts: 6762, ccData: 0x6174, type: 0 }, - { pts: 6762, ccData: 0x696f, type: 0 }, - { pts: 6762, ccData: 0x6e61, type: 0 }, - { pts: 6762, ccData: 0x6c20, type: 0 }, - { pts: 6763, ccData: 0x6465, type: 0 }, - { pts: 6763, ccData: 0x6274, type: 0 }, - { pts: 6763, ccData: 0x3f00, type: 0 }, - // RCL (resume caption loading) - { pts: 6781, ccData: 0x1420, type: 0 }, - // EDM (erase displayed memory), flush paint-on caption - { pts: 6781, ccData: 0x142c, type: 0 }, - // EOC (end of caption), mark pop-on caption 1 start - { pts: 6782, ccData: 0x142f, type: 0 }, - // RCL (resume caption loading) - { pts: 6782, ccData: 0x1420, type: 0 }, - // PAC: row 1, indent 4 - { pts: 6782, ccData: 0x1152, type: 0 }, - // TO2 (tab offset 2 columns) - { pts: 6783, ccData: 0x1722, type: 0 }, - // text: Will they stay true - { pts: 6783, ccData: 0x5769, type: 0 }, - { pts: 6783, ccData: 0x6c6c, type: 0 }, - { pts: 6783, ccData: 0x2074, type: 0 }, - { pts: 6784, ccData: 0x6865, type: 0 }, - { pts: 6784, ccData: 0x7920, type: 0 }, - { pts: 6784, ccData: 0x7374, type: 0 }, - { pts: 6785, ccData: 0x6179, type: 0 }, - { pts: 6785, ccData: 0x2074, type: 0 }, - { pts: 6785, ccData: 0x7275, type: 0 }, - { pts: 6786, ccData: 0x6500, type: 0 }, - // PAC: row 2, indent 8 - { pts: 6786, ccData: 0x1174, type: 0 }, - // text: to their words? - { pts: 6786, ccData: 0x746f, type: 0 }, - { pts: 6786, ccData: 0x2074, type: 0 }, - { pts: 6787, ccData: 0x6865, type: 0 }, - { pts: 6787, ccData: 0x6972, type: 0 }, - { pts: 6787, ccData: 0x2077, type: 0 }, - { pts: 6788, ccData: 0x6f72, type: 0 }, - { pts: 6788, ccData: 0x6473, type: 0 }, - { pts: 6788, ccData: 0x3f00, type: 0 }, - // RCL (resume caption loading) - { pts: 6797, ccData: 0x1420, type: 0 }, - // EDM (erase displayed memory), mark pop-on caption 1 end and flush - { pts: 6797, ccData: 0x142c, type: 0 }, - // EOC (end of caption), mark pop-on caption 2 start, flush nothing - { pts: 6798, ccData: 0x142f, type: 0 }, - // RCL - { pts: 6799, ccData: 0x1420, type: 0 }, - // EOC, mark pop-on caption 2 end and flush - { pts: 6838, ccData: 0x142f, type: 0 }, - // RU2 (roll-up, 2 rows), wipes memories - { pts: 6841, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush nothing - { pts: 6841, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6841, ccData: 0x1170, type: 0 }, - // text: NO MORE SPECULATION, NO MORE - { pts: 6841, ccData: 0x3e3e, type: 0 }, - { pts: 6841, ccData: 0x3e00, type: 0 }, - { pts: 6842, ccData: 0x204e, type: 0 }, - { pts: 6842, ccData: 0x4f00, type: 0 }, - { pts: 6842, ccData: 0x204d, type: 0 }, - { pts: 6842, ccData: 0x4f52, type: 0 }, - { pts: 6842, ccData: 0x4500, type: 0 }, - { pts: 6842, ccData: 0x2000, type: 0 }, - { pts: 6842, ccData: 0x5350, type: 0 }, - { pts: 6843, ccData: 0x4543, type: 0 }, - { pts: 6843, ccData: 0x554c, type: 0 }, - { pts: 6843, ccData: 0x4154, type: 0 }, - { pts: 6843, ccData: 0x494f, type: 0 }, - { pts: 6843, ccData: 0x4e2c, type: 0 }, - { pts: 6843, ccData: 0x204e, type: 0 }, - { pts: 6843, ccData: 0x4f00, type: 0 }, - { pts: 6843, ccData: 0x204d, type: 0 }, - { pts: 6844, ccData: 0x4f52, type: 0 }, - { pts: 6844, ccData: 0x4500, type: 0 }, - // RU2 (roll-up, two rows) - { pts: 6844, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush 1 roll-up row - { pts: 6844, ccData: 0x142d, type: 0 }, - // PAC: row 2, indent 0 - { pts: 6844, ccData: 0x1170, type: 0 }, - // text: RUMORS OR GUESSING GAMES. - { pts: 6844, ccData: 0x5255, type: 0 }, - { pts: 6844, ccData: 0x4d4f, type: 0 }, - { pts: 6844, ccData: 0x5253, type: 0 }, - { pts: 6844, ccData: 0x204f, type: 0 }, - { pts: 6845, ccData: 0x5200, type: 0 }, - { pts: 6845, ccData: 0x2047, type: 0 }, - { pts: 6845, ccData: 0x5545, type: 0 }, - { pts: 6845, ccData: 0x5353, type: 0 }, - { pts: 6845, ccData: 0x494e, type: 0 }, - { pts: 6845, ccData: 0x4700, type: 0 }, - { pts: 6845, ccData: 0x2047, type: 0 }, - { pts: 6845, ccData: 0x414d, type: 0 }, - { pts: 6845, ccData: 0x4553, type: 0 }, - { pts: 6845, ccData: 0x2e00, type: 0 }, - // RU2 (roll-up, 2 rows) - { pts: 6846, ccData: 0x1425, type: 0 }, - // CR (carriage return), flush 2 roll-up rows - { pts: 6846, ccData: 0x142d, type: 0 } - ].forEach(cea608Stream.push, cea608Stream); - - assert.equal(captions.length, 7, 'detected 7 captions of varying types'); - assert.deepEqual(captions[0], { - content: [{ - line: 2, - position: 10, - text: 'YEAR.', - }], - startPts: 6675, - endPts: 6677, - stream: 'CC1' - }, 'parsed the 1st roll-up caption'); - assert.deepEqual(captions[1], { - content: [ - { - line: 1, - position: 10, - text: 'YEAR.', - }, - { - line: 2, - position: 10, - text: 'GO TO CNNHEROS.COM.', - } - ], - startPts: 6677, - endPts: 6697, - stream: 'CC1' - }, 'parsed the 2nd roll-up caption'); - assert.deepEqual(captions[2], { - content: [ - { - line: 1, - position: 10, - text: 'Did your Senator or Congressman', - }, - { - line: 2, - position: 10, - text: 'get elected by talking tough', - } - ], - startPts: 6749, - endPts: 6781, - stream: 'CC1' - }, 'parsed the paint-on caption'); - assert.deepEqual(captions[3], { - content: [{ - line: 1, - position: 22.5, - text: 'on the national debt?', - }], - startPts: 6782, - endPts: 6797, - stream: 'CC1' - }, 'parsed the 1st pop-on caption'); - assert.deepEqual(captions[4], { - content: [ - { - line: 1, - position: 25, - text: 'Will they stay true', - }, - { - line: 2, - position: 30, - text: 'to their words?', - } - ], - startPts: 6798, - endPts: 6838, - stream: 'CC1' - }, 'parsed the 2nd pop-on caption'); - assert.deepEqual(captions[5], { - content: [{ - line: 2, - position: 10, - text: '>>> NO MORE SPECULATION, NO MORE', - }], - startPts: 6841, - endPts: 6844, - stream: 'CC1' - }, 'parsed the 3rd roll-up caption'); - assert.deepEqual(captions[6], { - content: [ - { - line: 1, - position: 10, - text: '>>> NO MORE SPECULATION, NO MORE', - }, - { - line: 2, - position: 10, - text: 'RUMORS OR GUESSING GAMES.', - } - ], - startPts: 6844, - endPts: 6846, - stream: 'CC1' - }, 'parsed the 4th roll-up caption'); - -}); - -QUnit.test('Cea608Stream will trigger log on malformed captions', function(assert) { - var result; - var logs = []; - - cea608Stream.on('log', function(log) { - logs.push(log); - }) - - // this will force an exception to happen in flushDisplayed - cea608Stream.displayed_[0] = undefined; - - try { - cea608Stream.flushDisplayed(); - result = true; - } catch (e) { - result = false; - } - - assert.ok( - result, - 'the function does not throw an exception' - ); - assert.deepEqual( - logs, - [ - {level: 'warn', message: 'Skipping a malformed 608 caption at index 0.'} - ], - 'logs were triggered' - ); -}); - -var cea708Stream; - -QUnit.module('CEA 708 Stream', { - beforeEach: function() { - cea708Stream = new m2ts.Cea708Stream(); - } -}); - -QUnit.test('Filters encoding values out of captionServices option block', function(assert) { - var expectedServiceEncodings = { - SERVICE1: 'euc-kr', - SERVICE2: 'utf-8', - }; - - cea708Stream = new m2ts.Cea708Stream({ - captionServices: { - SERVICE1: { - language: 'kr', - label: 'Korean', - encoding: 'euc-kr' - }, - SERVICE2: { - language: 'en', - label: 'English', - encoding: 'utf-8' - } - } - }); - - assert.deepEqual(cea708Stream.serviceEncodings, expectedServiceEncodings, 'filtered encodings correctly'); -}); - -QUnit.test('parses 708 captions', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - cc708PinkUnderscore.forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 235, 'parsed 235 captions'); - assert.deepEqual(captions[0], { - startPts: 6723335478, - endPts: 6723626769, - text: '\"Pinkalicious_and_Peterrific\"\nis_made_possible_in_part_by:', - stream: 'cc708_1' - }, 'parsed first caption correctly'); - assert.deepEqual(captions[1], { - startPts: 6723740883, - endPts: 6723945087, - text: 'GIRL:\nRead_me_the_tale\nof_a_faraway_land.', - stream: 'cc708_1' - }, 'parsed second caption correctly'); - assert.deepEqual(captions[2], { - startPts: 6723948090, - endPts: 6724200342, - text: 'Tell_me_of_planets\nwith_oceans_of_sand.', - stream: 'cc708_1' - }, 'parsed third caption correctly'); - assert.deepEqual(captions[33], { - startPts: 6732617751, - endPts: 6732876009, - text: '♪_It\'s_a_Pinkalicious_feeling_♪', - stream: 'cc708_1' - }, 'parsed caption 33 correctly with music note'); - assert.deepEqual(captions[38], { - startPts: 6734218350, - endPts: 6734425557, - text: 'PINKALICIOUS:\n\"Dream_Salon.\"', - stream: 'cc708_1' - }, 'parsed caption 38 correctly'); - assert.deepEqual(captions[234], { - startPts: 6778809897, - endPts: 6779104191, - text: 'I_guess_I\'ll_just_have\nto_duck_a_little_bit.', - stream: 'cc708_1' - }, 'parsed caption 234 correctly'); -}); - -QUnit.test('Decodes multibyte characters if valid encoding option is provided and TextDecoder is supported', function(assert) { - var captions = []; - - cea708Stream = new m2ts.Cea708Stream({ - captionServices: { - SERVICE1: { - encoding: 'euc-kr' - } - } - }); - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - cc708Korean.forEach(cea708Stream.push, cea708Stream); - - cea708Stream.flushDisplayed(4721138662, cea708Stream.services[1]); - - assert.equal(captions.length, 1, 'parsed single caption correctly'); - - if (window.TextDecoder) { - assert.ok(cea708Stream.services[1].textDecoder_, 'TextDecoder created when supported'); - assert.equal( - captions[0].text, - '니가 ', - 'parsed multibyte characters correctly' - ); - } else { - assert.notOk(cea708Stream.services[1].textDecoder_, 'TextDecoder not created when unsupported'); - } -}); - -QUnit.test('Creates TextDecoder only if valid encoding value is provided', function(assert) { - var secondCea708Stream; - - cea708Stream = new m2ts.Cea708Stream({ - captionServices: { - SERVICE1: { - encoding: 'euc-kr' - } - } - }); - - cc708Korean.forEach(cea708Stream.push, cea708Stream); - cea708Stream.flushDisplayed(4721138662, cea708Stream.services[1]); - - if (window.TextDecoder) { - assert.ok(cea708Stream.services[1].textDecoder_, 'TextDecoder created successfully when encoding is valid'); - } - - secondCea708Stream = new m2ts.Cea708Stream({ - captionServices: { - SERVICE1: { - encoding: 'invalid' - } - } - }); - - cc708Korean.forEach(secondCea708Stream.push, secondCea708Stream); - secondCea708Stream.flushDisplayed(4721138662, secondCea708Stream.services[1]); - - assert.notOk(secondCea708Stream.services[1].textDecoder_, 'TextDecoder not created when encoding is invalid'); -}); - -QUnit.test('reset command', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 153315036, ccData: 0x8322 }, - { type: 2, pts: 153315036, ccData: 0x4820 }, - { type: 2, pts: 153315036, ccData: 0x0000 }, - { type: 3, pts: 153318039, ccData: 0xc322 }, - { type: 2, pts: 153318039, ccData: 0x4953 }, - { type: 2, pts: 153318039, ccData: 0x0000 }, - { type: 3, pts: 153387108, ccData: 0x0628 }, - { type: 2, pts: 153387108, ccData: 0x0d90 }, - { type: 2, pts: 153387108, ccData: 0x0503 }, - { type: 2, pts: 153387108, ccData: 0x912a }, - { type: 2, pts: 153387108, ccData: 0x002a }, - { type: 2, pts: 153387108, ccData: 0x0000 }, - { type: 3, pts: 153405126, ccData: 0x4da2 }, - { type: 2, pts: 153405126, ccData: 0x8c0f }, - { type: 2, pts: 153405126, ccData: 0x628c }, - { type: 2, pts: 153405126, ccData: 0x0f31 }, - { type: 2, pts: 153405126, ccData: 0x983b }, - { type: 2, pts: 153405126, ccData: 0x912a }, - { type: 2, pts: 153405126, ccData: 0x8f00 }, - { type: 2, pts: 153405126, ccData: 0x611f }, - { type: 2, pts: 153405126, ccData: 0x002a }, - { type: 2, pts: 153405126, ccData: 0x1090 }, - { type: 2, pts: 153405126, ccData: 0x0503 }, - { type: 3, pts: 153408129, ccData: 0x8a31 }, - { type: 2, pts: 153408129, ccData: 0x9201 }, - { type: 2, pts: 153408129, ccData: 0x983b }, - // RST (Reset command) - { type: 2, pts: 153408129, ccData: 0x8f00 }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x611f }, - { type: 2, pts: 153408129, ccData: 0x1090 }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x0503 }, - { type: 2, pts: 153408129, ccData: 0x912a }, - { type: 2, pts: 153408129, ccData: 0x0000 }, - { type: 2, pts: 153408129, ccData: 0x9201 }, - { type: 3, pts: 153414135, ccData: 0xc322 }, - { type: 2, pts: 153414135, ccData: 0x434f }, - { type: 2, pts: 153414135, ccData: 0x0000 } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.deepEqual(captions[0], { - startPts: 153315036, - endPts: 153408129, - text: '*\n;', - stream: 'cc708_1' - }, 'parsed the caption correctly'); -}); - -QUnit.test('windowing', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: characters('w0') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8100 }, // CW1 - { type: 2, pts: 1000, ccData: characters('w1') }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8200 }, // CW2 - { type: 2, pts: 1000, ccData: characters('w2') }, - - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8300 }, // CW3 - { type: 2, pts: 1000, ccData: characters('w3') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8400 }, // CW4 - { type: 2, pts: 1000, ccData: characters('w4') }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8500 }, // CW5 - { type: 2, pts: 1000, ccData: characters('w5') }, - - { type: 3, pts: 1000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8600 }, // CW6 - { type: 2, pts: 1000, ccData: characters('w6') }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: 0x8700 }, // CW7 - { type: 2, pts: 1000, ccData: characters('w7') }, - - { type: 3, pts: 2000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 2000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 2000, ccData: displayWindows708([0]) }, - - { type: 3, pts: 3000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 3000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 3000, ccData: displayWindows708([1]) }, - - { type: 3, pts: 4000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 4000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 4000, ccData: displayWindows708([2, 3]) }, - - { type: 3, pts: 5000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 5000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 5000, ccData: displayWindows708([3, 4]) }, - - { type: 3, pts: 6000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 6000, ccData: 0x8aff }, // HDW (Hide all) - { type: 2, pts: 6000, ccData: displayWindows708([5, 6, 7]) }, - - { type: 3, pts: 7000, ccData: packetHeader708(1, 2, 1, 2) }, - { type: 2, pts: 7000, ccData: 0x8aff }, // HDW (Hide all) - - // Indicate end of last packet - { type: 3, pts: 8000, ccData: packetHeader708(2, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 5, 'parsed 5 captions'); - assert.deepEqual(captions[0], { - startPts: 2000, - endPts: 3000, - text: 'w0', - stream: 'cc708_1' - }, 'parsed caption 0 correctly'); - assert.deepEqual(captions[1], { - startPts: 3000, - endPts: 4000, - text: 'w1', - stream: 'cc708_1' - }, 'parsed caption 1 correctly'); - assert.deepEqual(captions[2], { - startPts: 4000, - endPts: 5000, - text: 'w2\n\nw3', - stream: 'cc708_1' - }, 'parsed caption 2 correctly'); - assert.deepEqual(captions[3], { - startPts: 5000, - endPts: 6000, - text: 'w3\n\nw4', - stream: 'cc708_1' - }, 'parsed caption 3 correctly'); - assert.deepEqual(captions[4], { - startPts: 6000, - endPts: 7000, - text: 'w5\n\nw6\n\nw7', - stream: 'cc708_1' - }, 'parsed caption 4 correctly'); -}); - -QUnit.test('backspace', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: characters('ty') }, - { type: 2, pts: 1000, ccData: characters('op') }, - { type: 2, pts: 1000, ccData: 0x0808 }, // BS BS: Backspace twice - { type: 2, pts: 1000, ccData: characters('po') }, - { type: 2, pts: 1000, ccData: displayWindows708([0]) }, - - { type: 3, pts: 2000, ccData: packetHeader708(1, 2, 1, 2) }, - { type: 2, pts: 2000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 3000, ccData: packetHeader708(2, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.equal(captions[0].text, 'typo', 'parsed caption with backspaces correctly'); -}); - -QUnit.test('extended character set', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - { type: 3, pts: 1000, ccData: packetHeader708(0, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: displayWindows708([0]) }, - { type: 2, pts: 1000, ccData: 0x8000 }, // CW0 - { type: 2, pts: 1000, ccData: 0x103f }, // Ÿ - { type: 2, pts: 1000, ccData: 0x1035 }, // • - { type: 2, pts: 1000, ccData: 0x103f }, // Ÿ - { type: 2, pts: 1000, ccData: 0x0020 }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 7, 1, 12) }, - { type: 2, pts: 1000, ccData: 0x103c }, // œ - { type: 2, pts: 1000, ccData: 0x102a }, // Š - { type: 2, pts: 1000, ccData: 0x1025 }, // … - { type: 2, pts: 1000, ccData: 0x102a }, // Š - { type: 2, pts: 1000, ccData: 0x103c }, // œ - { type: 2, pts: 1000, ccData: 0x0020 }, - - { type: 3, pts: 1000, ccData: packetHeader708(2, 5, 1, 8) }, - { type: 2, pts: 1000, ccData: 0x1033 }, // “ - { type: 2, pts: 1000, ccData: 0x103d }, // ℠ - { type: 2, pts: 1000, ccData: 0x1034 }, // ” - { type: 2, pts: 1000, ccData: 0x1039 }, // ™ - - { type: 3, pts: 2000, ccData: packetHeader708(0, 2, 1, 2) }, - { type: 2, pts: 2000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 3000, ccData: packetHeader708(1, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 1, 'parsed 1 caption'); - assert.equal(captions[0].text, 'Ÿ•Ÿ œŠ…Šœ “℠”™', 'parsed extended characters correctly'); -}); - -QUnit.test('roll up', function(assert) { - var captions = []; - - cea708Stream.on('data', function(caption) { - captions.push(caption); - }); - - [ - // Define window with two virtual rows (rowCount = 1) - { type: 3, pts: 1000, ccData: packetHeader708(0, 4, 1, 6) }, - { type: 2, pts: 1000, ccData: 0x983b }, - { type: 2, pts: 1000, ccData: 0x8f00 }, - { type: 2, pts: 1000, ccData: 0x611f }, - - { type: 3, pts: 1000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 1000, ccData: characters('L1') }, - { type: 2, pts: 1000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 2000, ccData: packetHeader708(2, 3, 1, 4) }, - { type: 2, pts: 2000, ccData: characters('L2') }, - { type: 2, pts: 2000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 3000, ccData: packetHeader708(0, 3, 1, 4) }, - { type: 2, pts: 3000, ccData: characters('L3') }, - { type: 2, pts: 3000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 4000, ccData: packetHeader708(1, 3, 1, 4) }, - { type: 2, pts: 4000, ccData: characters('L4') }, - { type: 2, pts: 4000, ccData: 0x0d00 }, // CR - - { type: 3, pts: 5000, ccData: packetHeader708(2, 2, 1, 2) }, - { type: 2, pts: 5000, ccData: 0x8aff }, - - // Indicate end of last packet - { type: 3, pts: 6000, ccData: packetHeader708(0, 1, 1, 0) } - ].forEach(cea708Stream.push, cea708Stream); - - assert.equal(captions.length, 3, 'parsed 3 captions'); - assert.equal(captions[0].text, 'L1\nL2', 'parsed caption 1 correctly'); - assert.equal(captions[1].text, 'L2\nL3', 'parsed caption 2 correctly'); - assert.equal(captions[2].text, 'L3\nL4', 'parsed caption 3 correctly'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/captions.dfxp b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/captions.dfxp deleted file mode 100644 index 6e38e977bc..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/captions.dfxp +++ /dev/null @@ -1,1114 +0,0 @@ - - - - - - - -
- -

- ASUKA 明日香, 飛鳥 f Japanese -

- -

- Он подчеркнул, что "вчера дал поручение коллегам из министерств". -

- -

- 🍒 🐑 💀 -

-

- 0:10.50 - 0:15.10 -

-

- 0:20.00 - 0:23.00 -

-

- 30 - 34 -

-

- 35 - 39 -

-

- 40 - 44 -

-

- 45 - 49 -

-

- 50 - 54 -

-

- 55 - 59 -

-

- 60 - 64 -

-

- 65 - 69 -

-

- 70 - 74 -

-

- 75 - 79 -

-

- 80 - 84 -

-

- 85 - 89 -

-

- 90 - 94 -

-

- 95 - 99 -

-

- 100 - 104 -

-

- 105 - 109 -

-

- 110 - 114 -

-

- 115 - 119 -

-

- 120 - 124 -

-

- 125 - 129 -

-

- 130 - 134 -

-

- 135 - 139 -

-

- 140 - 144 -

-

- 145 - 149 -

-

- 150 - 154 -

-

- 155 - 159 -

-

- 160 - 164 -

-

- 165 - 169 -

-

- 170 - 174 -

-

- 175 - 179 -

-

- 180 - 184 -

-

- 185 - 189 -

-

- 190 - 194 -

-

- 195 - 199 -

-

- 200 - 204 -

-

- 205 - 209 -

-

- 210 - 214 -

-

- 215 - 219 -

-

- 220 - 224 -

-

- 225 - 229 -

-

- 230 - 234 -

-

- 235 - 239 -

-

- 240 - 244 -

-

- 245 - 249 -

-

- 250 - 254 -

-

- 255 - 259 -

-

- 260 - 264 -

-

- 265 - 269 -

-

- 270 - 274 -

-

- 275 - 279 -

-

- 280 - 284 -

-

- 285 - 289 -

-

- 290 - 294 -

-

- 295 - 299 -

-

- 300 - 304 -

-

- 305 - 309 -

-

- 310 - 314 -

-

- 315 - 319 -

-

- 320 - 324 -

-

- 325 - 329 -

-

- 330 - 334 -

-

- 335 - 339 -

-

- 340 - 344 -

-

- 345 - 349 -

-

- 350 - 354 -

-

- 355 - 359 -

-

- 360 - 364 -

-

- 365 - 369 -

-

- 370 - 374 -

-

- 375 - 379 -

-

- 380 - 384 -

-

- 385 - 389 -

-

- 390 - 394 -

-

- 395 - 399 -

-

- 400 - 404 -

-

- 405 - 409 -

-

- 410 - 414 -

-

- 415 - 419 -

-

- 420 - 424 -

-

- 425 - 429 -

-

- 430 - 434 -

-

- 435 - 439 -

-

- 440 - 444 -

-

- 445 - 449 -

-

- 450 - 454 -

-

- 455 - 459 -

-

- 460 - 464 -

-

- 465 - 469 -

-

- 470 - 474 -

-

- 475 - 479 -

-

- 480 - 484 -

-

- 485 - 489 -

-

- 490 - 494 -

-

- 495 - 499 -

-

- 500 - 504 -

-

- 505 - 509 -

-

- 510 - 514 -

-

- 515 - 519 -

-

- 520 - 524 -

-

- 525 - 529 -

-

- 530 - 534 -

-

- 535 - 539 -

-

- 540 - 544 -

-

- 545 - 549 -

-

- 550 - 554 -

-

- 555 - 559 -

-

- 560 - 564 -

-

- 565 - 569 -

-

- 570 - 574 -

-

- 575 - 579 -

-

- 580 - 584 -

-

- 585 - 589 -

-

- 590 - 594 -

-

- 595 - 599 -

-

- 600 - 604 -

-

- 605 - 609 -

-

- 610 - 614 -

-

- 615 - 619 -

-

- 620 - 624 -

-

- 625 - 629 -

-

- 630 - 634 -

-

- 635 - 639 -

-

- 640 - 644 -

-

- 645 - 649 -

-

- 650 - 654 -

-

- 655 - 659 -

-

- 660 - 664 -

-

- 665 - 669 -

-

- 670 - 674 -

-

- 675 - 679 -

-

- 680 - 684 -

-

- 685 - 689 -

-

- 690 - 694 -

-

- 695 - 699 -

-

- 700 - 704 -

-

- 705 - 709 -

-

- 710 - 714 -

-

- 715 - 719 -

-

- 720 - 724 -

-

- 725 - 729 -

-

- 730 - 734 -

-

- 735 - 739 -

-

- 740 - 744 -

-

- 745 - 749 -

-

- 750 - 754 -

-

- 755 - 759 -

-

- 760 - 764 -

-

- 765 - 769 -

-

- 770 - 774 -

-

- 775 - 779 -

-

- 780 - 784 -

-

- 785 - 789 -

-

- 790 - 794 -

-

- 795 - 799 -

-

- 800 - 804 -

-

- 805 - 809 -

-

- 810 - 814 -

-

- 815 - 819 -

-

- 820 - 824 -

-

- 825 - 829 -

-

- 830 - 834 -

-

- 835 - 839 -

-

- 840 - 844 -

-

- 845 - 849 -

-

- 850 - 854 -

-

- 855 - 859 -

-

- 860 - 864 -

-

- 865 - 869 -

-

- 870 - 874 -

-

- 875 - 879 -

-

- 880 - 884 -

-

- 885 - 889 -

-

- 890 - 894 -

-

- 895 - 899 -

-

- 900 - 904 -

-

- 905 - 909 -

-

- 910 - 914 -

-

- 915 - 919 -

-

- 920 - 924 -

-

- 925 - 929 -

-

- 930 - 934 -

-

- 935 - 939 -

-

- 940 - 944 -

-

- 945 - 949 -

-

- 950 - 954 -

-

- 955 - 959 -

-

- 960 - 964 -

-

- 965 - 969 -

-

- 970 - 974 -

-

- 975 - 979 -

-

- 980 - 984 -

-

- 985 - 989 -

-

- 990 - 994 -

-

- 995 - 999 -

-

- 1000 - 1004 -

-

- 1005 - 1009 -

-

- 1010 - 1014 -

-

- 1015 - 1019 -

-

- 1020 - 1024 -

-

- 1025 - 1029 -

-

- 1030 - 1034 -

-

- 1035 - 1039 -

-

- 1040 - 1044 -

-

- 1045 - 1049 -

-

- 1050 - 1054 -

-

- 1055 - 1059 -

-

- 1060 - 1064 -

-

- 1065 - 1069 -

-

- 1070 - 1074 -

-

- 1075 - 1079 -

-

- 1080 - 1084 -

-

- 1085 - 1089 -

-

- 1090 - 1094 -

-

- 1095 - 1099 -

-

- 1100 - 1104 -

-

- 1105 - 1109 -

-

- 1110 - 1114 -

-

- 1115 - 1119 -

-

- 1120 - 1124 -

-

- 1125 - 1129 -

-

- 1130 - 1134 -

-

- 1135 - 1139 -

-

- 1140 - 1144 -

-

- 1145 - 1149 -

-

- 1150 - 1154 -

-

- 1155 - 1159 -

-

- 1160 - 1164 -

-

- 1165 - 1169 -

-

- 1170 - 1174 -

-

- 1175 - 1179 -

-

- 1180 - 1184 -

-

- 1185 - 1189 -

-

- 1190 - 1194 -

-

- 1195 - 1199 -

-

- 1200 - 1204 -

-

- 1205 - 1209 -

-

- 1210 - 1214 -

-

- 1215 - 1219 -

-

- 1220 - 1224 -

-

- 1225 - 1229 -

-

- 1230 - 1234 -

-

- 1235 - 1239 -

-

- 1240 - 1244 -

-

- 1245 - 1249 -

-

- 1250 - 1254 -

-

- 1255 - 1259 -

-

- 1260 - 1264 -

-

- 1265 - 1269 -

-

- 1270 - 1274 -

-

- 1275 - 1279 -

-

- 1280 - 1284 -

-

- 1285 - 1289 -

-

- 1290 - 1294 -

-

- 1295 - 1299 -

-

- 1300 - 1304 -

-

- 1305 - 1309 -

-

- 1310 - 1314 -

-

- 1315 - 1319 -

-

- 1320 - 1324 -

-

- 1325 - 1329 -

-

- 1330 - 1334 -

-

- 1335 - 1339 -

-

- 1340 - 1344 -

-

- 1345 - 1349 -

-

- 1350 - 1354 -

-

- 1355 - 1359 -

-

- 1360 - 1364 -

-

- 1365 - 1369 -

-

- 1370 - 1374 -

-

- 1375 - 1379 -

-

- 1380 - 1384 -

-

- 1385 - 1389 -

-

- 1390 - 1394 -

-

- 1395 - 1399 -

-

- 1400 - 1404 -

-

- 1405 - 1409 -

-

- 1410 - 1414 -

-

- 1415 - 1419 -

-

- 1420 - 1424 -

-

- 1425 - 1429 -

-

- 1430 - 1434 -

-

- 1435 - 1439 -

-

- 1440 - 1444 -

-

- 1445 - 1449 -

-

- 1450 - 1454 -

-

- 1455 - 1459 -

-

- 1460 - 1464 -

-

- 1465 - 1469 -

-

- 1470 - 1474 -

-

- 1475 - 1479 -

-

- 1480 - 1484 -

-

- 1485 - 1489 -

-

- 1490 - 1494 -

-

- 1495 - 1499 -

-

- 1500 - 1504 -

-

- 1505 - 1509 -

-

- 1510 - 1514 -

-

- 1515 - 1519 -

-

- 1520 - 1524 -

-

- 1525 - 1529 -

-

- 1530 - 1534 -

-

- 1535 - 1539 -

-

- 1540 - 1544 -

-

- 1545 - 1549 -

-

- 1550 - 1554 -

-

- 1555 - 1559 -

-

- 1560 - 1564 -

-

- 1565 - 1569 -

-

- 1570 - 1574 -

-

- 1575 - 1579 -

-

- 1580 - 1584 -

-

- 1585 - 1589 -

-

- 1590 - 1594 -

-

- 1595 - 1599 -

-

- 1600 - 1604 -

-

- 1605 - 1609 -

-

- 1610 - 1614 -

-

- 1615 - 1619 -

-

- 1620 - 1624 -

-

- 1625 - 1629 -

-

- 1630 - 1634 -

-

- 1635 - 1639 -

-

- 1640 - 1644 -

-

- 1645 - 1649 -

-

- 1650 - 1654 -

-

- 1655 - 1659 -

-

- 1660 - 1664 -

-

- 1665 - 1669 -

-

- 1670 - 1674 -

-

- 1675 - 1679 -

-

- 1680 - 1684 -

-

- 1685 - 1689 -

-

- 1690 - 1694 -

-

- 1695 - 1699 -

-

- 1700 - 1704 -

-

- 1705 - 1709 -

-

- 1710 - 1714 -

-

- 1715 - 1719 -

-

- 1720 - 1724 -

-

- 1725 - 1729 -

-

- 1730 - 1734 -

-

- 1735 - 1739 -

-

- 1740 - 1744 -

-

- 1745 - 1749 -

-

- 1750 - 1754 -

-

- 1755 - 1759 -

-

- 1760 - 1764 -

-

- 1765 - 1769 -

-

- 1770 - 1774 -

-

- 1775 - 1779 -

-

- 1780 - 1784 -

-

- 1785 - 1789 -

-

- 1790 - 1794 -

-

- 1795 - 1799 -

-

- 1800 - 1804 -

-

- 1805 - 1809 -

-

- 1810 - 1814 -

-

- 1815 - 1819 -

-

- 1820 - 1824 -

-

- 1825 - 1829 -

- - -

- This is the final caption. -

-
- -
diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/exp-golomb.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/exp-golomb.test.js deleted file mode 100644 index 83e602c57c..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/exp-golomb.test.js +++ /dev/null @@ -1,113 +0,0 @@ - /* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - assert.notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - assert.notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - assert.notStrictEqual(actual, expected, [message]) - assert.throws(block, [expected], [message]) - */ -var - buffer, - ExpGolomb = require('../lib/utils/exp-golomb'), - expGolomb; - -QUnit.module('Exponential Golomb coding'); - -QUnit.test('small numbers are coded correctly', function(assert) { - var - expected = [ - [0xF8, 0], - [0x5F, 1], - [0x7F, 2], - [0x27, 3], - [0x2F, 4], - [0x37, 5], - [0x3F, 6], - [0x11, 7], - [0x13, 8], - [0x15, 9] - ], - i = expected.length, - result; - - while (i--) { - buffer = new Uint8Array([expected[i][0]]); - expGolomb = new ExpGolomb(buffer); - result = expGolomb.readUnsignedExpGolomb(); - assert.equal(expected[i][1], result, expected[i][0] + ' is decoded to ' + expected[i][1]); - } -}); - -QUnit.test('drops working data as it is parsed', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x00, 0xFF])); - expGolomb.skipBits(8); - assert.equal(8, expGolomb.bitsAvailable(), '8 bits remain'); - assert.equal(0xFF, expGolomb.readBits(8), 'the second byte is read'); -}); - -QUnit.test('drops working data when skipping leading zeros', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x00, 0x00, 0x00, 0x00, 0xFF])); - assert.equal(32, expGolomb.skipLeadingZeros(), '32 leading zeros are dropped'); - assert.equal(8, expGolomb.bitsAvailable(), '8 bits remain'); - assert.equal(0xFF, expGolomb.readBits(8), 'the second byte is read'); -}); - -QUnit.test('drops working data when skipping leading zeros', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x15, 0xab, 0x40, 0xc8, 0xFF])); - assert.equal(3, expGolomb.skipLeadingZeros(), '3 leading zeros are dropped'); - assert.equal((8 * 4) + 5, expGolomb.bitsAvailable(), '37 bits remain'); - expGolomb.skipBits(1); - assert.equal(0x5a, expGolomb.readBits(8), 'the next bits are read'); -}); - -QUnit.test('skipBits correctly across word-boundaries', function(assert) { - var expGolomb = new ExpGolomb(new Uint8Array([0x15, 0x00, 0x00, 0x28, 0x00, 0x0a, 0x00, 0x00])); - assert.equal(expGolomb.readUnsignedExpGolomb(), 9, 'the first number is read'); - expGolomb.skipBits(17); - assert.equal(expGolomb.readUnsignedExpGolomb(), 4, 'the second number is read'); - expGolomb.skipBits(13); // Crosses word boundary - assert.equal(expGolomb.readUnsignedExpGolomb(), 4, 'the third number is read'); -}); - -QUnit.test('parses a sequence parameter set', function(assert) { - var - sps = new Uint8Array([ - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x35, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ]), - expGolomb = new ExpGolomb(sps); - - assert.strictEqual(expGolomb.readBits(8), 0x27, 'the NAL type specifies an SPS'); - assert.strictEqual(expGolomb.readBits(8), 66, 'profile_idc is 66'); - assert.strictEqual(expGolomb.readBits(4), 0x0E, 'constraints 0-3 are correct'); - - expGolomb.skipBits(4); - assert.strictEqual(expGolomb.readBits(8), 11, 'level_idc is 11'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 0, 'seq_parameter_set_id is 0'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 1, 'log2_max_frame_num_minus4 is 1'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 0, 'pic_order_cnt_type is 0'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 3, 'log2_max_pic_order_cnt_lsb_minus4 is 3'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 2, 'max_num_ref_frames is 2'); - assert.strictEqual(expGolomb.readBits(1), 0, 'gaps_in_frame_num_value_allowed_flag is false'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 11, 'pic_width_in_mbs_minus1 is 11'); - assert.strictEqual(expGolomb.readUnsignedExpGolomb(), 8, 'pic_height_in_map_units_minus1 is 8'); - assert.strictEqual(expGolomb.readBits(1), 1, 'frame_mbs_only_flag is true'); - assert.strictEqual(expGolomb.readBits(1), 1, 'direct_8x8_inference_flag is true'); - assert.strictEqual(expGolomb.readBits(1), 0, 'frame_cropping_flag is false'); -}); - diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/m2ts-probe.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/m2ts-probe.test.js deleted file mode 100644 index aedbb3d386..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/m2ts-probe.test.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - probe = require('../lib/m2ts/probe.js'), - testSegment = segments['test-segment.ts'](), - stuffedPesPacket = segments['test-stuffed-pes.ts'](); - -/** - * All subarray indices verified with the use of thumbcoil. - */ -var patPacket = testSegment.subarray(188, 376); -var pmtPid = 4095; -var programMapTable = { - 256: 0x1B, - 257: 0x0F -}; -var pmtPacket = testSegment.subarray(376, 564); -var pesPacket = testSegment.subarray(564, 752); -var videoPacket = testSegment.subarray(564, 1692); -var videoNoKeyFramePacket = testSegment.subarray(1880, 2820); -var audioPacket = testSegment.subarray(6956, 7144); -var notPusiPacket = testSegment.subarray(1316, 1504); - -QUnit.module('M2TS Probe'); - -QUnit.test('correctly parses packet type', function(assert) { - assert.equal(probe.parseType(patPacket), 'pat', 'parses pat type'); - assert.equal(probe.parseType(pmtPacket), null, - 'cannot determine type of pmt packet when pmt pid has not been parsed yet'); - assert.equal(probe.parseType(pmtPacket, pmtPid), 'pmt', 'parses pmt type'); - assert.equal(probe.parseType(pesPacket), null, - 'cannot determine type of pes packet when pmt pid has not been parsed yet'); - assert.equal(probe.parseType(pesPacket, pmtPid), 'pes', 'parses pes type'); -}); - -QUnit.test('correctly parses pmt pid from pat packet', function(assert) { - assert.equal(probe.parsePat(patPacket), pmtPid, 'parses pmt pid from pat'); -}); - -QUnit.test('correctly parses program map table from pmt packet', function(assert) { - assert.deepEqual(probe.parsePmt(pmtPacket), programMapTable, 'generates correct pmt'); -}); - -QUnit.test('correctly parses payload unit start indicator', function(assert) { - assert.ok(probe.parsePayloadUnitStartIndicator(pesPacket), - 'detects payload unit start indicator'); - assert.ok(!probe.parsePayloadUnitStartIndicator(notPusiPacket), - 'detects no payload unit start indicator'); -}); - -QUnit.test('correctly parses type of pes packet', function(assert) { - assert.equal(probe.parsePesType(videoPacket, programMapTable), 'video', - 'parses video pes type'); - assert.equal(probe.parsePesType(audioPacket, programMapTable), 'audio', - 'parses audio pes type'); -}); - -QUnit.test('correctly parses dts and pts values of pes packet', function(assert) { - var videoPes = probe.parsePesTime(videoPacket); - assert.equal(videoPes.dts, 126000, 'correct dts value'); - assert.equal(videoPes.pts, 126000, 'correct pts value'); - - videoPes = probe.parsePesTime(stuffedPesPacket); - assert.equal(videoPes, null, - 'correctly returned null when there is no packet data, only stuffing'); -}); - -QUnit.test('correctly determines if video pes packet contains a key frame', function(assert) { - assert.ok(probe.videoPacketContainsKeyFrame(videoPacket), 'detects key frame in packet'); - assert.ok(!probe.videoPacketContainsKeyFrame(videoNoKeyFramePacket), - 'detects no key frame in packet'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream-test-worker.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream-test-worker.js deleted file mode 100644 index 29e77f0ee8..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream-test-worker.js +++ /dev/null @@ -1,11 +0,0 @@ -var mp2t, metadataStream; - -mp2t = require('../lib/m2ts'); -metadataStream = new mp2t.MetadataStream(); - -self.addEventListener('message', function(e) { - metadataStream.on('data', function(data) { - self.postMessage(data); - }); - metadataStream.push(e.data); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream.test.js deleted file mode 100644 index 4b2c4db14d..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/metadata-stream.test.js +++ /dev/null @@ -1,732 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - ok(value, [message]) - equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ - -var metadataStream, stringToInts, stringToCString, id3Tag, id3Frame, id3Generator, mp2t, QUnit, - webworkify, MetadataStreamTestWorker; - -mp2t = require('../lib/m2ts'); -QUnit = require('qunit'); -id3Generator = require('./utils/id3-generator'); -MetadataStreamTestWorker = require('worker!./metadata-stream-test-worker.js'); -stringToInts = id3Generator.stringToInts; -stringToCString = id3Generator.stringToCString; -id3Tag = id3Generator.id3Tag; -id3Frame = id3Generator.id3Frame; - -QUnit.module('MetadataStream', { - beforeEach: function() { - metadataStream = new mp2t.MetadataStream(); - } -}); - -QUnit.test('can construct a MetadataStream', function(assert) { - assert.ok(metadataStream, 'does not return null'); -}); - -QUnit.test('triggers log for non-id3/invalid data', function(assert) { - var logs = []; - - metadataStream.on('log', function(log) { - logs.push(log); - }); - - // id3 not long enough - metadataStream.push({type: 'timed-metadata', data: new Uint8Array()}); - // invalid data - metadataStream.push({type: 'timed-metadata', data: new Uint8Array([ - 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01 - ])}); - const zeroFrames = new Uint8Array(stringToInts('ID3').concat([ - 0x03, 0x00, // version 3.0 of ID3v2 (aka ID3v.2.3.0) - 0x40, // flags. include an extended header - 0x00, 0x00, 0x00, 0x00, // size. set later - - // extended header - 0x00, 0x00, 0x00, 0x06, // extended header size. no CRC - 0x00, 0x00, // extended flags - 0x00, 0x00, 0x00, 0x02 // size of padding - ])); - - metadataStream.push({type: 'timed-metadata', data: zeroFrames}); - - assert.deepEqual(logs, [ - {level: 'warn', message: 'Skipping unrecognized metadata packet'}, - {level: 'warn', message: 'Skipping unrecognized metadata packet'}, - {level: 'warn', message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.'} - ], 'logs as expected.'); -}); - -QUnit.test('parses simple ID3 metadata out of PES packets', function(assert) { - var - events = [], - wxxxPayload = [ - 0x00 // text encoding. ISO-8859-1 - ].concat(stringToCString('ad tag URL'), // description - stringToInts('http://example.com/ad?v=1234&q=7')), // value - id3Bytes, - size; - - metadataStream.on('data', function(event) { - events.push(event); - }); - - id3Bytes = new Uint8Array(stringToInts('ID3').concat([ - 0x03, 0x00, // version 3.0 of ID3v2 (aka ID3v.2.3.0) - 0x40, // flags. include an extended header - 0x00, 0x00, 0x00, 0x00, // size. set later - - // extended header - 0x00, 0x00, 0x00, 0x06, // extended header size. no CRC - 0x00, 0x00, // extended flags - 0x00, 0x00, 0x00, 0x02 // size of padding - - // frame 0 - // http://id3.org/id3v2.3.0#User_defined_text_information_frame - ], id3Frame('WXXX', - wxxxPayload), // value - // frame 1 - // custom tag - id3Frame('XINF', - [ - 0x04, 0x03, 0x02, 0x01 // arbitrary data - ]), [ - 0x00, 0x00 // padding - ])); - - // set header size field - size = id3Bytes.byteLength - 10; - id3Bytes[6] = (size >>> 21) & 0x7f; - id3Bytes[7] = (size >>> 14) & 0x7f; - id3Bytes[8] = (size >>> 7) & 0x7f; - id3Bytes[9] = (size) & 0x7f; - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 1000, - - // header - data: id3Bytes - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 2, 'parsed two frames'); - assert.equal(events[0].frames[0].key, 'WXXX', 'parsed a WXXX frame'); - assert.deepEqual(new Uint8Array(events[0].frames[0].data), - new Uint8Array(wxxxPayload), - 'attached the frame payload'); - assert.equal(events[0].frames[1].key, 'XINF', 'parsed a user-defined frame'); - assert.deepEqual(new Uint8Array(events[0].frames[1].data), - new Uint8Array([0x04, 0x03, 0x02, 0x01]), - 'attached the frame payload'); - assert.equal(events[0].pts, 1000, 'did not modify the PTS'); - assert.equal(events[0].dts, 1000, 'did not modify the PTS'); -}); - -QUnit.test('skips non-ID3 metadata events', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 1000, - - // header - data: new Uint8Array([0]) - }); - - assert.equal(events.length, 0, 'did not emit an event'); -}); - -// missing cases: -// unsynchronization -// CRC -// no extended header -// compressed frames -// encrypted frames -// frame groups -// too large/small tag size values -// too large/small frame size values -QUnit.test('parses TXXX frames without null terminators', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToInts('{ "key": "value" }')), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'TXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(events[0].frames[0].data), { key: 'value' }, 'parsed the data'); -}); - -QUnit.test('parses TXXX frames with null terminators', function(assert) { - var events = []; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToCString('{ "key": "value" }')), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'TXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(events[0].frames[0].data), { key: 'value' }, 'parsed the data'); -}); - -QUnit.test('parses WXXX frames', function(assert) { - var events = [], url = 'http://example.com/path/file?abc=7&d=4#ty'; - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('WXXX', - 0x03, // utf-8 - stringToCString(''), - stringToInts(url)), - [0x00, 0x00])) - }); - - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames.length, 1, 'parsed one frame'); - assert.equal(events[0].frames[0].key, 'WXXX', 'parsed the frame key'); - assert.equal(events[0].frames[0].description, '', 'parsed the description'); - assert.equal(events[0].frames[0].url, url, 'parsed the value'); -}); - -QUnit.test('parses TXXX frames with characters that have a single-digit hexadecimal representation', function(assert) { - var events = [], value = String.fromCharCode(7); - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString(''), - stringToCString(value)), - [0x00, 0x00])) - }); - - assert.equal(events[0].frames[0].data, - value, - 'parsed the single-digit character'); -}); - -QUnit.test('parses PRIV frames', function(assert) { - var - events = [], - payload = stringToInts('arbitrary data may be included in the payload ' + - 'of a PRIV frame'); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - - // header - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('priv-owner@example.com'), - payload))) - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].key, 'PRIV', 'frame key is PRIV'); - assert.equal(events[0].frames[0].owner, 'priv-owner@example.com', 'parsed the owner'); - assert.deepEqual(new Uint8Array(events[0].frames[0].data), - new Uint8Array(payload), - 'parsed the frame private data'); - -}); - -QUnit.test('parses tags split across pushes', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - front = tag.subarray(0, 100), - back = tag.subarray(100); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: back, - dataAlignmentIndicator: false - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); - - // parses subsequent fragmented tags - tag = new Uint8Array(id3Tag(id3Frame('PRIV', - owner, payload, payload))); - front = tag.subarray(0, 188); - back = tag.subarray(188); - events = []; - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 2000, - dts: 2000, - data: front, - dataAlignmentIndicator: true - }); - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 2000, - dts: 2000, - data: back, - dataAlignmentIndicator: false - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - 2 * payload.length, - 'collected data across pushes'); -}); - -QUnit.test('id3 frame is malformed first time but gets corrected in the next frame', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - front = tag.subarray(0, 100); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - // receives incomplete id3 - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - // receives complete id3 - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: tag, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); -}); - -QUnit.test('id3 frame reports more data than its tagsize ', function(assert) { - var - events = [], - owner = stringToCString('owner@example.com'), - payload = stringToInts('A TS packet is 188 bytes in length so that it can' + - ' be easily transmitted over ATM networks, an ' + - 'important medium at one time. We want to be sure' + - ' that ID3 frames larger than a TS packet are ' + - 'properly re-assembled.'), - tag = new Uint8Array(id3Tag(id3Frame('PRIV', owner, payload))), - d = new Uint8Array([0x04, 0x05, 0x06]), - data = new Uint8Array(tag.byteLength + d.byteLength); - - data.set(tag); - data.set(d, tag.length); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: data, - dataAlignmentIndicator: true - }); - - assert.equal(events.length, 1, 'parsed a tag'); - assert.equal(events[0].frames.length, 1, 'parsed a frame'); - assert.equal(events[0].frames[0].data.byteLength, - payload.length, - 'collected data across pushes'); -}); - -QUnit.test('ignores tags when the header is fragmented', function(assert) { - - var - events = [], - tag = new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('owner@example.com'), - stringToInts('payload')))), - // split the 10-byte ID3 tag header in half - front = tag.subarray(0, 5), - back = tag.subarray(5); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: front - }); - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - data: back - }); - - assert.equal(events.length, 0, 'parsed zero tags'); - - metadataStream.push({ - type: 'timed-metadata', - trackId: 7, - pts: 1500, - dts: 1500, - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('owner2'), - stringToInts('payload2')))) - }); - assert.equal(events.length, 1, 'parsed one tag'); - assert.equal(events[0].frames[0].owner, 'owner2', 'dropped the first tag'); -}); - -// https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track -QUnit.test('constructs the dispatch type', function(assert) { - metadataStream = new mp2t.MetadataStream({ - descriptor: new Uint8Array([0x03, 0x02, 0x01, 0x00]) - }); - - assert.equal(metadataStream.dispatchType, '1503020100', 'built the dispatch type'); -}); - -QUnit.test('should skip tag frame parsing on malformed frame, preserving previous frames', function(assert) { - var events = [], - validFrame = id3Frame('TIT2', - 0x03, // utf-8 - stringToCString('sample title')), - malformedFrame = id3Frame('WOAF'), // frame with size of 0B - tag = id3Tag(validFrame, malformedFrame); - - metadataStream.on('data', function(event) { - events.push(event); - }); - - metadataStream.push({ - type: 'timed-metadata', - data: new Uint8Array(tag) - }) - - assert.equal(events.length, 1, 'parsed 1 tag') - assert.equal(events[0].frames.length, 1, 'parsed 1 frame'); - assert.equal(events[0].frames[0].key, 'TIT2'); -}); - -QUnit.test('can parse APIC frame in web worker', function(assert) { - var worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'APIC', 'frame key is APIC'); - assert.equal(e.data.frames[0].mimeType, 'image/jpeg', 'parsed MIME type is "image/jpeg"'); - assert.equal(e.data.frames[0].pictureType, 0x03, 'parsed picture type is 0x03'); - assert.equal(e.data.frames[0].description, 'sample description', 'parsed description'); - assert.deepEqual(e.data.frames[0].pictureData, new Uint8Array(stringToInts("picture binary data")), 'parsed picture data'); - assert.equal(e.data.frames[1].key, 'APIC', 'frame key is APIC'); - assert.equal(e.data.frames[1].mimeType, '-->', 'parsed MIME type is "-->"'); - assert.equal(e.data.frames[1].pictureType, 0x04, 'parsed picture type is 0x04'); - assert.equal(e.data.frames[1].description, 'sample description 2', 'parsed description'); - assert.equal(e.data.frames[1].url, 'http://example.org/cover-back.jpg', 'parsed picture data'); - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - data: new Uint8Array(id3Tag(id3Frame('APIC', - 0x03, // Text encoding: UTF-8 - stringToCString('image/jpeg'), // MIME type + \0 - 0x03, // Picture type: Cover (front) [ID3v2.4.0 section 4.14] - stringToCString('sample description'), // Decription + \0 - stringToInts('picture binary data') - ), - id3Frame('APIC', - 0x03, // Text encoding: UTF-8 - stringToCString('-->'), // MIME type: link to the image [ID3v2.4.0 section 4.14] + \0 - 0x04, // Picture type: Cover (back) [ID3v2.4.0 section 4.14] - stringToCString('sample description 2'), // Decription + \0 - stringToInts('http://example.org/cover-back.jpg') - ))) - }); -}); - -QUnit.test('can parse PRIV frames in web worker', function(assert) { - var payload = stringToInts('arbitrary'), - worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'PRIV', 'frame key is PRIV'); - assert.deepEqual(new Uint8Array(e.data.frames[0].data), new Uint8Array(payload), - 'parsed the frame private data'); - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - // header - data: new Uint8Array(id3Tag(id3Frame('PRIV', - stringToCString('priv-owner@example.com'), - payload))) - }); -}); - -QUnit.test('can parse TXXX frames in web worker', function(assert) { - var worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'TXXX', 'frame key is TXXX'); - assert.equal(e.data.frames[0].description, 'get done', 'parsed the description'); - assert.deepEqual(JSON.parse(e.data.frames[0].data), { key: 'value' }, 'parsed the data'); - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - trackId: 7, - pts: 1000, - dts: 900, - // header - data: new Uint8Array(id3Tag(id3Frame('TXXX', - 0x03, // utf-8 - stringToCString('get done'), - stringToCString('{ "key": "value" }')), - [0x00, 0x00])) - }); -}); - -QUnit.test('should parse text frames in web worker', function(assert) { - var worker = new MetadataStreamTestWorker(), - done = assert.async(); - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames.length, 2, 'got 2 frames'); - assert.equal(e.data.frames[0].key, 'TIT2', 'frame key is TIT2'); - assert.equal(e.data.frames[0].value, 'sample song title', 'parsed value') - assert.equal(e.data.frames[0].values.length, 1, 'parsed value is an array of size 1') - assert.equal(e.data.frames[0].values[0], 'sample song title', 'parsed a non multiple strings value') - assert.equal(e.data.frames[1].key, 'TIT3', 'frame key is TIT3'); - assert.equal(e.data.frames[1].value, 'sample title 1\0sample title 2', 'parsed value') - assert.equal(e.data.frames[1].values.length, 2, 'parsed value is an array of size 2') - assert.equal(e.data.frames[1].values[0], 'sample title 1', 'parsed 1st multiple strings value') - assert.equal(e.data.frames[1].values[1], 'sample title 2', 'parsed 2nd multiple strings value') - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - data: new Uint8Array(id3Tag(id3Frame('TIT2', - 0x03, // utf-8 - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - stringToCString('sample song title')), - id3Frame('TIT3', - 0x03, // utf-8 - // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.] - // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.] - stringToCString('sample title 1'), stringToCString('sample title 2')))) - }); -}); - -QUnit.test('should parse URL link frames in web worker', function(assert) { - var worker = new MetadataStreamTestWorker(), - done = assert.async(), - payloadBytes; - - // if the payload is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3] - payloadBytes = stringToInts('http://example.org\0 ignored \0 part') - - worker.addEventListener('message', function(e) { - assert.equal(e.data.frames[0].key, 'WOAF', 'frame key is WOAF'); - assert.equal(e.data.frames[0].url, 'http://example.org', 'parsed URL') - worker.terminate(); - done(); - }); - - worker.postMessage({ - type: 'timed-metadata', - data: new Uint8Array(id3Tag(id3Frame('WOAF', payloadBytes))) - }); -}); - -QUnit.test('triggers special event after parsing a timestamp ID3 tag', function(assert) { - var - array = new Uint8Array(73), - streamTimestamp = 'com.apple.streaming.transportStreamTimestamp', - priv = 'PRIV', - count = 0, - frame, - tag, - metadataStream, - chunk, - i; - - metadataStream = new mp2t.MetadataStream(); - metadataStream.on('timestamp', function(f) { - frame = f; - count += 1; - }); - metadataStream.on('data', function(t) { - tag = t; - }); - - array[0] = 73; - array[1] = 68; - array[2] = 51; - array[3] = 4; - array[9] = 63; - array[17] = 53; - array[70] = 13; - array[71] = 187; - array[72] = 160; - for (i = 0; i < priv.length; i++) { - array[i + 10] = priv.charCodeAt(i); - } - for (i = 0; i < streamTimestamp.length; i++) { - array[i + 20] = streamTimestamp.charCodeAt(i); - } - chunk = { - type: 'timed-metadata', - data: array - }; - - metadataStream.push(chunk); - assert.equal(count, 1, 'timestamp event triggered once'); - assert.equal(frame.timeStamp, 900000, 'Initial timestamp fired and calculated correctly'); - assert.equal(tag.pts, 10 * 90e3, 'set tag PTS'); - assert.equal(tag.dts, 10 * 90e3, 'set tag DTS'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-emsg.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-emsg.test.js deleted file mode 100644 index bc447f7b53..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-emsg.test.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -var QUnit = require('qunit'), - emsg = require('../lib/mp4/emsg'), - generateEmsgBoxData = require('./utils/mp4-helpers').generateEmsgBoxData, - messageData = new Uint8Array([0x64, 0x61, 0x74, 0x61]); // data; - -QUnit.module('EMSG Parsing'); - -QUnit.test('Can parse a v0 emsg box', function(assert) { - var boxData = generateEmsgBoxData(0, messageData); - var parsedBox = emsg.parseEmsgBox(boxData); - - assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'v0 box has expected scheme_id_uri'); - assert.equal(parsedBox.value, 'foo.bar.value\0', 'v0 box has expected value'); - assert.equal(parsedBox.timescale, 100, 'v0 box has expected timescale'); - assert.equal(parsedBox.presentation_time, undefined, 'v0 box has expected presentation_time'); - assert.equal(parsedBox.presentation_time_delta, 1000, 'v0 box has expected presentation_time_delta'); - assert.equal(parsedBox.event_duration, 0, 'v0 box has expected event_duration'); - assert.equal(parsedBox.id, 1, 'v0 box has expected id'); - assert.deepEqual(parsedBox.message_data, messageData, 'v0 box has expected data'); - -}); - -QUnit.test('Can parse a v1 emsg box', function(assert) { - var boxData = generateEmsgBoxData(1, messageData); - var parsedBox = emsg.parseEmsgBox(boxData); - - assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'v1 box has expected scheme_id_uri'); - assert.equal(parsedBox.value, 'foo.bar.value\0', 'v1 box has expected value'); - assert.equal(parsedBox.timescale, 100, 'v1 box has expected timescale'); - assert.equal(parsedBox.presentation_time, 10000, 'v1 box has expected presentation_time'); - assert.equal(parsedBox.presentation_time_delta, undefined, 'v1 box has expected presentation_time_delta'); - assert.equal(parsedBox.event_duration, 1, 'v1 box has expected event_duration'); - assert.equal(parsedBox.id, 2, 'v1 box has expected id'); - assert.deepEqual(parsedBox.message_data, messageData, 'v1 box has expected data'); -}); - -QUnit.test('Will return undefined if the emsg version is invalid', function(assert) { - var badBoxData = generateEmsgBoxData(2, messageData); - var parsedBox = emsg.parseEmsgBox(badBoxData); - assert.equal(parsedBox, undefined, 'parsed box is undefined'); -}); - -QUnit.test('Will return undefined if the emsg data is malformed', function(assert) { - var badBoxData = generateEmsgBoxData(3, messageData); - var parsedBox = emsg.parseEmsgBox(badBoxData); - assert.equal(parsedBox, undefined, 'malformed box is undefined'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-generator.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-generator.test.js deleted file mode 100644 index e2a0b1a211..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-generator.test.js +++ /dev/null @@ -1,582 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - QUnit.test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ -var - mp4 = require('../lib/mp4'), - tools = require('../lib/tools/mp4-inspector.js'), - QUnit = require('qunit'), - validateMvhd, validateTrak, validateTkhd, validateMdia, - validateMdhd, validateHdlr, validateMinf, validateDinf, - validateStbl, validateStsd, validateMvex, - validateVideoSample, validateAudioSample; - -QUnit.module('MP4 Generator'); - -QUnit.test('generates a BSMFF ftyp', function(assert) { - var data = mp4.generator.ftyp(), boxes; - - assert.ok(data, 'box is not null'); - - boxes = tools.inspect(data); - assert.equal(1, boxes.length, 'generated a single box'); - assert.equal(boxes[0].type, 'ftyp', 'generated ftyp type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].majorBrand, 'isom', 'major version is "isom"'); - assert.equal(boxes[0].minorVersion, 1, 'minor version is one'); -}); - -validateMvhd = function(mvhd) { - QUnit.assert.equal(mvhd.type, 'mvhd', 'generated a mvhd'); - QUnit.assert.equal(mvhd.duration, 0xffffffff, 'wrote the maximum movie header duration'); - QUnit.assert.equal(mvhd.nextTrackId, 0xffffffff, 'wrote the max next track id'); -}; - -validateTrak = function(trak, expected) { - expected = expected || {}; - QUnit.assert.equal(trak.type, 'trak', 'generated a trak'); - QUnit.assert.equal(trak.boxes.length, 2, 'generated two track sub boxes'); - - validateTkhd(trak.boxes[0], expected); - validateMdia(trak.boxes[1], expected); -}; - -validateTkhd = function(tkhd, expected) { - QUnit.assert.equal(tkhd.type, 'tkhd', 'generated a tkhd'); - QUnit.assert.equal(tkhd.trackId, 7, 'wrote the track id'); - QUnit.assert.deepEqual(tkhd.flags, new Uint8Array([0, 0, 7]), 'flags should QUnit.equal 7'); - QUnit.assert.equal(tkhd.duration, - expected.duration || Math.pow(2, 32) - 1, - 'wrote duration into the track header'); - QUnit.assert.equal(tkhd.width, expected.width || 0, 'wrote width into the track header'); - QUnit.assert.equal(tkhd.height, expected.height || 0, 'wrote height into the track header'); - QUnit.assert.equal(tkhd.volume, 1, 'set volume to 1'); -}; - -validateMdia = function(mdia, expected) { - QUnit.assert.equal(mdia.type, 'mdia', 'generated an mdia type'); - QUnit.assert.equal(mdia.boxes.length, 3, 'generated three track media sub boxes'); - - validateMdhd(mdia.boxes[0], expected); - validateHdlr(mdia.boxes[1], expected); - validateMinf(mdia.boxes[2], expected); -}; - -validateMdhd = function(mdhd, expected) { - QUnit.assert.equal(mdhd.type, 'mdhd', 'generate an mdhd type'); - QUnit.assert.equal(mdhd.language, 'und', 'wrote undetermined language'); - QUnit.assert.equal(mdhd.timescale, expected.timescale || 90000, 'wrote the timescale'); - QUnit.assert.equal(mdhd.duration, - expected.duration || Math.pow(2, 32) - 1, - 'wrote duration into the media header'); -}; - -validateHdlr = function(hdlr, expected) { - QUnit.assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - if (expected.type !== 'audio') { - QUnit.assert.equal(hdlr.handlerType, 'vide', 'wrote a video handler'); - QUnit.assert.equal(hdlr.name, 'VideoHandler', 'wrote the handler name'); - } else { - QUnit.assert.equal(hdlr.handlerType, 'soun', 'wrote a sound handler'); - QUnit.assert.equal(hdlr.name, 'SoundHandler', 'wrote the sound handler name'); - } -}; - -validateMinf = function(minf, expected) { - QUnit.assert.equal(minf.type, 'minf', 'generate an minf type'); - QUnit.assert.equal(minf.boxes.length, 3, 'generates three minf sub boxes'); - - if (expected.type !== 'audio') { - QUnit.assert.deepEqual({ - type: 'vmhd', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 1]), - graphicsmode: 0, - opcolor: new Uint16Array([0, 0, 0]) - }, minf.boxes[0], 'generates a vhmd'); - } else { - QUnit.assert.deepEqual({ - type: 'smhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - balance: 0 - }, minf.boxes[0], 'generates an smhd'); - } - - validateDinf(minf.boxes[1]); - validateStbl(minf.boxes[2], expected); -}; - -validateDinf = function(dinf) { - QUnit.assert.deepEqual({ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 0, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, dinf, 'generates a dinf'); -}; - -validateStbl = function(stbl, expected) { - QUnit.assert.equal(stbl.type, 'stbl', 'generates an stbl type'); - QUnit.assert.equal(stbl.boxes.length, 5, 'generated five stbl child boxes'); - - validateStsd(stbl.boxes[0], expected); - QUnit.assert.deepEqual({ - type: 'stts', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [] - }, stbl.boxes[1], 'generated an stts'); - QUnit.assert.deepEqual({ - type: 'stsc', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [] - }, stbl.boxes[2], 'generated an stsc'); - QUnit.assert.deepEqual({ - type: 'stsz', - version: 0, - size: 20, - flags: new Uint8Array([0, 0, 0]), - sampleSize: 0, - entries: [] - }, stbl.boxes[3], 'generated an stsz'); - QUnit.assert.deepEqual({ - type: 'stco', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [] - }, stbl.boxes[4], 'generated and stco'); -}; - -validateStsd = function(stsd, expected) { - QUnit.assert.equal(stsd.type, 'stsd', 'generated an stsd'); - QUnit.assert.equal(stsd.sampleDescriptions.length, 1, 'generated one sample'); - if (expected.type !== 'audio') { - validateVideoSample(stsd.sampleDescriptions[0]); - } else { - validateAudioSample(stsd.sampleDescriptions[0]); - } -}; - -validateVideoSample = function(sample) { - QUnit.assert.deepEqual(sample, { - type: 'avc1', - size: 152, - dataReferenceIndex: 1, - width: 600, - height: 300, - horizresolution: 72, - vertresolution: 72, - frameCount: 1, - depth: 24, - config: [{ - type: 'avcC', - size: 30, - configurationVersion: 1, - avcProfileIndication: 3, - avcLevelIndication: 5, - profileCompatibility: 7, - lengthSizeMinusOne: 3, - sps: [new Uint8Array([ - 0, 1, 2 - ]), new Uint8Array([ - 3, 4, 5 - ])], - pps: [new Uint8Array([ - 6, 7, 8 - ])] - }, { - type: 'btrt', - size: 20, - bufferSizeDB: 1875072, - maxBitrate: 3000000, - avgBitrate: 3000000 - }, { - type: 'pasp', - size: 16, - data: new Uint8Array([0, 0, 0, 1, 0, 0, 0, 1]) - }] - }, 'generated a video sample'); -}; - -validateAudioSample = function(sample) { - QUnit.assert.deepEqual(sample, { - type: 'mp4a', - size: 75, - dataReferenceIndex: 1, - channelcount: 2, - samplesize: 16, - samplerate: 48000, - streamDescriptor: { - type: 'esds', - version: 0, - flags: new Uint8Array([0, 0, 0]), - size: 39, - esId: 0, - streamPriority: 0, - // these values were hard-coded based on a working audio init segment - decoderConfig: { - avgBitrate: 56000, - maxBitrate: 56000, - bufferSize: 1536, - objectProfileIndication: 64, - streamType: 5, - decoderConfigDescriptor: { - audioObjectType: 2, - channelConfiguration: 2, - length: 2, - samplingFrequencyIndex: 3, - tag: 5 - } - } - } - }, 'generated an audio sample'); -}; - -validateMvex = function(mvex, options) { - options = options || { - sampleDegradationPriority: 1 - }; - QUnit.assert.deepEqual({ - type: 'mvex', - size: 40, - boxes: [{ - type: 'trex', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - trackId: 7, - defaultSampleDescriptionIndex: 1, - defaultSampleDuration: 0, - defaultSampleSize: 0, - sampleDependsOn: 0, - sampleIsDependedOn: 0, - sampleHasRedundancy: 0, - samplePaddingValue: 0, - sampleIsDifferenceSample: true, - sampleDegradationPriority: options.sampleDegradationPriority - }] - }, mvex, 'writes a movie extends box'); -}; - -QUnit.test('generates a video moov', function(assert) { - var - boxes, - data = mp4.generator.moov([{ - id: 7, - duration: 100, - width: 600, - height: 300, - type: 'video', - profileIdc: 3, - levelIdc: 5, - profileCompatibility: 7, - sarRatio: [1, 1], - sps: [new Uint8Array([0, 1, 2]), new Uint8Array([3, 4, 5])], - pps: [new Uint8Array([6, 7, 8])] - }]); - - assert.ok(data, 'box is not null'); - boxes = tools.inspect(data); - assert.equal(boxes.length, 1, 'generated a single box'); - assert.equal(boxes[0].type, 'moov', 'generated a moov type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].boxes.length, 3, 'generated three sub boxes'); - - validateMvhd(boxes[0].boxes[0]); - validateTrak(boxes[0].boxes[1], { - duration: 100, - width: 600, - height: 300 - }); - validateMvex(boxes[0].boxes[2]); -}); - -QUnit.test('generates an audio moov', function(assert) { - var - data = mp4.generator.moov([{ - id: 7, - type: 'audio', - audioobjecttype: 2, - channelcount: 2, - samplerate: 48000, - samplingfrequencyindex: 3, - samplesize: 16 - }]), - boxes; - - assert.ok(data, 'box is not null'); - boxes = tools.inspect(data); - assert.equal(boxes.length, 1, 'generated a single box'); - assert.equal(boxes[0].type, 'moov', 'generated a moov type'); - assert.equal(boxes[0].size, data.byteLength, 'generated size'); - assert.equal(boxes[0].boxes.length, 3, 'generated three sub boxes'); - - validateMvhd(boxes[0].boxes[0]); - validateTrak(boxes[0].boxes[1], { - type: 'audio', - timescale: 48000 - }); - validateMvex(boxes[0].boxes[2], { - sampleDegradationPriority: 0 - }); -}); - -QUnit.test('generates a sound hdlr', function(assert) { - var boxes, hdlr, - data = mp4.generator.moov([{ - duration: 100, - type: 'audio' - }]); - - assert.ok(data, 'box is not null'); - - boxes = tools.inspect(data); - - hdlr = boxes[0].boxes[1].boxes[1].boxes[1]; - assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - assert.equal(hdlr.handlerType, 'soun', 'wrote a sound handler'); - assert.equal(hdlr.name, 'SoundHandler', 'wrote the handler name'); -}); - -QUnit.test('generates a video hdlr', function(assert) { - var boxes, hdlr, - data = mp4.generator.moov([{ - duration: 100, - width: 600, - height: 300, - type: 'video', - sps: [], - pps: [] - }]); - - assert.ok(data, 'box is not null'); - - boxes = tools.inspect(data); - - hdlr = boxes[0].boxes[1].boxes[1].boxes[1]; - assert.equal(hdlr.type, 'hdlr', 'generate an hdlr type'); - assert.equal(hdlr.handlerType, 'vide', 'wrote a video handler'); - assert.equal(hdlr.name, 'VideoHandler', 'wrote the handler name'); -}); - -QUnit.test('generates an initialization segment', function(assert) { - var - data = mp4.generator.initSegment([{ - id: 1, - width: 600, - height: 300, - type: 'video', - sps: [new Uint8Array([0])], - pps: [new Uint8Array([1])] - }, { - id: 2, - type: 'audio' - }]), - init, mvhd, trak1, trak2, mvex; - - init = tools.inspect(data); - assert.equal(init.length, 2, 'generated two boxes'); - assert.equal(init[0].type, 'ftyp', 'generated a ftyp box'); - assert.equal(init[1].type, 'moov', 'generated a moov box'); - assert.equal(init[1].boxes[0].duration, 0xffffffff, 'wrote a maximum duration'); - - mvhd = init[1].boxes[0]; - assert.equal(mvhd.type, 'mvhd', 'wrote an mvhd'); - - trak1 = init[1].boxes[1]; - assert.equal(trak1.type, 'trak', 'wrote a trak'); - assert.equal(trak1.boxes[0].trackId, 1, 'wrote the first track id'); - assert.equal(trak1.boxes[0].width, 600, 'wrote the first track width'); - assert.equal(trak1.boxes[0].height, 300, 'wrote the first track height'); - assert.equal(trak1.boxes[1].boxes[1].handlerType, 'vide', 'wrote the first track type'); - - trak2 = init[1].boxes[2]; - assert.equal(trak2.type, 'trak', 'wrote a trak'); - assert.equal(trak2.boxes[0].trackId, 2, 'wrote the second track id'); - assert.equal(trak2.boxes[1].boxes[1].handlerType, 'soun', 'wrote the second track type'); - - mvex = init[1].boxes[3]; - assert.equal(mvex.type, 'mvex', 'wrote an mvex'); -}); - -QUnit.test('generates a minimal moof', function(assert) { - var - data = mp4.generator.moof(7, [{ - id: 17, - samples: [{ - duration: 9000, - size: 10, - flags: { - isLeading: 0, - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 14 - }, - compositionTimeOffset: 500 - }, { - duration: 10000, - size: 11, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 9 - }, - compositionTimeOffset: 1000 - }] - }]), - moof = tools.inspect(data), - trun, - sdtp; - - assert.equal(moof.length, 1, 'generated one box'); - assert.equal(moof[0].type, 'moof', 'generated a moof box'); - assert.equal(moof[0].boxes.length, 2, 'generated two child boxes'); - assert.equal(moof[0].boxes[0].type, 'mfhd', 'generated an mfhd box'); - assert.equal(moof[0].boxes[0].sequenceNumber, 7, 'included the sequence_number'); - assert.equal(moof[0].boxes[1].type, 'traf', 'generated a traf box'); - assert.equal(moof[0].boxes[1].boxes.length, 4, 'generated track fragment info'); - assert.equal(moof[0].boxes[1].boxes[0].type, 'tfhd', 'generated a tfhd box'); - assert.equal(moof[0].boxes[1].boxes[0].trackId, 17, 'wrote the first track id'); - assert.equal(moof[0].boxes[1].boxes[0].baseDataOffset, undefined, 'did not set a base data offset'); - - assert.equal(moof[0].boxes[1].boxes[1].type, 'tfdt', 'generated a tfdt box'); - assert.ok(moof[0].boxes[1].boxes[1].baseMediaDecodeTime >= 0, - 'media decode time is non-negative'); - - trun = moof[0].boxes[1].boxes[2]; - assert.equal(trun.type, 'trun', 'generated a trun box'); - assert.equal(typeof trun.dataOffset, 'number', 'has a data offset'); - assert.ok(trun.dataOffset >= 0, 'has a non-negative data offset'); - assert.equal(trun.dataOffset, moof[0].size + 8, 'sets the data offset past the mdat header'); - assert.equal(trun.samples.length, 2, 'wrote two samples'); - - assert.equal(trun.samples[0].duration, 9000, 'wrote a sample duration'); - assert.equal(trun.samples[0].size, 10, 'wrote a sample size'); - assert.deepEqual(trun.samples[0].flags, { - isLeading: 0, - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 14 - }, 'wrote the sample flags'); - assert.equal(trun.samples[0].compositionTimeOffset, 500, 'wrote the composition time offset'); - - assert.equal(trun.samples[1].duration, 10000, 'wrote a sample duration'); - assert.equal(trun.samples[1].size, 11, 'wrote a sample size'); - assert.deepEqual(trun.samples[1].flags, { - isLeading: 0, - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0, - paddingValue: 0, - isNonSyncSample: 0, - degradationPriority: 9 - }, 'wrote the sample flags'); - assert.equal(trun.samples[1].compositionTimeOffset, 1000, 'wrote the composition time offset'); - - sdtp = moof[0].boxes[1].boxes[3]; - assert.equal(sdtp.type, 'sdtp', 'generated an sdtp box'); - assert.equal(sdtp.samples.length, 2, 'wrote two samples'); - assert.deepEqual(sdtp.samples[0], { - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 0 - }, 'wrote the sample data table'); - assert.deepEqual(sdtp.samples[1], { - dependsOn: 1, - isDependedOn: 0, - hasRedundancy: 0 - }, 'wrote the sample data table'); -}); - -QUnit.test('generates a moof for audio', function(assert) { - var - data = mp4.generator.moof(7, [{ - id: 17, - type: 'audio', - samples: [{ - duration: 9000, - size: 10 - }, { - duration: 10000, - size: 11 - }] - }]), - moof = tools.inspect(data), - trun; - - assert.deepEqual(moof[0].boxes[1].boxes.length, 3, 'generated three traf children'); - trun = moof[0].boxes[1].boxes[2]; - assert.ok(trun, 'generated a trun'); - assert.equal(trun.dataOffset, data.byteLength + 8, 'calculated the data offset'); - assert.deepEqual(trun.samples, [{ - duration: 9000, - size: 10 - }, { - duration: 10000, - size: 11 - }], 'wrote simple audio samples'); -}); - -QUnit.test('can generate a traf without samples', function(assert) { - var - data = mp4.generator.moof(8, [{ - trackId: 13 - }]), - moof = tools.inspect(data); - - assert.equal(moof[0].boxes[1].boxes[2].samples.length, 0, 'generated no samples'); -}); - -QUnit.test('generates an mdat', function(assert) { - var - data = mp4.generator.mdat(new Uint8Array([1, 2, 3, 4])), - mdat = tools.inspect(data); - - assert.equal(mdat.length, 1, 'generated one box'); - assert.equal(mdat[0].type, 'mdat', 'generated an mdat box'); - assert.deepEqual(mdat[0].byteLength, 4, 'encapsulated the data'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-inspector.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-inspector.test.js deleted file mode 100644 index aa8e8e67b1..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-inspector.test.js +++ /dev/null @@ -1,1173 +0,0 @@ -'use strict'; -/* - ======== A Handy Little QUnit Reference ======== - http://api.qunitjs.com/ - - Test methods: - module(name, {[setup][ ,teardown]}) - QUnit.test(name, callback) - expect(numberOfAssertions) - stop(increment) - start(decrement) - Test assertions: - assert.ok(value, [message]) - assert.equal(actual, expected, [message]) - notEqual(actual, expected, [message]) - assert.deepEqual(actual, expected, [message]) - notDeepEqual(actual, expected, [message]) - assert.strictEqual(actual, expected, [message]) - notStrictEqual(actual, expected, [message]) - throws(block, [expected], [message]) -*/ -var - mp4 = require('../lib/mp4'), - mp4Helpers = require('./utils/mp4-helpers'), - QUnit = require('qunit'), - window = require('global/window'), - typeBytes = mp4Helpers.typeBytes, - box = mp4Helpers.box, - unityMatrix = mp4Helpers.unityMatrix, - BigInt = window.BigInt || Number, - - mvhd0 = box('mvhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x00, 0x00, 0x3c, // timescale - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - unityMatrix, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x00, 0x00, 0x00, 0x02), - - tkhd0 = box('tkhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x80, 0x00, // 300.5 in 16.16 fixed point - 0x00, 0x96, 0x80, 0x00), // 150.5 in 16.16 fixed point - mdhd0 = box('mdhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x3c, // timescale - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00); - -QUnit.module('MP4 Inspector'); - -QUnit.test('produces an empty array for empty input', function(assert) { - assert.strictEqual(mp4.tools.inspect(new Uint8Array([])).length, 0, 'returned an empty array'); -}); - -QUnit.test('can parse a Box', function(assert) { - var box = new Uint8Array([ - 0x00, 0x00, 0x00, 0x00, // size 0 - 0x00, 0x00, 0x00, 0x00 // boxtype 0 - ]); - assert.deepEqual(mp4.tools.inspect(box), [{ - type: '\u0000\u0000\u0000\u0000', - size: 0, - data: box.subarray(box.byteLength) - }], 'parsed a Box'); -}); - -QUnit.test('can parse an ftyp', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('ftyp', - 0x61, 0x76, 0x63, 0x31, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 111, 111, 112, // compatible brands - 98, 101, 101, 112 // compatible brands - ))), [{ - type: 'ftyp', - size: 4 * 6, - majorBrand: 'avc1', - minorVersion: 2, - compatibleBrands: ['boop', 'beep'] - }], 'parsed an ftyp'); -}); - -QUnit.test('can parse a pdin', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('pdin', - 0x01, // version 1 - 0x01, 0x02, 0x03, // flags - 0x00, 0x00, 0x04, 0x00, // 1024 = 0x400 bytes/second rate - 0x00, 0x00, 0x00, 0x01 // initial delay - ))), [{ - size: 20, - type: 'pdin', - version: 1, - flags: new Uint8Array([1, 2, 3]), - rate: 1024, - initialDelay: 1 - }], 'parsed a pdin'); -}); - -QUnit.test('can parse an mdat', function(assert) { - var mdat = new Uint8Array(box('mdat', - 0, 0, 0, 4, // length - 0x01, 0x02, 0x03, 0x04 // data - )); - assert.deepEqual(mp4.tools.inspect(mdat), [{ - size: 16, - type: 'mdat', - nals: [ - 'slice_layer_without_partitioning_rbsp' - ], - byteLength: 8 - }], 'parsed an mdat'); -}); - -QUnit.test('can parse a free or skip', function(assert) { - var - free = new Uint8Array(box('free', - 0x01, 0x02, 0x03, 0x04)), // data - skip = new Uint8Array(box('skip', - 0x01, 0x02, 0x03, 0x04)); // data - - assert.deepEqual(mp4.tools.inspect(free), [{ - size: 12, - type: 'free', - data: free.subarray(free.byteLength - 4) - }], 'parsed a free'); - assert.deepEqual(mp4.tools.inspect(skip), [{ - size: 12, - type: 'skip', - data: skip.subarray(skip.byteLength - 4) - }], 'parsed a skip'); -}); - -QUnit.test('can parse a version 0 mvhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mvhd0)), [{ - type: 'mvhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(1000 - 2082844800000), - modificationTime: new Date(2000 - 2082844800000), - timescale: 60, - duration: 600, - rate: 1, - volume: 1, - matrix: new Uint32Array(unityMatrix), - size: 108, - nextTrackId: 2 - }]); -}); - -QUnit.test('can parse a version 0 tkhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(tkhd0)), [{ - type: 'tkhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 92, - trackId: 1, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300.5, - height: 150.5 - }]); -}); - -QUnit.test('can parse a version 0 mdhd', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mdhd0)), [{ - type: 'mdhd', - version: 0, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 32, - timescale: 60, - duration: 600, - language: 'eng' - }]); -}); - -QUnit.test('can parse a moov', function(assert) { - var data = mp4Helpers.sampleMoov; - - QUnit.dump.maxDepth = 100; - var result = QUnit.dump.parse(mp4.tools.inspect(new Uint8Array(data))); - var expected = QUnit.dump.parse([{ - type: 'moov', - size: 1129, - boxes: [{ - type: 'mvhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(1000 - 2082844800000), - modificationTime: new Date(2000 - 2082844800000), - timescale: 1000, - duration: 600, - rate: 1, - size: 120, - volume: 1, - matrix: new Uint32Array(unityMatrix), - nextTrackId: 2 - }, { - type: 'trak', - size: 519, - boxes: [{ - type: 'tkhd', - flags: new Uint8Array([0, 0, 0]), - version: 1, - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 104, - trackId: 1, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300, - height: 150 - }, { - type: 'edts', - size: 36, - boxes: [{ - type: 'elst', - size: 28, - version: 0, - flags: new Uint8Array([0, 0, 0]), - edits: [{ - segmentDuration: 0, - mediaTime: 1024, - mediaRate: 1.5 - }] - }] - }, { - type: 'mdia', - size: 371, - boxes: [{ - type: 'mdhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - timescale: 90e3, - duration: 600, - language: 'eng', - size: 44 - }, { - type: 'hdlr', - version: 1, - flags: new Uint8Array([0, 0, 0]), - handlerType: 'vide', - name: 'one', - size: 37 - }, { - type: 'minf', - size: 282, - boxes: [{ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 1, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, { - type: 'stbl', - size: 238, - boxes: [{ - type: 'stsd', - size: 114, - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - config: [ - { - avcLevelIndication: 13, - avcProfileIndication: 77, - configurationVersion: 0, - lengthSizeMinusOne: 0, - pps: [], - profileCompatibility: 64, - size: 0, - sps: [], - type: 'avcC' - } - ], - dataReferenceIndex: 0, - depth: 0, - frameCount: 0, - height: 0, - horizresolution: 0, - size: 98, - type: 'avc1', - vertresolution: 0, - width: 0 - } - ] - }, { - type: 'stts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [{ - sampleCount: 1, - sampleDelta: 1 - }] - }, { - type: 'stsc', - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [{ - firstChunk: 2, - samplesPerChunk: 3, - sampleDescriptionIndex: 1 - }], - size: 28 - }, { - type: 'stco', - size: 20, - version: 1, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [1] - }, { - type: 'stss', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 0]), - syncSamples: [1] - }, { - type: 'ctts', - size: 24, - version: 0, - flags: new Uint8Array([0, 0, 0]), - compositionOffsets: [ - { sampleCount: 1, sampleOffset: 1 } - ] - }] - }] - }] - }] - }, { - type: 'trak', - size: 482, - boxes: [{ - type: 'tkhd', - flags: new Uint8Array([0, 0, 0]), - version: 1, - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - size: 104, - trackId: 2, - duration: 600, - layer: 0, - alternateGroup: 0, - volume: 0, - matrix: new Uint32Array(unityMatrix), - width: 300, - height: 150 - }, { - type: 'edts', - size: 44, - boxes: [{ - type: 'elst', - size: 36, - version: 1, - flags: new Uint8Array([0, 0, 0]), - edits: [{ - segmentDuration: 0, - mediaTime: BigInt('0x1000000000000000'), - mediaRate: 1.5 - }] - }] - }, { - type: 'mdia', - size: 326, - boxes: [{ - type: 'mdhd', - version: 1, - flags: new Uint8Array([0, 0, 0]), - creationTime: new Date(2000 - 2082844800000), - modificationTime: new Date(3000 - 2082844800000), - timescale: 90e3, - duration: 600, - language: 'eng', - size: 44 - }, { - type: 'hdlr', - version: 1, - flags: new Uint8Array([0, 0, 0]), - handlerType: 'soun', - name: 'one', - size: 37 - }, { - type: 'minf', - size: 237, - boxes: [{ - type: 'dinf', - size: 36, - boxes: [{ - type: 'dref', - size: 28, - version: 1, - flags: new Uint8Array([0, 0, 0]), - dataReferences: [{ - type: 'url ', - size: 12, - version: 0, - flags: new Uint8Array([0, 0, 1]) - }] - }] - }, { - type: 'stbl', - size: 193, - boxes: [{ - type: 'stsd', - size: 89, - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - channelcount: 0, - dataReferenceIndex: 0, - samplerate: 0, - samplesize: 0, - size: 73, - streamDescriptor: { - decoderConfig: { - avgBitrate: 0, - bufferSize: 0, - decoderConfigDescriptor: { - audioObjectType: 0, - channelConfiguration: 0, - length: 0, - samplingFrequencyIndex: 0, - tag: 0 - }, - maxBitrate: 0, - objectProfileIndication: 64, - streamType: 2 - }, - esId: 0, - flags: { - 0: 0, - 1: 0, - 2: 0 - }, - size: 0, - streamPriority: 0, - type: 'esds', - version: 0 - }, - type: 'mp4a' - }] - }, { - type: 'stts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - timeToSamples: [{ - sampleCount: 1, - sampleDelta: 1 - }] - }, { - type: 'stsc', - version: 1, - flags: new Uint8Array([0, 0, 0]), - sampleToChunks: [{ - firstChunk: 2, - samplesPerChunk: 3, - sampleDescriptionIndex: 1 - }], - size: 28 - }, { - type: 'ctts', - size: 24, - version: 1, - flags: new Uint8Array([0, 0, 0]), - compositionOffsets: [ - { sampleCount: 1, sampleOffset: -1 } - ] - }, { - type: 'stco', - size: 20, - version: 1, - flags: new Uint8Array([0, 0, 0]), - chunkOffsets: [1] - }] - }] - }] - }] - }] - }]); - assert.equal(result, expected, 'can parse moov'); -}); - -QUnit.test('can parse an mvex', function(assert) { - var mvex = - box('mvex', - box('trex', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x01, // default_sample_description_index - 0x00, 0x00, 0x00, 0x02, // default_sample_duration - 0x00, 0x00, 0x00, 0x03, // default_sample_size - 0x00, 0x61, 0x00, 0x01)); // default_sample_flags - assert.deepEqual(mp4.tools.inspect(new Uint8Array(mvex)), [{ - type: 'mvex', - size: 40, - boxes: [{ - type: 'trex', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - trackId: 1, - defaultSampleDescriptionIndex: 1, - defaultSampleDuration: 2, - defaultSampleSize: 3, - sampleDependsOn: 0, - sampleIsDependedOn: 1, - sampleHasRedundancy: 2, - samplePaddingValue: 0, - sampleIsDifferenceSample: true, - sampleDegradationPriority: 1 - }] - }], 'parsed an mvex'); -}); - -QUnit.test('can parse a video stsd', function(assert) { - var data = box('stsd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, - box('avc1', - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x01, 0x2c, // width = 300 - 0x00, 0x96, // height = 150 - 0x00, 0x48, 0x00, 0x00, // horizresolution - 0x00, 0x48, 0x00, 0x00, // vertresolution - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // frame_count - 0x04, - typeBytes('avc1'), - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // compressorname - 0x00, 0x18, // depth = 24 - 0x11, 0x11, // pre_defined - box('avcC', - 0x01, // configurationVersion - 0x00, // AVCProfileIndication?? - 0x00, // profile_compatibility - 0x00, // AVCLevelIndication - 0x1c, // lengthSizeMinusOne - 0xe1, // numOfSequenceParameterSets - 0x00, 0x01, // sequenceParameterSetLength - 0x00, // "SPS" - 0x02, // numOfPictureParameterSets - 0x00, 0x02, // pictureParameterSetLength - 0x01, 0x02, // "PPS" - 0x00, 0x01, // pictureParameterSetLength - 0xff), // "PPS" - box('btrt', - 0x00, 0x00, 0x00, 0x00, // bufferSizeDB - 0x00, 0x00, 0x00, 0x01, // maxBitrate - 0x00, 0x00, 0x00, 0x01), // avgBitrate - box('pasp', - 0x00, 0x00, 0x00, 0x01, // hSpacing - 0x00, 0x00, 0x00, 0x01))); // vSpacing - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - type: 'stsd', - size: 163, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleDescriptions: [{ - type: 'avc1', - size: 147, - dataReferenceIndex: 1, - width: 300, - height: 150, - horizresolution: 72, - vertresolution: 72, - frameCount: 1, - depth: 24, - config: [{ - type: 'avcC', - size: 25, - configurationVersion: 1, - avcProfileIndication: 0, - profileCompatibility: 0, - avcLevelIndication: 0, - lengthSizeMinusOne: 0, - sps: [new Uint8Array(1)], - pps: [new Uint8Array([1, 2]), - new Uint8Array([0xff])] - }, { - type: 'btrt', - size: 20, - bufferSizeDB: 0, - maxBitrate: 1, - avgBitrate: 1 - }, { - type: 'pasp', - size: 16, - data: new Uint8Array([0, 0, 0, 1, 0, 0, 0, 1]) - }] - }] - }]); -}); - -QUnit.test('can parse an audio stsd', function(assert) { - var data = box('stsd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('mp4a', - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // reserved - 0x00, 0x01, // data_reference_index - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x02, // channelcount - 0x00, 0x10, // samplesize - 0x00, 0x00, // pre_defined - 0x00, 0x00, // reserved - 0xbb, 0x80, 0x00, 0x00, // samplerate, fixed-point 16.16 - box('esds', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x03, // tag, ES_DescrTag - 0x00, // length - 0x00, 0x01, // ES_ID - 0x00, // streamDependenceFlag, URL_Flag, reserved, streamPriority - - // DecoderConfigDescriptor - 0x04, // tag, DecoderConfigDescrTag - 0x0d, // length - 0x40, // objectProfileIndication, AAC Main - 0x15, // streamType, AudioStream. upstream, reserved - 0x00, 0x00, 0xff, // bufferSizeDB - 0x00, 0x00, 0x00, 0xff, // maxBitrate - 0x00, 0x00, 0x00, 0xaa, // avgBitrate - - // DecoderSpecificInfo - 0x05, // tag, DecoderSpecificInfoTag - 0x02, // length - // audioObjectType, samplingFrequencyIndex, channelConfiguration - 0x11, 0x90, - // GASpecificConfig - 0x06, 0x01, 0x02))); - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - version: 0, - flags: new Uint8Array([0, 0, 0]), - type: 'stsd', - size: 91, - sampleDescriptions: [{ - type: 'mp4a', - dataReferenceIndex: 1, - channelcount: 2, - samplesize: 16, - samplerate: 48000, - size: 75, - streamDescriptor: { - type: 'esds', - version: 0, - size: 39, - flags: new Uint8Array([0, 0, 0]), - esId: 1, - streamPriority: 0, - decoderConfig: { - objectProfileIndication: 0x40, - streamType: 0x05, - bufferSize: 0xff, - maxBitrate: 0xff, - avgBitrate: 0xaa, - decoderConfigDescriptor: { - tag: 5, - length: 2, - audioObjectType: 2, - samplingFrequencyIndex: 3, - channelConfiguration: 2 - } - } - } - }] - }], 'parsed an audio stsd'); -}); - -QUnit.test('can parse an styp', function(assert) { - assert.deepEqual(mp4.tools.inspect(new Uint8Array(box('styp', - 0x61, 0x76, 0x63, 0x31, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 111, 111, 112 // compatible brands - ))), [{ - type: 'styp', - size: 4 * 5, - majorBrand: 'avc1', - minorVersion: 2, - compatibleBrands: ['boop'] - }], 'parsed an styp'); -}); - -QUnit.test('can parse a vmhd', function(assert) { - var data = box('vmhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, // graphicsmode - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00); // opcolor - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'vmhd', - size: 20, - version: 0, - flags: new Uint8Array([0, 0, 0]), - graphicsmode: 0, - opcolor: new Uint16Array([0, 0, 0]) - }]); -}); - -QUnit.test('can parse an stsz', function(assert) { - var data = box('stsz', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // sample_size - 0x00, 0x00, 0x00, 0x03, // sample_count - 0x00, 0x00, 0x00, 0x01, // entry_size - 0x00, 0x00, 0x00, 0x02, // entry_size - 0x00, 0x00, 0x00, 0x03); // entry_size - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'stsz', - size: 32, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sampleSize: 0, - entries: [1, 2, 3] - }]); -}); - -QUnit.test('can parse a moof', function(assert) { - var data = box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05))); // default_sample_flags - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'moof', - size: 72, - boxes: [{ - type: 'mfhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - sequenceNumber: 4 - }, - { - type: 'traf', - size: 48, - boxes: [{ - type: 'tfhd', - version: 0, - size: 40, - flags: new Uint8Array([0x00, 0, 0x3b]), - trackId: 1, - baseDataOffset: 1, - sampleDescriptionIndex: 2, - defaultSampleDuration: 3, - defaultSampleSize: 4, - defaultSampleFlags: 5 - }] - }] - }]); -}); - -QUnit.test('can parse a trun', function(assert) { - var data = box('trun', - 0x00, // version - 0x00, 0x0b, 0x05, // flags - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x01, // data_offset - // first_sample_flags - // r:0000 il:10 sdo:01 sido:10 shr:01 spv:111 snss:1 - // dp:1111 1110 1101 1100 - 0x09, 0x9f, 0xfe, 0xdc, - - 0x00, 0x00, 0x00, 0x09, // sample_duration - 0x00, 0x00, 0x00, 0xff, // sample_size - 0x00, 0x00, 0x00, 0x00, // sample_composition_time_offset - - 0x00, 0x00, 0x00, 0x08, // sample_duration - 0x00, 0x00, 0x00, 0xfe, // sample_size - 0x00, 0x00, 0x00, 0x00); // sample_composition_time_offset - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'trun', - version: 0, - size: 48, - flags: new Uint8Array([0, 0x0b, 0x05]), - dataOffset: 1, - samples: [{ - duration: 9, - size: 0xff, - flags: { - isLeading: 2, - dependsOn: 1, - isDependedOn: 2, - hasRedundancy: 1, - paddingValue: 7, - isNonSyncSample: 1, - degradationPriority: 0xfedc - }, - compositionTimeOffset: 0 - }, { - duration: 8, - size: 0xfe, - compositionTimeOffset: 0 - }] - }]); -}); - -QUnit.test('can parse a trun with per-sample flags', function(assert) { - var data = box('trun', - 0x00, // version - 0x00, 0x0f, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // sample_count - - 0x00, 0x00, 0x00, 0x09, // sample_duration - 0x00, 0x00, 0x00, 0xff, // sample_size - // sample_flags - // r:0000 il:00 sdo:01, sido:11 shr:00 spv:010 snss:0 - // dp: 0001 0010 0011 0100 - 0x01, 0xc4, 0x12, 0x34, - 0x00, 0x00, 0x00, 0x00); // sample_composition_time_offset - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'trun', - version: 0, - size: 32, - flags: new Uint8Array([0, 0x0f, 0x00]), - samples: [{ - duration: 9, - size: 0xff, - flags: { - isLeading: 0, - dependsOn: 1, - isDependedOn: 3, - hasRedundancy: 0, - paddingValue: 2, - isNonSyncSample: 0, - degradationPriority: 0x1234 - }, - compositionTimeOffset: 0 - }] - }]); - -}); - -QUnit.test('can parse an sdtp', function(assert) { - var data = box('sdtp', - 0x00, // version - 0x00, 0x00, 0x00, // flags - // reserved + sample_depends_on + - // sample_is_dependend_on + sample_has_redundancy - 0x15, - // reserved + sample_depends_on + - // sample_is_dependend_on + sample_has_redundancy - 0x27); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), [{ - type: 'sdtp', - version: 0, - flags: new Uint8Array([0, 0, 0]), - size: 14, - samples: [{ - dependsOn: 1, - isDependedOn: 1, - hasRedundancy: 1 - }, { - dependsOn: 2, - isDependedOn: 1, - hasRedundancy: 3 - }] - }]); -}); - -QUnit.test('can parse a sidx', function(assert) { - var data = box('sidx', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // reference_ID - 0x00, 0x00, 0x00, 0x01, // timescale - 0x01, 0x02, 0x03, 0x04, // earliest_presentation_time - 0x00, 0x00, 0x00, 0x00, // first_offset - 0x00, 0x00, // reserved - 0x00, 0x02, // reference_count - // first reference - 0x80, 0x00, 0x00, 0x07, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x08, // subsegment_duration - 0x80, 0x00, 0x00, 0x09, // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - // second reference - 0x00, 0x00, 0x00, 0x03, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x04, // subsegment_duration - 0x10, 0x00, 0x00, 0x05 // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - ); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'sidx', - version: 0, - flags: new Uint8Array([0, 0x00, 0x00]), - timescale: 1, - earliestPresentationTime: 0x01020304, - firstOffset: 0, - referenceId: 2, - size: 56, - references: [{ - referenceType: 1, - referencedSize: 7, - subsegmentDuration: 8, - startsWithSap: true, - sapType: 0, - sapDeltaTime: 9 - }, { - referenceType: 0, - referencedSize: 3, - subsegmentDuration: 4, - startsWithSap: false, - sapType: 1, - sapDeltaTime: 5 - }] - - }]); -}); - -QUnit.test('can parse a version 1 sidx', function(assert) { - var data = box('sidx', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // reference_ID - 0x00, 0x00, 0x00, 0x01, // timescale - 0x00, 0x00, 0x00, 0x00, // earliest_presentation_time - 0x01, 0x02, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x00, // first_offset - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, // reserved - 0x00, 0x02, // reference_count - // first reference - 0x80, 0x00, 0x00, 0x07, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x08, // subsegment_duration - 0x80, 0x00, 0x00, 0x09, // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - // second reference - 0x00, 0x00, 0x00, 0x03, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x04, // subsegment_duration - 0x10, 0x00, 0x00, 0x05 // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - ); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'sidx', - version: 1, - flags: new Uint8Array([0, 0x00, 0x00]), - timescale: 1, - earliestPresentationTime: 0x01020304, - firstOffset: 0, - referenceId: 2, - size: 64, - references: [{ - referenceType: 1, - referencedSize: 7, - subsegmentDuration: 8, - startsWithSap: true, - sapType: 0, - sapDeltaTime: 9 - }, { - referenceType: 0, - referencedSize: 3, - subsegmentDuration: 4, - startsWithSap: false, - sapType: 1, - sapDeltaTime: 5 - }] - - }]); -}); - -QUnit.test('can parse a big version 1 sidx', function(assert) { - var data = box('sidx', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // reference_ID - 0x00, 0x00, 0x00, 0x01, // timescale - 0x01, 0x02, 0x03, 0x04, // earliest_presentation_time - 0x05, 0x06, 0x07, 0x08, - 0x08, 0x07, 0x06, 0x05, // first_offset - 0x04, 0x03, 0x02, 0x01, - 0x00, 0x00, // reserved - 0x00, 0x02, // reference_count - // first reference - 0x80, 0x00, 0x00, 0x07, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x08, // subsegment_duration - 0x80, 0x00, 0x00, 0x09, // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - // second reference - 0x00, 0x00, 0x00, 0x03, // reference_type(1) + referenced_size(31) - 0x00, 0x00, 0x00, 0x04, // subsegment_duration - 0x10, 0x00, 0x00, 0x05 // starts_with_SAP(1) + SAP_type(3) + SAP_delta_time(28) - ); - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'sidx', - version: 1, - flags: new Uint8Array([0, 0x00, 0x00]), - timescale: 1, - earliestPresentationTime: BigInt('0x0102030405060708'), - firstOffset: BigInt('0x0807060504030201'), - referenceId: 2, - size: 64, - references: [{ - referenceType: 1, - referencedSize: 7, - subsegmentDuration: 8, - startsWithSap: true, - sapType: 0, - sapDeltaTime: 9 - }, { - referenceType: 0, - referencedSize: 3, - subsegmentDuration: 4, - startsWithSap: false, - sapType: 1, - sapDeltaTime: 5 - }] - - }]); -}); - -QUnit.test('can parse an smhd', function(assert) { - var data = box('smhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0xff, // balance, fixed-point 8.8 - 0x00, 0x00); // reserved - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'smhd', - size: 16, - version: 0, - flags: new Uint8Array([0, 0, 0]), - balance: 0xff / Math.pow(2, 8) - }], - 'parsed an smhd'); -}); - -QUnit.test('can parse a version 0 tfdt', function(assert) { - var data = box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04); // baseMediaDecodeTime - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'tfdt', - version: 0, - size: 16, - flags: new Uint8Array([0, 0, 0]), - baseMediaDecodeTime: 0x01020304 - }]); -}); - -QUnit.test('can parse a version 1 tfdt and return an unsigned integer value', function(assert) { - var data = box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x81, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, 0x08); // baseMediaDecodeTime - assert.deepEqual(mp4.tools.inspect(new Uint8Array(data)), - [{ - type: 'tfdt', - version: 1, - size: 20, - flags: new Uint8Array([0, 0, 0]), - baseMediaDecodeTime: BigInt('0x8102030405060708') - }]); -}); - -QUnit.test('can parse a series of boxes', function(assert) { - var ftyp = [ - 0x00, 0x00, 0x00, 0x18 // size 4 * 6 = 24 - ].concat(typeBytes('ftyp')).concat([ - 0x69, 0x73, 0x6f, 0x6d, // major brand - 0x00, 0x00, 0x00, 0x02, // minor version - 98, 101, 101, 112, // compatible brands - 98, 111, 111, 112 // compatible brands - ]); - - assert.deepEqual(mp4.tools.inspect(new Uint8Array(ftyp.concat(ftyp))), - [{ - type: 'ftyp', - size: 4 * 6, - majorBrand: 'isom', - minorVersion: 2, - compatibleBrands: ['beep', 'boop'] - }, { - type: 'ftyp', - size: 4 * 6, - majorBrand: 'isom', - minorVersion: 2, - compatibleBrands: ['beep', 'boop'] - }], - 'parsed two boxes in series'); - -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-probe.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-probe.test.js deleted file mode 100644 index db5f31efab..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/mp4-probe.test.js +++ /dev/null @@ -1,481 +0,0 @@ -'use strict'; - -var - QUnit = require('qunit'), - probe = require('../lib/mp4/probe'), - mp4Helpers = require('./utils/mp4-helpers'), - box = mp4Helpers.box, - id3 = require('./utils/id3-generator'), - - // defined below - moovWithoutMdhd, - moovWithoutTkhd, - moofWithTfdt, - multiMoof, - multiTraf, - noTrunSamples, - v1boxes; - -QUnit.module('MP4 Probe'); - -QUnit.test('reads the timescale from an mdhd', function(assert) { - // sampleMoov has a base timescale of 1000 with an override to 90kHz - // in the mdhd - assert.deepEqual(probe.timescale(new Uint8Array(mp4Helpers.sampleMoov)), { - 1: 90e3, - 2: 90e3 - }, 'found the timescale'); -}); - -QUnit.test('reads tracks', function(assert) { - var tracks = probe.tracks(new Uint8Array(mp4Helpers.sampleMoov)); - - assert.equal(tracks.length, 2, 'two tracks'); - assert.equal(tracks[0].codec, 'avc1.4d400d', 'codec is correct'); - assert.equal(tracks[0].id, 1, 'id is correct'); - assert.equal(tracks[0].type, 'video', 'type is correct'); - assert.equal(tracks[0].timescale, 90e3, 'timescale is correct'); - - assert.equal(tracks[1].codec, 'mp4a.40.2', 'codec is correct'); - assert.equal(tracks[1].id, 2, 'id is correct'); - assert.equal(tracks[1].type, 'audio', 'type is correct'); - assert.equal(tracks[1].timescale, 90e3, 'timescale is correct'); -}); - -QUnit.test('returns null if the tkhd is missing', function(assert) { - assert.equal(probe.timescale(new Uint8Array(moovWithoutTkhd)), null, 'indicated missing info'); -}); - -QUnit.test('returns null if the mdhd is missing', function(assert) { - assert.equal(probe.timescale(new Uint8Array(moovWithoutMdhd)), null, 'indicated missing info'); -}); - -QUnit.test('startTime reads the base decode time from a tfdt', function(assert) { - assert.equal(probe.startTime({ - 4: 2 - }, new Uint8Array(moofWithTfdt)), - 0x01020304 / 2, - 'calculated base decode time'); -}); - -QUnit.test('startTime returns the earliest base decode time', function(assert) { - assert.equal(probe.startTime({ - 4: 2, - 6: 1 - }, new Uint8Array(multiMoof)), - 0x01020304 / 2, - 'returned the earlier time'); -}); - -QUnit.test('startTime parses 64-bit base decode times', function(assert) { - assert.equal(probe.startTime({ - 4: 3 - }, new Uint8Array(v1boxes)), - 0x0101020304 / 3, - 'parsed a long value'); -}); - -QUnit.test('compositionStartTime calculates composition time using composition time' + - 'offset from first trun sample', function(assert) { - assert.equal(probe.compositionStartTime({ - 1: 6, - 4: 3 - }, new Uint8Array(moofWithTfdt)), - (0x01020304 + 10) / 3, - 'calculated correct composition start time'); -}); - -QUnit.test('compositionStartTime looks at only the first traf', function(assert) { - assert.equal(probe.compositionStartTime({ - 2: 6, - 4: 3 - }, new Uint8Array(multiTraf)), - (0x01020304 + 10) / 3, - 'calculated composition start time from first traf'); -}); - -QUnit.test('compositionStartTime uses default composition time offset of 0' + - 'if no trun samples present', function(assert) { - assert.equal(probe.compositionStartTime({ - 2: 6, - 4: 3 - }, new Uint8Array(noTrunSamples)), - (0x01020304 + 0) / 3, - 'calculated correct composition start time using default offset'); -}); - -QUnit.test('getTimescaleFromMediaHeader gets timescale for version 0 mdhd', function(assert) { - var mdhd = new Uint8Array([ - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - // version 0 has 32 bit creation_time, modification_time, and duration - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7 // 'eng' language - ]); - - assert.equal( - probe.getTimescaleFromMediaHeader(mdhd), - 1000, - 'got timescale from version 0 mdhd' - ); -}); - -QUnit.test('getTimescaleFromMediaHeader gets timescale for version 0 mdhd', function(assert) { - var mdhd = new Uint8Array([ - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - // version 1 has 64 bit creation_time, modification_time, and duration - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7 // 'eng' language - ]); - - assert.equal( - probe.getTimescaleFromMediaHeader(mdhd), - 1000, - 'got timescale from version 1 mdhd' - ); -}); - -QUnit.test('can get ID3 data from a v0 EMSG box', function(assert) { - var id3Data = new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', - id3.stringToCString('priv-owner@example.com'), - id3.stringToInts('foo.bar.id3.com'))) - ); - - var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, id3Data); - var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data))); - var emsgBoxes = probe.getEmsgID3(emsgId3Box, 10); - assert.equal(emsgBoxes[0].cueTime, 20, 'got correct emsg cueTime value from v0 emsg'); - assert.equal(emsgBoxes[0].duration, 0, 'got correct emsg duration value from v0 emsg'); - assert.equal(emsgBoxes[0].frames[0].id, 'PRIV' , 'got correct ID3 id'); - assert.equal(emsgBoxes[0].frames[0].owner, 'priv-owner@example.com', 'got correct ID3 owner'); - assert.deepEqual(emsgBoxes[0].frames[0].data, new Uint8Array(id3.stringToInts('foo.bar.id3.com')), 'got correct ID3 data'); -}); - -QUnit.test('can get ID3 data from a v1 EMSG box', function(assert) { - var id3Data = new Uint8Array(id3.id3Tag(id3.id3Frame('TXXX', - 0x03, // utf-8 - id3.stringToCString('foo bar'), - id3.stringToCString('{ "key": "value" }')), - [0x00, 0x00]) - ); - - var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, id3Data); - var emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data))); - var emsgBoxes = probe.getEmsgID3(emsgId3Box); - assert.equal(emsgBoxes[0].cueTime, 100, 'got correct emsg cueTime value from v1 emsg'); - assert.equal(emsgBoxes[0].duration, 0.01, 'got correct emsg duration value from v1 emsg'); - assert.equal(emsgBoxes[0].frames[0].id, 'TXXX' , 'got correct ID3 id'); - assert.equal(emsgBoxes[0].frames[0].description, 'foo bar', 'got correct ID3 description'); - assert.deepEqual(JSON.parse(emsgBoxes[0].frames[0].data), { key: 'value' }, 'got correct ID3 data'); -}); - -QUnit.test('can get ID3 data from multiple EMSG boxes', function(assert) { - var v1id3Data = new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', - id3.stringToCString('priv-owner@example.com'), - id3.stringToInts('foo.bar.id3.com'))) - ); - - var v0id3Data = new Uint8Array(id3.id3Tag(id3.id3Frame('TXXX', - 0x03, // utf-8 - id3.stringToCString('foo bar'), - id3.stringToCString('{ "key": "value" }')), - [0x00, 0x00]) - ); - - var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, v1id3Data); - var v1emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v1EmsgId3Data))); - - var v0EmsgId3Data = mp4Helpers.generateEmsgBoxData(0, v0id3Data); - var v0emsgId3Box = new Uint8Array(box('emsg', [].slice.call(v0EmsgId3Data))); - - var multiBoxData = new Uint8Array(v1emsgId3Box.length + v0emsgId3Box.length); - multiBoxData.set(v1emsgId3Box); - multiBoxData.set(v0emsgId3Box, v1emsgId3Box.length); - - var emsgBoxes = probe.getEmsgID3(multiBoxData); - - assert.equal(emsgBoxes[0].cueTime, 100, 'got correct emsg cueTime value from v1 emsg'); - assert.equal(emsgBoxes[0].duration, 0.01, 'got correct emsg duration value from v1 emsg'); - assert.equal(emsgBoxes[0].frames[0].id, 'PRIV' , 'got correct ID3 id'); - assert.equal(emsgBoxes[0].frames[0].owner, 'priv-owner@example.com', 'got correct ID3 owner'); - assert.deepEqual(emsgBoxes[0].frames[0].data, new Uint8Array(id3.stringToInts('foo.bar.id3.com')), 'got correct ID3 data'); - - - assert.equal(emsgBoxes[1].cueTime, 10, 'got correct emsg cueTime value from v0 emsg'); - assert.equal(emsgBoxes[1].duration, 0, 'got correct emsg duration value from v0 emsg'); - assert.equal(emsgBoxes[1].frames[0].id, 'TXXX' , 'got correct ID3 id'); - assert.equal(emsgBoxes[1].frames[0].description, 'foo bar', 'got correct ID3 description'); - assert.deepEqual(JSON.parse(emsgBoxes[1].frames[0].data),{ key: 'value' }, 'got correct ID3 data'); -}); - -// --------- -// Test Data -// --------- - -moovWithoutTkhd = - box('moov', - box('trak', - box('mdia', - box('mdhd', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x00, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - mp4Helpers.typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - mp4Helpers.typeBytes('one'), 0x00)))); // name - -moovWithoutMdhd = - box('moov', - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - mp4Helpers.unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('mdia', - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - mp4Helpers.typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - mp4Helpers.typeBytes('one'), 0x00)))); // name - -moofWithTfdt = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14))); // signed sample_composition_time_offset = 20 - -noTrunSamples = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x00, // sample_count - 0x00, 0x00, 0x00, 0x00))); // data_offset, no first_sample_flags - - -multiTraf = - box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a, // signed sample_composition_time_offset = 10 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14)), // signed sample_composition_time_offset = 20 - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x02, // track_ID = 2 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x01, 0x02), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0b, // signed sample_composition_time_offset = 11 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x05))); // signed sample_composition_time_offset = 5 - -multiMoof = moofWithTfdt - .concat(box('moof', - box('mfhd', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x00, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x06, // track_ID = 6 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x01, 0x02, 0x03, 0x04), // baseMediaDecodeTime - box('trun', - 0x00, // version - 0x00, 0x0f, 0x01, // flags: dataOffsetPresent, sampleDurationPresent, - // sampleSizePresent, sampleFlagsPresent, - // sampleCompositionTimeOffsetsPresent - 0x00, 0x00, 0x00, 0x02, // sample_count - 0x00, 0x00, 0x00, 0x00, // data_offset, no first_sample_flags - // sample 1 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x14, // signed sample_composition_time_offset = 20 - // sample 2 - 0x00, 0x00, 0x00, 0x0a, // sample_duration = 10 - 0x00, 0x00, 0x00, 0x0a, // sample_size = 10 - 0x00, 0x00, 0x00, 0x00, // sample_flags - 0x00, 0x00, 0x00, 0x0a)))); // signed sample_composition_time_offset = 10 -v1boxes = - box('moof', - box('mfhd', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x04), // sequence_number - box('traf', - box('tfhd', - 0x01, // version - 0x00, 0x00, 0x3b, // flags - 0x00, 0x00, 0x00, 0x04, // track_ID = 4 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // base_data_offset - 0x00, 0x00, 0x00, 0x02, // sample_description_index - 0x00, 0x00, 0x00, 0x03, // default_sample_duration, - 0x00, 0x00, 0x00, 0x04, // default_sample_size - 0x00, 0x00, 0x00, 0x05), - box('tfdt', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x03, 0x04))); // baseMediaDecodeTime diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/partial.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/partial.test.js deleted file mode 100644 index e7c5a28765..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/partial.test.js +++ /dev/null @@ -1,142 +0,0 @@ -var Transmuxer = require('../lib/partial/transmuxer.js'); -var utils = require('./utils'); -var generatePMT = utils.generatePMT; -var videoPes = utils.videoPes; -var audioPes = utils.audioPes; -var packetize = utils.packetize; -var PAT = utils.PAT; - -QUnit.module('Partial Transmuxer - Options'); -[ - {options: {keepOriginalTimestamps: false}}, - {options: {keepOriginalTimestamps: true}}, - {options: {keepOriginalTimestamps: false, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: true, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: false}, baseMediaSetter: 15000}, - {options: {keepOriginalTimestamps: true}, baseMediaSetter: 15000} -].forEach(function(test) { - var createTransmuxer = function() { - var transmuxer = new Transmuxer(test.options); - - if (test.baseMediaSetter) { - transmuxer.setBaseMediaDecodeTime(test.baseMediaSetter); - } - - return transmuxer; - }; - - var name = ''; - - Object.keys(test.options).forEach(function(optionName) { - name += '' + optionName + ' ' + test.options[optionName] + ' '; - }); - - if (test.baseMediaSetter) { - name += 'baseMediaDecodeTime setter ' + test.baseMediaSetter; - } - - QUnit.test('Audio frames after video not trimmed, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // not be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts + 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - // the partial transmuxer only generates a video segment - // when all audio frames are trimmed. So we should have an audio and video - // segment - assert.equal(segments.length, 2, 'generated a video and an audio segment'); - assert.equal(segments[0].type, 'video', 'video segment exists'); - assert.equal(segments[1].type, 'audio', 'audio segment exists'); - }); - - QUnit.test('Audio frames trimmed before video, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - baseTime = test.options.baseMediaDecodeTime || test.baseMediaSetter || 0, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts - baseTime - 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - // the partial transmuxer only generates a video segment - // when all audio frames are trimmed. - if (test.options.keepOriginalTimestamps && !baseTime) { - assert.equal(segments.length, 2, 'generated both a video/audio segment'); - assert.equal(segments[0].type, 'video', 'segment is video'); - assert.equal(segments[1].type, 'audio', 'segment is audio'); - } else { - assert.equal(segments.length, 1, 'generated only a video segment'); - assert.equal(segments[0].type, 'video', 'segment is video'); - } - }); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 deleted file mode 100644 index f22cffd2ab..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-init.mp4 and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s deleted file mode 100644 index be26d749c3..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/dash-608-captions-seg.m4s and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei-init.mp4 b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei-init.mp4 deleted file mode 100644 index 67c2d703b1..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei-init.mp4 and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei.m4s b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei.m4s deleted file mode 100644 index 706d9b66d4..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/malformed-sei.m4s and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/multi-channel-608-captions.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/multi-channel-608-captions.ts deleted file mode 100644 index 31dca2aa5c..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/multi-channel-608-captions.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/sintel-captions.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/sintel-captions.ts deleted file mode 100644 index cbcfb20358..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/sintel-captions.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-aac-segment.aac b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-aac-segment.aac deleted file mode 100644 index bf6148bc12..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-aac-segment.aac and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts deleted file mode 100644 index edcb9522f8..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-middle-pat-pmt.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-no-audio-segment.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-no-audio-segment.ts deleted file mode 100644 index 76df1f136b..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-no-audio-segment.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-segment.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-segment.ts deleted file mode 100644 index 383fbb4cbf..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-segment.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-stuffed-pes.ts b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-stuffed-pes.ts deleted file mode 100644 index 929974e0d7..0000000000 Binary files a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/segments/test-stuffed-pes.ts and /dev/null differ diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/stream.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/stream.test.js deleted file mode 100644 index 5e078333d9..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/stream.test.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -var - stream, - Stream = require('../lib/utils/stream'), - QUnit = require('qunit'); - -QUnit.module('Stream', { - beforeEach: function() { - stream = new Stream(); - stream.init(); - } -}); - -QUnit.test('trigger calls listeners', function(assert) { - var args = []; - - stream.on('test', function(data) { - args.push(data); - }); - - stream.trigger('test', 1); - stream.trigger('test', 2); - - assert.deepEqual(args, [1, 2]); -}); - -QUnit.test('callbacks can remove themselves', function(assert) { - var args1 = [], args2 = [], args3 = []; - - stream.on('test', function(event) { - args1.push(event); - }); - stream.on('test', function t(event) { - args2.push(event); - stream.off('test', t); - }); - stream.on('test', function(event) { - args3.push(event); - }); - - stream.trigger('test', 1); - stream.trigger('test', 2); - - assert.deepEqual(args1, [1, 2], 'first callback ran all times'); - assert.deepEqual(args2, [1], 'second callback removed after first run'); - assert.deepEqual(args3, [1, 2], 'third callback ran all times'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/transmuxer.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/transmuxer.test.js deleted file mode 100644 index df17f09278..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/transmuxer.test.js +++ /dev/null @@ -1,4664 +0,0 @@ -'use strict'; - -var segments = require('data-files!segments'); - -var mp2t = require('../lib/m2ts'), - codecs = require('../lib/codecs'), - flv = require('../lib/flv'), - id3Generator = require('./utils/id3-generator'), - mp4 = require('../lib/mp4'), - QUnit = require('qunit'), - testSegment = segments['test-segment.ts'](), - testMiddlePatPMT = segments['test-middle-pat-pmt.ts'](), - mp4Transmuxer = require('../lib/mp4/transmuxer'), - mp4AudioProperties = mp4Transmuxer.AUDIO_PROPERTIES, - mp4VideoProperties = mp4Transmuxer.VIDEO_PROPERTIES, - generateSegmentTimingInfo = mp4Transmuxer.generateSegmentTimingInfo, - clock = require('../lib/utils/clock'), - utils = require('./utils'), - TransportPacketStream = mp2t.TransportPacketStream, - transportPacketStream, - TransportParseStream = mp2t.TransportParseStream, - transportParseStream, - ElementaryStream = mp2t.ElementaryStream, - elementaryStream, - TimestampRolloverStream = mp2t.TimestampRolloverStream, - timestampRolloverStream, - H264Stream = codecs.h264.H264Stream, - h264Stream, - - VideoSegmentStream = mp4.VideoSegmentStream, - videoSegmentStream, - AudioSegmentStream = mp4.AudioSegmentStream, - audioSegmentStream, - - AdtsStream = codecs.Adts, - adtsStream, - Transmuxer = mp4.Transmuxer, - FlvTransmuxer = flv.Transmuxer, - transmuxer, - NalByteStream = codecs.h264.NalByteStream, - nalByteStream, - - H264_STREAM_TYPE = mp2t.H264_STREAM_TYPE, - ADTS_STREAM_TYPE = mp2t.ADTS_STREAM_TYPE, - METADATA_STREAM_TYPE = mp2t.METADATA_STREAM_TYPE, - - validateTrack, - validateTrackFragment, - - PMT = utils.PMT, - PAT = utils.PAT, - generatePMT = utils.generatePMT, - pesHeader = utils.pesHeader, - packetize = utils.packetize, - videoPes = utils.videoPes, - adtsFrame = utils.adtsFrame, - audioPes = utils.audioPes, - timedMetadataPes = utils.timedMetadataPes; - -mp4.tools = require('../lib/tools/mp4-inspector'); - -QUnit.module('MP2T Packet Stream', { - beforeEach: function() { - transportPacketStream = new TransportPacketStream(); - } -}); -QUnit.test('tester', function(assert) { - assert.ok(true, 'did not throw'); -}); -QUnit.test('empty input does not error', function(assert) { - transportPacketStream.push(new Uint8Array([])); - assert.ok(true, 'did not throw'); -}); -QUnit.test('parses a generic packet', function(assert) { - var - datas = [], - packet = new Uint8Array(188); - - packet[0] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - transportPacketStream.push(packet); - transportPacketStream.flush(); - - assert.equal(1, datas.length, 'fired one event'); - assert.equal(datas[0].byteLength, 188, 'delivered the packet'); -}); - -QUnit.test('buffers partial packets', function(assert) { - var - datas = [], - partialPacket1 = new Uint8Array(187), - partialPacket2 = new Uint8Array(189); - - partialPacket1[0] = 0x47; // Sync-byte - partialPacket2[1] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - transportPacketStream.push(partialPacket1); - - assert.equal(0, datas.length, 'did not fire an event'); - - transportPacketStream.push(partialPacket2); - transportPacketStream.flush(); - - assert.equal(2, datas.length, 'fired events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); -}); - -QUnit.test('parses multiple packets delivered at once', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 3); - - packetStream[0] = 0x47; // Sync-byte - packetStream[188] = 0x47; // Sync-byte - packetStream[376] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - transportPacketStream.flush(); - - assert.equal(3, datas.length, 'fired three events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); - assert.equal(188, datas[2].byteLength, 'parsed the third packet'); -}); - -QUnit.test('resyncs packets', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 3 - 2); - - packetStream[0] = 0x47; // Sync-byte - packetStream[186] = 0x47; // Sync-byte - packetStream[374] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - transportPacketStream.flush(); - - assert.equal(datas.length, 2, 'fired three events'); - assert.equal(datas[0].byteLength, 188, 'parsed the first packet'); - assert.equal(datas[1].byteLength, 188, 'parsed the second packet'); -}); - -QUnit.test('buffers extra after multiple packets', function(assert) { - var datas = [], packetStream = new Uint8Array(188 * 2 + 10); - - packetStream[0] = 0x47; // Sync-byte - packetStream[188] = 0x47; // Sync-byte - packetStream[376] = 0x47; // Sync-byte - - transportPacketStream.on('data', function(event) { - datas.push(event); - }); - - transportPacketStream.push(packetStream); - assert.equal(2, datas.length, 'fired three events'); - assert.equal(188, datas[0].byteLength, 'parsed the first packet'); - assert.equal(188, datas[1].byteLength, 'parsed the second packet'); - - transportPacketStream.push(new Uint8Array(178)); - transportPacketStream.flush(); - - assert.equal(3, datas.length, 'fired a final event'); - assert.equal(188, datas[2].length, 'parsed the finel packet'); -}); - -QUnit.module('MP2T TransportParseStream', { - beforeEach: function() { - transportPacketStream = new TransportPacketStream(); - transportParseStream = new TransportParseStream(); - - transportPacketStream.pipe(transportParseStream); - } -}); - -QUnit.test('parses generic packet properties', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(packetize(PAT)); - transportParseStream.push(packetize(generatePMT({}))); - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0001 tsc:01 afc:10 cc:11 padding: 00 - 0x40, 0x01, 0x6c - ])); - - assert.ok(packet.payloadUnitStartIndicator, 'parsed payload_unit_start_indicator'); - assert.ok(packet.pid, 'parsed PID'); -}); - -QUnit.test('parses piped data events', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(packetize(PAT)); - transportParseStream.push(packetize(generatePMT({}))); - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0001 tsc:01 afc:10 cc:11 padding: 00 - 0x40, 0x01, 0x6c - ])); - - assert.ok(packet, 'parsed a packet'); -}); - -QUnit.test('parses a data packet with adaptation fields', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0000 tsc:01 afc:10 cc:11 afl:00 0000 00 stuffing:00 0000 00 pscp:00 0001 padding:0000 - 0x40, 0x00, 0x6c, 0x00, 0x00, 0x10 - ])); - assert.strictEqual(packet.type, 'pat', 'parsed the packet type'); -}); - -QUnit.test('parses a PES packet', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - // setup a program map table - transportParseStream.programMapTable = { - video: 0x0010, - 'timed-metadata': {} - }; - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0010 tsc:01 afc:01 cc:11 padding:00 - 0x40, 0x02, 0x5c - ])); - assert.strictEqual(packet.type, 'pes', 'parsed a PES packet'); -}); - -QUnit.test('parses packets with variable length adaptation fields and a payload', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - // setup a program map table - transportParseStream.programMapTable = { - video: 0x0010, - 'timed-metadata': {} - }; - - transportParseStream.push(new Uint8Array([ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0010 tsc:01 afc:11 cc:11 afl:00 0000 11 stuffing:00 0000 0000 00 pscp:00 0001 - 0x40, 0x02, 0x7c, 0x0c, 0x00, 0x01 - ])); - assert.strictEqual(packet.type, 'pes', 'parsed a PES packet'); -}); - -QUnit.test('parses the program map table pid from the program association table (PAT)', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - - transportParseStream.push(new Uint8Array(PAT)); - assert.ok(packet, 'parsed a packet'); - assert.strictEqual(0x0010, transportParseStream.pmtPid, 'parsed PMT pid'); -}); - -QUnit.test('does not parse PES packets until after the PES has been parsed', function(assert) { - var pesCount = 0; - - transportParseStream.on('data', function(data) { - if (data.type === 'pmt') { - assert.equal(pesCount, 0, 'have not yet parsed any PES packets'); - } else if (data.type === 'pes') { - pesCount++; - } - }); - - transportPacketStream.push(testMiddlePatPMT); -}); - -QUnit.test('parse the elementary streams from a program map table', function(assert) { - var packet; - transportParseStream.on('data', function(data) { - packet = data; - }); - transportParseStream.pmtPid = 0x0010; - - transportParseStream.push(new Uint8Array(PMT.concat(0, 0, 0, 0, 0))); - - assert.ok(packet, 'parsed a packet'); - assert.ok(transportParseStream.programMapTable, 'parsed a program map'); - assert.strictEqual(transportParseStream.programMapTable.video, 0x11, 'associated h264 with pid 0x11'); - assert.strictEqual(transportParseStream.programMapTable.audio, 0x12, 'associated adts with pid 0x12'); - assert.deepEqual(transportParseStream.programMapTable, packet.programMapTable, 'recorded the PMT'); -}); - -QUnit.module('MP2T ElementaryStream', { - beforeEach: function() { - elementaryStream = new ElementaryStream(); - } -}); - -QUnit.test('parses metadata events from PSI packets', function(assert) { - var - metadatas = [], - datas = 0, - sortById = function(left, right) { - return left.id - right.id; - }; - elementaryStream.on('data', function(data) { - if (data.type === 'metadata') { - metadatas.push(data); - } - datas++; - }); - elementaryStream.push({ - type: 'pat' - }); - elementaryStream.push({ - type: 'pmt', - programMapTable: { - video: 1, - audio: 2, - 'timed-metadata': {} - } - }); - - assert.equal(1, datas, 'data fired'); - assert.equal(1, metadatas.length, 'metadata generated'); - metadatas[0].tracks.sort(sortById); - assert.deepEqual(metadatas[0].tracks, [{ - id: 1, - codec: 'avc', - type: 'video', - timelineStartInfo: { - baseMediaDecodeTime: 0 - } - }, { - id: 2, - codec: 'adts', - type: 'audio', - timelineStartInfo: { - baseMediaDecodeTime: 0 - } - }], 'identified two tracks'); -}); - -QUnit.test('parses standalone program stream packets', function(assert) { - var - packets = [], - packetData = [0x01, 0x02], - pesHead = pesHeader(false, 7, 2); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHead.concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(packets.length, 1, 'built one packet'); - assert.equal(packets[0].type, 'audio', 'identified audio data'); - assert.equal(packets[0].data.byteLength, packetData.length, 'parsed the correct payload size'); - assert.equal(packets[0].pts, 7, 'correctly parsed the pts value'); -}); - -QUnit.test('aggregates program stream packets from the transport stream', function(assert) { - var - events = [], - packetData = [0x01, 0x02], - pesHead = pesHeader(false, 7); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHead.slice(0, 4)) // Spread PES Header across packets - }); - - assert.equal(events.length, 0, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.slice(4).concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(events.length, 1, 'built one packet'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[0].pts, 7, 'correctly parsed the pts'); - assert.equal(events[0].data.byteLength, packetData.length, 'concatenated transport packets'); -}); - -QUnit.test('aggregates program stream packets from the transport stream with no header data', function(assert) { - var events = [] - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array([0x1, 0x2, 0x3]) - }); - - assert.equal(events.length, 0, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([0x4, 0x5, 0x6]) - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array([0x7, 0x8, 0x9]) - }); - elementaryStream.flush(); - - assert.equal(events.length, 1, 'built one packet'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[0].data.byteLength, 0, 'empty packet'); -}); - -QUnit.test('parses an elementary stream packet with just a pts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 1001 - 0x00, 0x00, 0x09, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:10 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0xc0, - // phdl:0000 0101 '0010' pts:111 mb:1 pts:1111 1111 - 0x05, 0xFF, 0xFF, - // pts:1111 111 mb:1 pts:1111 1111 pts:1111 111 mb:1 - 0xFF, 0xFF, 0xFF, - // "data":0101 - 0x11 - ]) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 1, 'parsed a single data byte'); - assert.equal(packet.data[0], 0x11, 'parsed the data'); - // 2^33-1 is the maximum value of a 33-bit unsigned value - assert.equal(packet.pts, Math.pow(2, 33) - 1, 'parsed the pts'); -}); - -QUnit.test('parses an elementary stream packet with a pts and dts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array([ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 1110 - 0x00, 0x00, 0x0e, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:11 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0xe0, - // phdl:0000 1010 '0011' pts:000 mb:1 pts:0000 0000 - 0x0a, 0x21, 0x00, - // pts:0000 000 mb:1 pts:0000 0000 pts:0000 100 mb:1 - 0x01, 0x00, 0x09, - // '0001' dts:000 mb:1 dts:0000 0000 dts:0000 000 mb:1 - 0x11, 0x00, 0x01, - // dts:0000 0000 dts:0000 010 mb:1 - 0x00, 0x05, - // "data":0101 - 0x11 - ]) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 1, 'parsed a single data byte'); - assert.equal(packet.data[0], 0x11, 'parsed the data'); - assert.equal(packet.pts, 4, 'parsed the pts'); - assert.equal(packet.dts, 2, 'parsed the dts'); -}); - -QUnit.test('parses an elementary stream packet without a pts or dts', function(assert) { - var packet; - elementaryStream.on('data', function(data) { - packet = data; - }); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeader().concat([0xaf, 0x01])) - }); - elementaryStream.flush(); - - assert.ok(packet, 'parsed a packet'); - assert.equal(packet.data.byteLength, 2, 'parsed two data bytes'); - assert.equal(packet.data[0], 0xaf, 'parsed the first data byte'); - assert.equal(packet.data[1], 0x01, 'parsed the second data byte'); - assert.ok(!packet.pts, 'did not parse a pts'); - assert.ok(!packet.dts, 'did not parse a dts'); -}); - -QUnit.test('won\'t emit non-video packets if the PES_packet_length is larger than the contents', function(assert) { - var events = []; - var pesHead = pesHeader(false, 1, 5); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - // data larger than 5 byte dataLength, should still emit event - data: new Uint8Array(pesHead.concat([1, 1, 1, 1, 1, 1, 1, 1, 1])) - }); - - assert.equal(0, events.length, 'buffers partial packets'); - - elementaryStream.flush(); - assert.equal(events.length, 2, 'emitted 2 packets'); - assert.equal(events[0].type, 'video', 'identified video data'); - assert.equal(events[1].type, 'timed-metadata', 'identified timed-metadata'); -}); - -QUnit.test('buffers audio and video program streams individually', function(assert) { - var events = []; - var pesHead = pesHeader(false, 1, 2); - - elementaryStream.on('data', function(event) { - events.push(event); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - assert.equal(0, events.length, 'buffers partial packets'); - - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(1) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(1) - }); - elementaryStream.flush(); - assert.equal(2, events.length, 'parsed a complete packet'); - assert.equal('video', events[0].type, 'identified video data'); - assert.equal('audio', events[1].type, 'identified audio data'); -}); - -QUnit.test('flushes the buffered packets when a new one of that type is started', function(assert) { - var packets = []; - var pesHead = pesHeader(false, 1, 2); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: ADTS_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1, 2])) - }); - elementaryStream.push({ - type: 'pes', - streamType: H264_STREAM_TYPE, - data: new Uint8Array(1) - }); - assert.equal(packets.length, 0, 'buffers packets by type'); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: H264_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([1])) - }); - assert.equal(packets.length, 1, 'built one packet'); - assert.equal(packets[0].type, 'video', 'identified video data'); - assert.equal(packets[0].data.byteLength, 2, 'concatenated packets'); - - elementaryStream.flush(); - assert.equal(packets.length, 3, 'built two more packets'); - assert.equal(packets[1].type, 'video', 'identified video data'); - assert.equal(packets[1].data.byteLength, 1, 'parsed the video payload'); - assert.equal(packets[2].type, 'audio', 'identified audio data'); - assert.equal(packets[2].data.byteLength, 2, 'parsed the audio payload'); -}); - -QUnit.test('buffers and emits timed-metadata', function(assert) { - var packets = []; - var pesHead = pesHeader(false, 1, 4); - - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([0, 1])) - }); - elementaryStream.push({ - type: 'pes', - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array([2, 3]) - }); - assert.equal(packets.length, 0, 'buffers metadata until the next start indicator'); - - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array(pesHead.concat([4, 5])) - }); - elementaryStream.push({ - type: 'pes', - streamType: METADATA_STREAM_TYPE, - data: new Uint8Array([6, 7]) - }); - assert.equal(packets.length, 1, 'built a packet'); - assert.equal(packets[0].type, 'timed-metadata', 'identified timed-metadata'); - assert.deepEqual(packets[0].data, new Uint8Array([0, 1, 2, 3]), 'concatenated the data'); - - elementaryStream.flush(); - assert.equal(packets.length, 2, 'flushed a packet'); - assert.equal(packets[1].type, 'timed-metadata', 'identified timed-metadata'); - assert.deepEqual(packets[1].data, new Uint8Array([4, 5, 6, 7]), 'included the data'); -}); - -QUnit.test('drops packets with unknown stream types', function(assert) { - var packets = []; - elementaryStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - data: new Uint8Array(1) - }); - elementaryStream.push({ - type: 'pes', - payloadUnitStartIndicator: true, - data: new Uint8Array(1) - }); - - assert.equal(packets.length, 0, 'ignored unknown packets'); -}); - -QUnit.module('MP2T TimestampRolloverStream', { - beforeEach: function() { - timestampRolloverStream = new TimestampRolloverStream('audio'); - elementaryStream = new ElementaryStream(); - elementaryStream.pipe(timestampRolloverStream); - } -}); - -QUnit.test('Correctly parses rollover PTS', function(assert) { - var - maxTS = 8589934592, - packets = [], - packetData = [0x01, 0x02], - pesHeadOne = pesHeader(false, maxTS - 400, 2), - pesHeadTwo = pesHeader(false, maxTS - 100, 2), - pesHeadThree = pesHeader(false, maxTS, 2), - pesHeadFour = pesHeader(false, 50, 2); - - timestampRolloverStream.on('data', function(packet) { - packets.push(packet); - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadOne.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadTwo.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadThree.concat(packetData)) - }); - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesHeadFour.concat(packetData)) - }); - elementaryStream.flush(); - - assert.equal(packets.length, 4, 'built four packets'); - assert.equal(packets[0].type, 'audio', 'identified audio data'); - assert.equal(packets[0].data.byteLength, packetData.length, 'parsed the correct payload size'); - assert.equal(packets[0].pts, maxTS - 400, 'correctly parsed the pts value'); - assert.equal(packets[1].pts, maxTS - 100, 'Does not rollover on minor change'); - assert.equal(packets[2].pts, maxTS, 'correctly parses the max pts value'); - assert.equal(packets[3].pts, maxTS + 50, 'correctly parsed the rollover pts value'); -}); - -QUnit.test('Correctly parses multiple PTS rollovers', function(assert) { - var - maxTS = 8589934592, - packets = [], - packetData = [0x01, 0x02], - pesArray = [pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2), - pesHeader(false, Math.floor(maxTS * (1 / 3)), 2), - pesHeader(false, Math.floor(maxTS * (2 / 3)), 2), - pesHeader(false, 1, 2)]; - - timestampRolloverStream.on('data', function(packet) { - packets.push(packet); - }); - - while (pesArray.length > 0) { - elementaryStream.push({ - type: 'pes', - streamType: ADTS_STREAM_TYPE, - payloadUnitStartIndicator: true, - data: new Uint8Array(pesArray.shift().concat(packetData)) - }); - elementaryStream.flush(); - } - - - assert.equal(packets.length, 10, 'built ten packets'); - assert.equal(packets[0].pts, 1, 'correctly parsed the pts value'); - assert.equal(packets[1].pts, Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[2].pts, Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[3].pts, maxTS + 1, 'correctly parsed the pts value'); - assert.equal(packets[4].pts, maxTS + Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[5].pts, maxTS + Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[6].pts, (2 * maxTS) + 1, 'correctly parsed the pts value'); - assert.equal(packets[7].pts, (2 * maxTS) + Math.floor(maxTS * (1 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[8].pts, (2 * maxTS) + Math.floor(maxTS * (2 / 3)), 'correctly parsed the pts value'); - assert.equal(packets[9].pts, (3 * maxTS) + 1, 'correctly parsed the pts value'); -}); - -QUnit.module('H264 Stream', { - beforeEach: function() { - h264Stream = new H264Stream(); - } -}); - -QUnit.test('properly parses seq_parameter_set_rbsp nal units', function(assert) { - var - data, - expectedRBSP = new Uint8Array([ - 0x42, 0xc0, 0x1e, 0xd9, - 0x00, 0xb4, 0x35, 0xf9, - 0xe1, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x3c, 0x0f, 0x16, 0x2e, - 0x48 - ]), - expectedConfig = { - profileIdc: 66, - levelIdc: 30, - profileCompatibility: 192, - width: 720, - height: 404, - sarRatio: [1, 1] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - // QUnit.test SPS: - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x42, 0xc0, 0x1e, - 0xd9, 0x00, 0xb4, 0x35, - 0xf9, 0xe1, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, - 0x00, 0x03, 0x00, 0x3c, - 0x0f, 0x16, 0x2e, 0x48, - 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.escapedRBSP, expectedRBSP, 'properly removed Emulation Prevention Bytes from the RBSP'); - - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set VUI nal unit', function(assert) { - var - data, - expectedConfig = { - profileIdc: 66, - levelIdc: 30, - profileCompatibility: 192, - width: 16, - height: 16, - sarRatio: [65528, 16384] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x42, 0xc0, 0x1e, - 0xd9, 0xff, 0xff, 0xff, - 0xff, 0xe1, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, - 0x00, 0x03, 0x00, 0x3c, - 0x0f, 0x16, 0x2e, 0x48, - 0xff, 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit with defined sarRatio', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 352, - height: 480, - sarRatio: [20, 11] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x60, 0xe2, 0x00, 0x00, - 0x07, 0xd2, 0x00, 0x01, - 0xd4, 0xc0, 0x1e, 0x2c, - 0x5b, 0x2c, 0x00, 0x00, - 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit with extended sarRatio', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 352, - height: 480, - sarRatio: [8, 7] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x7F, 0xe0, 0x01, 0x00, - 0x00, 0xf0, 0x00, 0x00, - 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('Properly parses seq_parameter_set nal unit without VUI', function(assert) { - var - data, - expectedConfig = { - profileIdc: 77, - levelIdc: 21, - profileCompatibility: 64, - width: 352, - height: 480, - sarRatio: [1, 1] - }; - - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x67, 0x4d, 0x40, 0x15, - 0xec, 0xa0, 0xb0, 0x7b, - 0x02, 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - assert.deepEqual(data.config, expectedConfig, 'parsed the sps'); -}); - -QUnit.test('unpacks nal units from simple byte stream framing', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // the simplest byte stream framing: - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00, 0x00, 0x01 - ]) - }); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 2, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('unpacks nal units from byte streams split across pushes', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // handles byte streams split across pushes - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, 0x06, 0x05, - 0x04 - ]) - }); - assert.ok(!data, 'buffers NAL units across events'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x03, 0x02, 0x01, - 0x00, 0x00, 0x01 - ]) - }); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 8, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('buffers nal unit trailing zeros across pushes', function(assert) { - var data = []; - h264Stream.on('data', function(event) { - data.push(event); - }); - - // lots of zeros after the nal, stretching into the next push - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00 - ]) - }); - assert.equal(data.length, 1, 'delivered the first nal'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, - 0x00, 0x00, 0x01, - 0x09, 0x06, - 0x00, 0x00, 0x01 - ]) - }); - assert.equal(data.length, 2, 'generated data events'); - assert.equal(data[0].data.length, 2, 'ignored trailing zeros'); - assert.equal(data[0].data[0], 0x09, 'found the first nal start'); - assert.equal(data[1].data.length, 2, 'found the following nal start'); - assert.equal(data[1].data[0], 0x09, 'found the second nal start'); -}); - -QUnit.test('unpacks nal units from byte streams with split sync points', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - // handles sync points split across pushes - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00]) - }); - assert.ok(!data, 'buffers NAL units across events'); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x01 - ]) - }); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data.data.length, 2, 'calculated nal unit length'); - assert.equal(data.data[1], 7, 'read a payload byte'); -}); - -QUnit.test('parses nal unit types', function(assert) { - var data; - h264Stream.on('data', function(event) { - data = event; - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09 - ]) - }); - h264Stream.flush(); - - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x07, - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x35, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'seq_parameter_set_rbsp', 'identified a sequence parameter set'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x08, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'pic_parameter_set_rbsp', 'identified a picture parameter set'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x05, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'slice_layer_without_partitioning_rbsp_idr', 'identified a key frame'); - - data = null; - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x06, 0x01 - ]) - }); - h264Stream.flush(); - assert.ok(data, 'generated a data event'); - assert.equal(data.nalUnitType, 'sei_rbsp', 'identified a supplemental enhancement information unit'); -}); - -// MP4 expects H264 (aka AVC) data to be in storage format. Storage -// format is optimized for reliable, random-access media in contrast -// to the byte stream format that retransmits metadata regularly to -// allow decoders to quickly begin operation from wherever in the -// broadcast they begin receiving. -// Details on the byte stream format can be found in Annex B of -// Recommendation ITU-T H.264. -// The storage format is described in ISO/IEC 14496-15 -QUnit.test('strips byte stream framing during parsing', function(assert) { - var data = []; - h264Stream.on('data', function(event) { - data.push(event); - }); - - h264Stream.push({ - type: 'video', - data: new Uint8Array([ - // -- NAL unit start - // zero_byte - 0x00, - // start_code_prefix_one_3bytes - 0x00, 0x00, 0x01, - // nal_unit_type (picture parameter set) - 0x08, - // fake data - 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, - // trailing_zero_8bits * 5 - 0x00, 0x00, 0x00, 0x00, - 0x00, - - // -- NAL unit start - // zero_byte - 0x00, - // start_code_prefix_one_3bytes - 0x00, 0x00, 0x01, - // nal_unit_type (access_unit_delimiter_rbsp) - 0x09, - // fake data - 0x06, 0x05, 0x04, 0x03, - 0x02, 0x01, 0x00 - ]) - }); - h264Stream.flush(); - - assert.equal(data.length, 2, 'parsed two NAL units'); - assert.deepEqual(new Uint8Array([ - 0x08, - 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07 - ]), new Uint8Array(data[0].data), 'parsed the first NAL unit'); - assert.deepEqual(new Uint8Array([ - 0x09, - 0x06, 0x05, 0x04, 0x03, - 0x02, 0x01, 0x00 - ]), new Uint8Array(data[1].data), 'parsed the second NAL unit'); -}); - -QUnit.test('can be reset', function(assert) { - var input = { - type: 'video', - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, - 0x09, 0x07, - 0x00, 0x00, 0x01 - ]) - }, data = []; - // only the laQUnit.test event is relevant for this QUnit.test - h264Stream.on('data', function(event) { - data.push(event); - }); - - h264Stream.push(input); - h264Stream.flush(); - h264Stream.push(input); - h264Stream.flush(); - - assert.equal(data.length, 2, 'generated two data events'); - assert.equal(data[1].nalUnitType, 'access_unit_delimiter_rbsp', 'identified an access unit delimiter'); - assert.equal(data[1].data.length, 2, 'calculated nal unit length'); - assert.equal(data[1].data[1], 7, 'read a payload byte'); -}); - -QUnit.module('VideoSegmentStream', { - beforeEach: function() { - var track = {}; - var options = {}; - videoSegmentStream = new VideoSegmentStream(track, options); - videoSegmentStream.track = track; - videoSegmentStream.options = options; - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: 0 - }; - } -}); - -// see ISO/IEC 14496-15, Section 5 "AVC elementary streams and sample definitions" -QUnit.test('concatenates NAL units into AVC elementary streams', function(assert) { - var segment, boxes; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - nalUnitType: 'access_unit_delimiter_rbsp', - data: new Uint8Array([0x09, 0x01]) - }); - videoSegmentStream.push({ - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - data: new Uint8Array([0x05, 0x01]) - }); - videoSegmentStream.push({ - data: new Uint8Array([ - 0x08, - 0x01, 0x02, 0x03 - ]) - }); - videoSegmentStream.push({ - data: new Uint8Array([ - 0x08, - 0x04, 0x03, 0x02, 0x01, 0x00 - ]) - }); - videoSegmentStream.flush(); - - assert.ok(segment, 'generated a data event'); - boxes = mp4.tools.inspect(segment); - assert.equal(boxes[1].byteLength, - (2 + 4) + (2 + 4) + (4 + 4) + (4 + 6), - 'wrote the correct number of bytes'); - assert.deepEqual(new Uint8Array(segment.subarray(boxes[0].size + 8)), new Uint8Array([ - 0, 0, 0, 2, - 0x09, 0x01, - 0, 0, 0, 2, - 0x05, 0x01, - 0, 0, 0, 4, - 0x08, 0x01, 0x02, 0x03, - 0, 0, 0, 6, - 0x08, 0x04, 0x03, 0x02, 0x01, 0x00 - ]), 'wrote an AVC stream into the mdat'); -}); - -QUnit.test('infers sample durations from DTS values', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4 - }); - videoSegmentStream.flush(); - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 3, 'generated three samples'); - assert.equal(samples[0].duration, 1, 'set the first sample duration'); - assert.equal(samples[1].duration, 2, 'set the second sample duration'); - assert.equal(samples[2].duration, 2, 'inferred the final sample duration'); -}); - -QUnit.test('filters pre-IDR samples and calculate duration correctly', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 2, 'generated two samples, filters out pre-IDR'); - assert.equal(samples[0].duration, 3, 'set the first sample duration'); - assert.equal(samples[1].duration, 3, 'set the second sample duration'); -}); - -QUnit.test('holds onto the last GOP and prepends the subsequent push operation with that GOP', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.track.timelineStartInfo.dts = 0; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 4, 'generated four samples, two from previous segment'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); - assert.equal(samples[1].size, 6, 'second sample is an AUD'); - assert.equal(samples[2].size, 6, 'third sample is an AUD'); - assert.equal(samples[3].size, 24, 'fourth sample is an AUD + PPS + SPS + IDR'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment has earlier PTS', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 10, - pts: 10 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 10, - pts: 10 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 11, - pts: 11 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 12, - pts: 12 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 12, - pts: 12 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 13, - pts: 13 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment has different PPS or SPS', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x00]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 5, - pts: 5 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 6, - pts: 6 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x01]), - nalUnitType: 'seq_parameter_set_rbsp', - config: {}, - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x00, 0x01]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 6, - pts: 6 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 24, 'first sample is an AUD + PPS + SPS + IDR'); -}); - -QUnit.test('doesn\'t prepend the last GOP if the next segment is more than 1 seconds in the future', function(assert) { - var segment, boxes, samples; - - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x66, 0x66]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 2, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x03]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x99, 0x99]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 3, - pts: 3 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01, 0x04]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 4, - pts: 4 - }); - videoSegmentStream.flush(); - - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1000000, - pts: 1000000 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02, 0x02]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1000001, - pts: 1000001 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x11, 0x11]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1000001, - pts: 1000001 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 1, 'generated one sample'); - assert.equal(samples[0].size, 12, 'first sample is an AUD + IDR pair'); -}); - -QUnit.test('track values from seq_parameter_set_rbsp should be cleared by a flush', function(assert) { - var track; - videoSegmentStream.on('data', function(data) { - track = data.track; - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'access_unit_delimiter_rbsp' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 123, - height: 321, - profileIdc: 1, - levelIdc: 2, - profileCompatibility: 3 - }, - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x88]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 1234, - height: 4321, - profileIdc: 4, - levelIdc: 5, - profileCompatibility: 6 - }, - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.width, 123, 'width is set by first SPS'); - assert.equal(track.height, 321, 'height is set by first SPS'); - assert.equal(track.sps[0][0], 0xFF, 'first sps is 0xFF'); - assert.equal(track.profileIdc, 1, 'profileIdc is set by first SPS'); - assert.equal(track.levelIdc, 2, 'levelIdc is set by first SPS'); - assert.equal(track.profileCompatibility, 3, 'profileCompatibility is set by first SPS'); - - videoSegmentStream.push({ - data: new Uint8Array([0x99]), - nalUnitType: 'seq_parameter_set_rbsp', - config: { - width: 300, - height: 200, - profileIdc: 11, - levelIdc: 12, - profileCompatibility: 13 - }, - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.width, 300, 'width is set by first SPS after flush'); - assert.equal(track.height, 200, 'height is set by first SPS after flush'); - assert.equal(track.sps.length, 1, 'there is one sps'); - assert.equal(track.sps[0][0], 0x99, 'first sps is 0x99'); - assert.equal(track.profileIdc, 11, 'profileIdc is set by first SPS after flush'); - assert.equal(track.levelIdc, 12, 'levelIdc is set by first SPS after flush'); - assert.equal(track.profileCompatibility, 13, 'profileCompatibility is set by first SPS after flush'); -}); - -QUnit.test('track pps from pic_parameter_set_rbsp should be cleared by a flush', function(assert) { - var track; - videoSegmentStream.on('data', function(data) { - track = data.track; - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'access_unit_delimiter_rbsp' - }); - videoSegmentStream.push({ - data: new Uint8Array([0xFF]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr' - }); - videoSegmentStream.push({ - data: new Uint8Array([0x01]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x02]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.pps[0][0], 0x01, 'first pps is 0x01'); - - videoSegmentStream.push({ - data: new Uint8Array([0x03]), - nalUnitType: 'pic_parameter_set_rbsp', - dts: 1 - }); - videoSegmentStream.flush(); - - assert.equal(track.pps[0][0], 0x03, 'first pps is 0x03 after a flush'); -}); - -QUnit.test('calculates compositionTimeOffset values from the PTS/DTS', function(assert) { - var segment, boxes, samples; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 1 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 2 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 1, - pts: 4 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - samples = boxes[0].boxes[1].boxes[2].samples; - assert.equal(samples.length, 3, 'generated three samples'); - assert.equal(samples[0].compositionTimeOffset, 0, 'calculated compositionTimeOffset'); - assert.equal(samples[1].compositionTimeOffset, 1, 'calculated compositionTimeOffset'); - assert.equal(samples[2].compositionTimeOffset, 3, 'calculated compositionTimeOffset'); -}); - -QUnit.test('calculates baseMediaDecodeTime values from the first DTS ever seen and subsequent segments\' lowest DTS', function(assert) { - var segment, boxes, tfdt; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - assert.equal(tfdt.baseMediaDecodeTime, 90, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('doesn\'t adjust baseMediaDecodeTime when configured to keep original timestamps', function(assert) { - videoSegmentStream.options.keepOriginalTimestamps = true; - - var segment, boxes, tfdt; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - assert.equal(tfdt.baseMediaDecodeTime, 100, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('calculates baseMediaDecodeTime values relative to a customizable baseMediaDecodeTime', function(assert) { - var segment, boxes, tfdt, baseMediaDecodeTimeValue; - - // Set the baseMediaDecodeTime to something over 2^32 to ensure - // that the version 1 TFDT box is being created correctly - baseMediaDecodeTimeValue = Math.pow(2, 32) + 100; - - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: baseMediaDecodeTimeValue - }; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 100, - pts: 100 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 200, - pts: 200 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 300, - pts: 300 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - - // The timeline begins at 10 and the first sample has a dts of - // 100, so the baseMediaDecodeTime should be equal to (100 - 10) - assert.equal(tfdt.baseMediaDecodeTime, baseMediaDecodeTimeValue + 90, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('do not subtract the first frame\'s compositionTimeOffset from baseMediaDecodeTime', function(assert) { - var segment, boxes, tfdt; - videoSegmentStream.track.timelineStartInfo = { - dts: 10, - pts: 10, - baseMediaDecodeTime: 100 - }; - videoSegmentStream.on('data', function(data) { - segment = data.boxes; - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 50, - pts: 60 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: 50, - pts: 60 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 110 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 150, - pts: 160 - }); - videoSegmentStream.flush(); - - boxes = mp4.tools.inspect(segment); - tfdt = boxes[0].boxes[1].boxes[1]; - - // The timelineStartInfo's bMDT is 100 and that corresponds to a dts/pts of 10 - // The first frame has a dts 50 so the bMDT is calculated as: (50 - 10) + 100 = 140 - assert.equal(tfdt.baseMediaDecodeTime, 140, 'calculated baseMediaDecodeTime'); -}); - -QUnit.test('video segment stream triggers segmentTimingInfo with timing info', -function(assert) { - var - segmentTimingInfoArr = [], - baseMediaDecodeTime = 40, - startingDts = 50, - startingPts = 60, - lastFrameStartDts = 150, - lastFrameStartPts = 160; - - videoSegmentStream.on('segmentTimingInfo', function(segmentTimingInfo) { - segmentTimingInfoArr.push(segmentTimingInfo); - }); - - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: startingDts, - pts: startingPts - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'slice_layer_without_partitioning_rbsp_idr', - dts: startingDts, - pts: startingPts - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: 100, - pts: 110 - }); - videoSegmentStream.push({ - data: new Uint8Array([0x09, 0x01]), - nalUnitType: 'access_unit_delimiter_rbsp', - dts: lastFrameStartDts, - pts: lastFrameStartPts - }); - videoSegmentStream.flush(); - - assert.equal(segmentTimingInfoArr.length, 1, 'triggered segmentTimingInfo once'); - assert.equal( - baseMediaDecodeTime, - segmentTimingInfoArr[0].baseMediaDecodeTime, - 'set baseMediaDecodeTime' - ); - assert.deepEqual(segmentTimingInfoArr[0], { - start: { - // baseMediaDecodeTime - dts: 40, - // baseMediaDecodeTime + startingPts - startingDts - pts: 40 + 60 - 50 - }, - end: { - // because no duration is provided in this test, the duration will instead be based - // on the previous frame, which will be the start of this frame minus the end of the - // last frame, or 150 - 100 = 50, which gets added to lastFrameStartDts - startDts = - // 150 - 50 = 100 - // + baseMediaDecodeTime - dts: 40 + 100 + 50, - pts: 40 + 100 + 50 - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTime - }, 'triggered correct segment timing info'); -}); - -QUnit.test('aignGopsAtStart_ filters gops appropriately', function(assert) { - var gopsToAlignWith, gops, actual, expected; - - // atog === arrayToGops - var atog = function(list) { - var mapped = list.map(function(item) { - return { - pts: item, - dts: item, - nalCount: 1, - duration: 1, - byteLength: 1 - }; - }); - - mapped.byteLength = mapped.length; - mapped.nalCount = mapped.length; - mapped.duration = mapped.length; - mapped.dts = mapped[0].dts; - mapped.pts = mapped[0].pts; - - return mapped; - }; - - // no gops to trim, all gops start after any alignment candidates - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([10, 12, 13, 14, 16]); - expected = atog([10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, all gops start after any alignment candidates'); - - // no gops to trim, first gop has a match with first alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([0, 2, 4, 6, 8]); - expected = atog([0, 2, 4, 6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with first alignment candidate'); - - // no gops to trim, first gop has a match with last alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([8, 10, 12, 13, 14, 16]); - expected = atog([8, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with last alignment candidate'); - - // no gops to trim, first gop has a match with an alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([6, 9, 10, 12, 13, 14, 16]); - expected = atog([6, 9, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with an alignment candidate'); - - // all gops trimmed, all gops come before first alignment candidate - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before first alignment candidate'); - - // all gops trimmed, all gops come before last alignment candidate, no match found - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - // all gops trimmed, all gops contained between alignment candidates, no match found - gopsToAlignWith = atog([6, 10, 12, 13, 14, 16]); - gops = atog([7, 8, 9, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops contained between alignment candidates, no match found'); - - // some gops trimmed, some gops before first alignment candidate - // match on first alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 9, 10, 12]); - expected = atog([9, 10, 12]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on first alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 13, 14]); - expected = atog([13, 14]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 12, 15, 16]); - expected = atog([16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 10, 13]); - expected = atog([10, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // no match found - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 13, 15]); - expected = atog([13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'no match found'); - - // some gops trimmed, gops contained between alignment candidates - // match with an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([2, 4, 6, 8]); - expected = atog([6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, gops contained between alignment candidates,' + - 'match with an alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // no match - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 11, 13]); - expected = atog([11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'no match'); - - // some gops trimmed, alignment candidates contained between gops - // match with first alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 3, 4, 5, 9, 10, 11]); - expected = atog([3, 4, 5, 9, 10, 11]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with first alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with last alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 10, 13, 15]); - expected = atog([10, 13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with last alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with an alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 6, 9, 11, 13]); - expected = atog([6, 9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtStart_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with an alignment candidate'); -}); - -QUnit.test('alignGopsAtEnd_ filters gops appropriately', function(assert) { - var gopsToAlignWith, gops, actual, expected; - - // atog === arrayToGops - var atog = function(list) { - var mapped = list.map(function(item) { - return { - pts: item, - dts: item, - nalCount: 1, - duration: 1, - byteLength: 1 - }; - }); - - mapped.byteLength = mapped.length; - mapped.nalCount = mapped.length; - mapped.duration = mapped.length; - mapped.dts = mapped[0].dts; - mapped.pts = mapped[0].pts; - - return mapped; - }; - - // no gops to trim, all gops start after any alignment candidates - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([10, 12, 13, 14, 16]); - expected = atog([10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, all gops start after any alignment candidates'); - - // no gops to trim, first gop has a match with first alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([0, 1, 3, 5, 7]); - expected = atog([0, 1, 3, 5, 7]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with first alignment candidate'); - - // no gops to trim, first gop has a match with last alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([8, 10, 12, 13, 14, 16]); - expected = atog([8, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with last alignment candidate'); - - // no gops to trim, first gop has a match with an alignment candidate - gopsToAlignWith = atog([0, 2, 4, 6, 8]); - gops = atog([6, 9, 10, 12, 13, 14, 16]); - expected = atog([6, 9, 10, 12, 13, 14, 16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'no gops to trim, first gop has a match with an alignment candidate'); - - // all gops trimmed, all gops come before first alignment candidate - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before first alignment candidate'); - - // all gops trimmed, all gops come before last alignment candidate, no match found - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([0, 2, 4, 6, 8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - gopsToAlignWith = atog([10, 12, 13, 14, 16]); - gops = atog([8, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops come before last alignment candidate, no match found'); - - // all gops trimmed, all gops contained between alignment candidates, no match found - gopsToAlignWith = atog([6, 10, 12, 13, 14, 16]); - gops = atog([7, 8, 9, 11, 15]); - expected = null; - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'all gops trimmed, all gops contained between alignment candidates, no match found'); - - // some gops trimmed, some gops before first alignment candidate - // match on first alignment candidate - gopsToAlignWith = atog([9, 11, 13, 16]); - gops = atog([7, 8, 9, 10, 12]); - expected = atog([9, 10, 12]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on first alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([9, 10, 11, 13, 16]); - gops = atog([7, 8, 11, 13, 14, 15]); - expected = atog([13, 14, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops before first alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([9, 10, 13, 16]); - gops = atog([7, 8, 11, 12, 15, 16]); - expected = atog([16]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops before first alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 6, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on an alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // match on last alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 9, 10, 13]); - expected = atog([10, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'match on last alignment candidate'); - - // some gops trimmed, some gops after last alignment candidate - // no match found - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([4, 5, 7, 13, 15]); - expected = atog([13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, some gops after last alignment candidate,' + - 'no match found'); - - // some gops trimmed, gops contained between alignment candidates - // match with an alignment candidate - gopsToAlignWith = atog([0, 3, 6, 9, 10]); - gops = atog([2, 4, 6, 8]); - expected = atog([6, 8]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, gops contained between alignment candidates,' + - 'match with an alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // no match - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 11, 13]); - expected = atog([11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'no match'); - - // some gops trimmed, alignment candidates contained between gops - // match with first alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 3, 4, 5, 11]); - expected = atog([3, 4, 5, 11]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with first alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with last alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 8, 10, 13, 15]); - expected = atog([10, 13, 15]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with last alignment candidate'); - - // some gops trimmed, alignment candidates contained between gops - // match with an alignment candidate - gopsToAlignWith = atog([3, 6, 9, 10]); - gops = atog([0, 2, 4, 6, 9, 11, 13]); - expected = atog([9, 11, 13]); - videoSegmentStream.alignGopsWith(gopsToAlignWith); - actual = videoSegmentStream.alignGopsAtEnd_(gops); - assert.deepEqual(actual, expected, - 'some gops trimmed, alignment candidates contained between gops,' + - 'match with an alignment candidate'); -}); - -QUnit.test('generateSegmentTimingInfo generates correct timing info object', function(assert) { - var - firstFrame = { - dts: 12, - pts: 14, - duration: 3 - }, - lastFrame = { - dts: 120, - pts: 140, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 0; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 14 - 12 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 120 + 4 - 12, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 140 + 4 - 14 - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTime - }, 'generated correct timing info object'); -}); - -QUnit.test('generateSegmentTimingInfo accounts for prepended GOPs', function(assert) { - var - firstFrame = { - dts: 12, - pts: 14, - duration: 3 - }, - lastFrame = { - dts: 120, - pts: 140, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 7; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 14 - 12 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 120 + 4 - 12, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 140 + 4 - 14 - }, - prependedContentDuration: 7, - baseMediaDecodeTime: 20 - }, - 'included prepended content duration in timing info'); -}); - -QUnit.test('generateSegmentTimingInfo handles GOPS where pts is < dts', function(assert) { - var - firstFrame = { - dts: 14, - pts: 12, - duration: 3 - }, - lastFrame = { - dts: 140, - pts: 120, - duration: 4 - }, - baseMediaDecodeTime = 20, - prependedContentDuration = 7; - - assert.deepEqual( - generateSegmentTimingInfo( - baseMediaDecodeTime, - firstFrame.dts, - firstFrame.pts, - lastFrame.dts + lastFrame.duration, - lastFrame.pts + lastFrame.duration, - prependedContentDuration - ), { - start: { - // baseMediaDecodeTime, - dts: 20, - // baseMediaDecodeTime + firstFrame.pts - firstFrame.dts - pts: 20 + 12 - 14 - }, - end: { - // baseMediaDecodeTime + lastFrame.dts + lastFrame.duration - firstFrame.dts, - dts: 20 + 140 + 4 - 14, - // baseMediaDecodeTime + lastFrame.pts + lastFrame.duration - firstFrame.pts - pts: 20 + 120 + 4 - 12 - }, - prependedContentDuration: 7, - baseMediaDecodeTime: 20 - }, - 'included prepended content duration in timing info'); -}); - -QUnit.module('ADTS Stream', { - beforeEach: function() { - adtsStream = new AdtsStream(); - } -}); - -QUnit.test('generates AAC frame events from ADTS bytes', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34, // AAC payload - 0x56, 0x78 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 1, 'generated one frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'extracted AAC frame'); - assert.equal(frames[0].channelcount, 2, 'parsed channelcount'); - assert.equal(frames[0].samplerate, 44100, 'parsed samplerate'); - - // Chrome only supports 8, 16, and 32 bit sample sizes. Assuming the - // default value of 16 in ISO/IEC 14496-12 AudioSampleEntry is - // acceptable. - assert.equal(frames[0].samplesize, 16, 'parsed samplesize'); -}); - -QUnit.test('skips garbage data between sync words', function(assert) { - var frames = []; - var logs = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - - adtsStream.on('log', function(log) { - logs.push(log); - }); - - var frameHeader = [ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 including header - 0x00, // one AAC per ADTS frame - ]; - adtsStream.push({ - type: 'audio', - data: new Uint8Array( - [] - // garbage - .concat([0x00, 0x00, 0x00]) - // frame - .concat(frameHeader) - .concat([0x00, 0x01]) - // garbage - .concat([0x00, 0x00, 0x00, 0x00, 0x00]) - .concat(frameHeader) - .concat([0x00, 0x02]) - // garbage - .concat([0x00, 0x00, 0x00, 0x00]) - .concat(frameHeader) - .concat([0x00, 0x03]) - .concat([0x00, 0x00, 0x00, 0x00]) - ) - }); - - assert.equal(frames.length, 3, 'generated three frames'); - frames.forEach(function(frame, i) { - assert.deepEqual( - new Uint8Array(frame.data), - new Uint8Array([0x00, i + 1]), - 'extracted AAC frame' - ); - - assert.equal(frame.channelcount, 2, 'parsed channelcount'); - assert.equal(frame.samplerate, 44100, 'parsed samplerate'); - - // Chrome only supports 8, 16, and 32 bit sample sizes. Assuming the - // default value of 16 in ISO/IEC 14496-12 AudioSampleEntry is - // acceptable. - assert.equal(frame.samplesize, 16, 'parsed samplesize'); - }); - assert.deepEqual(logs, [ - {level: 'warn', message: 'adts skiping bytes 0 to 3 in frame 0 outside syncword'}, - {level: 'warn', message: 'adts skiping bytes 12 to 17 in frame 1 outside syncword'}, - {level: 'warn', message: 'adts skiping bytes 26 to 30 in frame 2 outside syncword'} - ], 'logged skipped data'); -}); - -QUnit.test('parses across packets', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34 // AAC payload 1 - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 2 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the second AAC frame'); -}); - -QUnit.test('parses frames segmented across packet', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12 // incomplete AAC payload 1 - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x34, // remainder of the previous frame's payload - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 2 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'extracted the first AAC frame'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the second AAC frame'); -}); - -QUnit.test('resyncs data in aac frames that contain garbage', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x67, // garbage - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x9a, 0xbc, // AAC payload 1 - 0xde, 0xf0 // extra junk that should be ignored - ]) - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0x67, // garbage - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x20, // 2 channels, frame length 9 bytes - 0x00, // one AAC per ADTS frame - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 2, 'parsed two frames'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x9a, 0xbc]), - 'extracted the first AAC frame'); - assert.deepEqual(new Uint8Array(frames[1].data), - new Uint8Array([0x12, 0x34]), - 'extracted the second AAC frame'); -}); - -QUnit.test('ignores audio "MPEG version" bit in adts header', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf8, // MPEG-2 audio, CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x60, // 2 channels, frame length 11 bytes - 0x00, // one AAC per ADTS frame - 0xfe, 0xdc, // "CRC" - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 1, 'parsed a frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'skipped the CRC'); -}); - -QUnit.test('skips CRC bytes', function(assert) { - var frames = []; - adtsStream.on('data', function(frame) { - frames.push(frame); - }); - adtsStream.push({ - type: 'audio', - data: new Uint8Array([ - 0xff, 0xf0, // with CRC - 0x10, // AAC Main, 44.1KHz - 0xbc, 0x01, 0x60, // 2 channels, frame length 11 bytes - 0x00, // one AAC per ADTS frame - 0xfe, 0xdc, // "CRC" - 0x12, 0x34 // AAC payload 2 - ]) - }); - - assert.equal(frames.length, 1, 'parsed a frame'); - assert.deepEqual(new Uint8Array(frames[0].data), - new Uint8Array([0x12, 0x34]), - 'skipped the CRC'); -}); - -QUnit.module('AudioSegmentStream', { - beforeEach: function() { - var track = { - type: 'audio', - samplerate: 90e3 // no scaling - }; - audioSegmentStream = new AudioSegmentStream(track); - audioSegmentStream.track = track; - audioSegmentStream.track.timelineStartInfo = { - dts: 111, - pts: 111, - baseMediaDecodeTime: 0 - }; - } -}); - -QUnit.test('fills audio gaps taking into account audio sample rate', function(assert) { - var - events = [], - boxes, - numSilentFrames, - videoGap = 0.29, - audioGap = 0.49, - expectedFillSeconds = audioGap - videoGap, - sampleRate = 44100, - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - audioBMDT, - offsetSeconds = clock.videoTsToSeconds(111), - startingAudioBMDT = clock.secondsToAudioTs(10 + audioGap - offsetSeconds, sampleRate); - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(10)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(10 + audioGap), - dts: clock.secondsToVideoTs(10 + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - numSilentFrames = Math.floor(expectedFillSeconds / frameSeconds); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[7].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[8].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - audioBMDT, - // should always be rounded up so as not to overfill - Math.ceil(startingAudioBMDT - - clock.secondsToAudioTs(numSilentFrames * frameSeconds, sampleRate)), - 'filled the gap to the nearest frame'); - assert.equal( - Math.floor(clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(10 + videoGap)), - Math.floor(clock.secondsToVideoTs(expectedFillSeconds) % frameDuration - - clock.secondsToVideoTs(offsetSeconds)), - 'filled all but frame remainder between video start and audio start'); -}); - -QUnit.test('fills audio gaps with existing frame if odd sample rate', function(assert) { - var - events = [], - boxes, - numSilentFrames, - videoGap = 0.29, - audioGap = 0.49, - expectedFillSeconds = audioGap - videoGap, - sampleRate = 90e3, // we don't have matching silent frames - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - audioBMDT, - offsetSeconds = clock.videoTsToSeconds(111), - startingAudioBMDT = clock.secondsToAudioTs(10 + audioGap - offsetSeconds, sampleRate); - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(10)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(10 + audioGap), - dts: clock.secondsToVideoTs(10 + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - numSilentFrames = Math.floor(expectedFillSeconds / frameSeconds); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'copied sample'); - assert.equal(events[0].track.samples[7].size, 1, 'copied sample'); - assert.equal(events[0].track.samples[8].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - audioBMDT, - // should always be rounded up so as not to overfill - Math.ceil(startingAudioBMDT - - clock.secondsToAudioTs(numSilentFrames * frameSeconds, sampleRate)), - 'filled the gap to the nearest frame'); - assert.equal( - Math.floor(clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(10 + videoGap)), - Math.floor(clock.secondsToVideoTs(expectedFillSeconds) % frameDuration - - clock.secondsToVideoTs(offsetSeconds)), - 'filled all but frame remainder between video start and audio start'); -}); - -QUnit.test('fills audio gaps with smaller of audio gap and audio-video gap', function(assert) { - var - events = [], - boxes, - offsetSeconds = clock.videoTsToSeconds(111), - videoGap = 0.29, - sampleRate = 44100, - frameDuration = Math.ceil(90e3 / (sampleRate / 1024)), - frameSeconds = clock.videoTsToSeconds(frameDuration), - // audio gap smaller, should be used as fill - numSilentFrames = 1, - // buffer for imprecise numbers - audioGap = frameSeconds + offsetSeconds + 0.001, - oldAudioEnd = 10.5, - audioBMDT; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(oldAudioEnd)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(10 + videoGap)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: sampleRate, - pts: clock.secondsToVideoTs(oldAudioEnd + audioGap), - dts: clock.secondsToVideoTs(oldAudioEnd + audioGap), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1 + numSilentFrames, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 364, 'silent sample'); - assert.equal(events[0].track.samples[1].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - - audioBMDT = boxes[0].boxes[1].boxes[1].baseMediaDecodeTime; - - assert.equal( - Math.floor(clock.secondsToVideoTs(oldAudioEnd + audioGap) - - clock.audioTsToVideoTs(audioBMDT, sampleRate) - - clock.secondsToVideoTs(offsetSeconds)), - Math.floor(frameDuration + 0.001), - 'filled length of audio gap only'); -}); - -QUnit.test('does not fill audio gaps if no audio append start time', function(assert) { - var - events = [], - boxes, - videoGap = 0.29, - audioGap = 0.49; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setVideoBaseMediaDecodeTime((10 + videoGap) * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill gap'); -}); - -QUnit.test('does not fill audio gap if no video base media decode time', function(assert) { - var - events = [], - boxes, - audioGap = 0.49; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(10 * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill the gap'); -}); - -QUnit.test('does not fill audio gaps greater than a half second', function(assert) { - var - events = [], - boxes, - videoGap = 0.01, - audioGap = videoGap + 0.51; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.setAudioAppendStart(10 * 90e3); - audioSegmentStream.setVideoBaseMediaDecodeTime((10 + videoGap) * 90e3); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: (10 + audioGap) * 90e3, - dts: (10 + audioGap) * 90e3, - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - (10 + audioGap) * 90e3 - 111, - 'did not fill gap'); -}); - -QUnit.test('does not fill audio gaps smaller than a frame duration', function(assert) { - var - events = [], - boxes, - offsetSeconds = clock.videoTsToSeconds(111), - // audio gap small enough that it shouldn't be filled - audioGap = 0.001, - newVideoStart = 10, - oldAudioEnd = 10.3, - newAudioStart = oldAudioEnd + audioGap + offsetSeconds; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - // the real audio gap is tiny, but the gap between the new video and audio segments - // would be large enough to fill - audioSegmentStream.setAudioAppendStart(clock.secondsToVideoTs(oldAudioEnd)); - audioSegmentStream.setVideoBaseMediaDecodeTime(clock.secondsToVideoTs(newVideoStart)); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: clock.secondsToVideoTs(newAudioStart), - dts: clock.secondsToVideoTs(newAudioStart), - data: new Uint8Array([1]) - }); - - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated samples'); - assert.equal(events[0].track.samples[0].size, 1, 'normal sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - clock.secondsToVideoTs(newAudioStart - offsetSeconds), - 'did not fill gap'); -}); - -QUnit.test('ensures baseMediaDecodeTime for audio is not negative', function(assert) { - var events = [], boxes; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - audioSegmentStream.track.timelineStartInfo.baseMediaDecodeTime = 10; - audioSegmentStream.setEarliestDts(101); - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 111 - 10 - 1, // before the earliest DTS - dts: 111 - 10 - 1, // before the earliest DTS - data: new Uint8Array([0]) - }); - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 111 - 10 + 2, // after the earliest DTS - dts: 111 - 10 + 2, // after the earliest DTS - data: new Uint8Array([1]) - }); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 1, 'generated only one sample'); - boxes = mp4.tools.inspect(events[0].boxes); - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, 2, 'kept the later sample'); -}); - -QUnit.test('audio track metadata takes on the value of the last metadata seen', function(assert) { - var events = []; - - audioSegmentStream.on('data', function(event) { - events.push(event); - }); - - audioSegmentStream.push({ - channelcount: 2, - samplerate: 90e3, - pts: 100, - dts: 100, - data: new Uint8Array([0]) - }); - audioSegmentStream.push({ - channelcount: 4, - samplerate: 10000, - pts: 111, - dts: 111, - data: new Uint8Array([1]) - }); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a data event fired'); - assert.equal(events[0].track.samples.length, 2, 'generated two samples'); - assert.equal(events[0].track.samplerate, 10000, 'kept the later samplerate'); - assert.equal(events[0].track.channelcount, 4, 'kept the later channelcount'); -}); - -QUnit.test('audio segment stream triggers segmentTimingInfo with timing info', -function(assert) { - var - events = [], - samplerate = 48000, - baseMediaDecodeTimeInVideoClock = 30, - audioFrameDurationInVideoClock = 90000 * 1024 / samplerate, - firstFrame = { - channelcount: 2, - samplerate: samplerate, - pts: 112, - dts: 111, - data: new Uint8Array([0]) - }, - secondFrame = { - channelcount: 2, - samplerate: samplerate, - pts: firstFrame.pts + audioFrameDurationInVideoClock, - dts: firstFrame.dts + audioFrameDurationInVideoClock, - data: new Uint8Array([1]) - }; - - audioSegmentStream.on('segmentTimingInfo', function(event) { - events.push(event); - }); - audioSegmentStream.track.timelineStartInfo.baseMediaDecodeTime = - baseMediaDecodeTimeInVideoClock; - - audioSegmentStream.push(firstFrame); - audioSegmentStream.push(secondFrame); - audioSegmentStream.flush(); - - assert.equal(events.length, 1, 'a segmentTimingInfo event was fired'); - assert.deepEqual( - events[0], - { - start: { - dts: baseMediaDecodeTimeInVideoClock, - pts: baseMediaDecodeTimeInVideoClock + (firstFrame.pts - firstFrame.dts) - }, - end: { - dts: baseMediaDecodeTimeInVideoClock + (secondFrame.dts - firstFrame.dts) + - audioFrameDurationInVideoClock, - pts: baseMediaDecodeTimeInVideoClock + (secondFrame.pts - firstFrame.pts) + - audioFrameDurationInVideoClock - }, - prependedContentDuration: 0, - baseMediaDecodeTime: baseMediaDecodeTimeInVideoClock - }, - 'has correct segmentTimingInfo' - ); -}); - - -QUnit.module('Transmuxer - options'); - -QUnit.test('no options creates combined output', function(assert) { - var - segments = [], - boxes, - initSegment, - transmuxer = new Transmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 init segment boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a single moov box'); - assert.equal(boxes.length, 4, 'generated 4 top-level boxes'); - assert.equal('moof', boxes[0].type, 'generated a first moof box'); - assert.equal('mdat', boxes[1].type, 'generated a first mdat box'); - assert.equal('moof', boxes[2].type, 'generated a second moof box'); - assert.equal('mdat', boxes[3].type, 'generated a second mdat box'); -}); - -QUnit.test('first sequence number option is used in mfhd box', function(assert) { - var - segments = [], - mfhds = [], - boxes, - transmuxer = new Transmuxer({ firstSequenceNumber: 10 }); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - - boxes = mp4.tools.inspect(segments[0].data); - boxes.forEach(function(box) { - if (box.type === 'moof') { - box.boxes.forEach(function(moofBox) { - if (moofBox.type === 'mfhd') { - mfhds.push(moofBox); - } - }); - } - }); - - assert.equal(mfhds.length, 2, 'muxed output has two mfhds'); - - assert.equal(mfhds[0].sequenceNumber, 10, 'first mfhd sequence starts at 10'); - assert.equal(mfhds[1].sequenceNumber, 10, 'second mfhd sequence starts at 10'); -}); - -QUnit.test('can specify that we want to generate separate audio and video segments', function(assert) { - var - segments = [], - segmentLengthOnDone, - boxes, - initSegment, - transmuxer = new Transmuxer({remux: false}); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.on('done', function(segment) { - if (!segmentLengthOnDone) { - segmentLengthOnDone = segments.length; - } - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segmentLengthOnDone, 2, 'emitted both segments before triggering done'); - assert.equal(segments.length, 2, 'generated a video and an audio segment'); - assert.ok(segments[0].type === 'video' || segments[1].type === 'video', 'one segment is video'); - assert.ok(segments[0].type === 'audio' || segments[1].type === 'audio', 'one segment is audio'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 top-level initSegment boxes'); - assert.equal(boxes.length, 2, 'generated 2 top-level boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a moov box'); - assert.equal('moof', boxes[0].type, 'generated a moof box'); - assert.equal('mdat', boxes[1].type, 'generated a mdat box'); - - boxes = mp4.tools.inspect(segments[1].data); - initSegment = mp4.tools.inspect(segments[1].initSegment); - assert.equal(initSegment.length, 2, 'generated 2 top-level initSegment boxes'); - assert.equal(boxes.length, 2, 'generated 2 top-level boxes'); - assert.equal('ftyp', initSegment[0].type, 'generated an ftyp box'); - assert.equal('moov', initSegment[1].type, 'generated a moov box'); - assert.equal('moof', boxes[0].type, 'generated a moof box'); - assert.equal('mdat', boxes[1].type, 'generated a mdat box'); -}); - -QUnit.test('adjusts caption and ID3 times when configured to adjust timestamps', function(assert) { - var transmuxer = new Transmuxer({ keepOriginalTimestamps: false }); - - var - segments = [], - captions = []; - - transmuxer.on('data', function(segment) { - captions = captions.concat(segment.captions); - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, 90002))); - transmuxer.push(packetize(videoPes([ - 0x06, // sei_rbsp - 0x04, 0x29, 0xb5, 0x00, - 0x31, 0x47, 0x41, 0x39, - 0x34, 0x03, 0x52, 0xff, - 0xfc, 0x94, 0xae, 0xfc, - 0x94, 0x20, 0xfc, 0x91, - 0x40, 0xfc, 0xb0, 0xb0, - 0xfc, 0xba, 0xb0, 0xfc, - 0xb0, 0xba, 0xfc, 0xb0, - 0xb0, 0xfc, 0x94, 0x2f, - 0xfc, 0x94, 0x2f, 0xfc, - 0x94, 0x2f, 0xff, 0x80, - 0x00 // has an extra End Of Caption, so start and end times will be the same - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, 90004))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - assert.equal(captions.length, 1, 'got one caption'); - assert.equal(captions[0].startPts, 90004, 'original pts value intact'); - assert.equal(captions[0].startTime, (90004 - 90002) / 90e3, 'caption start time are based on original timeline'); - assert.equal(captions[0].endTime, (90004 - 90002) / 90e3, 'caption end time are based on original timeline'); -}); - -[ - {options: {keepOriginalTimestamps: false}}, - {options: {keepOriginalTimestamps: true}}, - {options: {keepOriginalTimestamps: false, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: true, baseMediaDecodeTime: 15000}}, - {options: {keepOriginalTimestamps: false}, baseMediaSetter: 15000}, - {options: {keepOriginalTimestamps: true}, baseMediaSetter: 15000} -].forEach(function(test) { - var createTransmuxer = function() { - var transmuxer = new Transmuxer(test.options); - - if (test.baseMediaSetter) { - transmuxer.setBaseMediaDecodeTime(test.baseMediaSetter); - } - - return transmuxer; - }; - - var name = ''; - - Object.keys(test.options).forEach(function(optionName) { - name += '' + optionName + ' ' + test.options[optionName] + ' '; - }); - - if (test.baseMediaSetter) { - name += 'baseMediaDecodeTime setter ' + test.baseMediaSetter; - } - - QUnit.test('Audio frames after video not trimmed, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // not be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts + 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined segment'); - // The audio frame is 10 bytes. The full data is 305 bytes without anything - // trimmed. If the audio frame was trimmed this will be 295 bytes. - assert.equal(segments[0].data.length, 305, 'trimmed audio frame'); - }); - - QUnit.test('Audio frames trimmed before video, ' + name, function(assert) { - var - segments = [], - earliestDts = 15000, - baseTime = test.options.baseMediaDecodeTime || test.baseMediaSetter || 0, - transmuxer = createTransmuxer(); - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - // the following transmuxer pushes add tiny video and - // audio data to the transmuxer. When we add the data - // we also set the pts/dts time so that audio should - // be trimmed. - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, earliestDts - baseTime - 1))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, earliestDts))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, earliestDts))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined segment'); - // The audio frame is 10 bytes. The full data is 305 bytes without anything - // trimmed. If the audio frame was trimmed this will be 295 bytes. - if (test.options.keepOriginalTimestamps && !baseTime) { - assert.equal(segments[0].data.length, 305, 'did not trim audio frame'); - } else { - assert.equal(segments[0].data.length, 295, 'trimmed audio frame'); - } - }); -}); - -QUnit.test("doesn't adjust caption and ID3 times when configured to keep original timestamps", function(assert) { - var transmuxer = new Transmuxer({ keepOriginalTimestamps: true }); - - var - segments = [], - captions = []; - - transmuxer.on('data', function(segment) { - captions = captions.concat(segment.captions); - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true, 90000))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false, 90002))); - transmuxer.push(packetize(videoPes([ - 0x06, // sei_rbsp - 0x04, 0x29, 0xb5, 0x00, - 0x31, 0x47, 0x41, 0x39, - 0x34, 0x03, 0x52, 0xff, - 0xfc, 0x94, 0xae, 0xfc, - 0x94, 0x20, 0xfc, 0x91, - 0x40, 0xfc, 0xb0, 0xb0, - 0xfc, 0xba, 0xb0, 0xfc, - 0xb0, 0xba, 0xfc, 0xb0, - 0xb0, 0xfc, 0x94, 0x2f, - 0xfc, 0x94, 0x2f, 0xfc, - 0x94, 0x2f, 0xff, 0x80, - 0x00 // has an extra End Of Caption, so start and end times will be the same - ], true, 90002))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true, 90004))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a combined video and audio segment'); - assert.equal(segments[0].type, 'combined', 'combined is the segment type'); - assert.equal(captions.length, 1, 'got one caption'); - assert.equal(captions[0].startPts, 90004, 'original pts value intact'); - assert.equal(captions[0].startTime, 90004 / 90e3, 'caption start time are based on original timeline'); - assert.equal(captions[0].endTime, 90004 / 90e3, 'caption end time are based on original timeline'); -}); - -QUnit.module('MP4 - Transmuxer', { - beforeEach: function() { - transmuxer = new Transmuxer(); - } -}); - -QUnit.test('generates a video init segment', function(assert) { - var segments = [], boxes; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x87, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a segment'); - assert.ok(segments[0].data, 'wrote data in the init segment'); - assert.equal(segments[0].type, 'video', 'video is the segment type'); - assert.ok(segments[0].info, 'video info is alongside video segments/bytes'); - - mp4VideoProperties.forEach(function(prop) { - assert.ok(segments[0].info[prop], 'video info has ' + prop); - }); - - boxes = mp4.tools.inspect(segments[0].initSegment); - assert.equal('ftyp', boxes[0].type, 'generated an ftyp box'); - assert.equal('moov', boxes[1].type, 'generated a moov box'); -}); - -QUnit.test('transmuxer triggers video timing info event on flush', function(assert) { - var videoSegmentTimingInfoArr = []; - - transmuxer.on('videoSegmentTimingInfo', function(videoSegmentTimingInfo) { - videoSegmentTimingInfoArr.push(videoSegmentTimingInfo); - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x05, 0x01 // slice_layer_without_partitioning_rbsp_idr - ], true))); - - assert.equal( - videoSegmentTimingInfoArr.length, - 0, - 'has not triggered videoSegmentTimingInfo' - ); - - transmuxer.flush(); - - assert.equal(videoSegmentTimingInfoArr.length, 1, 'triggered videoSegmentTimingInfo'); -}); - -QUnit.test('generates an audio init segment', function(assert) { - var segments = [], boxes; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated a segment'); - assert.ok(segments[0].data, 'wrote data in the init segment'); - assert.equal(segments[0].type, 'audio', 'audio is the segment type'); - assert.ok(segments[0].info, 'audio info is alongside audio segments/bytes'); - mp4AudioProperties.forEach(function(prop) { - assert.ok(segments[0].info[prop], 'audio info has ' + prop); - }); - - boxes = mp4.tools.inspect(segments[0].initSegment); - assert.equal('ftyp', boxes[0].type, 'generated an ftyp box'); - assert.equal('moov', boxes[1].type, 'generated a moov box'); -}); - -QUnit.test('buffers video samples until flushed', function(assert) { - var samples = [], offset, boxes, initSegment; - transmuxer.on('data', function(data) { - samples.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x05, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - assert.equal(samples.length, 1, 'emitted one event'); - boxes = mp4.tools.inspect(samples[0].data); - initSegment = mp4.tools.inspect(samples[0].initSegment); - assert.equal(boxes.length, 2, 'generated two boxes'); - assert.equal(initSegment.length, 2, 'generated two init segment boxes'); - assert.equal(boxes[0].type, 'moof', 'the first box is a moof'); - assert.equal(boxes[1].type, 'mdat', 'the second box is a mdat'); - - offset = boxes[0].size + 8; - assert.deepEqual(new Uint8Array(samples[0].data.subarray(offset)), - new Uint8Array([ - 0, 0, 0, 2, - 0x09, 0x01, - 0, 0, 0, 2, - 0x05, 0x02, - 0, 0, 0, 2, - 0x09, 0x03, - 0, 0, 0, 2, - 0x00, 0x04, - 0, 0, 0, 2, - 0x00, 0x05]), - 'concatenated NALs into an mdat'); -}); - -QUnit.test('creates a metadata stream', function(assert) { - transmuxer.push(packetize(PAT)); - assert.ok(transmuxer.transmuxPipeline_.metadataStream, 'created a metadata stream'); -}); - -QUnit.test('pipes timed metadata to the metadata stream', function(assert) { - var metadatas = []; - transmuxer.push(packetize(PAT)); - transmuxer.transmuxPipeline_.metadataStream.on('data', function(data) { - metadatas.push(data); - }); - transmuxer.push(packetize(PMT)); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - - transmuxer.flush(); - assert.equal(metadatas.length, 1, 'emitted timed metadata'); -}); - -QUnit.test('pipeline dynamically configures itself based on input', function(assert) { - var id3 = id3Generator; - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'ts', 'detected TS file data'); - - transmuxer.push(new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01)).concat([0xFF, 0xF1]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'aac', 'detected AAC file data'); -}); - -QUnit.test('pipeline retriggers log events', function(assert) { - var id3 = id3Generator; - var logs = []; - - var checkLogs = function() { - Object.keys(transmuxer.transmuxPipeline_).forEach(function(key) { - var stream = transmuxer.transmuxPipeline_[key]; - - if (!stream.on || key === 'headOfPipeline') { - return; - } - - stream.trigger('log', {level: 'foo', message: 'bar'}); - - assert.deepEqual(logs, [ - {level: 'foo', message: 'bar', stream: key} - ], 'retriggers log from ' + key); - logs.length = 0; - }); - }; - - transmuxer.on('log', function(log) { - logs.push(log); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - transmuxer.flush(); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(timedMetadataPes([0x03]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'ts', 'detected TS file data'); - checkLogs(); - - transmuxer.push(new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01)).concat([0xFF, 0xF1]))); - transmuxer.flush(); - transmuxer.push(new Uint8Array(id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01)).concat([0xFF, 0xF1]))); - transmuxer.flush(); - assert.equal(transmuxer.transmuxPipeline_.type, 'aac', 'detected AAC file data'); - checkLogs(); -}); - -QUnit.test('reuses audio track object when the pipeline reconfigures itself', function(assert) { - var boxes, segments = [], - id3Tag = new Uint8Array(75), - streamTimestamp = 'com.apple.streaming.transportStreamTimestamp', - priv = 'PRIV', - i, - adtsPayload; - - id3Tag[0] = 73; - id3Tag[1] = 68; - id3Tag[2] = 51; - id3Tag[3] = 4; - id3Tag[9] = 63; - id3Tag[17] = 53; - id3Tag[70] = 13; - id3Tag[71] = 187; - id3Tag[72] = 160; - id3Tag[73] = 0xFF; - id3Tag[74] = 0xF1; - - for (i = 0; i < priv.length; i++) { - id3Tag[i + 10] = priv.charCodeAt(i); - } - for (i = 0; i < streamTimestamp.length; i++) { - id3Tag[i + 20] = streamTimestamp.charCodeAt(i); - } - - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(packetize(generatePMT({ - hasAudio: true - })))); - transmuxer.push(packetize(audioPes([0x19, 0x47], true, 10000))); - transmuxer.flush(); - - boxes = mp4.tools.inspect(segments[0].data); - - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - 0, - 'first segment starts at 0 pts'); - - adtsPayload = new Uint8Array(adtsFrame(2).concat([0x19, 0x47])); - - transmuxer.push(id3Tag); - transmuxer.push(adtsPayload); - transmuxer.flush(); - - boxes = mp4.tools.inspect(segments[1].data); - - assert.equal(boxes[0].boxes[1].boxes[1].baseMediaDecodeTime, - // The first segment had a PTS of 10,000 and the second segment 900,000 - // Audio PTS is specified in a clock equal to samplerate (44.1khz) - // So you have to take the different between the PTSs (890,000) - // and transform it from 90khz to 44.1khz clock - Math.floor((900000 - 10000) / (90000 / 44100)), - 'second segment starts at the right time'); -}); - -validateTrack = function(track, metadata) { - var mdia; - QUnit.assert.equal(track.type, 'trak', 'wrote the track type'); - QUnit.assert.equal(track.boxes.length, 2, 'wrote track children'); - QUnit.assert.equal(track.boxes[0].type, 'tkhd', 'wrote the track header'); - if (metadata) { - if (metadata.trackId) { - QUnit.assert.equal(track.boxes[0].trackId, metadata.trackId, 'wrote the track id'); - } - if (metadata.width) { - QUnit.assert.equal(track.boxes[0].width, metadata.width, 'wrote the width'); - } - if (metadata.height) { - QUnit.assert.equal(track.boxes[0].height, metadata.height, 'wrote the height'); - } - } - - mdia = track.boxes[1]; - QUnit.assert.equal(mdia.type, 'mdia', 'wrote the media'); - QUnit.assert.equal(mdia.boxes.length, 3, 'wrote the mdia children'); - - QUnit.assert.equal(mdia.boxes[0].type, 'mdhd', 'wrote the media header'); - QUnit.assert.equal(mdia.boxes[0].language, 'und', 'the language is undefined'); - QUnit.assert.equal(mdia.boxes[0].duration, 0xffffffff, 'the duration is at maximum'); - - QUnit.assert.equal(mdia.boxes[1].type, 'hdlr', 'wrote the media handler'); - - QUnit.assert.equal(mdia.boxes[2].type, 'minf', 'wrote the media info'); -}; - -validateTrackFragment = function(track, segment, metadata, type) { - var tfhd, trun, sdtp, i, j, sample, nalUnitType; - QUnit.assert.equal(track.type, 'traf', 'wrote a track fragment'); - - if (type === 'video') { - QUnit.assert.equal(track.boxes.length, 4, 'wrote four track fragment children'); - } else if (type === 'audio') { - QUnit.assert.equal(track.boxes.length, 3, 'wrote three track fragment children'); - } - - tfhd = track.boxes[0]; - QUnit.assert.equal(tfhd.type, 'tfhd', 'wrote a track fragment header'); - QUnit.assert.equal(tfhd.trackId, metadata.trackId, 'wrote the track id'); - - QUnit.assert.equal(track.boxes[1].type, - 'tfdt', - 'wrote a track fragment decode time box'); - QUnit.assert.ok(track.boxes[1].baseMediaDecodeTime >= 0, 'base decode time is non-negative'); - - trun = track.boxes[2]; - QUnit.assert.ok(trun.dataOffset >= 0, 'set data offset'); - - QUnit.assert.equal(trun.dataOffset, - metadata.mdatOffset + 8, - 'trun data offset is the size of the moof'); - - QUnit.assert.ok(trun.samples.length > 0, 'generated media samples'); - for (i = 0, j = metadata.baseOffset + trun.dataOffset; - i < trun.samples.length; - i++) { - sample = trun.samples[i]; - QUnit.assert.ok(sample.size > 0, 'wrote a positive size for sample ' + i); - if (type === 'video') { - QUnit.assert.ok(sample.duration > 0, 'wrote a positive duration for sample ' + i); - QUnit.assert.ok(sample.compositionTimeOffset >= 0, - 'wrote a positive composition time offset for sample ' + i); - QUnit.assert.ok(sample.flags, 'wrote sample flags'); - QUnit.assert.equal(sample.flags.isLeading, 0, 'the leading nature is unknown'); - - QUnit.assert.notEqual(sample.flags.dependsOn, 0, 'sample dependency is not unknown'); - QUnit.assert.notEqual(sample.flags.dependsOn, 4, 'sample dependency is valid'); - nalUnitType = segment[j + 4] & 0x1F; - QUnit.assert.equal(nalUnitType, 9, 'samples begin with an access_unit_delimiter_rbsp'); - - QUnit.assert.equal(sample.flags.isDependedOn, 0, 'dependency of other samples is unknown'); - QUnit.assert.equal(sample.flags.hasRedundancy, 0, 'sample redundancy is unknown'); - QUnit.assert.equal(sample.flags.degradationPriority, 0, 'sample degradation priority is zero'); - // If current sample is Key frame - if (sample.flags.dependsOn === 2) { - QUnit.assert.equal(sample.flags.isNonSyncSample, 0, 'samples_is_non_sync_sample flag is zero'); - } else { - QUnit.assert.equal(sample.flags.isNonSyncSample, 1, 'samples_is_non_sync_sample flag is one'); - } - } else { - QUnit.assert.equal(sample.duration, 1024, - 'aac sample duration is always 1024'); - } - j += sample.size; // advance to the next sample in the mdat - } - - if (type === 'video') { - sdtp = track.boxes[3]; - QUnit.assert.equal(trun.samples.length, - sdtp.samples.length, - 'wrote an QUnit.equal number of trun and sdtp samples'); - for (i = 0; i < sdtp.samples.length; i++) { - sample = sdtp.samples[i]; - QUnit.assert.notEqual(sample.dependsOn, 0, 'sample dependency is not unknown'); - QUnit.assert.equal(trun.samples[i].flags.dependsOn, - sample.dependsOn, - 'wrote a consistent dependsOn'); - QUnit.assert.equal(trun.samples[i].flags.isDependedOn, - sample.isDependedOn, - 'wrote a consistent isDependedOn'); - QUnit.assert.equal(trun.samples[i].flags.hasRedundancy, - sample.hasRedundancy, - 'wrote a consistent hasRedundancy'); - } - } -}; - -QUnit.test('parses an example mp2t file and generates combined media segments', function(assert) { - var - segments = [], - i, j, boxes, mfhd, trackType = 'audio', trackId = 257, baseOffset = 0, initSegment; - - transmuxer.on('data', function(segment) { - if (segment.type === 'combined') { - segments.push(segment); - } - }); - transmuxer.push(testSegment); - transmuxer.flush(); - - assert.equal(segments.length, 1, 'generated one combined segment'); - - boxes = mp4.tools.inspect(segments[0].data); - initSegment = mp4.tools.inspect(segments[0].initSegment); - assert.equal(boxes.length, 4, 'combined segments are composed of 4 boxes'); - assert.equal(initSegment.length, 2, 'init segment is composed of 2 boxes'); - assert.equal(initSegment[0].type, 'ftyp', 'the first box is an ftyp'); - assert.equal(initSegment[1].type, 'moov', 'the second box is a moov'); - assert.equal(initSegment[1].boxes[0].type, 'mvhd', 'generated an mvhd'); - validateTrack(initSegment[1].boxes[1], { - trackId: 256 - }); - validateTrack(initSegment[1].boxes[2], { - trackId: 257 - }); - - for (i = 0; i < boxes.length; i += 2) { - assert.equal(boxes[i].type, 'moof', 'first box is a moof'); - assert.equal(boxes[i].boxes.length, 2, 'the moof has two children'); - - mfhd = boxes[i].boxes[0]; - assert.equal(mfhd.type, 'mfhd', 'mfhd is a child of the moof'); - - assert.equal(boxes[i + 1].type, 'mdat', 'second box is an mdat'); - - // Only do even numbered boxes because the odd-offsets will be mdat - if (i % 2 === 0) { - for (j = 0; j < i; j++) { - baseOffset += boxes[j].size; - } - - validateTrackFragment(boxes[i].boxes[1], segments[0].data, { - trackId: trackId, - width: 388, - height: 300, - baseOffset: baseOffset, - mdatOffset: boxes[i].size - }, trackType); - - trackId--; - baseOffset = 0; - trackType = 'video'; - } - } -}); - -QUnit.test('can be reused for multiple TS segments', function(assert) { - var - boxes = [], - initSegments = []; - - transmuxer.on('data', function(segment) { - if (segment.type === 'combined') { - boxes.push(mp4.tools.inspect(segment.data)); - initSegments.push(mp4.tools.inspect(segment.initSegment)); - } - }); - transmuxer.push(testSegment); - transmuxer.flush(); - transmuxer.push(testSegment); - transmuxer.flush(); - - assert.equal(boxes.length, 2, 'generated two combined segments'); - assert.equal(initSegments.length, 2, 'generated two combined init segments'); - - assert.deepEqual(initSegments[0][0], initSegments[1][0], 'generated identical ftyps'); - assert.deepEqual(initSegments[0][1], initSegments[1][1], 'generated identical moovs'); - - assert.deepEqual(boxes[0][0].boxes[1], - boxes[1][0].boxes[1], - 'generated identical video trafs'); - assert.equal(boxes[0][0].boxes[0].sequenceNumber, - 0, - 'set the correct video sequence number'); - assert.equal(boxes[1][0].boxes[0].sequenceNumber, - 1, - 'set the correct video sequence number'); - assert.deepEqual(boxes[0][1], - boxes[1][1], - 'generated identical video mdats'); - - assert.deepEqual(boxes[0][2].boxes[3], - boxes[1][2].boxes[3], - 'generated identical audio trafs'); - assert.equal(boxes[0][2].boxes[0].sequenceNumber, - 0, - 'set the correct audio sequence number'); - assert.equal(boxes[1][2].boxes[0].sequenceNumber, - 1, - 'set the correct audio sequence number'); - assert.deepEqual(boxes[0][3], - boxes[1][3], - 'generated identical audio mdats'); -}); - -QUnit.module('NalByteStream', { - beforeEach: function() { - nalByteStream = new NalByteStream(); - } -}); - -QUnit.test('parses nal units with 4-byte start code', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); -}); - -QUnit.test('parses nal units with 3-byte start code', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); -}); - -QUnit.test('does not emit empty nal units', function(assert) { - var dataTriggerCount = 0; - nalByteStream.on('data', function(data) { - dataTriggerCount++; - }); - - // An empty nal unit is just two start codes: - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, 0x01, // start code - 0x00, 0x00, 0x00, 0x01 // start code - ]) - }); - assert.equal(dataTriggerCount, 0, 'emmited no nal units'); -}); - -QUnit.test('parses multiple nal units', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x01, // start code - 0x12, 0xDD, // Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 2, 'found two nals'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); - assert.deepEqual(nalUnits[1], new Uint8Array([0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.test('parses nal units surrounded by an unreasonable amount of zero-bytes', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF, // Payload - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x01, // start code - 0x12, 0xDD, // Payload - 0x00, 0x00, 0x00, // end code - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 - ]) - }); - - assert.equal(nalUnits.length, 2, 'found two nals'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF]), 'has the proper payload'); - assert.deepEqual(nalUnits[1], new Uint8Array([0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.test('parses nal units split across multiple packets', function(assert) { - var nalUnits = []; - nalByteStream.on('data', function(data) { - nalUnits.push(data); - }); - - nalByteStream.push({ - data: new Uint8Array([ - 0x00, 0x00, 0x01, // start code - 0x09, 0xFF // Partial payload - ]) - }); - nalByteStream.push({ - data: new Uint8Array([ - 0x12, 0xDD, // Partial Payload - 0x00, 0x00, 0x00 // end code - ]) - }); - - assert.equal(nalUnits.length, 1, 'found one nal'); - assert.deepEqual(nalUnits[0], new Uint8Array([0x09, 0xFF, 0x12, 0xDD]), 'has the proper payload'); -}); - -QUnit.module('FLV - Transmuxer', { - beforeEach: function() { - transmuxer = new FlvTransmuxer(); - } -}); - -QUnit.test('generates video tags', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated a two video tags'); -}); - -QUnit.test('drops nalUnits at the start of a segment not preceeded by an access_unit_delimiter_rbsp', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - transmuxer.push(packetize(videoPes([ - 0x08, 0x01 // pic_parameter_set_rbsp - ], true))); - transmuxer.push(packetize(videoPes([ - 0x07, // seq_parameter_set_rbsp - 0x27, 0x42, 0xe0, 0x0b, - 0xa9, 0x18, 0x60, 0x9d, - 0x80, 0x53, 0x06, 0x01, - 0x06, 0xb6, 0xc2, 0xb5, - 0xef, 0x7c, 0x04 - ], false))); - transmuxer.push(packetize(videoPes([ - 0x09, 0x01 // access_unit_delimiter_rbsp - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 1, 'generated a single video tag'); -}); - -QUnit.test('generates audio tags', function(assert) { - var segments = []; - transmuxer.on('data', function(segment) { - segments.push(segment); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasAudio: true - }))); - transmuxer.push(packetize(audioPes([ - 0x19, 0x47 - ], true))); - - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 3, 'generated three audio tags'); - assert.equal(segments[0].tags.videoTags.length, 0, 'generated no video tags'); -}); - -QUnit.test('buffers video samples until flushed', function(assert) { - var segments = []; - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); -}); - -QUnit.test('does not buffer a duplicate video sample on subsequent flushes', function(assert) { - var segments = []; - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); - - segments = []; - - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); -}); - -QUnit.test('emits done event when no audio data is present', function(assert) { - var segments = []; - var done = false; - - transmuxer.on('data', function(data) { - segments.push(data); - }); - transmuxer.on('done', function() { - done = true; - }); - transmuxer.push(packetize(PAT)); - transmuxer.push(packetize(generatePMT({ - hasVideo: true, - hasAudio: true - }))); - - // buffer a NAL - transmuxer.push(packetize(videoPes([0x09, 0x01], true))); - transmuxer.push(packetize(videoPes([0x00, 0x02]))); - - // add an access_unit_delimiter_rbsp - transmuxer.push(packetize(videoPes([0x09, 0x03]))); - transmuxer.push(packetize(videoPes([0x00, 0x04]))); - transmuxer.push(packetize(videoPes([0x00, 0x05]))); - - // flush everything - transmuxer.flush(); - - assert.equal(segments[0].tags.audioTags.length, 0, 'generated no audio tags'); - assert.equal(segments[0].tags.videoTags.length, 2, 'generated two video tags'); - assert.ok(done, 'emitted done event even though no audio data was given'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/ts-inspector.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/ts-inspector.test.js deleted file mode 100644 index 980074521f..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/ts-inspector.test.js +++ /dev/null @@ -1,205 +0,0 @@ -'use strict'; -var segments = require('data-files!segments'); - -var - QUnit = require('qunit'), - tsInspector = require('../lib/tools/ts-inspector.js'), - StreamTypes = require('../lib/m2ts/stream-types.js'), - tsSegment = segments['test-segment.ts'](), - tsNoAudioSegment = segments['test-no-audio-segment.ts'](), - aacSegment = segments['test-aac-segment.aac'](), - utils = require('./utils'), - inspect = tsInspector.inspect, - parseAudioPes_ = tsInspector.parseAudioPes_, - packetize = utils.packetize, - audioPes = utils.audioPes, - PES_TIMESCALE = 90000; - -QUnit.module('TS Inspector'); - -QUnit.test('returns null for empty segment input', function(assert) { - assert.equal(inspect(new Uint8Array([])), null, 'returned null'); -}); - -QUnit.test('can parse a ts segment', function(assert) { - var expected = { - video: [ - { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'video', - pts: 924000, - dts: 924000, - ptsTime: 924000 / PES_TIMESCALE, - dtsTime: 924000 / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - audio: [ - { - type: 'audio', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'audio', - pts: 859518, - dts: 859518, - ptsTime: 859518 / PES_TIMESCALE, - dtsTime: 859518 / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(tsSegment), expected, 'parses ts segment timing data'); -}); - -QUnit.test('adjusts timestamp values based on provided reference', function(assert) { - var rollover = Math.pow(2, 33); - - var expected = { - video: [ - { - type: 'video', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - { - type: 'video', - pts: (924000 + rollover), - dts: (924000 + rollover), - ptsTime: (924000 + rollover) / PES_TIMESCALE, - dtsTime: (924000 + rollover) / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - audio: [ - { - type: 'audio', - pts: (126000 + rollover), - dts: (126000 + rollover), - ptsTime: (126000 + rollover) / PES_TIMESCALE, - dtsTime: (126000 + rollover) / PES_TIMESCALE - }, - { - type: 'audio', - pts: (859518 + rollover), - dts: (859518 + rollover), - ptsTime: (859518 + rollover) / PES_TIMESCALE, - dtsTime: (859518 + rollover) / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(tsSegment, rollover - 1), expected, - 'adjusts inspected time data to account for pts rollover'); -}); - -QUnit.test('can parse an aac segment', function(assert) { - var expected = { - audio: [ - { - type: 'audio', - pts: 895690, - dts: 895690, - ptsTime: 895690 / PES_TIMESCALE, - dtsTime: 895690 / PES_TIMESCALE - }, - { - type: 'audio', - pts: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)), - dts: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)), - ptsTime: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)) / PES_TIMESCALE, - dtsTime: (895690 + (430 * 1024 * PES_TIMESCALE / 44100)) / PES_TIMESCALE - } - ] - }; - - assert.deepEqual(inspect(aacSegment), expected, 'parses aac segment timing data'); -}); - -QUnit.test('can parse ts segment with no audio muxed in', function(assert) { - var expected = { - video: [ - { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - }, - { - type: 'video', - pts: 924000, - dts: 924000, - ptsTime: 924000 / PES_TIMESCALE, - dtsTime: 924000 / PES_TIMESCALE - } - ], - firstKeyFrame: { - type: 'video', - pts: 126000, - dts: 126000, - ptsTime: 126000 / PES_TIMESCALE, - dtsTime: 126000 / PES_TIMESCALE - } - }; - - var actual = inspect(tsNoAudioSegment); - - assert.equal(typeof actual.audio, 'undefined', 'results do not contain audio info'); - assert.deepEqual(actual, expected, - 'parses ts segment without audio timing data'); -}); - -QUnit.test('can parse audio PES when it\'s the only packet in a stream', function(assert) { - var - pts = 90000, - pmt = { - // fake pmt pid that doesn't clash with the audio pid - pid: 0x10, - table: { - // pid copied over from default of audioPes function - 0x12: StreamTypes.ADTS_STREAM_TYPE - } - }, - result = { audio: [] }; - - parseAudioPes_(packetize(audioPes([0x00], true, pts)), pmt, result); - - // note that both the first and last packet timings are the same, as there's only one - // packet to parse - assert.deepEqual( - result.audio, - [{ - dts: pts, - pts: pts, - type: 'audio' - }, { - dts: pts, - pts: pts, - type: 'audio' - }], - 'parses audio pes for timing info'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.bin.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.bin.test.js deleted file mode 100644 index c0bcf78791..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.bin.test.js +++ /dev/null @@ -1,32 +0,0 @@ -var - QUnit = require('qunit'), - toUnsigned = require('../lib/utils/bin').toUnsigned; - -QUnit.module('Binary Utils'); - -QUnit.test('converts values to unsigned integers after bitwise operations', function(assert) { - var bytes; - - bytes = [0, 0, 124, 129]; - - assert.equal(toUnsigned(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3]), - 31873, 'positive signed result stays positive'); - - bytes = [150, 234, 221, 192]; - - // sanity check - assert.equal(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3], - -1762992704, 'bitwise operation produces negative signed result'); - - assert.equal(toUnsigned(bytes[0] << 24 | - bytes[1] << 16 | - bytes[2] << 8 | - bytes[3]), - 2531974592, 'negative signed result becomes unsigned positive'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.clock.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.clock.test.js deleted file mode 100644 index a33cc16df6..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.clock.test.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict'; - -var - QUnit = require('qunit'), - clock = require('../lib/utils/clock'); - -QUnit.module('Clock Utils'); - -QUnit.test('converts from seconds to video timestamps', function(assert) { - assert.equal(clock.secondsToVideoTs(0), 0, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(1), 90000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(10), 900000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(-1), -90000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(3), 270000, 'converts seconds to video timestamp'); - assert.equal(clock.secondsToVideoTs(0.1), 9000, 'converts seconds to video timestamp'); -}); - -QUnit.test('converts from seconds to audio timestamps', function(assert) { - assert.equal(clock.secondsToAudioTs(0, 90000), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(1, 90000), - 90000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(-1, 90000), - -90000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(3, 90000), - 270000, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(0, 44100), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(1, 44100), - 44100, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(3, 44100), - 132300, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(-1, 44100), - -44100, - 'converts seconds to audio timestamp'); - assert.equal(clock.secondsToAudioTs(0.1, 44100), - 4410, - 'converts seconds to audio timestamp'); -}); - -QUnit.test('converts from video timestamp to seconds', function(assert) { - assert.equal(clock.videoTsToSeconds(0), 0, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(90000), 1, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(900000), 10, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(-90000), -1, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(270000), 3, 'converts video timestamp to seconds'); - assert.equal(clock.videoTsToSeconds(9000), 0.1, 'converts video timestamp to seconds'); -}); - -QUnit.test('converts from audio timestamp to seconds', function(assert) { - assert.equal(clock.audioTsToSeconds(0, 90000), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(90000, 90000), - 1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(-90000, 90000), - -1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(270000, 90000), - 3, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(0, 44100), - 0, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(44100, 44100), - 1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(132300, 44100), - 3, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(-44100, 44100), - -1, - 'converts seconds to audio timestamp'); - assert.equal(clock.audioTsToSeconds(4410, 44100), - 0.1, - 'converts seconds to audio timestamp'); -}); - -QUnit.test('converts from audio timestamp to video timestamp', function(assert) { - assert.equal(clock.audioTsToVideoTs(0, 90000), - 0, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(90000, 90000), - 90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(900000, 90000), - 900000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(-90000, 90000), - -90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(270000, 90000), - 270000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(9000, 90000), - 9000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(0, 44100), - 0, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(44100, 44100), - 90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(441000, 44100), - 900000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(-44100, 44100), - -90000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(132300, 44100), - 270000, - 'converts audio timestamp to video timestamp'); - assert.equal(clock.audioTsToVideoTs(4410, 44100), - 9000, - 'converts audio timestamp to video timestamp'); -}); - -QUnit.test('converts from video timestamp to audio timestamp', function(assert) { - assert.equal(clock.videoTsToAudioTs(0, 90000), - 0, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(90000, 90000), - 90000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(900000, 90000), - 900000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(-90000, 90000), - -90000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(270000, 90000), - 270000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(9000, 90000), - 9000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(0, 44100), - 0, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(90000, 44100), - 44100, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(900000, 44100), - 441000, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(-90000, 44100), - -44100, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(270000, 44100), - 132300, - 'converts video timestamp to audio timestamp'); - assert.equal(clock.videoTsToAudioTs(9000, 44100), - 4410, - 'converts video timestamp to audio timestamp'); -}); - -QUnit.test('converts from metadata timestamp to seconds', function(assert) { - assert.equal(clock.metadataTsToSeconds(90000, 90000, false), - 0, - 'converts metadata timestamp to seconds and adjusts by timelineStartPts'); - - assert.equal(clock.metadataTsToSeconds(270000, 90000, false), - 2, - 'converts metadata timestamp to seconds and adjusts by timelineStartPts'); - - assert.equal(clock.metadataTsToSeconds(90000, 90000, true), - 1, - 'converts metadata timestamp to seconds while keeping original timestamps'); - - assert.equal(clock.metadataTsToSeconds(180000, 0, true), - 2, - 'converts metadata timestamp to seconds while keeping original timestamps'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.js deleted file mode 100644 index aeee72a099..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.js +++ /dev/null @@ -1,327 +0,0 @@ -var - mp2t = require('../lib/m2ts'), - id3Generator = require('./utils/id3-generator'), - MP2T_PACKET_LENGTH = mp2t.MP2T_PACKET_LENGTH, - PMT, - PAT, - generatePMT, - pesHeader, - packetize, - transportPacket, - videoPes, - adtsFrame, - audioPes, - timedMetadataPes, - binaryStringToArrayOfBytes, - leftPad; - - -PMT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0010 0000 - 0x40, 0x10, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0010 ssi:0 0:0 r:00 sl:0000 0001 1100 - 0x02, 0x00, 0x1c, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // r:000 ppid:0 0011 1111 1111 - 0x03, 0xff, - // r:0000 pil:0000 0000 0000 - 0x00, 0x00, - // h264 - // st:0001 1010 r:000 epid:0 0000 0001 0001 - 0x1b, 0x00, 0x11, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - // adts - // st:0000 1111 r:000 epid:0 0000 0001 0010 - 0x0f, 0x00, 0x12, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - - // timed metadata - // st:0001 0111 r:000 epid:0 0000 0001 0011 - 0x15, 0x00, 0x13, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00, - - // crc - 0x00, 0x00, 0x00, 0x00 -]; - -/* - Packet Header: - | sb | tei pusi tp pid:5 | pid | tsc afc cc | - with af: - | afl | ... | | - without af: - | | - -PAT: - | pf? | ... | - | tid | ssi '0' r sl:4 | sl | tsi:8 | - | tsi | r vn cni | sn | lsn | - -with program_number == '0': - | pn | pn | r np:5 | np | -otherwise: - | pn | pn | r pmp:5 | pmp | -*/ - -PAT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0000 0000 - 0x40, 0x00, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0000 ssi:0 0:0 r:00 sl:0000 0000 0000 - 0x00, 0x00, 0x00, - // tsi:0000 0000 0000 0000 - 0x00, 0x00, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:000 pmp:0 0000 0010 0000 - 0x00, 0x10, - // crc32:0000 0000 0000 0000 0000 0000 0000 0000 - 0x00, 0x00, 0x00, 0x00 -]; - -generatePMT = function(options) { - var PMT = [ - 0x47, // sync byte - // tei:0 pusi:1 tp:0 pid:0 0000 0010 0000 - 0x40, 0x10, - // tsc:01 afc:01 cc:0000 pointer_field:0000 0000 - 0x50, 0x00, - // tid:0000 0010 ssi:0 0:0 r:00 sl:0000 0001 1100 - 0x02, 0x00, 0x1c, - // pn:0000 0000 0000 0001 - 0x00, 0x01, - // r:00 vn:00 000 cni:1 sn:0000 0000 lsn:0000 0000 - 0x01, 0x00, 0x00, - // r:000 ppid:0 0011 1111 1111 - 0x03, 0xff, - // r:0000 pil:0000 0000 0000 - 0x00, 0x00]; - - if (options.hasVideo) { - // h264 - PMT = PMT.concat([ - // st:0001 1010 r:000 epid:0 0000 0001 0001 - 0x1b, 0x00, 0x11, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - if (options.hasAudio) { - // adts - PMT = PMT.concat([ - // st:0000 1111 r:000 epid:0 0000 0001 0010 - 0x0f, 0x00, 0x12, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - if (options.hasMetadata) { - // timed metadata - PMT = PMT.concat([ - // st:0001 0111 r:000 epid:0 0000 0001 0011 - 0x15, 0x00, 0x13, - // r:0000 esil:0000 0000 0000 - 0x00, 0x00 - ]); - } - - // crc - return PMT.concat([0x00, 0x00, 0x00, 0x00]); -}; - -pesHeader = function(first, pts, dataLength) { - if (!dataLength) { - dataLength = 0; - } else { - // Add the pes header length (only the portion after the - // pes_packet_length field) - dataLength += 3; - } - - // PES_packet(), Rec. ITU-T H.222.0, Table 2-21 - var result = [ - // pscp:0000 0000 0000 0000 0000 0001 - 0x00, 0x00, 0x01, - // sid:0000 0000 ppl:0000 0000 0000 0000 - 0x00, 0x00, 0x00, - // 10 psc:00 pp:0 dai:1 c:0 ooc:0 - 0x84, - // pdf:?0 ef:1 erf:0 dtmf:0 acif:0 pcf:0 pef:0 - 0x20 | (pts ? 0x80 : 0x00), - // phdl:0000 0000 - (first ? 0x01 : 0x00) + (pts ? 0x05 : 0x00) - ]; - - // Only store 15 bits of the PTS for QUnit.testing purposes - if (pts) { - var - pts32 = Math.floor(pts / 2), // right shift by 1 - leftMostBit = ((pts32 & 0x80000000) >>> 31) & 0x01, - firstThree; - - pts = pts & 0xffffffff; // remove left most bit - firstThree = (leftMostBit << 3) | (((pts & 0xc0000000) >>> 29) & 0x06) | 0x01; - result.push((0x2 << 4) | firstThree); - result.push((pts >>> 22) & 0xff); - result.push(((pts >>> 14) | 0x01) & 0xff); - result.push((pts >>> 7) & 0xff); - result.push(((pts << 1) | 0x01) & 0xff); - - // Add the bytes spent on the pts info - dataLength += 5; - } - if (first) { - result.push(0x00); - dataLength += 1; - } - - // Finally set the pes_packet_length field - result[4] = (dataLength & 0x0000FF00) >> 8; - result[5] = dataLength & 0x000000FF; - - return result; -}; - -packetize = function(data) { - var packet = new Uint8Array(MP2T_PACKET_LENGTH); - packet.set(data); - return packet; -}; - -/** - * Helper function to create transport stream PES packets - * @param pid {uint8} - the program identifier (PID) - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -transportPacket = function(pid, data, first, pts, isVideoData) { - var - adaptationFieldLength = 188 - data.length - 14 - (first ? 1 : 0) - (pts ? 5 : 0), - // transport_packet(), Rec. ITU-T H.222.0, Table 2-2 - result = [ - // sync byte - 0x47, - // tei:0 pusi:1 tp:0 pid:0 0000 0001 0001 - 0x40, pid, - // tsc:01 afc:11 cc:0000 - 0x70 - ].concat([ - // afl - adaptationFieldLength & 0xff, - // di:0 rai:0 espi:0 pf:0 of:0 spf:0 tpdf:0 afef:0 - 0x00 - ]), - i; - - i = adaptationFieldLength - 1; - while (i--) { - // stuffing_bytes - result.push(0xff); - } - - // PES_packet(), Rec. ITU-T H.222.0, Table 2-21 - result = result.concat(pesHeader(first, pts, isVideoData ? 0 : data.length)); - - return result.concat(data); -}; - -/** - * Helper function to create video PES packets - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -videoPes = function(data, first, pts) { - return transportPacket(0x11, [ - // NAL unit start code - 0x00, 0x00, 0x01 - ].concat(data), first, pts, true); -}; - -/** - * Helper function to create audio ADTS frame header - * @param dataLength {number} - the payload byte count - */ -adtsFrame = function(dataLength) { - var frameLength = dataLength + 7; - return [ - 0xff, 0xf1, // no CRC - 0x10, // AAC Main, 44.1KHz - 0xb0 | ((frameLength & 0x1800) >> 11), // 2 channels - (frameLength & 0x7f8) >> 3, - ((frameLength & 0x07) << 5) + 7, // frame length in bytes - 0x00 // one AAC per ADTS frame - ]; -}; - -/** - * Helper function to create audio PES packets - * @param data {arraylike} - the payload bytes - * @payload first {boolean} - true if this PES should be a payload - * unit start - */ -audioPes = function(data, first, pts) { - return transportPacket(0x12, - adtsFrame(data.length).concat(data), - first, pts); -}; - -timedMetadataPes = function(data) { - var id3 = id3Generator; - return transportPacket(0x13, id3.id3Tag(id3.id3Frame('PRIV', 0x00, 0x01))); -}; - -binaryStringToArrayOfBytes = function(string) { - var - array = [], - arrayIndex = 0, - stringIndex = 0; - - while (stringIndex < string.length) { - array[arrayIndex] = parseInt(string.slice(stringIndex, stringIndex + 8), 2); - - arrayIndex++; - // next byte - stringIndex += 8; - } - - return array; -}; - -leftPad = function(string, targetLength) { - if (string.length >= targetLength) { - return string; - } - return new Array(targetLength - string.length + 1).join('0') + string; -}; - -module.exports = { - PMT: PMT, - PAT: PAT, - generatePMT: generatePMT, - pesHeader: pesHeader, - packetize: packetize, - transportPacket: transportPacket, - videoPes: videoPes, - adtsFrame: adtsFrame, - audioPes: audioPes, - timedMetadataPes: timedMetadataPes, - binaryStringToArrayOfBytes: binaryStringToArrayOfBytes, - leftPad: leftPad -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.string.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.string.test.js deleted file mode 100644 index 87768a0b33..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.string.test.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -var - QUnit = require('qunit'), - string = require('../lib/utils/string'); - -QUnit.module('String Utils'); - -QUnit.test('Converts a uint8 array into a C string from start of array until first null char', function(assert) { - var uint8String = new Uint8Array([0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00, - 0x76, 0x61, 0x6C, 0x75, 0x65, 0x2E, 0x62, 0x61, 0x72, 0x00]); // foo.bar.value\0value.bar\0 - var firstString = string.uint8ToCString(uint8String); - assert.equal(firstString, 'foo.bar.value\0', 'converts uint8 data to a c string'); - assert.equal(firstString.length, 14, 'string has the correct length'); - var secondString = string.uint8ToCString(uint8String.subarray(14)); - assert.equal(secondString, 'value.bar\0', 'converts uint8 data to a c string'); - assert.equal(secondString.length, 10, 'string has the correct length'); -}); - -QUnit.test('Converts a uint8 array with no null char into a C string', function(assert) { - var uint8String = new Uint8Array([0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72]); // foo.bar - var firstString = string.uint8ToCString(uint8String); - assert.equal(firstString, 'foo.bar\0', 'converts uint8 data to a c string'); - assert.equal(firstString.length, 8, 'string has the correct length'); -}); - -QUnit.test('Returns a null char from a uint8 array starting with a null char', function(assert) { - var uint8String = new Uint8Array([0x00, 0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72]); // \0foo.bar - var firstString = string.uint8ToCString(uint8String); - assert.equal(firstString, '\0', 'converts uint8 data to a c string'); - assert.equal(firstString.length, 1, 'string has the correct length'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.typed-array.test.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.typed-array.test.js deleted file mode 100644 index ea8c12b1ac..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils.typed-array.test.js +++ /dev/null @@ -1,28 +0,0 @@ - -'use strict'; - -var - QUnit = require('qunit'), - typedArrayIndexOf = require('../lib/utils/typed-array').typedArrayIndexOf; - -QUnit.module('typedArrayIndexOf'); - -QUnit.test('returns -1 when no typed array', function(assert) { - assert.equal(typedArrayIndexOf(null, 5, 0), -1, 'returned -1'); -}); - -QUnit.test('returns -1 when element not found', function(assert) { - assert.equal(typedArrayIndexOf(new Uint8Array([2, 3]), 5, 0), -1, 'returned -1'); -}); - -QUnit.test('returns -1 when element not found starting from index', function(assert) { - assert.equal(typedArrayIndexOf(new Uint8Array([3, 5, 6, 7]), 5, 2), -1, 'returned -1'); -}); - -QUnit.test('returns index when element found', function(assert) { - assert.equal(typedArrayIndexOf(new Uint8Array([2, 3, 5]), 5, 0), 2, 'returned 2'); -}); - -QUnit.test('returns index when element found starting from index', function(assert) { - assert.equal(typedArrayIndexOf(new Uint8Array([2, 3, 5]), 5, 2), 2, 'returned 2'); -}); diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-korean.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-korean.js deleted file mode 100644 index 83d3cd3a59..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-korean.js +++ /dev/null @@ -1,134 +0,0 @@ -module.exports = [ - { - type: 3, - pts: 4720415602, - ccData: 545, - presortIndex: 292 - }, - { - type: 3, - pts: 4721117602, - ccData: 53308, - presortIndex: 381 - }, - { - type: 2, - pts: 4721117602, - ccData: 39200, - presortIndex: 382 - }, - { - type: 2, - pts: 4721117602, - ccData: 58162, - presortIndex: 383 - }, - { - type: 2, - pts: 4721117602, - ccData: 29229, - presortIndex: 384 - }, - { - type: 2, - pts: 4721117602, - ccData: 4503, - presortIndex: 385 - }, - { - type: 2, - pts: 4721117602, - ccData: 49152, - presortIndex: 386 - }, - { - type: 2, - pts: 4721117602, - ccData: 3072, - presortIndex: 387 - }, - { - type: 2, - pts: 4721117602, - ccData: 37183, - presortIndex: 388 - }, - { - type: 2, - pts: 4721117602, - ccData: 0, - presortIndex: 389 - }, - { - type: 2, - pts: 4721117602, - ccData: 37378, - presortIndex: 390 - }, - { - type: 2, - pts: 4721117602, - ccData: 1304, - presortIndex: 391 - }, - { - type: 2, - pts: 4721117602, - ccData: 46287, - presortIndex: 392 - }, - { - type: 2, - pts: 4721117602, - ccData: 6320, - presortIndex: 393 - }, - { - type: 2, - pts: 4721117602, - ccData: 41240, - presortIndex: 394 - }, - { - type: 2, - pts: 4721117602, - ccData: 32, - presortIndex: 395 - }, - { - type: 2, - pts: 4721117602, - ccData: 0, - presortIndex: 396 - }, - { - type: 3, - pts: 4721138662, - ccData: 1318, - presortIndex: 411 - }, - { - type: 2, - pts: 4721138662, - ccData: 6323, - presortIndex: 412 - }, - { - type: 2, - pts: 4721138662, - ccData: 47896, - presortIndex: 413 - }, - { - type: 2, - pts: 4721138662, - ccData: 32, - presortIndex: 414 - }, - { - type: 2, - pts: 4721138662, - ccData: 0, - presortIndex: 415 - } -] diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-pink-underscore.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-pink-underscore.js deleted file mode 100644 index cf328ef1b8..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/cc708-pink-underscore.js +++ /dev/null @@ -1,10816 +0,0 @@ -module.exports = [ - { type: 3, pts: 6723191334, ccData: 546 }, - { type: 2, pts: 6723191334, ccData: 35842 }, - { type: 3, pts: 6723197340, ccData: 16930 }, - { type: 2, pts: 6723197340, ccData: 35072 }, - { type: 3, pts: 6723215358, ccData: 35377 }, - { type: 2, pts: 6723215358, ccData: 38939 }, - { type: 2, pts: 6723215358, ccData: 16640 }, - { type: 2, pts: 6723215358, ccData: 31 }, - { type: 2, pts: 6723215358, ccData: 5264 }, - { type: 2, pts: 6723215358, ccData: 1283 }, - { type: 2, pts: 6723215358, ccData: 37162 }, - { type: 2, pts: 6723215358, ccData: 42 }, - { type: 2, pts: 6723215358, ccData: 37376 }, - { type: 2, pts: 6723215358, ccData: 0 }, - { type: 3, pts: 6723221364, ccData: 49955 }, - { type: 2, pts: 6723221364, ccData: 37376 }, - { type: 2, pts: 6723221364, ccData: 256 }, - { type: 3, pts: 6723227370, ccData: 546 }, - { type: 2, pts: 6723227370, ccData: 8784 }, - { type: 3, pts: 6723230373, ccData: 16930 }, - { type: 2, pts: 6723230373, ccData: 26990 }, - { type: 3, pts: 6723233376, ccData: 33314 }, - { type: 2, pts: 6723233376, ccData: 27489 }, - { type: 3, pts: 6723236379, ccData: 49698 }, - { type: 2, pts: 6723236379, ccData: 27753 }, - { type: 3, pts: 6723239382, ccData: 546 }, - { type: 2, pts: 6723239382, ccData: 25449 }, - { type: 3, pts: 6723242385, ccData: 16930 }, - { type: 2, pts: 6723242385, ccData: 28533 }, - { type: 3, pts: 6723245388, ccData: 33314 }, - { type: 2, pts: 6723245388, ccData: 29535 }, - { type: 3, pts: 6723248391, ccData: 49698 }, - { type: 2, pts: 6723248391, ccData: 24942 }, - { type: 3, pts: 6723251394, ccData: 546 }, - { type: 2, pts: 6723251394, ccData: 25695 }, - { type: 3, pts: 6723254397, ccData: 16930 }, - { type: 2, pts: 6723254397, ccData: 20581 }, - { type: 3, pts: 6723257400, ccData: 33314 }, - { type: 2, pts: 6723257400, ccData: 29797 }, - { type: 3, pts: 6723260403, ccData: 49698 }, - { type: 2, pts: 6723260403, ccData: 29298 }, - { type: 3, pts: 6723263406, ccData: 546 }, - { type: 2, pts: 6723263406, ccData: 26982 }, - { type: 3, pts: 6723266409, ccData: 16930 }, - { type: 2, pts: 6723266409, ccData: 26979 }, - { type: 3, pts: 6723269412, ccData: 33314 }, - { type: 2, pts: 6723269412, ccData: 8704 }, - { type: 3, pts: 6723272415, ccData: 51761 }, - { type: 2, pts: 6723272415, ccData: 38939 }, - { type: 2, pts: 6723272415, ccData: 16640 }, - { type: 2, pts: 6723272415, ccData: 287 }, - { type: 2, pts: 6723272415, ccData: 4240 }, - { type: 2, pts: 6723272415, ccData: 1283 }, - { type: 2, pts: 6723272415, ccData: 37162 }, - { type: 2, pts: 6723272415, ccData: 0 }, - { type: 2, pts: 6723272415, ccData: 37377 }, - { type: 2, pts: 6723272415, ccData: 0 }, - { type: 3, pts: 6723275418, ccData: 51761 }, - { type: 2, pts: 6723275418, ccData: 38939 }, - { type: 2, pts: 6723275418, ccData: 16640 }, - { type: 2, pts: 6723275418, ccData: 287 }, - { type: 2, pts: 6723275418, ccData: 4240 }, - { type: 2, pts: 6723275418, ccData: 1283 }, - { type: 2, pts: 6723275418, ccData: 37162 }, - { type: 2, pts: 6723275418, ccData: 0 }, - { type: 2, pts: 6723275418, ccData: 37377 }, - { type: 2, pts: 6723275418, ccData: 0 }, - { type: 3, pts: 6723281424, ccData: 803 }, - { type: 2, pts: 6723281424, ccData: 37377 }, - { type: 2, pts: 6723281424, ccData: 512 }, - { type: 3, pts: 6723287430, ccData: 16930 }, - { type: 2, pts: 6723287430, ccData: 26995 }, - { type: 3, pts: 6723290433, ccData: 33314 }, - { type: 2, pts: 6723290433, ccData: 24429 }, - { type: 3, pts: 6723293436, ccData: 49698 }, - { type: 2, pts: 6723293436, ccData: 24932 }, - { type: 3, pts: 6723296439, ccData: 546 }, - { type: 2, pts: 6723296439, ccData: 25951 }, - { type: 3, pts: 6723299442, ccData: 16930 }, - { type: 2, pts: 6723299442, ccData: 28783 }, - { type: 3, pts: 6723302445, ccData: 33314 }, - { type: 2, pts: 6723302445, ccData: 29555 }, - { type: 3, pts: 6723305448, ccData: 49698 }, - { type: 2, pts: 6723305448, ccData: 26978 }, - { type: 3, pts: 6723308451, ccData: 546 }, - { type: 2, pts: 6723308451, ccData: 27749 }, - { type: 3, pts: 6723311454, ccData: 16930 }, - { type: 2, pts: 6723311454, ccData: 24425 }, - { type: 3, pts: 6723314457, ccData: 33314 }, - { type: 2, pts: 6723314457, ccData: 28255 }, - { type: 3, pts: 6723317460, ccData: 49698 }, - { type: 2, pts: 6723317460, ccData: 28769 }, - { type: 3, pts: 6723320463, ccData: 546 }, - { type: 2, pts: 6723320463, ccData: 29300 }, - { type: 3, pts: 6723323466, ccData: 16930 }, - { type: 2, pts: 6723323466, ccData: 24418 }, - { type: 3, pts: 6723326469, ccData: 33314 }, - { type: 2, pts: 6723326469, ccData: 31034 }, - { type: 3, pts: 6723335478, ccData: 49698 }, - { type: 2, pts: 6723335478, ccData: 35073 }, - { type: 3, pts: 6723626769, ccData: 546 }, - { type: 2, pts: 6723626769, ccData: 35841 }, - { type: 3, pts: 6723644787, ccData: 16930 }, - { type: 2, pts: 6723644787, ccData: 35072 }, - { type: 3, pts: 6723650793, ccData: 35377 }, - { type: 2, pts: 6723650793, ccData: 38939 }, - { type: 2, pts: 6723650793, ccData: 15360 }, - { type: 2, pts: 6723650793, ccData: 31 }, - { type: 2, pts: 6723650793, ccData: 5264 }, - { type: 2, pts: 6723650793, ccData: 1283 }, - { type: 2, pts: 6723650793, ccData: 37162 }, - { type: 2, pts: 6723650793, ccData: 0 }, - { type: 2, pts: 6723650793, ccData: 37376 }, - { type: 2, pts: 6723650793, ccData: 3072 }, - { type: 3, pts: 6723653796, ccData: 49955 }, - { type: 2, pts: 6723653796, ccData: 37376 }, - { type: 2, pts: 6723653796, ccData: 3328 }, - { type: 3, pts: 6723656799, ccData: 546 }, - { type: 2, pts: 6723656799, ccData: 18249 }, - { type: 3, pts: 6723659802, ccData: 16930 }, - { type: 2, pts: 6723659802, ccData: 21068 }, - { type: 3, pts: 6723662805, ccData: 33314 }, - { type: 2, pts: 6723662805, ccData: 14848 }, - { type: 3, pts: 6723665808, ccData: 51761 }, - { type: 2, pts: 6723665808, ccData: 38939 }, - { type: 2, pts: 6723665808, ccData: 15360 }, - { type: 2, pts: 6723665808, ccData: 287 }, - { type: 2, pts: 6723665808, ccData: 4240 }, - { type: 2, pts: 6723665808, ccData: 1283 }, - { type: 2, pts: 6723665808, ccData: 37162 }, - { type: 2, pts: 6723665808, ccData: 0 }, - { type: 2, pts: 6723665808, ccData: 37377 }, - { type: 2, pts: 6723665808, ccData: 2048 }, - { type: 3, pts: 6723668811, ccData: 546 }, - { type: 2, pts: 6723668811, ccData: 21093 }, - { type: 3, pts: 6723671814, ccData: 16930 }, - { type: 2, pts: 6723671814, ccData: 24932 }, - { type: 3, pts: 6723674817, ccData: 33314 }, - { type: 2, pts: 6723674817, ccData: 24429 }, - { type: 3, pts: 6723677820, ccData: 49698 }, - { type: 2, pts: 6723677820, ccData: 25951 }, - { type: 3, pts: 6723680823, ccData: 546 }, - { type: 2, pts: 6723680823, ccData: 29800 }, - { type: 3, pts: 6723683826, ccData: 16930 }, - { type: 2, pts: 6723683826, ccData: 25951 }, - { type: 3, pts: 6723686829, ccData: 33314 }, - { type: 2, pts: 6723686829, ccData: 29793 }, - { type: 3, pts: 6723689832, ccData: 49698 }, - { type: 2, pts: 6723689832, ccData: 27749 }, - { type: 3, pts: 6723692835, ccData: 2609 }, - { type: 2, pts: 6723692835, ccData: 38939 }, - { type: 2, pts: 6723692835, ccData: 15360 }, - { type: 2, pts: 6723692835, ccData: 543 }, - { type: 2, pts: 6723692835, ccData: 4240 }, - { type: 2, pts: 6723692835, ccData: 1283 }, - { type: 2, pts: 6723692835, ccData: 37162 }, - { type: 2, pts: 6723692835, ccData: 0 }, - { type: 2, pts: 6723692835, ccData: 37378 }, - { type: 2, pts: 6723692835, ccData: 1024 }, - { type: 3, pts: 6723695838, ccData: 17187 }, - { type: 2, pts: 6723695838, ccData: 37378 }, - { type: 2, pts: 6723695838, ccData: 1792 }, - { type: 3, pts: 6723698841, ccData: 33314 }, - { type: 2, pts: 6723698841, ccData: 28518 }, - { type: 3, pts: 6723701844, ccData: 49698 }, - { type: 2, pts: 6723701844, ccData: 24417 }, - { type: 3, pts: 6723704847, ccData: 546 }, - { type: 2, pts: 6723704847, ccData: 24422 }, - { type: 3, pts: 6723707850, ccData: 16930 }, - { type: 2, pts: 6723707850, ccData: 24946 }, - { type: 3, pts: 6723710853, ccData: 33314 }, - { type: 2, pts: 6723710853, ccData: 24951 }, - { type: 3, pts: 6723713856, ccData: 49698 }, - { type: 2, pts: 6723713856, ccData: 24953 }, - { type: 3, pts: 6723716859, ccData: 546 }, - { type: 2, pts: 6723716859, ccData: 24428 }, - { type: 3, pts: 6723719862, ccData: 16930 }, - { type: 2, pts: 6723719862, ccData: 24942 }, - { type: 3, pts: 6723722865, ccData: 33314 }, - { type: 2, pts: 6723722865, ccData: 25646 }, - { type: 3, pts: 6723740883, ccData: 49698 }, - { type: 2, pts: 6723740883, ccData: 35073 }, - { type: 3, pts: 6723746889, ccData: 2609 }, - { type: 2, pts: 6723746889, ccData: 39195 }, - { type: 2, pts: 6723746889, ccData: 16640 }, - { type: 2, pts: 6723746889, ccData: 31 }, - { type: 2, pts: 6723746889, ccData: 5264 }, - { type: 2, pts: 6723746889, ccData: 1283 }, - { type: 2, pts: 6723746889, ccData: 37162 }, - { type: 2, pts: 6723746889, ccData: 42 }, - { type: 2, pts: 6723746889, ccData: 37376 }, - { type: 2, pts: 6723746889, ccData: 1024 }, - { type: 3, pts: 6723749892, ccData: 17187 }, - { type: 2, pts: 6723749892, ccData: 37376 }, - { type: 2, pts: 6723749892, ccData: 1792 }, - { type: 3, pts: 6723752895, ccData: 33314 }, - { type: 2, pts: 6723752895, ccData: 21605 }, - { type: 3, pts: 6723755898, ccData: 49698 }, - { type: 2, pts: 6723755898, ccData: 27756 }, - { type: 3, pts: 6723758901, ccData: 546 }, - { type: 2, pts: 6723758901, ccData: 24429 }, - { type: 3, pts: 6723761904, ccData: 16930 }, - { type: 2, pts: 6723761904, ccData: 25951 }, - { type: 3, pts: 6723764907, ccData: 33314 }, - { type: 2, pts: 6723764907, ccData: 28518 }, - { type: 3, pts: 6723767910, ccData: 49698 }, - { type: 2, pts: 6723767910, ccData: 24432 }, - { type: 3, pts: 6723770913, ccData: 546 }, - { type: 2, pts: 6723770913, ccData: 27745 }, - { type: 3, pts: 6723773916, ccData: 16930 }, - { type: 2, pts: 6723773916, ccData: 28261 }, - { type: 3, pts: 6723776919, ccData: 33314 }, - { type: 2, pts: 6723776919, ccData: 29811 }, - { type: 3, pts: 6723779922, ccData: 51761 }, - { type: 2, pts: 6723779922, ccData: 39195 }, - { type: 2, pts: 6723779922, ccData: 16640 }, - { type: 2, pts: 6723779922, ccData: 287 }, - { type: 2, pts: 6723779922, ccData: 4240 }, - { type: 2, pts: 6723779922, ccData: 1283 }, - { type: 2, pts: 6723779922, ccData: 37162 }, - { type: 2, pts: 6723779922, ccData: 0 }, - { type: 2, pts: 6723779922, ccData: 37377 }, - { type: 2, pts: 6723779922, ccData: 1024 }, - { type: 3, pts: 6723782925, ccData: 803 }, - { type: 2, pts: 6723782925, ccData: 37377 }, - { type: 2, pts: 6723782925, ccData: 1536 }, - { type: 3, pts: 6723785928, ccData: 16930 }, - { type: 2, pts: 6723785928, ccData: 30569 }, - { type: 3, pts: 6723788931, ccData: 33314 }, - { type: 2, pts: 6723788931, ccData: 29800 }, - { type: 3, pts: 6723791934, ccData: 49698 }, - { type: 2, pts: 6723791934, ccData: 24431 }, - { type: 3, pts: 6723794937, ccData: 546 }, - { type: 2, pts: 6723794937, ccData: 25445 }, - { type: 3, pts: 6723797940, ccData: 16930 }, - { type: 2, pts: 6723797940, ccData: 24942 }, - { type: 3, pts: 6723800943, ccData: 33314 }, - { type: 2, pts: 6723800943, ccData: 29535 }, - { type: 3, pts: 6723803946, ccData: 49698 }, - { type: 2, pts: 6723803946, ccData: 28518 }, - { type: 3, pts: 6723806949, ccData: 546 }, - { type: 2, pts: 6723806949, ccData: 24435 }, - { type: 3, pts: 6723809952, ccData: 16930 }, - { type: 2, pts: 6723809952, ccData: 24942 }, - { type: 3, pts: 6723812955, ccData: 33314 }, - { type: 2, pts: 6723812955, ccData: 25646 }, - { type: 3, pts: 6723945087, ccData: 49698 }, - { type: 2, pts: 6723945087, ccData: 35841 }, - { type: 3, pts: 6723948090, ccData: 546 }, - { type: 2, pts: 6723948090, ccData: 35074 }, - { type: 3, pts: 6723954096, ccData: 18993 }, - { type: 2, pts: 6723954096, ccData: 38939 }, - { type: 2, pts: 6723954096, ccData: 16640 }, - { type: 2, pts: 6723954096, ccData: 31 }, - { type: 2, pts: 6723954096, ccData: 5264 }, - { type: 2, pts: 6723954096, ccData: 1283 }, - { type: 2, pts: 6723954096, ccData: 37162 }, - { type: 2, pts: 6723954096, ccData: 42 }, - { type: 2, pts: 6723954096, ccData: 37376 }, - { type: 2, pts: 6723954096, ccData: 1024 }, - { type: 3, pts: 6723957099, ccData: 33571 }, - { type: 2, pts: 6723957099, ccData: 37376 }, - { type: 2, pts: 6723957099, ccData: 1792 }, - { type: 3, pts: 6723960102, ccData: 49698 }, - { type: 2, pts: 6723960102, ccData: 21601 }, - { type: 3, pts: 6723963105, ccData: 546 }, - { type: 2, pts: 6723963105, ccData: 27493 }, - { type: 3, pts: 6723966108, ccData: 16930 }, - { type: 2, pts: 6723966108, ccData: 24429 }, - { type: 3, pts: 6723969111, ccData: 33314 }, - { type: 2, pts: 6723969111, ccData: 25951 }, - { type: 3, pts: 6723972114, ccData: 49698 }, - { type: 2, pts: 6723972114, ccData: 29807 }, - { type: 3, pts: 6723975117, ccData: 546 }, - { type: 2, pts: 6723975117, ccData: 24432 }, - { type: 3, pts: 6723978120, ccData: 16930 }, - { type: 2, pts: 6723978120, ccData: 27745 }, - { type: 3, pts: 6723981123, ccData: 33314 }, - { type: 2, pts: 6723981123, ccData: 25445 }, - { type: 3, pts: 6723984126, ccData: 49698 }, - { type: 2, pts: 6723984126, ccData: 29440 }, - { type: 3, pts: 6723987129, ccData: 2609 }, - { type: 2, pts: 6723987129, ccData: 38939 }, - { type: 2, pts: 6723987129, ccData: 16640 }, - { type: 2, pts: 6723987129, ccData: 287 }, - { type: 2, pts: 6723987129, ccData: 4240 }, - { type: 2, pts: 6723987129, ccData: 1283 }, - { type: 2, pts: 6723987129, ccData: 37162 }, - { type: 2, pts: 6723987129, ccData: 0 }, - { type: 2, pts: 6723987129, ccData: 37377 }, - { type: 2, pts: 6723987129, ccData: 1024 }, - { type: 3, pts: 6723990132, ccData: 17187 }, - { type: 2, pts: 6723990132, ccData: 37377 }, - { type: 2, pts: 6723990132, ccData: 1536 }, - { type: 3, pts: 6723993135, ccData: 33314 }, - { type: 2, pts: 6723993135, ccData: 28025 }, - { type: 3, pts: 6723996138, ccData: 49698 }, - { type: 2, pts: 6723996138, ccData: 24432 }, - { type: 3, pts: 6723999141, ccData: 546 }, - { type: 2, pts: 6723999141, ccData: 24947 }, - { type: 3, pts: 6724002144, ccData: 16930 }, - { type: 2, pts: 6724002144, ccData: 29545 }, - { type: 3, pts: 6724005147, ccData: 33314 }, - { type: 2, pts: 6724005147, ccData: 28526 }, - { type: 3, pts: 6724008150, ccData: 49698 }, - { type: 2, pts: 6724008150, ccData: 29535 }, - { type: 3, pts: 6724011153, ccData: 546 }, - { type: 2, pts: 6724011153, ccData: 28789 }, - { type: 3, pts: 6724014156, ccData: 16930 }, - { type: 2, pts: 6724014156, ccData: 29299 }, - { type: 3, pts: 6724017159, ccData: 33314 }, - { type: 2, pts: 6724017159, ccData: 30053 }, - { type: 3, pts: 6724020162, ccData: 49698 }, - { type: 2, pts: 6724020162, ccData: 11776 }, - { type: 3, pts: 6724200342, ccData: 546 }, - { type: 2, pts: 6724200342, ccData: 35842 }, - { type: 3, pts: 6724203345, ccData: 16930 }, - { type: 2, pts: 6724203345, ccData: 35073 }, - { type: 3, pts: 6724209351, ccData: 35377 }, - { type: 2, pts: 6724209351, ccData: 39195 }, - { type: 2, pts: 6724209351, ccData: 16640 }, - { type: 2, pts: 6724209351, ccData: 31 }, - { type: 2, pts: 6724209351, ccData: 5264 }, - { type: 2, pts: 6724209351, ccData: 1283 }, - { type: 2, pts: 6724209351, ccData: 37162 }, - { type: 2, pts: 6724209351, ccData: 42 }, - { type: 2, pts: 6724209351, ccData: 37376 }, - { type: 2, pts: 6724209351, ccData: 1024 }, - { type: 3, pts: 6724212354, ccData: 49955 }, - { type: 2, pts: 6724212354, ccData: 37376 }, - { type: 2, pts: 6724212354, ccData: 1792 }, - { type: 3, pts: 6724215357, ccData: 546 }, - { type: 2, pts: 6724215357, ccData: 21605 }, - { type: 3, pts: 6724218360, ccData: 16930 }, - { type: 2, pts: 6724218360, ccData: 24931 }, - { type: 3, pts: 6724221363, ccData: 33314 }, - { type: 2, pts: 6724221363, ccData: 26719 }, - { type: 3, pts: 6724224366, ccData: 49698 }, - { type: 2, pts: 6724224366, ccData: 28005 }, - { type: 3, pts: 6724227369, ccData: 546 }, - { type: 2, pts: 6724227369, ccData: 24436 }, - { type: 3, pts: 6724230372, ccData: 16930 }, - { type: 2, pts: 6724230372, ccData: 28511 }, - { type: 3, pts: 6724233375, ccData: 33314 }, - { type: 2, pts: 6724233375, ccData: 29285 }, - { type: 3, pts: 6724236378, ccData: 49698 }, - { type: 2, pts: 6724236378, ccData: 24932 }, - { type: 3, pts: 6724239381, ccData: 546 }, - { type: 2, pts: 6724239381, ccData: 11264 }, - { type: 3, pts: 6724242384, ccData: 18993 }, - { type: 2, pts: 6724242384, ccData: 39195 }, - { type: 2, pts: 6724242384, ccData: 16640 }, - { type: 2, pts: 6724242384, ccData: 287 }, - { type: 2, pts: 6724242384, ccData: 4240 }, - { type: 2, pts: 6724242384, ccData: 1283 }, - { type: 2, pts: 6724242384, ccData: 37162 }, - { type: 2, pts: 6724242384, ccData: 0 }, - { type: 2, pts: 6724242384, ccData: 37377 }, - { type: 2, pts: 6724242384, ccData: 0 }, - { type: 3, pts: 6724245387, ccData: 33571 }, - { type: 2, pts: 6724245387, ccData: 37377 }, - { type: 2, pts: 6724245387, ccData: 512 }, - { type: 3, pts: 6724248390, ccData: 49698 }, - { type: 2, pts: 6724248390, ccData: 24942 }, - { type: 3, pts: 6724251393, ccData: 546 }, - { type: 2, pts: 6724251393, ccData: 25695 }, - { type: 3, pts: 6724254396, ccData: 16930 }, - { type: 2, pts: 6724254396, ccData: 18727 }, - { type: 3, pts: 6724257399, ccData: 33314 }, - { type: 2, pts: 6724257399, ccData: 27756 }, - { type: 3, pts: 6724260402, ccData: 49698 }, - { type: 2, pts: 6724260402, ccData: 24436 }, - { type: 3, pts: 6724263405, ccData: 546 }, - { type: 2, pts: 6724263405, ccData: 25953 }, - { type: 3, pts: 6724266408, ccData: 16930 }, - { type: 2, pts: 6724266408, ccData: 25448 }, - { type: 3, pts: 6724269411, ccData: 33314 }, - { type: 2, pts: 6724269411, ccData: 24435 }, - { type: 3, pts: 6724272414, ccData: 49698 }, - { type: 2, pts: 6724272414, ccData: 28525 }, - { type: 3, pts: 6724275417, ccData: 546 }, - { type: 2, pts: 6724275417, ccData: 25967 }, - { type: 3, pts: 6724278420, ccData: 16930 }, - { type: 2, pts: 6724278420, ccData: 28261 }, - { type: 3, pts: 6724281423, ccData: 33314 }, - { type: 2, pts: 6724281423, ccData: 11359 }, - { type: 3, pts: 6724284426, ccData: 49698 }, - { type: 2, pts: 6724284426, ccData: 29807 }, - { type: 3, pts: 6724287429, ccData: 546 }, - { type: 2, pts: 6724287429, ccData: 28462 }, - { type: 3, pts: 6724482624, ccData: 16930 }, - { type: 2, pts: 6724482624, ccData: 35841 }, - { type: 3, pts: 6724485627, ccData: 33314 }, - { type: 2, pts: 6724485627, ccData: 35074 }, - { type: 3, pts: 6724491633, ccData: 51761 }, - { type: 2, pts: 6724491633, ccData: 38939 }, - { type: 2, pts: 6724491633, ccData: 0 }, - { type: 2, pts: 6724491633, ccData: 31 }, - { type: 2, pts: 6724491633, ccData: 5264 }, - { type: 2, pts: 6724491633, ccData: 1283 }, - { type: 2, pts: 6724491633, ccData: 37162 }, - { type: 2, pts: 6724491633, ccData: 42 }, - { type: 2, pts: 6724491633, ccData: 37376 }, - { type: 2, pts: 6724491633, ccData: 1024 }, - { type: 3, pts: 6724494636, ccData: 546 }, - { type: 2, pts: 6724494636, ccData: 18543 }, - { type: 3, pts: 6724497639, ccData: 16930 }, - { type: 2, pts: 6724497639, ccData: 28005 }, - { type: 3, pts: 6724500642, ccData: 33314 }, - { type: 2, pts: 6724500642, ccData: 29279 }, - { type: 3, pts: 6724503645, ccData: 49698 }, - { type: 2, pts: 6724503645, ccData: 26995 }, - { type: 3, pts: 6724506648, ccData: 546 }, - { type: 2, pts: 6724506648, ccData: 24417 }, - { type: 3, pts: 6724509651, ccData: 16930 }, - { type: 2, pts: 6724509651, ccData: 24432 }, - { type: 3, pts: 6724512654, ccData: 33314 }, - { type: 2, pts: 6724512654, ccData: 29295 }, - { type: 3, pts: 6724515657, ccData: 49698 }, - { type: 2, pts: 6724515657, ccData: 30052 }, - { type: 3, pts: 6724518660, ccData: 546 }, - { type: 2, pts: 6724518660, ccData: 24435 }, - { type: 3, pts: 6724521663, ccData: 16930 }, - { type: 2, pts: 6724521663, ccData: 28783 }, - { type: 3, pts: 6724524666, ccData: 33314 }, - { type: 2, pts: 6724524666, ccData: 28275 }, - { type: 3, pts: 6724527669, ccData: 49698 }, - { type: 2, pts: 6724527669, ccData: 28530 }, - { type: 3, pts: 6724530672, ccData: 2609 }, - { type: 2, pts: 6724530672, ccData: 38939 }, - { type: 2, pts: 6724530672, ccData: 0 }, - { type: 2, pts: 6724530672, ccData: 287 }, - { type: 2, pts: 6724530672, ccData: 4240 }, - { type: 2, pts: 6724530672, ccData: 1283 }, - { type: 2, pts: 6724530672, ccData: 37162 }, - { type: 2, pts: 6724530672, ccData: 0 }, - { type: 2, pts: 6724530672, ccData: 37377 }, - { type: 2, pts: 6724530672, ccData: 2048 }, - { type: 3, pts: 6724533675, ccData: 17187 }, - { type: 2, pts: 6724533675, ccData: 37377 }, - { type: 2, pts: 6724533675, ccData: 2560 }, - { type: 3, pts: 6724536678, ccData: 33314 }, - { type: 2, pts: 6724536678, ccData: 28518 }, - { type: 3, pts: 6724539681, ccData: 49698 }, - { type: 2, pts: 6724539681, ccData: 24400 }, - { type: 3, pts: 6724542684, ccData: 546 }, - { type: 2, pts: 6724542684, ccData: 16979 }, - { type: 3, pts: 6724545687, ccData: 16930 }, - { type: 2, pts: 6724545687, ccData: 24395 }, - { type: 3, pts: 6724548690, ccData: 33314 }, - { type: 2, pts: 6724548690, ccData: 26980 }, - { type: 3, pts: 6724551693, ccData: 49698 }, - { type: 2, pts: 6724551693, ccData: 29486 }, - { type: 3, pts: 6724713855, ccData: 546 }, - { type: 2, pts: 6724713855, ccData: 35842 }, - { type: 3, pts: 6724716858, ccData: 16930 }, - { type: 2, pts: 6724716858, ccData: 35073 }, - { type: 3, pts: 6724975116, ccData: 33314 }, - { type: 2, pts: 6724975116, ccData: 35841 }, - { type: 3, pts: 6724996137, ccData: 49698 }, - { type: 2, pts: 6724996137, ccData: 35072 }, - { type: 3, pts: 6725002143, ccData: 2609 }, - { type: 2, pts: 6725002143, ccData: 38939 }, - { type: 2, pts: 6725002143, ccData: 17920 }, - { type: 2, pts: 6725002143, ccData: 31 }, - { type: 2, pts: 6725002143, ccData: 5264 }, - { type: 2, pts: 6725002143, ccData: 1283 }, - { type: 2, pts: 6725002143, ccData: 37162 }, - { type: 2, pts: 6725002143, ccData: 0 }, - { type: 2, pts: 6725002143, ccData: 37376 }, - { type: 2, pts: 6725002143, ccData: 3072 }, - { type: 3, pts: 6725005146, ccData: 17187 }, - { type: 2, pts: 6725005146, ccData: 37376 }, - { type: 2, pts: 6725005146, ccData: 3584 }, - { type: 3, pts: 6725008149, ccData: 33313 }, - { type: 2, pts: 6725008149, ccData: 32512 }, - { type: 3, pts: 6725011152, ccData: 49698 }, - { type: 2, pts: 6725011152, ccData: 24320 }, - { type: 3, pts: 6725014155, ccData: 545 }, - { type: 2, pts: 6725014155, ccData: 32512 }, - { type: 3, pts: 6725065206, ccData: 16930 }, - { type: 2, pts: 6725065206, ccData: 35073 }, - { type: 3, pts: 6725071212, ccData: 35377 }, - { type: 2, pts: 6725071212, ccData: 39195 }, - { type: 2, pts: 6725071212, ccData: 15360 }, - { type: 2, pts: 6725071212, ccData: 31 }, - { type: 2, pts: 6725071212, ccData: 5264 }, - { type: 2, pts: 6725071212, ccData: 1283 }, - { type: 2, pts: 6725071212, ccData: 37162 }, - { type: 2, pts: 6725071212, ccData: 42 }, - { type: 2, pts: 6725071212, ccData: 37376 }, - { type: 2, pts: 6725071212, ccData: 3072 }, - { type: 3, pts: 6725074215, ccData: 49955 }, - { type: 2, pts: 6725074215, ccData: 37376 }, - { type: 2, pts: 6725074215, ccData: 3584 }, - { type: 3, pts: 6725077218, ccData: 546 }, - { type: 2, pts: 6725077218, ccData: 19273 }, - { type: 3, pts: 6725080221, ccData: 16930 }, - { type: 2, pts: 6725080221, ccData: 17466 }, - { type: 3, pts: 6725083224, ccData: 35377 }, - { type: 2, pts: 6725083224, ccData: 39195 }, - { type: 2, pts: 6725083224, ccData: 15360 }, - { type: 2, pts: 6725083224, ccData: 287 }, - { type: 2, pts: 6725083224, ccData: 4240 }, - { type: 2, pts: 6725083224, ccData: 1283 }, - { type: 2, pts: 6725083224, ccData: 37162 }, - { type: 2, pts: 6725083224, ccData: 0 }, - { type: 2, pts: 6725083224, ccData: 37377 }, - { type: 2, pts: 6725083224, ccData: 2048 }, - { type: 3, pts: 6725086227, ccData: 49698 }, - { type: 2, pts: 6725086227, ccData: 21601 }, - { type: 3, pts: 6725089230, ccData: 546 }, - { type: 2, pts: 6725089230, ccData: 29287 }, - { type: 3, pts: 6725092233, ccData: 16930 }, - { type: 2, pts: 6725092233, ccData: 25972 }, - { type: 3, pts: 6725095236, ccData: 33314 }, - { type: 2, pts: 6725095236, ccData: 24418 }, - { type: 3, pts: 6725098239, ccData: 49698 }, - { type: 2, pts: 6725098239, ccData: 25964 }, - { type: 3, pts: 6725101242, ccData: 546 }, - { type: 2, pts: 6725101242, ccData: 26981 }, - { type: 3, pts: 6725104245, ccData: 16930 }, - { type: 2, pts: 6725104245, ccData: 30309 }, - { type: 3, pts: 6725107248, ccData: 33314 }, - { type: 2, pts: 6725107248, ccData: 29440 }, - { type: 3, pts: 6725110251, ccData: 51761 }, - { type: 2, pts: 6725110251, ccData: 39195 }, - { type: 2, pts: 6725110251, ccData: 15360 }, - { type: 2, pts: 6725110251, ccData: 543 }, - { type: 2, pts: 6725110251, ccData: 4240 }, - { type: 2, pts: 6725110251, ccData: 1283 }, - { type: 2, pts: 6725110251, ccData: 37162 }, - { type: 2, pts: 6725110251, ccData: 0 }, - { type: 2, pts: 6725110251, ccData: 37378 }, - { type: 2, pts: 6725110251, ccData: 1024 }, - { type: 3, pts: 6725113254, ccData: 803 }, - { type: 2, pts: 6725113254, ccData: 37378 }, - { type: 2, pts: 6725113254, ccData: 1280 }, - { type: 3, pts: 6725116257, ccData: 16930 }, - { type: 2, pts: 6725116257, ccData: 29800 }, - { type: 3, pts: 6725119260, ccData: 33314 }, - { type: 2, pts: 6725119260, ccData: 24948 }, - { type: 3, pts: 6725122263, ccData: 49698 }, - { type: 2, pts: 6725122263, ccData: 24436 }, - { type: 3, pts: 6725125266, ccData: 546 }, - { type: 2, pts: 6725125266, ccData: 26725 }, - { type: 3, pts: 6725128269, ccData: 16930 }, - { type: 2, pts: 6725128269, ccData: 24432 }, - { type: 3, pts: 6725131272, ccData: 33314 }, - { type: 2, pts: 6725131272, ccData: 28535 }, - { type: 3, pts: 6725134275, ccData: 49698 }, - { type: 2, pts: 6725134275, ccData: 25970 }, - { type: 3, pts: 6725137278, ccData: 546 }, - { type: 2, pts: 6725137278, ccData: 24431 }, - { type: 3, pts: 6725140281, ccData: 16930 }, - { type: 2, pts: 6725140281, ccData: 26207 }, - { type: 3, pts: 6725143284, ccData: 33314 }, - { type: 2, pts: 6725143284, ccData: 28780 }, - { type: 3, pts: 6725146287, ccData: 49698 }, - { type: 2, pts: 6725146287, ccData: 24953 }, - { type: 3, pts: 6725173314, ccData: 546 }, - { type: 2, pts: 6725173314, ccData: 35841 }, - { type: 3, pts: 6725176317, ccData: 16930 }, - { type: 2, pts: 6725176317, ccData: 35074 }, - { type: 3, pts: 6725182323, ccData: 35377 }, - { type: 2, pts: 6725182323, ccData: 38939 }, - { type: 2, pts: 6725182323, ccData: 17920 }, - { type: 2, pts: 6725182323, ccData: 31 }, - { type: 2, pts: 6725182323, ccData: 5264 }, - { type: 2, pts: 6725182323, ccData: 1283 }, - { type: 2, pts: 6725182323, ccData: 37162 }, - { type: 2, pts: 6725182323, ccData: 42 }, - { type: 2, pts: 6725182323, ccData: 37376 }, - { type: 2, pts: 6725182323, ccData: 0 }, - { type: 3, pts: 6725185326, ccData: 49955 }, - { type: 2, pts: 6725185326, ccData: 37376 }, - { type: 2, pts: 6725185326, ccData: 512 }, - { type: 3, pts: 6725188329, ccData: 546 }, - { type: 2, pts: 6725188329, ccData: 24942 }, - { type: 3, pts: 6725191332, ccData: 16930 }, - { type: 2, pts: 6725191332, ccData: 25695 }, - { type: 3, pts: 6725194335, ccData: 33314 }, - { type: 2, pts: 6725194335, ccData: 29800 }, - { type: 3, pts: 6725197338, ccData: 49698 }, - { type: 2, pts: 6725197338, ccData: 25951 }, - { type: 3, pts: 6725200341, ccData: 546 }, - { type: 2, pts: 6725200341, ccData: 27247 }, - { type: 3, pts: 6725203344, ccData: 16930 }, - { type: 2, pts: 6725203344, ccData: 31071 }, - { type: 3, pts: 6725206347, ccData: 33314 }, - { type: 2, pts: 6725206347, ccData: 28518 }, - { type: 3, pts: 6725209350, ccData: 49698 }, - { type: 2, pts: 6725209350, ccData: 24421 }, - { type: 3, pts: 6725212353, ccData: 546 }, - { type: 2, pts: 6725212353, ccData: 30309 }, - { type: 3, pts: 6725215356, ccData: 16930 }, - { type: 2, pts: 6725215356, ccData: 29305 }, - { type: 3, pts: 6725218359, ccData: 33314 }, - { type: 2, pts: 6725218359, ccData: 25697 }, - { type: 3, pts: 6725221362, ccData: 49698 }, - { type: 2, pts: 6725221362, ccData: 31071 }, - { type: 3, pts: 6725224365, ccData: 546 }, - { type: 2, pts: 6725224365, ccData: 27753 }, - { type: 3, pts: 6725227368, ccData: 16930 }, - { type: 2, pts: 6725227368, ccData: 26213 }, - { type: 3, pts: 6725374515, ccData: 33314 }, - { type: 2, pts: 6725374515, ccData: 35842 }, - { type: 3, pts: 6725377518, ccData: 49698 }, - { type: 2, pts: 6725377518, ccData: 35073 }, - { type: 3, pts: 6725383524, ccData: 2609 }, - { type: 2, pts: 6725383524, ccData: 39195 }, - { type: 2, pts: 6725383524, ccData: 17920 }, - { type: 2, pts: 6725383524, ccData: 31 }, - { type: 2, pts: 6725383524, ccData: 5264 }, - { type: 2, pts: 6725383524, ccData: 1283 }, - { type: 2, pts: 6725383524, ccData: 37162 }, - { type: 2, pts: 6725383524, ccData: 42 }, - { type: 2, pts: 6725383524, ccData: 37376 }, - { type: 2, pts: 6725383524, ccData: 2048 }, - { type: 3, pts: 6725386527, ccData: 16930 }, - { type: 2, pts: 6725386527, ccData: 24946 }, - { type: 3, pts: 6725389530, ccData: 33314 }, - { type: 2, pts: 6725389530, ccData: 25951 }, - { type: 3, pts: 6725392533, ccData: 49698 }, - { type: 2, pts: 6725392533, ccData: 24940 }, - { type: 3, pts: 6725395536, ccData: 546 }, - { type: 2, pts: 6725395536, ccData: 27743 }, - { type: 3, pts: 6725398539, ccData: 16930 }, - { type: 2, pts: 6725398539, ccData: 24946 }, - { type: 3, pts: 6725401542, ccData: 33314 }, - { type: 2, pts: 6725401542, ccData: 28533 }, - { type: 3, pts: 6725404545, ccData: 49698 }, - { type: 2, pts: 6725404545, ccData: 28260 }, - { type: 3, pts: 6725407548, ccData: 546 }, - { type: 2, pts: 6725407548, ccData: 11776 }, - { type: 3, pts: 6725578719, ccData: 16930 }, - { type: 2, pts: 6725578719, ccData: 35841 }, - { type: 3, pts: 6725581722, ccData: 33314 }, - { type: 2, pts: 6725581722, ccData: 35074 }, - { type: 3, pts: 6725587728, ccData: 51761 }, - { type: 2, pts: 6725587728, ccData: 38939 }, - { type: 2, pts: 6725587728, ccData: 17920 }, - { type: 2, pts: 6725587728, ccData: 31 }, - { type: 2, pts: 6725587728, ccData: 5264 }, - { type: 2, pts: 6725587728, ccData: 1283 }, - { type: 2, pts: 6725587728, ccData: 37162 }, - { type: 2, pts: 6725587728, ccData: 42 }, - { type: 2, pts: 6725587728, ccData: 37376 }, - { type: 2, pts: 6725587728, ccData: 3072 }, - { type: 3, pts: 6725590731, ccData: 803 }, - { type: 2, pts: 6725590731, ccData: 37376 }, - { type: 2, pts: 6725590731, ccData: 3584 }, - { type: 3, pts: 6725593734, ccData: 16929 }, - { type: 2, pts: 6725593734, ccData: 32512 }, - { type: 3, pts: 6725596737, ccData: 33314 }, - { type: 2, pts: 6725596737, ccData: 24320 }, - { type: 3, pts: 6725599740, ccData: 49697 }, - { type: 2, pts: 6725599740, ccData: 32512 }, - { type: 3, pts: 6725698839, ccData: 546 }, - { type: 2, pts: 6725698839, ccData: 35842 }, - { type: 3, pts: 6725701842, ccData: 16930 }, - { type: 2, pts: 6725701842, ccData: 35073 }, - { type: 3, pts: 6725707848, ccData: 35377 }, - { type: 2, pts: 6725707848, ccData: 39195 }, - { type: 2, pts: 6725707848, ccData: 16640 }, - { type: 2, pts: 6725707848, ccData: 31 }, - { type: 2, pts: 6725707848, ccData: 5264 }, - { type: 2, pts: 6725707848, ccData: 1283 }, - { type: 2, pts: 6725707848, ccData: 37162 }, - { type: 2, pts: 6725707848, ccData: 42 }, - { type: 2, pts: 6725707848, ccData: 37376 }, - { type: 2, pts: 6725707848, ccData: 0 }, - { type: 3, pts: 6725710851, ccData: 49955 }, - { type: 2, pts: 6725710851, ccData: 37376 }, - { type: 2, pts: 6725710851, ccData: 768 }, - { type: 3, pts: 6725713854, ccData: 546 }, - { type: 2, pts: 6725713854, ccData: 21601 }, - { type: 3, pts: 6725716857, ccData: 16930 }, - { type: 2, pts: 6725716857, ccData: 29287 }, - { type: 3, pts: 6725719860, ccData: 33314 }, - { type: 2, pts: 6725719860, ccData: 25972 }, - { type: 3, pts: 6725722863, ccData: 49698 }, - { type: 2, pts: 6725722863, ccData: 24425 }, - { type: 3, pts: 6725725866, ccData: 546 }, - { type: 2, pts: 6725725866, ccData: 29535 }, - { type: 3, pts: 6725728869, ccData: 16930 }, - { type: 2, pts: 6725728869, ccData: 24927 }, - { type: 3, pts: 6725731872, ccData: 33314 }, - { type: 2, pts: 6725731872, ccData: 28786 }, - { type: 3, pts: 6725734875, ccData: 49698 }, - { type: 2, pts: 6725734875, ccData: 28533 }, - { type: 3, pts: 6725737878, ccData: 546 }, - { type: 2, pts: 6725737878, ccData: 25695 }, - { type: 3, pts: 6725740881, ccData: 16930 }, - { type: 2, pts: 6725740881, ccData: 29552 }, - { type: 3, pts: 6725743884, ccData: 33314 }, - { type: 2, pts: 6725743884, ccData: 28526 }, - { type: 3, pts: 6725746887, ccData: 49698 }, - { type: 2, pts: 6725746887, ccData: 29551 }, - { type: 3, pts: 6725749890, ccData: 546 }, - { type: 2, pts: 6725749890, ccData: 29184 }, - { type: 3, pts: 6725752893, ccData: 18993 }, - { type: 2, pts: 6725752893, ccData: 39195 }, - { type: 2, pts: 6725752893, ccData: 16640 }, - { type: 2, pts: 6725752893, ccData: 287 }, - { type: 2, pts: 6725752893, ccData: 4240 }, - { type: 2, pts: 6725752893, ccData: 1283 }, - { type: 2, pts: 6725752893, ccData: 37162 }, - { type: 2, pts: 6725752893, ccData: 0 }, - { type: 2, pts: 6725752893, ccData: 37377 }, - { type: 2, pts: 6725752893, ccData: 2048 }, - { type: 3, pts: 6725755896, ccData: 33571 }, - { type: 2, pts: 6725755896, ccData: 37377 }, - { type: 2, pts: 6725755896, ccData: 2560 }, - { type: 3, pts: 6725758899, ccData: 49698 }, - { type: 2, pts: 6725758899, ccData: 28518 }, - { type: 3, pts: 6725761902, ccData: 546 }, - { type: 2, pts: 6725761902, ccData: 24400 }, - { type: 3, pts: 6725764905, ccData: 16930 }, - { type: 2, pts: 6725764905, ccData: 16979 }, - { type: 3, pts: 6725767908, ccData: 33314 }, - { type: 2, pts: 6725767908, ccData: 24395 }, - { type: 3, pts: 6725770911, ccData: 49698 }, - { type: 2, pts: 6725770911, ccData: 26980 }, - { type: 3, pts: 6725773914, ccData: 546 }, - { type: 2, pts: 6725773914, ccData: 29486 }, - { type: 3, pts: 6725812953, ccData: 16930 }, - { type: 2, pts: 6725812953, ccData: 35841 }, - { type: 3, pts: 6725815956, ccData: 33314 }, - { type: 2, pts: 6725815956, ccData: 35074 }, - { type: 3, pts: 6726188328, ccData: 49698 }, - { type: 2, pts: 6726188328, ccData: 35842 }, - { type: 3, pts: 6726347487, ccData: 546 }, - { type: 2, pts: 6726347487, ccData: 35072 }, - { type: 3, pts: 6726353493, ccData: 18993 }, - { type: 2, pts: 6726353493, ccData: 38939 }, - { type: 2, pts: 6726353493, ccData: 17920 }, - { type: 2, pts: 6726353493, ccData: 31 }, - { type: 2, pts: 6726353493, ccData: 5264 }, - { type: 2, pts: 6726353493, ccData: 1283 }, - { type: 2, pts: 6726353493, ccData: 37162 }, - { type: 2, pts: 6726353493, ccData: 42 }, - { type: 2, pts: 6726353493, ccData: 37376 }, - { type: 2, pts: 6726353493, ccData: 3072 }, - { type: 3, pts: 6726356496, ccData: 33571 }, - { type: 2, pts: 6726356496, ccData: 37376 }, - { type: 2, pts: 6726356496, ccData: 3584 }, - { type: 3, pts: 6726359499, ccData: 49697 }, - { type: 2, pts: 6726359499, ccData: 32512 }, - { type: 3, pts: 6726362502, ccData: 546 }, - { type: 2, pts: 6726362502, ccData: 24320 }, - { type: 3, pts: 6726365505, ccData: 16929 }, - { type: 2, pts: 6726365505, ccData: 32512 }, - { type: 3, pts: 6726392532, ccData: 33314 }, - { type: 2, pts: 6726392532, ccData: 35073 }, - { type: 3, pts: 6726512652, ccData: 51761 }, - { type: 2, pts: 6726512652, ccData: 39195 }, - { type: 2, pts: 6726512652, ccData: 0 }, - { type: 2, pts: 6726512652, ccData: 31 }, - { type: 2, pts: 6726512652, ccData: 5264 }, - { type: 2, pts: 6726512652, ccData: 1283 }, - { type: 2, pts: 6726512652, ccData: 37162 }, - { type: 2, pts: 6726512652, ccData: 42 }, - { type: 2, pts: 6726512652, ccData: 37376 }, - { type: 2, pts: 6726512652, ccData: 2048 }, - { type: 3, pts: 6726515655, ccData: 803 }, - { type: 2, pts: 6726515655, ccData: 37376 }, - { type: 2, pts: 6726515655, ccData: 2816 }, - { type: 3, pts: 6726518658, ccData: 16930 }, - { type: 2, pts: 6726518658, ccData: 16718 }, - { type: 3, pts: 6726521661, ccData: 33314 }, - { type: 2, pts: 6726521661, ccData: 20047 }, - { type: 3, pts: 6726524664, ccData: 49698 }, - { type: 2, pts: 6726524664, ccData: 21838 }, - { type: 3, pts: 6726527667, ccData: 546 }, - { type: 2, pts: 6726527667, ccData: 17221 }, - { type: 3, pts: 6726530670, ccData: 16930 }, - { type: 2, pts: 6726530670, ccData: 21050 }, - { type: 3, pts: 6726533673, ccData: 35377 }, - { type: 2, pts: 6726533673, ccData: 39195 }, - { type: 2, pts: 6726533673, ccData: 0 }, - { type: 2, pts: 6726533673, ccData: 287 }, - { type: 2, pts: 6726533673, ccData: 4240 }, - { type: 2, pts: 6726533673, ccData: 1283 }, - { type: 2, pts: 6726533673, ccData: 37162 }, - { type: 2, pts: 6726533673, ccData: 0 }, - { type: 2, pts: 6726533673, ccData: 37377 }, - { type: 2, pts: 6726533673, ccData: 1024 }, - { type: 3, pts: 6726536676, ccData: 49698 }, - { type: 2, pts: 6726536676, ccData: 19301 }, - { type: 3, pts: 6726539679, ccData: 546 }, - { type: 2, pts: 6726539679, ccData: 25968 }, - { type: 3, pts: 6726542682, ccData: 16930 }, - { type: 2, pts: 6726542682, ccData: 24419 }, - { type: 3, pts: 6726545685, ccData: 33314 }, - { type: 2, pts: 6726545685, ccData: 30066 }, - { type: 3, pts: 6726548688, ccData: 49698 }, - { type: 2, pts: 6726548688, ccData: 26991 }, - { type: 3, pts: 6726551691, ccData: 546 }, - { type: 2, pts: 6726551691, ccData: 29545 }, - { type: 3, pts: 6726554694, ccData: 16930 }, - { type: 2, pts: 6726554694, ccData: 29817 }, - { type: 3, pts: 6726557697, ccData: 33314 }, - { type: 2, pts: 6726557697, ccData: 24434 }, - { type: 3, pts: 6726560700, ccData: 49698 }, - { type: 2, pts: 6726560700, ccData: 30062 }, - { type: 3, pts: 6726563703, ccData: 546 }, - { type: 2, pts: 6726563703, ccData: 28265 }, - { type: 3, pts: 6726566706, ccData: 16930 }, - { type: 2, pts: 6726566706, ccData: 28263 }, - { type: 3, pts: 6726569709, ccData: 33314 }, - { type: 2, pts: 6726569709, ccData: 11776 }, - { type: 3, pts: 6726845985, ccData: 49698 }, - { type: 2, pts: 6726845985, ccData: 35841 }, - { type: 3, pts: 6726848988, ccData: 546 }, - { type: 2, pts: 6726848988, ccData: 35074 }, - { type: 3, pts: 6726854994, ccData: 18993 }, - { type: 2, pts: 6726854994, ccData: 38939 }, - { type: 2, pts: 6726854994, ccData: 0 }, - { type: 2, pts: 6726854994, ccData: 31 }, - { type: 2, pts: 6726854994, ccData: 5264 }, - { type: 2, pts: 6726854994, ccData: 1283 }, - { type: 2, pts: 6726854994, ccData: 37162 }, - { type: 2, pts: 6726854994, ccData: 42 }, - { type: 2, pts: 6726854994, ccData: 37376 }, - { type: 2, pts: 6726854994, ccData: 3072 }, - { type: 3, pts: 6726857997, ccData: 33571 }, - { type: 2, pts: 6726857997, ccData: 37376 }, - { type: 2, pts: 6726857997, ccData: 3584 }, - { type: 3, pts: 6726861000, ccData: 49697 }, - { type: 2, pts: 6726861000, ccData: 32512 }, - { type: 3, pts: 6726864003, ccData: 546 }, - { type: 2, pts: 6726864003, ccData: 24320 }, - { type: 3, pts: 6726867006, ccData: 16929 }, - { type: 2, pts: 6726867006, ccData: 32512 }, - { type: 3, pts: 6727098237, ccData: 33314 }, - { type: 2, pts: 6727098237, ccData: 35842 }, - { type: 3, pts: 6727101240, ccData: 49698 }, - { type: 2, pts: 6727101240, ccData: 35073 }, - { type: 3, pts: 6727107246, ccData: 2609 }, - { type: 2, pts: 6727107246, ccData: 39195 }, - { type: 2, pts: 6727107246, ccData: 0 }, - { type: 2, pts: 6727107246, ccData: 31 }, - { type: 2, pts: 6727107246, ccData: 5264 }, - { type: 2, pts: 6727107246, ccData: 1283 }, - { type: 2, pts: 6727107246, ccData: 37162 }, - { type: 2, pts: 6727107246, ccData: 42 }, - { type: 2, pts: 6727107246, ccData: 37376 }, - { type: 2, pts: 6727107246, ccData: 2048 }, - { type: 3, pts: 6727110249, ccData: 17187 }, - { type: 2, pts: 6727110249, ccData: 37376 }, - { type: 2, pts: 6727110249, ccData: 2304 }, - { type: 3, pts: 6727113252, ccData: 33314 }, - { type: 2, pts: 6727113252, ccData: 19305 }, - { type: 3, pts: 6727116255, ccData: 49698 }, - { type: 2, pts: 6727116255, ccData: 25700 }, - { type: 3, pts: 6727119258, ccData: 546 }, - { type: 2, pts: 6727119258, ccData: 26981 }, - { type: 3, pts: 6727122261, ccData: 16930 }, - { type: 2, pts: 6727122261, ccData: 24385 }, - { type: 3, pts: 6727125264, ccData: 33314 }, - { type: 2, pts: 6727125264, ccData: 25441 }, - { type: 3, pts: 6727128267, ccData: 49698 }, - { type: 2, pts: 6727128267, ccData: 25701 }, - { type: 3, pts: 6727131270, ccData: 546 }, - { type: 2, pts: 6727131270, ccData: 28025 }, - { type: 3, pts: 6727134273, ccData: 18993 }, - { type: 2, pts: 6727134273, ccData: 39195 }, - { type: 2, pts: 6727134273, ccData: 0 }, - { type: 2, pts: 6727134273, ccData: 287 }, - { type: 2, pts: 6727134273, ccData: 4240 }, - { type: 2, pts: 6727134273, ccData: 1283 }, - { type: 2, pts: 6727134273, ccData: 37162 }, - { type: 2, pts: 6727134273, ccData: 0 }, - { type: 2, pts: 6727134273, ccData: 37377 }, - { type: 2, pts: 6727134273, ccData: 1024 }, - { type: 3, pts: 6727137276, ccData: 33314 }, - { type: 2, pts: 6727137276, ccData: 17764 }, - { type: 3, pts: 6727140279, ccData: 49698 }, - { type: 2, pts: 6727140279, ccData: 30051 }, - { type: 3, pts: 6727143282, ccData: 546 }, - { type: 2, pts: 6727143282, ccData: 24948 }, - { type: 3, pts: 6727146285, ccData: 16930 }, - { type: 2, pts: 6727146285, ccData: 26991 }, - { type: 3, pts: 6727149288, ccData: 33314 }, - { type: 2, pts: 6727149288, ccData: 28257 }, - { type: 3, pts: 6727152291, ccData: 49698 }, - { type: 2, pts: 6727152291, ccData: 27743 }, - { type: 3, pts: 6727155294, ccData: 546 }, - { type: 2, pts: 6727155294, ccData: 17256 }, - { type: 3, pts: 6727158297, ccData: 16930 }, - { type: 2, pts: 6727158297, ccData: 26988 }, - { type: 3, pts: 6727161300, ccData: 33314 }, - { type: 2, pts: 6727161300, ccData: 25695 }, - { type: 3, pts: 6727164303, ccData: 49698 }, - { type: 2, pts: 6727164303, ccData: 17249 }, - { type: 3, pts: 6727167306, ccData: 546 }, - { type: 2, pts: 6727167306, ccData: 29285 }, - { type: 3, pts: 6727170309, ccData: 16930 }, - { type: 2, pts: 6727170309, ccData: 11776 }, - { type: 3, pts: 6727353492, ccData: 33314 }, - { type: 2, pts: 6727353492, ccData: 35841 }, - { type: 3, pts: 6727356495, ccData: 49698 }, - { type: 2, pts: 6727356495, ccData: 35074 }, - { type: 3, pts: 6727602741, ccData: 546 }, - { type: 2, pts: 6727602741, ccData: 35842 }, - { type: 3, pts: 6727891029, ccData: 18993 }, - { type: 2, pts: 6727891029, ccData: 38939 }, - { type: 2, pts: 6727891029, ccData: 16640 }, - { type: 2, pts: 6727891029, ccData: 31 }, - { type: 2, pts: 6727891029, ccData: 5264 }, - { type: 2, pts: 6727891029, ccData: 1283 }, - { type: 2, pts: 6727891029, ccData: 37162 }, - { type: 2, pts: 6727891029, ccData: 42 }, - { type: 2, pts: 6727891029, ccData: 37376 }, - { type: 2, pts: 6727891029, ccData: 1024 }, - { type: 3, pts: 6727897035, ccData: 33571 }, - { type: 2, pts: 6727897035, ccData: 37376 }, - { type: 2, pts: 6727897035, ccData: 1536 }, - { type: 3, pts: 6727903041, ccData: 49698 }, - { type: 2, pts: 6727903041, ccData: 16750 }, - { type: 3, pts: 6727906044, ccData: 546 }, - { type: 2, pts: 6727906044, ccData: 25695 }, - { type: 3, pts: 6727909047, ccData: 16930 }, - { type: 2, pts: 6727909047, ccData: 25209 }, - { type: 3, pts: 6727912050, ccData: 33314 }, - { type: 2, pts: 6727912050, ccData: 24419 }, - { type: 3, pts: 6727915053, ccData: 49698 }, - { type: 2, pts: 6727915053, ccData: 28526 }, - { type: 3, pts: 6727918056, ccData: 546 }, - { type: 2, pts: 6727918056, ccData: 29810 }, - { type: 3, pts: 6727921059, ccData: 16930 }, - { type: 2, pts: 6727921059, ccData: 26978 }, - { type: 3, pts: 6727924062, ccData: 33314 }, - { type: 2, pts: 6727924062, ccData: 30068 }, - { type: 3, pts: 6727927065, ccData: 49698 }, - { type: 2, pts: 6727927065, ccData: 26991 }, - { type: 3, pts: 6727930068, ccData: 546 }, - { type: 2, pts: 6727930068, ccData: 28275 }, - { type: 3, pts: 6727933071, ccData: 18993 }, - { type: 2, pts: 6727933071, ccData: 38939 }, - { type: 2, pts: 6727933071, ccData: 16640 }, - { type: 2, pts: 6727933071, ccData: 287 }, - { type: 2, pts: 6727933071, ccData: 4240 }, - { type: 2, pts: 6727933071, ccData: 1283 }, - { type: 2, pts: 6727933071, ccData: 37162 }, - { type: 2, pts: 6727933071, ccData: 0 }, - { type: 2, pts: 6727933071, ccData: 37377 }, - { type: 2, pts: 6727933071, ccData: 1024 }, - { type: 3, pts: 6727939077, ccData: 33571 }, - { type: 2, pts: 6727939077, ccData: 37377 }, - { type: 2, pts: 6727939077, ccData: 1536 }, - { type: 3, pts: 6727945083, ccData: 49698 }, - { type: 2, pts: 6727945083, ccData: 29807 }, - { type: 3, pts: 6727948086, ccData: 546 }, - { type: 2, pts: 6727948086, ccData: 24441 }, - { type: 3, pts: 6727951089, ccData: 16930 }, - { type: 2, pts: 6727951089, ccData: 28533 }, - { type: 3, pts: 6727954092, ccData: 33314 }, - { type: 2, pts: 6727954092, ccData: 29279 }, - { type: 3, pts: 6727957095, ccData: 49698 }, - { type: 2, pts: 6727957095, ccData: 20546 }, - { type: 3, pts: 6727960098, ccData: 546 }, - { type: 2, pts: 6727960098, ccData: 21343 }, - { type: 3, pts: 6727963101, ccData: 16930 }, - { type: 2, pts: 6727963101, ccData: 29556 }, - { type: 3, pts: 6727966104, ccData: 33314 }, - { type: 2, pts: 6727966104, ccData: 24948 }, - { type: 3, pts: 6727969107, ccData: 49698 }, - { type: 2, pts: 6727969107, ccData: 26991 }, - { type: 3, pts: 6727972110, ccData: 546 }, - { type: 2, pts: 6727972110, ccData: 28160 }, - { type: 3, pts: 6727981119, ccData: 16930 }, - { type: 2, pts: 6727981119, ccData: 35073 }, - { type: 3, pts: 6728182320, ccData: 35377 }, - { type: 2, pts: 6728182320, ccData: 39195 }, - { type: 2, pts: 6728182320, ccData: 17920 }, - { type: 2, pts: 6728182320, ccData: 31 }, - { type: 2, pts: 6728182320, ccData: 5264 }, - { type: 2, pts: 6728182320, ccData: 1283 }, - { type: 2, pts: 6728182320, ccData: 37162 }, - { type: 2, pts: 6728182320, ccData: 42 }, - { type: 2, pts: 6728182320, ccData: 37376 }, - { type: 2, pts: 6728182320, ccData: 1024 }, - { type: 3, pts: 6728188326, ccData: 49955 }, - { type: 2, pts: 6728188326, ccData: 37376 }, - { type: 2, pts: 6728188326, ccData: 1280 }, - { type: 3, pts: 6728194332, ccData: 546 }, - { type: 2, pts: 6728194332, ccData: 26226 }, - { type: 3, pts: 6728197335, ccData: 16930 }, - { type: 2, pts: 6728197335, ccData: 28525 }, - { type: 3, pts: 6728200338, ccData: 33314 }, - { type: 2, pts: 6728200338, ccData: 24438 }, - { type: 3, pts: 6728203341, ccData: 49698 }, - { type: 2, pts: 6728203341, ccData: 26981 }, - { type: 3, pts: 6728206344, ccData: 546 }, - { type: 2, pts: 6728206344, ccData: 30565 }, - { type: 3, pts: 6728209347, ccData: 16930 }, - { type: 2, pts: 6728209347, ccData: 29299 }, - { type: 3, pts: 6728212350, ccData: 33314 }, - { type: 2, pts: 6728212350, ccData: 24428 }, - { type: 3, pts: 6728215353, ccData: 49698 }, - { type: 2, pts: 6728215353, ccData: 26987 }, - { type: 3, pts: 6728218356, ccData: 546 }, - { type: 2, pts: 6728218356, ccData: 25951 }, - { type: 3, pts: 6728221359, ccData: 16930 }, - { type: 2, pts: 6728221359, ccData: 31087 }, - { type: 3, pts: 6728224362, ccData: 33314 }, - { type: 2, pts: 6728224362, ccData: 29998 }, - { type: 3, pts: 6728227365, ccData: 49698 }, - { type: 2, pts: 6728227365, ccData: 35841 }, - { type: 3, pts: 6728233371, ccData: 546 }, - { type: 2, pts: 6728233371, ccData: 35074 }, - { type: 3, pts: 6728377515, ccData: 18993 }, - { type: 2, pts: 6728377515, ccData: 38939 }, - { type: 2, pts: 6728377515, ccData: 17920 }, - { type: 2, pts: 6728377515, ccData: 31 }, - { type: 2, pts: 6728377515, ccData: 5264 }, - { type: 2, pts: 6728377515, ccData: 1283 }, - { type: 2, pts: 6728377515, ccData: 37162 }, - { type: 2, pts: 6728377515, ccData: 42 }, - { type: 2, pts: 6728377515, ccData: 37376 }, - { type: 2, pts: 6728377515, ccData: 2048 }, - { type: 3, pts: 6728383521, ccData: 33571 }, - { type: 2, pts: 6728383521, ccData: 37376 }, - { type: 2, pts: 6728383521, ccData: 2816 }, - { type: 3, pts: 6728389527, ccData: 49698 }, - { type: 2, pts: 6728389527, ccData: 21608 }, - { type: 3, pts: 6728392530, ccData: 546 }, - { type: 2, pts: 6728392530, ccData: 24942 }, - { type: 3, pts: 6728395533, ccData: 16930 }, - { type: 2, pts: 6728395533, ccData: 27487 }, - { type: 3, pts: 6728398536, ccData: 33314 }, - { type: 2, pts: 6728398536, ccData: 31087 }, - { type: 3, pts: 6728401539, ccData: 49698 }, - { type: 2, pts: 6728401539, ccData: 29985 }, - { type: 3, pts: 6728404542, ccData: 546 }, - { type: 2, pts: 6728404542, ccData: 35842 }, - { type: 3, pts: 6728410548, ccData: 16930 }, - { type: 2, pts: 6728410548, ccData: 35073 }, - { type: 3, pts: 6728572710, ccData: 33314 }, - { type: 2, pts: 6728572710, ccData: 35841 }, - { type: 3, pts: 6728605743, ccData: 49698 }, - { type: 2, pts: 6728605743, ccData: 35072 }, - { type: 3, pts: 6728623761, ccData: 2609 }, - { type: 2, pts: 6728623761, ccData: 38939 }, - { type: 2, pts: 6728623761, ccData: 16640 }, - { type: 2, pts: 6728623761, ccData: 31 }, - { type: 2, pts: 6728623761, ccData: 5264 }, - { type: 2, pts: 6728623761, ccData: 1283 }, - { type: 2, pts: 6728623761, ccData: 37162 }, - { type: 2, pts: 6728623761, ccData: 0 }, - { type: 2, pts: 6728623761, ccData: 37376 }, - { type: 2, pts: 6728623761, ccData: 1024 }, - { type: 3, pts: 6728629767, ccData: 17187 }, - { type: 2, pts: 6728629767, ccData: 37376 }, - { type: 2, pts: 6728629767, ccData: 1792 }, - { type: 3, pts: 6728635773, ccData: 33313 }, - { type: 2, pts: 6728635773, ccData: 32512 }, - { type: 3, pts: 6728638776, ccData: 49698 }, - { type: 2, pts: 6728638776, ccData: 24400 }, - { type: 3, pts: 6728641779, ccData: 546 }, - { type: 2, pts: 6728641779, ccData: 26990 }, - { type: 3, pts: 6728644782, ccData: 16930 }, - { type: 2, pts: 6728644782, ccData: 27487 }, - { type: 3, pts: 6728647785, ccData: 33314 }, - { type: 2, pts: 6728647785, ccData: 26995 }, - { type: 3, pts: 6728650788, ccData: 49698 }, - { type: 2, pts: 6728650788, ccData: 24436 }, - { type: 3, pts: 6728653791, ccData: 546 }, - { type: 2, pts: 6728653791, ccData: 26725 }, - { type: 3, pts: 6728656794, ccData: 16930 }, - { type: 2, pts: 6728656794, ccData: 24422 }, - { type: 3, pts: 6728659797, ccData: 33314 }, - { type: 2, pts: 6728659797, ccData: 30062 }, - { type: 3, pts: 6728662800, ccData: 51761 }, - { type: 2, pts: 6728662800, ccData: 38939 }, - { type: 2, pts: 6728662800, ccData: 16640 }, - { type: 2, pts: 6728662800, ccData: 287 }, - { type: 2, pts: 6728662800, ccData: 4240 }, - { type: 2, pts: 6728662800, ccData: 1283 }, - { type: 2, pts: 6728662800, ccData: 37162 }, - { type: 2, pts: 6728662800, ccData: 0 }, - { type: 2, pts: 6728662800, ccData: 37377 }, - { type: 2, pts: 6728662800, ccData: 1024 }, - { type: 3, pts: 6728668806, ccData: 803 }, - { type: 2, pts: 6728668806, ccData: 37377 }, - { type: 2, pts: 6728668806, ccData: 1536 }, - { type: 3, pts: 6728674812, ccData: 16930 }, - { type: 2, pts: 6728674812, ccData: 28518 }, - { type: 3, pts: 6728677815, ccData: 33314 }, - { type: 2, pts: 6728677815, ccData: 24436 }, - { type: 3, pts: 6728680818, ccData: 49698 }, - { type: 2, pts: 6728680818, ccData: 30569 }, - { type: 3, pts: 6728683821, ccData: 546 }, - { type: 2, pts: 6728683821, ccData: 29292 }, - { type: 3, pts: 6728686824, ccData: 16930 }, - { type: 2, pts: 6728686824, ccData: 26990 }, - { type: 3, pts: 6728689827, ccData: 33314 }, - { type: 2, pts: 6728689827, ccData: 26463 }, - { type: 3, pts: 6728692830, ccData: 49698 }, - { type: 2, pts: 6728692830, ccData: 24946 }, - { type: 3, pts: 6728695833, ccData: 546 }, - { type: 2, pts: 6728695833, ccData: 28533 }, - { type: 3, pts: 6728698836, ccData: 16930 }, - { type: 2, pts: 6728698836, ccData: 28260 }, - { type: 3, pts: 6728701839, ccData: 33314 }, - { type: 2, pts: 6728701839, ccData: 24320 }, - { type: 3, pts: 6728704842, ccData: 49697 }, - { type: 2, pts: 6728704842, ccData: 32512 }, - { type: 3, pts: 6728713851, ccData: 546 }, - { type: 2, pts: 6728713851, ccData: 35073 }, - { type: 3, pts: 6728888025, ccData: 18993 }, - { type: 2, pts: 6728888025, ccData: 39195 }, - { type: 2, pts: 6728888025, ccData: 16640 }, - { type: 2, pts: 6728888025, ccData: 31 }, - { type: 2, pts: 6728888025, ccData: 5264 }, - { type: 2, pts: 6728888025, ccData: 1283 }, - { type: 2, pts: 6728888025, ccData: 37162 }, - { type: 2, pts: 6728888025, ccData: 42 }, - { type: 2, pts: 6728888025, ccData: 37376 }, - { type: 2, pts: 6728888025, ccData: 1024 }, - { type: 3, pts: 6728894031, ccData: 33571 }, - { type: 2, pts: 6728894031, ccData: 37376 }, - { type: 2, pts: 6728894031, ccData: 1792 }, - { type: 3, pts: 6728900037, ccData: 49697 }, - { type: 2, pts: 6728900037, ccData: 32512 }, - { type: 3, pts: 6728903040, ccData: 546 }, - { type: 2, pts: 6728903040, ccData: 24385 }, - { type: 3, pts: 6728906043, ccData: 16930 }, - { type: 2, pts: 6728906043, ccData: 28260 }, - { type: 3, pts: 6728909046, ccData: 33314 }, - { type: 2, pts: 6728909046, ccData: 24435 }, - { type: 3, pts: 6728912049, ccData: 49698 }, - { type: 2, pts: 6728912049, ccData: 25455 }, - { type: 3, pts: 6728915052, ccData: 546 }, - { type: 2, pts: 6728915052, ccData: 28532 }, - { type: 3, pts: 6728918055, ccData: 16930 }, - { type: 2, pts: 6728918055, ccData: 26990 }, - { type: 3, pts: 6728921058, ccData: 33314 }, - { type: 2, pts: 6728921058, ccData: 26463 }, - { type: 3, pts: 6728924061, ccData: 49698 }, - { type: 2, pts: 6728924061, ccData: 24942 }, - { type: 3, pts: 6728927064, ccData: 546 }, - { type: 2, pts: 6728927064, ccData: 25600 }, - { type: 3, pts: 6728930067, ccData: 18993 }, - { type: 2, pts: 6728930067, ccData: 39195 }, - { type: 2, pts: 6728930067, ccData: 16640 }, - { type: 2, pts: 6728930067, ccData: 287 }, - { type: 2, pts: 6728930067, ccData: 4240 }, - { type: 2, pts: 6728930067, ccData: 1283 }, - { type: 2, pts: 6728930067, ccData: 37162 }, - { type: 2, pts: 6728930067, ccData: 0 }, - { type: 2, pts: 6728930067, ccData: 37377 }, - { type: 2, pts: 6728930067, ccData: 0 }, - { type: 3, pts: 6728936073, ccData: 33571 }, - { type: 2, pts: 6728936073, ccData: 37377 }, - { type: 2, pts: 6728936073, ccData: 512 }, - { type: 3, pts: 6728942079, ccData: 49698 }, - { type: 2, pts: 6728942079, ccData: 26735 }, - { type: 3, pts: 6728945082, ccData: 546 }, - { type: 2, pts: 6728945082, ccData: 28267 }, - { type: 3, pts: 6728948085, ccData: 16930 }, - { type: 2, pts: 6728948085, ccData: 26990 }, - { type: 3, pts: 6728951088, ccData: 33314 }, - { type: 2, pts: 6728951088, ccData: 26463 }, - { type: 3, pts: 6728954091, ccData: 49698 }, - { type: 2, pts: 6728954091, ccData: 29800 }, - { type: 3, pts: 6728957094, ccData: 546 }, - { type: 2, pts: 6728957094, ccData: 25951 }, - { type: 3, pts: 6728960097, ccData: 16930 }, - { type: 2, pts: 6728960097, ccData: 26721 }, - { type: 3, pts: 6728963100, ccData: 33314 }, - { type: 2, pts: 6728963100, ccData: 28784 }, - { type: 3, pts: 6728966103, ccData: 49698 }, - { type: 2, pts: 6728966103, ccData: 26981 }, - { type: 3, pts: 6728969106, ccData: 546 }, - { type: 2, pts: 6728969106, ccData: 29556 }, - { type: 3, pts: 6728972109, ccData: 16930 }, - { type: 2, pts: 6728972109, ccData: 24435 }, - { type: 3, pts: 6728975112, ccData: 33314 }, - { type: 2, pts: 6728975112, ccData: 28533 }, - { type: 3, pts: 6728978115, ccData: 49698 }, - { type: 2, pts: 6728978115, ccData: 28260 }, - { type: 3, pts: 6728981118, ccData: 546 }, - { type: 2, pts: 6728981118, ccData: 24320 }, - { type: 3, pts: 6728984121, ccData: 16929 }, - { type: 2, pts: 6728984121, ccData: 32512 }, - { type: 3, pts: 6728987124, ccData: 33314 }, - { type: 2, pts: 6728987124, ccData: 35841 }, - { type: 3, pts: 6728993130, ccData: 49698 }, - { type: 2, pts: 6728993130, ccData: 35074 }, - { type: 3, pts: 6729122259, ccData: 2609 }, - { type: 2, pts: 6729122259, ccData: 38939 }, - { type: 2, pts: 6729122259, ccData: 16640 }, - { type: 2, pts: 6729122259, ccData: 31 }, - { type: 2, pts: 6729122259, ccData: 5264 }, - { type: 2, pts: 6729122259, ccData: 1283 }, - { type: 2, pts: 6729122259, ccData: 37162 }, - { type: 2, pts: 6729122259, ccData: 42 }, - { type: 2, pts: 6729122259, ccData: 37376 }, - { type: 2, pts: 6729122259, ccData: 1024 }, - { type: 3, pts: 6729128265, ccData: 16929 }, - { type: 2, pts: 6729128265, ccData: 32512 }, - { type: 3, pts: 6729131268, ccData: 33314 }, - { type: 2, pts: 6729131268, ccData: 24399 }, - { type: 3, pts: 6729134271, ccData: 49698 }, - { type: 2, pts: 6729134271, ccData: 29279 }, - { type: 3, pts: 6729137274, ccData: 546 }, - { type: 2, pts: 6729137274, ccData: 25452 }, - { type: 3, pts: 6729140277, ccData: 16930 }, - { type: 2, pts: 6729140277, ccData: 26989 }, - { type: 3, pts: 6729143280, ccData: 33314 }, - { type: 2, pts: 6729143280, ccData: 25193 }, - { type: 3, pts: 6729146283, ccData: 49698 }, - { type: 2, pts: 6729146283, ccData: 28263 }, - { type: 3, pts: 6729149286, ccData: 546 }, - { type: 2, pts: 6729149286, ccData: 24431 }, - { type: 3, pts: 6729152289, ccData: 16930 }, - { type: 2, pts: 6729152289, ccData: 28255 }, - { type: 3, pts: 6729155292, ccData: 33314 }, - { type: 2, pts: 6729155292, ccData: 25196 }, - { type: 3, pts: 6729158295, ccData: 49698 }, - { type: 2, pts: 6729158295, ccData: 28515 }, - { type: 3, pts: 6729161298, ccData: 546 }, - { type: 2, pts: 6729161298, ccData: 27507 }, - { type: 3, pts: 6729164301, ccData: 18993 }, - { type: 2, pts: 6729164301, ccData: 38939 }, - { type: 2, pts: 6729164301, ccData: 16640 }, - { type: 2, pts: 6729164301, ccData: 287 }, - { type: 2, pts: 6729164301, ccData: 4240 }, - { type: 2, pts: 6729164301, ccData: 1283 }, - { type: 2, pts: 6729164301, ccData: 37162 }, - { type: 2, pts: 6729164301, ccData: 0 }, - { type: 2, pts: 6729164301, ccData: 37377 }, - { type: 2, pts: 6729164301, ccData: 1024 }, - { type: 3, pts: 6729170307, ccData: 33571 }, - { type: 2, pts: 6729170307, ccData: 37377 }, - { type: 2, pts: 6729170307, ccData: 1280 }, - { type: 3, pts: 6729176313, ccData: 49698 }, - { type: 2, pts: 6729176313, ccData: 29807 }, - { type: 3, pts: 6729179316, ccData: 546 }, - { type: 2, pts: 6729179316, ccData: 24436 }, - { type: 3, pts: 6729182319, ccData: 16930 }, - { type: 2, pts: 6729182319, ccData: 26725 }, - { type: 3, pts: 6729185322, ccData: 33314 }, - { type: 2, pts: 6729185322, ccData: 24429 }, - { type: 3, pts: 6729188325, ccData: 49698 }, - { type: 2, pts: 6729188325, ccData: 28527 }, - { type: 3, pts: 6729191328, ccData: 546 }, - { type: 2, pts: 6729191328, ccData: 28255 }, - { type: 3, pts: 6729194331, ccData: 16930 }, - { type: 2, pts: 6729194331, ccData: 30064 }, - { type: 3, pts: 6729197334, ccData: 33314 }, - { type: 2, pts: 6729197334, ccData: 24417 }, - { type: 3, pts: 6729200337, ccData: 49698 }, - { type: 2, pts: 6729200337, ccData: 25199 }, - { type: 3, pts: 6729203340, ccData: 546 }, - { type: 2, pts: 6729203340, ccData: 30309 }, - { type: 3, pts: 6729206343, ccData: 16930 }, - { type: 2, pts: 6729206343, ccData: 24320 }, - { type: 3, pts: 6729209346, ccData: 33313 }, - { type: 2, pts: 6729209346, ccData: 32512 }, - { type: 3, pts: 6729212349, ccData: 49698 }, - { type: 2, pts: 6729212349, ccData: 35842 }, - { type: 3, pts: 6729218355, ccData: 546 }, - { type: 2, pts: 6729218355, ccData: 35073 }, - { type: 3, pts: 6729419556, ccData: 18993 }, - { type: 2, pts: 6729419556, ccData: 39195 }, - { type: 2, pts: 6729419556, ccData: 16640 }, - { type: 2, pts: 6729419556, ccData: 31 }, - { type: 2, pts: 6729419556, ccData: 5264 }, - { type: 2, pts: 6729419556, ccData: 1283 }, - { type: 2, pts: 6729419556, ccData: 37162 }, - { type: 2, pts: 6729419556, ccData: 42 }, - { type: 2, pts: 6729419556, ccData: 37376 }, - { type: 2, pts: 6729419556, ccData: 1024 }, - { type: 3, pts: 6729425562, ccData: 33571 }, - { type: 2, pts: 6729425562, ccData: 37376 }, - { type: 2, pts: 6729425562, ccData: 1536 }, - { type: 3, pts: 6729431568, ccData: 49697 }, - { type: 2, pts: 6729431568, ccData: 32512 }, - { type: 3, pts: 6729434571, ccData: 546 }, - { type: 2, pts: 6729434571, ccData: 24400 }, - { type: 3, pts: 6729437574, ccData: 16930 }, - { type: 2, pts: 6729437574, ccData: 26990 }, - { type: 3, pts: 6729440577, ccData: 33314 }, - { type: 2, pts: 6729440577, ccData: 27487 }, - { type: 3, pts: 6729443580, ccData: 49698 }, - { type: 2, pts: 6729443580, ccData: 26995 }, - { type: 3, pts: 6729446583, ccData: 546 }, - { type: 2, pts: 6729446583, ccData: 24417 }, - { type: 3, pts: 6729449586, ccData: 16930 }, - { type: 2, pts: 6729449586, ccData: 24422 }, - { type: 3, pts: 6729452589, ccData: 33314 }, - { type: 2, pts: 6729452589, ccData: 25957 }, - { type: 3, pts: 6729455592, ccData: 49698 }, - { type: 2, pts: 6729455592, ccData: 27753 }, - { type: 3, pts: 6729458595, ccData: 546 }, - { type: 2, pts: 6729458595, ccData: 28263 }, - { type: 3, pts: 6729461598, ccData: 18993 }, - { type: 2, pts: 6729461598, ccData: 39195 }, - { type: 2, pts: 6729461598, ccData: 16640 }, - { type: 2, pts: 6729461598, ccData: 287 }, - { type: 2, pts: 6729461598, ccData: 4240 }, - { type: 2, pts: 6729461598, ccData: 1283 }, - { type: 2, pts: 6729461598, ccData: 37162 }, - { type: 2, pts: 6729461598, ccData: 0 }, - { type: 2, pts: 6729461598, ccData: 37377 }, - { type: 2, pts: 6729461598, ccData: 1024 }, - { type: 3, pts: 6729467604, ccData: 33571 }, - { type: 2, pts: 6729467604, ccData: 37377 }, - { type: 2, pts: 6729467604, ccData: 1792 }, - { type: 3, pts: 6729473610, ccData: 49698 }, - { type: 2, pts: 6729473610, ccData: 28518 }, - { type: 3, pts: 6729476613, ccData: 546 }, - { type: 2, pts: 6729476613, ccData: 24426 }, - { type: 3, pts: 6729479616, ccData: 16930 }, - { type: 2, pts: 6729479616, ccData: 28537 }, - { type: 3, pts: 6729482619, ccData: 33314 }, - { type: 2, pts: 6729482619, ccData: 24417 }, - { type: 3, pts: 6729485622, ccData: 49698 }, - { type: 2, pts: 6729485622, ccData: 28260 }, - { type: 3, pts: 6729488625, ccData: 546 }, - { type: 2, pts: 6729488625, ccData: 24428 }, - { type: 3, pts: 6729491628, ccData: 16930 }, - { type: 2, pts: 6729491628, ccData: 28534 }, - { type: 3, pts: 6729494631, ccData: 33314 }, - { type: 2, pts: 6729494631, ccData: 25951 }, - { type: 3, pts: 6729497634, ccData: 49697 }, - { type: 2, pts: 6729497634, ccData: 32512 }, - { type: 3, pts: 6729500637, ccData: 546 }, - { type: 2, pts: 6729500637, ccData: 35841 }, - { type: 3, pts: 6729506643, ccData: 16930 }, - { type: 2, pts: 6729506643, ccData: 35074 }, - { type: 3, pts: 6729806943, ccData: 35377 }, - { type: 2, pts: 6729806943, ccData: 38939 }, - { type: 2, pts: 6729806943, ccData: 16640 }, - { type: 2, pts: 6729806943, ccData: 31 }, - { type: 2, pts: 6729806943, ccData: 5264 }, - { type: 2, pts: 6729806943, ccData: 1283 }, - { type: 2, pts: 6729806943, ccData: 37162 }, - { type: 2, pts: 6729806943, ccData: 42 }, - { type: 2, pts: 6729806943, ccData: 37376 }, - { type: 2, pts: 6729806943, ccData: 1024 }, - { type: 3, pts: 6729812949, ccData: 49955 }, - { type: 2, pts: 6729812949, ccData: 37376 }, - { type: 2, pts: 6729812949, ccData: 1536 }, - { type: 3, pts: 6729818955, ccData: 545 }, - { type: 2, pts: 6729818955, ccData: 32512 }, - { type: 3, pts: 6729821958, ccData: 16930 }, - { type: 2, pts: 6729821958, ccData: 24400 }, - { type: 3, pts: 6729824961, ccData: 33314 }, - { type: 2, pts: 6729824961, ccData: 26990 }, - { type: 3, pts: 6729827964, ccData: 49698 }, - { type: 2, pts: 6729827964, ccData: 27487 }, - { type: 3, pts: 6729830967, ccData: 546 }, - { type: 2, pts: 6729830967, ccData: 26995 }, - { type: 3, pts: 6729833970, ccData: 16930 }, - { type: 2, pts: 6729833970, ccData: 24425 }, - { type: 3, pts: 6729836973, ccData: 33314 }, - { type: 2, pts: 6729836973, ccData: 28001 }, - { type: 3, pts: 6729839976, ccData: 49698 }, - { type: 2, pts: 6729839976, ccData: 26473 }, - { type: 3, pts: 6729842979, ccData: 546 }, - { type: 2, pts: 6729842979, ccData: 28265 }, - { type: 3, pts: 6729845982, ccData: 16930 }, - { type: 2, pts: 6729845982, ccData: 28263 }, - { type: 3, pts: 6729848985, ccData: 35377 }, - { type: 2, pts: 6729848985, ccData: 38939 }, - { type: 2, pts: 6729848985, ccData: 16640 }, - { type: 2, pts: 6729848985, ccData: 287 }, - { type: 2, pts: 6729848985, ccData: 4240 }, - { type: 2, pts: 6729848985, ccData: 1283 }, - { type: 2, pts: 6729848985, ccData: 37162 }, - { type: 2, pts: 6729848985, ccData: 0 }, - { type: 2, pts: 6729848985, ccData: 37377 }, - { type: 2, pts: 6729848985, ccData: 2048 }, - { type: 3, pts: 6729854991, ccData: 49698 }, - { type: 2, pts: 6729854991, ccData: 30568 }, - { type: 3, pts: 6729857994, ccData: 546 }, - { type: 2, pts: 6729857994, ccData: 24948 }, - { type: 3, pts: 6729860997, ccData: 16930 }, - { type: 2, pts: 6729860997, ccData: 24439 }, - { type: 3, pts: 6729864000, ccData: 33314 }, - { type: 2, pts: 6729864000, ccData: 25951 }, - { type: 3, pts: 6729867003, ccData: 49698 }, - { type: 2, pts: 6729867003, ccData: 25441 }, - { type: 3, pts: 6729870006, ccData: 546 }, - { type: 2, pts: 6729870006, ccData: 28255 }, - { type: 3, pts: 6729873009, ccData: 16930 }, - { type: 2, pts: 6729873009, ccData: 25189 }, - { type: 3, pts: 6729876012, ccData: 33314 }, - { type: 2, pts: 6729876012, ccData: 24320 }, - { type: 3, pts: 6729879015, ccData: 49697 }, - { type: 2, pts: 6729879015, ccData: 32512 }, - { type: 3, pts: 6729882018, ccData: 546 }, - { type: 2, pts: 6729882018, ccData: 35842 }, - { type: 3, pts: 6729888024, ccData: 16930 }, - { type: 2, pts: 6729888024, ccData: 35073 }, - { type: 3, pts: 6730044180, ccData: 35377 }, - { type: 2, pts: 6730044180, ccData: 39195 }, - { type: 2, pts: 6730044180, ccData: 15360 }, - { type: 2, pts: 6730044180, ccData: 31 }, - { type: 2, pts: 6730044180, ccData: 5264 }, - { type: 2, pts: 6730044180, ccData: 1283 }, - { type: 2, pts: 6730044180, ccData: 37162 }, - { type: 2, pts: 6730044180, ccData: 42 }, - { type: 2, pts: 6730044180, ccData: 37376 }, - { type: 2, pts: 6730044180, ccData: 0 }, - { type: 3, pts: 6730050186, ccData: 49697 }, - { type: 2, pts: 6730050186, ccData: 32512 }, - { type: 3, pts: 6730053189, ccData: 546 }, - { type: 2, pts: 6730053189, ccData: 24385 }, - { type: 3, pts: 6730056192, ccData: 16930 }, - { type: 2, pts: 6730056192, ccData: 24420 }, - { type: 3, pts: 6730059195, ccData: 33314 }, - { type: 2, pts: 6730059195, ccData: 24942 }, - { type: 3, pts: 6730062198, ccData: 49698 }, - { type: 2, pts: 6730062198, ccData: 25445 }, - { type: 3, pts: 6730065201, ccData: 546 }, - { type: 2, pts: 6730065201, ccData: 29279 }, - { type: 3, pts: 6730068204, ccData: 16929 }, - { type: 2, pts: 6730068204, ccData: 32512 }, - { type: 3, pts: 6730071207, ccData: 35377 }, - { type: 2, pts: 6730071207, ccData: 39195 }, - { type: 2, pts: 6730071207, ccData: 15360 }, - { type: 2, pts: 6730071207, ccData: 543 }, - { type: 2, pts: 6730071207, ccData: 4240 }, - { type: 2, pts: 6730071207, ccData: 1283 }, - { type: 2, pts: 6730071207, ccData: 37162 }, - { type: 2, pts: 6730071207, ccData: 0 }, - { type: 2, pts: 6730071207, ccData: 37378 }, - { type: 2, pts: 6730071207, ccData: 5120 }, - { type: 3, pts: 6730077213, ccData: 49955 }, - { type: 2, pts: 6730077213, ccData: 37378 }, - { type: 2, pts: 6730077213, ccData: 5376 }, - { type: 3, pts: 6730083219, ccData: 545 }, - { type: 2, pts: 6730083219, ccData: 32512 }, - { type: 3, pts: 6730086222, ccData: 16930 }, - { type: 2, pts: 6730086222, ccData: 24385 }, - { type: 3, pts: 6730089225, ccData: 33314 }, - { type: 2, pts: 6730089225, ccData: 24434 }, - { type: 3, pts: 6730092228, ccData: 49698 }, - { type: 2, pts: 6730092228, ccData: 28514 }, - { type: 3, pts: 6730095231, ccData: 546 }, - { type: 2, pts: 6730095231, ccData: 28532 }, - { type: 3, pts: 6730098234, ccData: 16930 }, - { type: 2, pts: 6730098234, ccData: 24320 }, - { type: 3, pts: 6730101237, ccData: 33313 }, - { type: 2, pts: 6730101237, ccData: 32512 }, - { type: 3, pts: 6730104240, ccData: 49698 }, - { type: 2, pts: 6730104240, ccData: 35841 }, - { type: 3, pts: 6730110246, ccData: 546 }, - { type: 2, pts: 6730110246, ccData: 35074 }, - { type: 3, pts: 6730227363, ccData: 18993 }, - { type: 2, pts: 6730227363, ccData: 38939 }, - { type: 2, pts: 6730227363, ccData: 17920 }, - { type: 2, pts: 6730227363, ccData: 31 }, - { type: 2, pts: 6730227363, ccData: 5264 }, - { type: 2, pts: 6730227363, ccData: 1283 }, - { type: 2, pts: 6730227363, ccData: 37162 }, - { type: 2, pts: 6730227363, ccData: 42 }, - { type: 2, pts: 6730227363, ccData: 37376 }, - { type: 2, pts: 6730227363, ccData: 1024 }, - { type: 3, pts: 6730233369, ccData: 33571 }, - { type: 2, pts: 6730233369, ccData: 37376 }, - { type: 2, pts: 6730233369, ccData: 1536 }, - { type: 3, pts: 6730239375, ccData: 49697 }, - { type: 2, pts: 6730239375, ccData: 32512 }, - { type: 3, pts: 6730242378, ccData: 546 }, - { type: 2, pts: 6730242378, ccData: 24385 }, - { type: 3, pts: 6730245381, ccData: 16930 }, - { type: 2, pts: 6730245381, ccData: 24432 }, - { type: 3, pts: 6730248384, ccData: 33314 }, - { type: 2, pts: 6730248384, ccData: 26994 }, - { type: 3, pts: 6730251387, ccData: 49698 }, - { type: 2, pts: 6730251387, ccData: 24948 }, - { type: 3, pts: 6730254390, ccData: 546 }, - { type: 2, pts: 6730254390, ccData: 25951 }, - { type: 3, pts: 6730257393, ccData: 16930 }, - { type: 2, pts: 6730257393, ccData: 24948 }, - { type: 3, pts: 6730260396, ccData: 33314 }, - { type: 2, pts: 6730260396, ccData: 24435 }, - { type: 3, pts: 6730263399, ccData: 49698 }, - { type: 2, pts: 6730263399, ccData: 25953 }, - { type: 3, pts: 6730266402, ccData: 546 }, - { type: 2, pts: 6730266402, ccData: 24320 }, - { type: 3, pts: 6730269405, ccData: 16929 }, - { type: 2, pts: 6730269405, ccData: 32512 }, - { type: 3, pts: 6730272408, ccData: 33314 }, - { type: 2, pts: 6730272408, ccData: 35842 }, - { type: 3, pts: 6730278414, ccData: 49698 }, - { type: 2, pts: 6730278414, ccData: 35073 }, - { type: 3, pts: 6730347483, ccData: 2609 }, - { type: 2, pts: 6730347483, ccData: 39195 }, - { type: 2, pts: 6730347483, ccData: 16640 }, - { type: 2, pts: 6730347483, ccData: 31 }, - { type: 2, pts: 6730347483, ccData: 5264 }, - { type: 2, pts: 6730347483, ccData: 1283 }, - { type: 2, pts: 6730347483, ccData: 37162 }, - { type: 2, pts: 6730347483, ccData: 42 }, - { type: 2, pts: 6730347483, ccData: 37376 }, - { type: 2, pts: 6730347483, ccData: 1024 }, - { type: 3, pts: 6730353489, ccData: 17187 }, - { type: 2, pts: 6730353489, ccData: 37376 }, - { type: 2, pts: 6730353489, ccData: 1792 }, - { type: 3, pts: 6730359495, ccData: 33313 }, - { type: 2, pts: 6730359495, ccData: 32512 }, - { type: 3, pts: 6730362498, ccData: 49698 }, - { type: 2, pts: 6730362498, ccData: 24400 }, - { type: 3, pts: 6730365501, ccData: 546 }, - { type: 2, pts: 6730365501, ccData: 26990 }, - { type: 3, pts: 6730368504, ccData: 16930 }, - { type: 2, pts: 6730368504, ccData: 27487 }, - { type: 3, pts: 6730371507, ccData: 33314 }, - { type: 2, pts: 6730371507, ccData: 26995 }, - { type: 3, pts: 6730374510, ccData: 49698 }, - { type: 2, pts: 6730374510, ccData: 24417 }, - { type: 3, pts: 6730377513, ccData: 546 }, - { type: 2, pts: 6730377513, ccData: 24423 }, - { type: 3, pts: 6730380516, ccData: 16930 }, - { type: 2, pts: 6730380516, ccData: 26983 }, - { type: 3, pts: 6730383519, ccData: 33314 }, - { type: 2, pts: 6730383519, ccData: 26476 }, - { type: 3, pts: 6730386522, ccData: 49698 }, - { type: 2, pts: 6730386522, ccData: 25856 }, - { type: 3, pts: 6730389525, ccData: 2609 }, - { type: 2, pts: 6730389525, ccData: 39195 }, - { type: 2, pts: 6730389525, ccData: 16640 }, - { type: 2, pts: 6730389525, ccData: 287 }, - { type: 2, pts: 6730389525, ccData: 4240 }, - { type: 2, pts: 6730389525, ccData: 1283 }, - { type: 2, pts: 6730389525, ccData: 37162 }, - { type: 2, pts: 6730389525, ccData: 0 }, - { type: 2, pts: 6730389525, ccData: 37377 }, - { type: 2, pts: 6730389525, ccData: 1024 }, - { type: 3, pts: 6730395531, ccData: 16930 }, - { type: 2, pts: 6730395531, ccData: 29800 }, - { type: 3, pts: 6730398534, ccData: 33314 }, - { type: 2, pts: 6730398534, ccData: 24948 }, - { type: 3, pts: 6730401537, ccData: 49698 }, - { type: 2, pts: 6730401537, ccData: 24439 }, - { type: 3, pts: 6730404540, ccData: 546 }, - { type: 2, pts: 6730404540, ccData: 26983 }, - { type: 3, pts: 6730407543, ccData: 16930 }, - { type: 2, pts: 6730407543, ccData: 26476 }, - { type: 3, pts: 6730410546, ccData: 33314 }, - { type: 2, pts: 6730410546, ccData: 25971 }, - { type: 3, pts: 6730413549, ccData: 49698 }, - { type: 2, pts: 6730413549, ccData: 24441 }, - { type: 3, pts: 6730416552, ccData: 546 }, - { type: 2, pts: 6730416552, ccData: 28533 }, - { type: 3, pts: 6730419555, ccData: 16930 }, - { type: 2, pts: 6730419555, ccData: 29279 }, - { type: 3, pts: 6730422558, ccData: 33314 }, - { type: 2, pts: 6730422558, ccData: 29807 }, - { type: 3, pts: 6730425561, ccData: 49698 }, - { type: 2, pts: 6730425561, ccData: 25971 }, - { type: 3, pts: 6730428564, ccData: 546 }, - { type: 2, pts: 6730428564, ccData: 24320 }, - { type: 3, pts: 6730431567, ccData: 16929 }, - { type: 2, pts: 6730431567, ccData: 32512 }, - { type: 3, pts: 6730434570, ccData: 33314 }, - { type: 2, pts: 6730434570, ccData: 35841 }, - { type: 3, pts: 6730440576, ccData: 49698 }, - { type: 2, pts: 6730440576, ccData: 35074 }, - { type: 3, pts: 6730575711, ccData: 2609 }, - { type: 2, pts: 6730575711, ccData: 38939 }, - { type: 2, pts: 6730575711, ccData: 16640 }, - { type: 2, pts: 6730575711, ccData: 31 }, - { type: 2, pts: 6730575711, ccData: 5264 }, - { type: 2, pts: 6730575711, ccData: 1283 }, - { type: 2, pts: 6730575711, ccData: 37162 }, - { type: 2, pts: 6730575711, ccData: 42 }, - { type: 2, pts: 6730575711, ccData: 37376 }, - { type: 2, pts: 6730575711, ccData: 1024 }, - { type: 3, pts: 6730581717, ccData: 17187 }, - { type: 2, pts: 6730581717, ccData: 37376 }, - { type: 2, pts: 6730581717, ccData: 1536 }, - { type: 3, pts: 6730587723, ccData: 33313 }, - { type: 2, pts: 6730587723, ccData: 32512 }, - { type: 3, pts: 6730590726, ccData: 49698 }, - { type: 2, pts: 6730590726, ccData: 24400 }, - { type: 3, pts: 6730593729, ccData: 546 }, - { type: 2, pts: 6730593729, ccData: 26990 }, - { type: 3, pts: 6730596732, ccData: 16930 }, - { type: 2, pts: 6730596732, ccData: 27487 }, - { type: 3, pts: 6730599735, ccData: 33314 }, - { type: 2, pts: 6730599735, ccData: 26995 }, - { type: 3, pts: 6730602738, ccData: 49698 }, - { type: 2, pts: 6730602738, ccData: 24417 }, - { type: 3, pts: 6730605741, ccData: 546 }, - { type: 2, pts: 6730605741, ccData: 24435 }, - { type: 3, pts: 6730608744, ccData: 16930 }, - { type: 2, pts: 6730608744, ccData: 28769 }, - { type: 3, pts: 6730611747, ccData: 33314 }, - { type: 2, pts: 6730611747, ccData: 29291 }, - { type: 3, pts: 6730614750, ccData: 49698 }, - { type: 2, pts: 6730614750, ccData: 27749 }, - { type: 3, pts: 6730617753, ccData: 2609 }, - { type: 2, pts: 6730617753, ccData: 38939 }, - { type: 2, pts: 6730617753, ccData: 16640 }, - { type: 2, pts: 6730617753, ccData: 287 }, - { type: 2, pts: 6730617753, ccData: 4240 }, - { type: 2, pts: 6730617753, ccData: 1283 }, - { type: 2, pts: 6730617753, ccData: 37162 }, - { type: 2, pts: 6730617753, ccData: 0 }, - { type: 2, pts: 6730617753, ccData: 37377 }, - { type: 2, pts: 6730617753, ccData: 1024 }, - { type: 3, pts: 6730623759, ccData: 17187 }, - { type: 2, pts: 6730623759, ccData: 37377 }, - { type: 2, pts: 6730623759, ccData: 1280 }, - { type: 3, pts: 6730629765, ccData: 33314 }, - { type: 2, pts: 6730629765, ccData: 29800 }, - { type: 3, pts: 6730632768, ccData: 49698 }, - { type: 2, pts: 6730632768, ccData: 24948 }, - { type: 3, pts: 6730635771, ccData: 546 }, - { type: 2, pts: 6730635771, ccData: 24423 }, - { type: 3, pts: 6730638774, ccData: 16930 }, - { type: 2, pts: 6730638774, ccData: 27759 }, - { type: 3, pts: 6730641777, ccData: 33314 }, - { type: 2, pts: 6730641777, ccData: 30579 }, - { type: 3, pts: 6730644780, ccData: 49698 }, - { type: 2, pts: 6730644780, ccData: 24417 }, - { type: 3, pts: 6730647783, ccData: 546 }, - { type: 2, pts: 6730647783, ccData: 28260 }, - { type: 3, pts: 6730650786, ccData: 16930 }, - { type: 2, pts: 6730650786, ccData: 24423 }, - { type: 3, pts: 6730653789, ccData: 33314 }, - { type: 2, pts: 6730653789, ccData: 27759 }, - { type: 3, pts: 6730656792, ccData: 49698 }, - { type: 2, pts: 6730656792, ccData: 30579 }, - { type: 3, pts: 6730659795, ccData: 546 }, - { type: 2, pts: 6730659795, ccData: 24320 }, - { type: 3, pts: 6730662798, ccData: 16929 }, - { type: 2, pts: 6730662798, ccData: 32512 }, - { type: 3, pts: 6730665801, ccData: 33314 }, - { type: 2, pts: 6730665801, ccData: 35842 }, - { type: 3, pts: 6730671807, ccData: 49698 }, - { type: 2, pts: 6730671807, ccData: 35073 }, - { type: 3, pts: 6731011146, ccData: 2609 }, - { type: 2, pts: 6731011146, ccData: 39195 }, - { type: 2, pts: 6731011146, ccData: 17920 }, - { type: 2, pts: 6731011146, ccData: 31 }, - { type: 2, pts: 6731011146, ccData: 5264 }, - { type: 2, pts: 6731011146, ccData: 1283 }, - { type: 2, pts: 6731011146, ccData: 37162 }, - { type: 2, pts: 6731011146, ccData: 42 }, - { type: 2, pts: 6731011146, ccData: 37376 }, - { type: 2, pts: 6731011146, ccData: 0 }, - { type: 3, pts: 6731017152, ccData: 17187 }, - { type: 2, pts: 6731017152, ccData: 37376 }, - { type: 2, pts: 6731017152, ccData: 256 }, - { type: 3, pts: 6731023158, ccData: 33313 }, - { type: 2, pts: 6731023158, ccData: 32512 }, - { type: 3, pts: 6731026161, ccData: 49698 }, - { type: 2, pts: 6731026161, ccData: 24393 }, - { type: 3, pts: 6731029164, ccData: 546 }, - { type: 2, pts: 6731029164, ccData: 29735 }, - { type: 3, pts: 6731032167, ccData: 16930 }, - { type: 2, pts: 6731032167, ccData: 29535 }, - { type: 3, pts: 6731035170, ccData: 33314 }, - { type: 2, pts: 6731035170, ccData: 24927 }, - { type: 3, pts: 6731038173, ccData: 49698 }, - { type: 2, pts: 6731038173, ccData: 28777 }, - { type: 3, pts: 6731041176, ccData: 546 }, - { type: 2, pts: 6731041176, ccData: 28267 }, - { type: 3, pts: 6731044179, ccData: 16930 }, - { type: 2, pts: 6731044179, ccData: 24948 }, - { type: 3, pts: 6731047182, ccData: 33314 }, - { type: 2, pts: 6731047182, ccData: 24947 }, - { type: 3, pts: 6731050185, ccData: 49698 }, - { type: 2, pts: 6731050185, ccData: 29801 }, - { type: 3, pts: 6731053188, ccData: 546 }, - { type: 2, pts: 6731053188, ccData: 25439 }, - { type: 3, pts: 6731056191, ccData: 16930 }, - { type: 2, pts: 6731056191, ccData: 26213 }, - { type: 3, pts: 6731059194, ccData: 33314 }, - { type: 2, pts: 6731059194, ccData: 25964 }, - { type: 3, pts: 6731062197, ccData: 49698 }, - { type: 2, pts: 6731062197, ccData: 26990 }, - { type: 3, pts: 6731065200, ccData: 546 }, - { type: 2, pts: 6731065200, ccData: 26463 }, - { type: 3, pts: 6731068203, ccData: 16929 }, - { type: 2, pts: 6731068203, ccData: 32512 }, - { type: 3, pts: 6731071206, ccData: 33314 }, - { type: 2, pts: 6731071206, ccData: 35841 }, - { type: 3, pts: 6731077212, ccData: 49698 }, - { type: 2, pts: 6731077212, ccData: 35074 }, - { type: 3, pts: 6731257392, ccData: 2609 }, - { type: 2, pts: 6731257392, ccData: 38939 }, - { type: 2, pts: 6731257392, ccData: 17920 }, - { type: 2, pts: 6731257392, ccData: 31 }, - { type: 2, pts: 6731257392, ccData: 5264 }, - { type: 2, pts: 6731257392, ccData: 1283 }, - { type: 2, pts: 6731257392, ccData: 37162 }, - { type: 2, pts: 6731257392, ccData: 42 }, - { type: 2, pts: 6731257392, ccData: 37376 }, - { type: 2, pts: 6731257392, ccData: 1024 }, - { type: 3, pts: 6731263398, ccData: 16929 }, - { type: 2, pts: 6731263398, ccData: 32512 }, - { type: 3, pts: 6731266401, ccData: 33314 }, - { type: 2, pts: 6731266401, ccData: 24393 }, - { type: 3, pts: 6731269404, ccData: 49698 }, - { type: 2, pts: 6731269404, ccData: 28255 }, - { type: 3, pts: 6731272407, ccData: 546 }, - { type: 2, pts: 6731272407, ccData: 24927 }, - { type: 3, pts: 6731275410, ccData: 16930 }, - { type: 2, pts: 6731275410, ccData: 28777 }, - { type: 3, pts: 6731278413, ccData: 33314 }, - { type: 2, pts: 6731278413, ccData: 28267 }, - { type: 3, pts: 6731281416, ccData: 49698 }, - { type: 2, pts: 6731281416, ccData: 24941 }, - { type: 3, pts: 6731284419, ccData: 546 }, - { type: 2, pts: 6731284419, ccData: 24954 }, - { type: 3, pts: 6731287422, ccData: 16930 }, - { type: 2, pts: 6731287422, ccData: 26990 }, - { type: 3, pts: 6731290425, ccData: 33314 }, - { type: 2, pts: 6731290425, ccData: 26463 }, - { type: 3, pts: 6731293428, ccData: 49698 }, - { type: 2, pts: 6731293428, ccData: 30561 }, - { type: 3, pts: 6731296431, ccData: 546 }, - { type: 2, pts: 6731296431, ccData: 31071 }, - { type: 3, pts: 6731299434, ccData: 16929 }, - { type: 2, pts: 6731299434, ccData: 32512 }, - { type: 3, pts: 6731302437, ccData: 33314 }, - { type: 2, pts: 6731302437, ccData: 35842 }, - { type: 3, pts: 6731308443, ccData: 49698 }, - { type: 2, pts: 6731308443, ccData: 35073 }, - { type: 3, pts: 6731500635, ccData: 2609 }, - { type: 2, pts: 6731500635, ccData: 39195 }, - { type: 2, pts: 6731500635, ccData: 17920 }, - { type: 2, pts: 6731500635, ccData: 31 }, - { type: 2, pts: 6731500635, ccData: 5264 }, - { type: 2, pts: 6731500635, ccData: 1283 }, - { type: 2, pts: 6731500635, ccData: 37162 }, - { type: 2, pts: 6731500635, ccData: 42 }, - { type: 2, pts: 6731500635, ccData: 37376 }, - { type: 2, pts: 6731500635, ccData: 0 }, - { type: 3, pts: 6731506641, ccData: 17187 }, - { type: 2, pts: 6731506641, ccData: 37376 }, - { type: 2, pts: 6731506641, ccData: 256 }, - { type: 3, pts: 6731512647, ccData: 33313 }, - { type: 2, pts: 6731512647, ccData: 32512 }, - { type: 3, pts: 6731515650, ccData: 49698 }, - { type: 2, pts: 6731515650, ccData: 24393 }, - { type: 3, pts: 6731518653, ccData: 546 }, - { type: 2, pts: 6731518653, ccData: 29735 }, - { type: 3, pts: 6731521656, ccData: 16930 }, - { type: 2, pts: 6731521656, ccData: 29535 }, - { type: 3, pts: 6731524659, ccData: 33314 }, - { type: 2, pts: 6731524659, ccData: 24927 }, - { type: 3, pts: 6731527662, ccData: 49698 }, - { type: 2, pts: 6731527662, ccData: 28777 }, - { type: 3, pts: 6731530665, ccData: 546 }, - { type: 2, pts: 6731530665, ccData: 28267 }, - { type: 3, pts: 6731533668, ccData: 16930 }, - { type: 2, pts: 6731533668, ccData: 24948 }, - { type: 3, pts: 6731536671, ccData: 33314 }, - { type: 2, pts: 6731536671, ccData: 24947 }, - { type: 3, pts: 6731539674, ccData: 49698 }, - { type: 2, pts: 6731539674, ccData: 29801 }, - { type: 3, pts: 6731542677, ccData: 546 }, - { type: 2, pts: 6731542677, ccData: 25439 }, - { type: 3, pts: 6731545680, ccData: 16930 }, - { type: 2, pts: 6731545680, ccData: 26213 }, - { type: 3, pts: 6731548683, ccData: 33314 }, - { type: 2, pts: 6731548683, ccData: 25964 }, - { type: 3, pts: 6731551686, ccData: 49698 }, - { type: 2, pts: 6731551686, ccData: 26990 }, - { type: 3, pts: 6731554689, ccData: 546 }, - { type: 2, pts: 6731554689, ccData: 26463 }, - { type: 3, pts: 6731557692, ccData: 16929 }, - { type: 2, pts: 6731557692, ccData: 32512 }, - { type: 3, pts: 6731560695, ccData: 33314 }, - { type: 2, pts: 6731560695, ccData: 35841 }, - { type: 3, pts: 6731566701, ccData: 49698 }, - { type: 2, pts: 6731566701, ccData: 35074 }, - { type: 3, pts: 6731728863, ccData: 2609 }, - { type: 2, pts: 6731728863, ccData: 38939 }, - { type: 2, pts: 6731728863, ccData: 17920 }, - { type: 2, pts: 6731728863, ccData: 31 }, - { type: 2, pts: 6731728863, ccData: 5264 }, - { type: 2, pts: 6731728863, ccData: 1283 }, - { type: 2, pts: 6731728863, ccData: 37162 }, - { type: 2, pts: 6731728863, ccData: 42 }, - { type: 2, pts: 6731728863, ccData: 37376 }, - { type: 2, pts: 6731728863, ccData: 0 }, - { type: 3, pts: 6731734869, ccData: 17187 }, - { type: 2, pts: 6731734869, ccData: 37376 }, - { type: 2, pts: 6731734869, ccData: 768 }, - { type: 3, pts: 6731740875, ccData: 33313 }, - { type: 2, pts: 6731740875, ccData: 32512 }, - { type: 3, pts: 6731743878, ccData: 49698 }, - { type: 2, pts: 6731743878, ccData: 24399 }, - { type: 3, pts: 6731746881, ccData: 546 }, - { type: 2, pts: 6731746881, ccData: 28255 }, - { type: 3, pts: 6731749884, ccData: 16930 }, - { type: 2, pts: 6731749884, ccData: 24927 }, - { type: 3, pts: 6731752887, ccData: 33314 }, - { type: 2, pts: 6731752887, ccData: 28777 }, - { type: 3, pts: 6731755890, ccData: 49698 }, - { type: 2, pts: 6731755890, ccData: 28267 }, - { type: 3, pts: 6731758893, ccData: 546 }, - { type: 2, pts: 6731758893, ccData: 24944 }, - { type: 3, pts: 6731761896, ccData: 16930 }, - { type: 2, pts: 6731761896, ccData: 25970 }, - { type: 3, pts: 6731764899, ccData: 33314 }, - { type: 2, pts: 6731764899, ccData: 26213 }, - { type: 3, pts: 6731767902, ccData: 49698 }, - { type: 2, pts: 6731767902, ccData: 25460 }, - { type: 3, pts: 6731770905, ccData: 546 }, - { type: 2, pts: 6731770905, ccData: 24420 }, - { type: 3, pts: 6731773908, ccData: 16930 }, - { type: 2, pts: 6731773908, ccData: 24953 }, - { type: 3, pts: 6731776911, ccData: 33314 }, - { type: 2, pts: 6731776911, ccData: 24320 }, - { type: 3, pts: 6731779914, ccData: 49697 }, - { type: 2, pts: 6731779914, ccData: 32512 }, - { type: 3, pts: 6731782917, ccData: 546 }, - { type: 2, pts: 6731782917, ccData: 35842 }, - { type: 3, pts: 6731788923, ccData: 16930 }, - { type: 2, pts: 6731788923, ccData: 35073 }, - { type: 3, pts: 6731957091, ccData: 35377 }, - { type: 2, pts: 6731957091, ccData: 39195 }, - { type: 2, pts: 6731957091, ccData: 16640 }, - { type: 2, pts: 6731957091, ccData: 31 }, - { type: 2, pts: 6731957091, ccData: 5264 }, - { type: 2, pts: 6731957091, ccData: 1283 }, - { type: 2, pts: 6731957091, ccData: 37162 }, - { type: 2, pts: 6731957091, ccData: 42 }, - { type: 2, pts: 6731957091, ccData: 37376 }, - { type: 2, pts: 6731957091, ccData: 1024 }, - { type: 3, pts: 6731963097, ccData: 49955 }, - { type: 2, pts: 6731963097, ccData: 37376 }, - { type: 2, pts: 6731963097, ccData: 1280 }, - { type: 3, pts: 6731969103, ccData: 545 }, - { type: 2, pts: 6731969103, ccData: 32512 }, - { type: 3, pts: 6731972106, ccData: 16930 }, - { type: 2, pts: 6731972106, ccData: 24385 }, - { type: 3, pts: 6731975109, ccData: 33314 }, - { type: 2, pts: 6731975109, ccData: 28281 }, - { type: 3, pts: 6731978112, ccData: 49698 }, - { type: 2, pts: 6731978112, ccData: 29800 }, - { type: 3, pts: 6731981115, ccData: 546 }, - { type: 2, pts: 6731981115, ccData: 26990 }, - { type: 3, pts: 6731984118, ccData: 16930 }, - { type: 2, pts: 6731984118, ccData: 26463 }, - { type: 3, pts: 6731987121, ccData: 33314 }, - { type: 2, pts: 6731987121, ccData: 25441 }, - { type: 3, pts: 6731990124, ccData: 49698 }, - { type: 2, pts: 6731990124, ccData: 28255 }, - { type: 3, pts: 6731993127, ccData: 546 }, - { type: 2, pts: 6731993127, ccData: 26721 }, - { type: 3, pts: 6731996130, ccData: 16930 }, - { type: 2, pts: 6731996130, ccData: 28784 }, - { type: 3, pts: 6731999133, ccData: 33314 }, - { type: 2, pts: 6731999133, ccData: 25966 }, - { type: 3, pts: 6732002136, ccData: 51761 }, - { type: 2, pts: 6732002136, ccData: 39195 }, - { type: 2, pts: 6732002136, ccData: 16640 }, - { type: 2, pts: 6732002136, ccData: 287 }, - { type: 2, pts: 6732002136, ccData: 4240 }, - { type: 2, pts: 6732002136, ccData: 1283 }, - { type: 2, pts: 6732002136, ccData: 37162 }, - { type: 2, pts: 6732002136, ccData: 0 }, - { type: 2, pts: 6732002136, ccData: 37377 }, - { type: 2, pts: 6732002136, ccData: 0 }, - { type: 3, pts: 6732008142, ccData: 803 }, - { type: 2, pts: 6732008142, ccData: 37377 }, - { type: 2, pts: 6732008142, ccData: 768 }, - { type: 3, pts: 6732014148, ccData: 16930 }, - { type: 2, pts: 6732014148, ccData: 24947 }, - { type: 3, pts: 6732017151, ccData: 33314 }, - { type: 2, pts: 6732017151, ccData: 24439 }, - { type: 3, pts: 6732020154, ccData: 49698 }, - { type: 2, pts: 6732020154, ccData: 25951 }, - { type: 3, pts: 6732023157, ccData: 546 }, - { type: 2, pts: 6732023157, ccData: 28780 }, - { type: 3, pts: 6732026160, ccData: 16930 }, - { type: 2, pts: 6732026160, ccData: 24953 }, - { type: 3, pts: 6732029163, ccData: 33314 }, - { type: 2, pts: 6732029163, ccData: 24436 }, - { type: 3, pts: 6732032166, ccData: 49698 }, - { type: 2, pts: 6732032166, ccData: 26725 }, - { type: 3, pts: 6732035169, ccData: 546 }, - { type: 2, pts: 6732035169, ccData: 24420 }, - { type: 3, pts: 6732038172, ccData: 16930 }, - { type: 2, pts: 6732038172, ccData: 24953 }, - { type: 3, pts: 6732041175, ccData: 33314 }, - { type: 2, pts: 6732041175, ccData: 24417 }, - { type: 3, pts: 6732044178, ccData: 49698 }, - { type: 2, pts: 6732044178, ccData: 30561 }, - { type: 3, pts: 6732047181, ccData: 546 }, - { type: 2, pts: 6732047181, ccData: 31071 }, - { type: 3, pts: 6732050184, ccData: 16929 }, - { type: 2, pts: 6732050184, ccData: 32512 }, - { type: 3, pts: 6732053187, ccData: 33314 }, - { type: 2, pts: 6732053187, ccData: 35841 }, - { type: 3, pts: 6732059193, ccData: 49698 }, - { type: 2, pts: 6732059193, ccData: 35074 }, - { type: 3, pts: 6732554688, ccData: 2609 }, - { type: 2, pts: 6732554688, ccData: 38939 }, - { type: 2, pts: 6732554688, ccData: 17920 }, - { type: 2, pts: 6732554688, ccData: 31 }, - { type: 2, pts: 6732554688, ccData: 5264 }, - { type: 2, pts: 6732554688, ccData: 1283 }, - { type: 2, pts: 6732554688, ccData: 37162 }, - { type: 2, pts: 6732554688, ccData: 42 }, - { type: 2, pts: 6732554688, ccData: 37376 }, - { type: 2, pts: 6732554688, ccData: 0 }, - { type: 3, pts: 6732560694, ccData: 16929 }, - { type: 2, pts: 6732560694, ccData: 32512 }, - { type: 3, pts: 6732563697, ccData: 33314 }, - { type: 2, pts: 6732563697, ccData: 24393 }, - { type: 3, pts: 6732566700, ccData: 49698 }, - { type: 2, pts: 6732566700, ccData: 29735 }, - { type: 3, pts: 6732569703, ccData: 546 }, - { type: 2, pts: 6732569703, ccData: 29535 }, - { type: 3, pts: 6732572706, ccData: 16930 }, - { type: 2, pts: 6732572706, ccData: 24927 }, - { type: 3, pts: 6732575709, ccData: 33314 }, - { type: 2, pts: 6732575709, ccData: 20585 }, - { type: 3, pts: 6732578712, ccData: 49698 }, - { type: 2, pts: 6732578712, ccData: 28267 }, - { type: 3, pts: 6732581715, ccData: 546 }, - { type: 2, pts: 6732581715, ccData: 24940 }, - { type: 3, pts: 6732584718, ccData: 16930 }, - { type: 2, pts: 6732584718, ccData: 26979 }, - { type: 3, pts: 6732587721, ccData: 33314 }, - { type: 2, pts: 6732587721, ccData: 26991 }, - { type: 3, pts: 6732590724, ccData: 49698 }, - { type: 2, pts: 6732590724, ccData: 30067 }, - { type: 3, pts: 6732593727, ccData: 546 }, - { type: 2, pts: 6732593727, ccData: 24422 }, - { type: 3, pts: 6732596730, ccData: 16930 }, - { type: 2, pts: 6732596730, ccData: 25957 }, - { type: 3, pts: 6732599733, ccData: 33314 }, - { type: 2, pts: 6732599733, ccData: 27753 }, - { type: 3, pts: 6732602736, ccData: 49698 }, - { type: 2, pts: 6732602736, ccData: 28263 }, - { type: 3, pts: 6732605739, ccData: 546 }, - { type: 2, pts: 6732605739, ccData: 24320 }, - { type: 3, pts: 6732608742, ccData: 16929 }, - { type: 2, pts: 6732608742, ccData: 32512 }, - { type: 3, pts: 6732611745, ccData: 33314 }, - { type: 2, pts: 6732611745, ccData: 35842 }, - { type: 3, pts: 6732617751, ccData: 49698 }, - { type: 2, pts: 6732617751, ccData: 35073 }, - { type: 3, pts: 6732818952, ccData: 2609 }, - { type: 2, pts: 6732818952, ccData: 39195 }, - { type: 2, pts: 6732818952, ccData: 17920 }, - { type: 2, pts: 6732818952, ccData: 31 }, - { type: 2, pts: 6732818952, ccData: 5264 }, - { type: 2, pts: 6732818952, ccData: 1283 }, - { type: 2, pts: 6732818952, ccData: 37162 }, - { type: 2, pts: 6732818952, ccData: 42 }, - { type: 2, pts: 6732818952, ccData: 37376 }, - { type: 2, pts: 6732818952, ccData: 0 }, - { type: 3, pts: 6732824958, ccData: 17187 }, - { type: 2, pts: 6732824958, ccData: 37376 }, - { type: 2, pts: 6732824958, ccData: 512 }, - { type: 3, pts: 6732830964, ccData: 33313 }, - { type: 2, pts: 6732830964, ccData: 32512 }, - { type: 3, pts: 6732833967, ccData: 49698 }, - { type: 2, pts: 6732833967, ccData: 24400 }, - { type: 3, pts: 6732836970, ccData: 546 }, - { type: 2, pts: 6732836970, ccData: 25972 }, - { type: 3, pts: 6732839973, ccData: 16930 }, - { type: 2, pts: 6732839973, ccData: 25970 }, - { type: 3, pts: 6732842976, ccData: 33314 }, - { type: 2, pts: 6732842976, ccData: 29289 }, - { type: 3, pts: 6732845979, ccData: 49698 }, - { type: 2, pts: 6732845979, ccData: 26217 }, - { type: 3, pts: 6732848982, ccData: 546 }, - { type: 2, pts: 6732848982, ccData: 25439 }, - { type: 3, pts: 6732851985, ccData: 16930 }, - { type: 2, pts: 6732851985, ccData: 31087 }, - { type: 3, pts: 6732854988, ccData: 33314 }, - { type: 2, pts: 6732854988, ccData: 30047 }, - { type: 3, pts: 6732857991, ccData: 49698 }, - { type: 2, pts: 6732857991, ccData: 28009 }, - { type: 3, pts: 6732860994, ccData: 546 }, - { type: 2, pts: 6732860994, ccData: 26472 }, - { type: 3, pts: 6732863997, ccData: 16930 }, - { type: 2, pts: 6732863997, ccData: 29791 }, - { type: 3, pts: 6732867000, ccData: 33314 }, - { type: 2, pts: 6732867000, ccData: 29537 }, - { type: 3, pts: 6732870003, ccData: 49698 }, - { type: 2, pts: 6732870003, ccData: 31071 }, - { type: 3, pts: 6732873006, ccData: 545 }, - { type: 2, pts: 6732873006, ccData: 32512 }, - { type: 3, pts: 6732876009, ccData: 16930 }, - { type: 2, pts: 6732876009, ccData: 35841 }, - { type: 3, pts: 6732882015, ccData: 33314 }, - { type: 2, pts: 6732882015, ccData: 35074 }, - { type: 3, pts: 6733065198, ccData: 51761 }, - { type: 2, pts: 6733065198, ccData: 38939 }, - { type: 2, pts: 6733065198, ccData: 17920 }, - { type: 2, pts: 6733065198, ccData: 31 }, - { type: 2, pts: 6733065198, ccData: 5264 }, - { type: 2, pts: 6733065198, ccData: 1283 }, - { type: 2, pts: 6733065198, ccData: 37162 }, - { type: 2, pts: 6733065198, ccData: 42 }, - { type: 2, pts: 6733065198, ccData: 37376 }, - { type: 2, pts: 6733065198, ccData: 0 }, - { type: 3, pts: 6733071204, ccData: 545 }, - { type: 2, pts: 6733071204, ccData: 32512 }, - { type: 3, pts: 6733074207, ccData: 16930 }, - { type: 2, pts: 6733074207, ccData: 24400 }, - { type: 3, pts: 6733077210, ccData: 33314 }, - { type: 2, pts: 6733077210, ccData: 26990 }, - { type: 3, pts: 6733080213, ccData: 49698 }, - { type: 2, pts: 6733080213, ccData: 27489 }, - { type: 3, pts: 6733083216, ccData: 546 }, - { type: 2, pts: 6733083216, ccData: 27753 }, - { type: 3, pts: 6733086219, ccData: 16930 }, - { type: 2, pts: 6733086219, ccData: 25449 }, - { type: 3, pts: 6733089222, ccData: 33314 }, - { type: 2, pts: 6733089222, ccData: 28533 }, - { type: 3, pts: 6733092225, ccData: 49698 }, - { type: 2, pts: 6733092225, ccData: 29535 }, - { type: 3, pts: 6733095228, ccData: 546 }, - { type: 2, pts: 6733095228, ccData: 24942 }, - { type: 3, pts: 6733098231, ccData: 16930 }, - { type: 2, pts: 6733098231, ccData: 25695 }, - { type: 3, pts: 6733101234, ccData: 33314 }, - { type: 2, pts: 6733101234, ccData: 20581 }, - { type: 3, pts: 6733104237, ccData: 49698 }, - { type: 2, pts: 6733104237, ccData: 29797 }, - { type: 3, pts: 6733107240, ccData: 546 }, - { type: 2, pts: 6733107240, ccData: 29298 }, - { type: 3, pts: 6733110243, ccData: 16930 }, - { type: 2, pts: 6733110243, ccData: 26982 }, - { type: 3, pts: 6733113246, ccData: 33314 }, - { type: 2, pts: 6733113246, ccData: 26979 }, - { type: 3, pts: 6733116249, ccData: 49698 }, - { type: 2, pts: 6733116249, ccData: 24320 }, - { type: 3, pts: 6733119252, ccData: 545 }, - { type: 2, pts: 6733119252, ccData: 32512 }, - { type: 3, pts: 6733122255, ccData: 16930 }, - { type: 2, pts: 6733122255, ccData: 35842 }, - { type: 3, pts: 6733128261, ccData: 33314 }, - { type: 2, pts: 6733128261, ccData: 35073 }, - { type: 3, pts: 6733335468, ccData: 51761 }, - { type: 2, pts: 6733335468, ccData: 39195 }, - { type: 2, pts: 6733335468, ccData: 16640 }, - { type: 2, pts: 6733335468, ccData: 31 }, - { type: 2, pts: 6733335468, ccData: 5264 }, - { type: 2, pts: 6733335468, ccData: 1283 }, - { type: 2, pts: 6733335468, ccData: 37162 }, - { type: 2, pts: 6733335468, ccData: 42 }, - { type: 2, pts: 6733335468, ccData: 37376 }, - { type: 2, pts: 6733335468, ccData: 2048 }, - { type: 3, pts: 6733341474, ccData: 803 }, - { type: 2, pts: 6733341474, ccData: 37376 }, - { type: 2, pts: 6733341474, ccData: 2304 }, - { type: 3, pts: 6733347480, ccData: 16929 }, - { type: 2, pts: 6733347480, ccData: 32512 }, - { type: 3, pts: 6733350483, ccData: 33314 }, - { type: 2, pts: 6733350483, ccData: 24400 }, - { type: 3, pts: 6733353486, ccData: 49698 }, - { type: 2, pts: 6733353486, ccData: 26990 }, - { type: 3, pts: 6733356489, ccData: 546 }, - { type: 2, pts: 6733356489, ccData: 27489 }, - { type: 3, pts: 6733359492, ccData: 16930 }, - { type: 2, pts: 6733359492, ccData: 27753 }, - { type: 3, pts: 6733362495, ccData: 33314 }, - { type: 2, pts: 6733362495, ccData: 25449 }, - { type: 3, pts: 6733365498, ccData: 49698 }, - { type: 2, pts: 6733365498, ccData: 28533 }, - { type: 3, pts: 6733368501, ccData: 546 }, - { type: 2, pts: 6733368501, ccData: 29440 }, - { type: 3, pts: 6733371504, ccData: 18993 }, - { type: 2, pts: 6733371504, ccData: 39195 }, - { type: 2, pts: 6733371504, ccData: 16640 }, - { type: 2, pts: 6733371504, ccData: 287 }, - { type: 2, pts: 6733371504, ccData: 4240 }, - { type: 2, pts: 6733371504, ccData: 1283 }, - { type: 2, pts: 6733371504, ccData: 37162 }, - { type: 2, pts: 6733371504, ccData: 0 }, - { type: 2, pts: 6733371504, ccData: 37377 }, - { type: 2, pts: 6733371504, ccData: 1024 }, - { type: 3, pts: 6733377510, ccData: 33571 }, - { type: 2, pts: 6733377510, ccData: 37377 }, - { type: 2, pts: 6733377510, ccData: 1536 }, - { type: 3, pts: 6733383516, ccData: 49698 }, - { type: 2, pts: 6733383516, ccData: 28777 }, - { type: 3, pts: 6733386519, ccData: 546 }, - { type: 2, pts: 6733386519, ccData: 28267 }, - { type: 3, pts: 6733389522, ccData: 16930 }, - { type: 2, pts: 6733389522, ccData: 11359 }, - { type: 3, pts: 6733392525, ccData: 33314 }, - { type: 2, pts: 6733392525, ccData: 28777 }, - { type: 3, pts: 6733395528, ccData: 49698 }, - { type: 2, pts: 6733395528, ccData: 28267 }, - { type: 3, pts: 6733398531, ccData: 546 }, - { type: 2, pts: 6733398531, ccData: 24424 }, - { type: 3, pts: 6733401534, ccData: 16930 }, - { type: 2, pts: 6733401534, ccData: 28527 }, - { type: 3, pts: 6733404537, ccData: 33314 }, - { type: 2, pts: 6733404537, ccData: 29281 }, - { type: 3, pts: 6733407540, ccData: 49698 }, - { type: 2, pts: 6733407540, ccData: 31009 }, - { type: 3, pts: 6733410543, ccData: 546 }, - { type: 2, pts: 6733410543, ccData: 24320 }, - { type: 3, pts: 6733413546, ccData: 16929 }, - { type: 2, pts: 6733413546, ccData: 32512 }, - { type: 3, pts: 6733416549, ccData: 33314 }, - { type: 2, pts: 6733416549, ccData: 35841 }, - { type: 3, pts: 6733422555, ccData: 49698 }, - { type: 2, pts: 6733422555, ccData: 35074 }, - { type: 3, pts: 6733668801, ccData: 2609 }, - { type: 2, pts: 6733668801, ccData: 38939 }, - { type: 2, pts: 6733668801, ccData: 17920 }, - { type: 2, pts: 6733668801, ccData: 31 }, - { type: 2, pts: 6733668801, ccData: 5264 }, - { type: 2, pts: 6733668801, ccData: 1283 }, - { type: 2, pts: 6733668801, ccData: 37162 }, - { type: 2, pts: 6733668801, ccData: 42 }, - { type: 2, pts: 6733668801, ccData: 37376 }, - { type: 2, pts: 6733668801, ccData: 1024 }, - { type: 3, pts: 6733674807, ccData: 17187 }, - { type: 2, pts: 6733674807, ccData: 37376 }, - { type: 2, pts: 6733674807, ccData: 1792 }, - { type: 3, pts: 6733680813, ccData: 33314 }, - { type: 2, pts: 6733680813, ccData: 20585 }, - { type: 3, pts: 6733683816, ccData: 49698 }, - { type: 2, pts: 6733683816, ccData: 28267 }, - { type: 3, pts: 6733686819, ccData: 546 }, - { type: 2, pts: 6733686819, ccData: 11359 }, - { type: 3, pts: 6733689822, ccData: 16930 }, - { type: 2, pts: 6733689822, ccData: 28777 }, - { type: 3, pts: 6733692825, ccData: 33314 }, - { type: 2, pts: 6733692825, ccData: 28267 }, - { type: 3, pts: 6733695828, ccData: 49698 }, - { type: 2, pts: 6733695828, ccData: 24424 }, - { type: 3, pts: 6733698831, ccData: 546 }, - { type: 2, pts: 6733698831, ccData: 28527 }, - { type: 3, pts: 6733701834, ccData: 16930 }, - { type: 2, pts: 6733701834, ccData: 29281 }, - { type: 3, pts: 6733704837, ccData: 33314 }, - { type: 2, pts: 6733704837, ccData: 31009 }, - { type: 3, pts: 6733707840, ccData: 49698 }, - { type: 2, pts: 6733707840, ccData: 35842 }, - { type: 3, pts: 6733713846, ccData: 546 }, - { type: 2, pts: 6733713846, ccData: 35073 }, - { type: 3, pts: 6733942074, ccData: 16930 }, - { type: 2, pts: 6733942074, ccData: 35841 }, - { type: 3, pts: 6734146278, ccData: 35377 }, - { type: 2, pts: 6734146278, ccData: 38939 }, - { type: 2, pts: 6734146278, ccData: 16640 }, - { type: 2, pts: 6734146278, ccData: 31 }, - { type: 2, pts: 6734146278, ccData: 5264 }, - { type: 2, pts: 6734146278, ccData: 1283 }, - { type: 2, pts: 6734146278, ccData: 37162 }, - { type: 2, pts: 6734146278, ccData: 0 }, - { type: 2, pts: 6734146278, ccData: 37376 }, - { type: 2, pts: 6734146278, ccData: 2048 }, - { type: 3, pts: 6734152284, ccData: 49955 }, - { type: 2, pts: 6734152284, ccData: 37376 }, - { type: 2, pts: 6734152284, ccData: 2304 }, - { type: 3, pts: 6734158290, ccData: 546 }, - { type: 2, pts: 6734158290, ccData: 20553 }, - { type: 3, pts: 6734161293, ccData: 16930 }, - { type: 2, pts: 6734161293, ccData: 20043 }, - { type: 3, pts: 6734164296, ccData: 33314 }, - { type: 2, pts: 6734164296, ccData: 16716 }, - { type: 3, pts: 6734167299, ccData: 49698 }, - { type: 2, pts: 6734167299, ccData: 18755 }, - { type: 3, pts: 6734170302, ccData: 546 }, - { type: 2, pts: 6734170302, ccData: 18767 }, - { type: 3, pts: 6734173305, ccData: 16930 }, - { type: 2, pts: 6734173305, ccData: 21843 }, - { type: 3, pts: 6734176308, ccData: 33314 }, - { type: 2, pts: 6734176308, ccData: 14848 }, - { type: 3, pts: 6734179311, ccData: 51761 }, - { type: 2, pts: 6734179311, ccData: 38939 }, - { type: 2, pts: 6734179311, ccData: 16640 }, - { type: 2, pts: 6734179311, ccData: 287 }, - { type: 2, pts: 6734179311, ccData: 4240 }, - { type: 2, pts: 6734179311, ccData: 1283 }, - { type: 2, pts: 6734179311, ccData: 37162 }, - { type: 2, pts: 6734179311, ccData: 0 }, - { type: 2, pts: 6734179311, ccData: 37377 }, - { type: 2, pts: 6734179311, ccData: 2048 }, - { type: 3, pts: 6734185317, ccData: 803 }, - { type: 2, pts: 6734185317, ccData: 37377 }, - { type: 2, pts: 6734185317, ccData: 2304 }, - { type: 3, pts: 6734191323, ccData: 16930 }, - { type: 2, pts: 6734191323, ccData: 8772 }, - { type: 3, pts: 6734194326, ccData: 33314 }, - { type: 2, pts: 6734194326, ccData: 29285 }, - { type: 3, pts: 6734197329, ccData: 49698 }, - { type: 2, pts: 6734197329, ccData: 24941 }, - { type: 3, pts: 6734200332, ccData: 546 }, - { type: 2, pts: 6734200332, ccData: 24403 }, - { type: 3, pts: 6734203335, ccData: 16930 }, - { type: 2, pts: 6734203335, ccData: 24940 }, - { type: 3, pts: 6734206338, ccData: 33314 }, - { type: 2, pts: 6734206338, ccData: 28526 }, - { type: 3, pts: 6734209341, ccData: 49698 }, - { type: 2, pts: 6734209341, ccData: 11810 }, - { type: 3, pts: 6734218350, ccData: 546 }, - { type: 2, pts: 6734218350, ccData: 35073 }, - { type: 3, pts: 6734425557, ccData: 16930 }, - { type: 2, pts: 6734425557, ccData: 35841 }, - { type: 3, pts: 6734488620, ccData: 35377 }, - { type: 2, pts: 6734488620, ccData: 38939 }, - { type: 2, pts: 6734488620, ccData: 15360 }, - { type: 2, pts: 6734488620, ccData: 31 }, - { type: 2, pts: 6734488620, ccData: 5264 }, - { type: 2, pts: 6734488620, ccData: 1283 }, - { type: 2, pts: 6734488620, ccData: 37162 }, - { type: 2, pts: 6734488620, ccData: 0 }, - { type: 2, pts: 6734488620, ccData: 37376 }, - { type: 2, pts: 6734488620, ccData: 2048 }, - { type: 3, pts: 6734494626, ccData: 49955 }, - { type: 2, pts: 6734494626, ccData: 37376 }, - { type: 2, pts: 6734494626, ccData: 2560 }, - { type: 3, pts: 6734500632, ccData: 546 }, - { type: 2, pts: 6734500632, ccData: 10358 }, - { type: 3, pts: 6734503635, ccData: 16930 }, - { type: 2, pts: 6734503635, ccData: 28521 }, - { type: 3, pts: 6734506638, ccData: 33314 }, - { type: 2, pts: 6734506638, ccData: 25445 }, - { type: 3, pts: 6734509641, ccData: 49698 }, - { type: 2, pts: 6734509641, ccData: 28534 }, - { type: 3, pts: 6734512644, ccData: 546 }, - { type: 2, pts: 6734512644, ccData: 25970 }, - { type: 3, pts: 6734515647, ccData: 16930 }, - { type: 2, pts: 6734515647, ccData: 10554 }, - { type: 3, pts: 6734518650, ccData: 35377 }, - { type: 2, pts: 6734518650, ccData: 38939 }, - { type: 2, pts: 6734518650, ccData: 15360 }, - { type: 2, pts: 6734518650, ccData: 287 }, - { type: 2, pts: 6734518650, ccData: 4240 }, - { type: 2, pts: 6734518650, ccData: 1283 }, - { type: 2, pts: 6734518650, ccData: 37162 }, - { type: 2, pts: 6734518650, ccData: 0 }, - { type: 2, pts: 6734518650, ccData: 37377 }, - { type: 2, pts: 6734518650, ccData: 1024 }, - { type: 3, pts: 6734524656, ccData: 49698 }, - { type: 2, pts: 6734524656, ccData: 21615 }, - { type: 3, pts: 6734527659, ccData: 546 }, - { type: 2, pts: 6734527659, ccData: 25697 }, - { type: 3, pts: 6734530662, ccData: 16930 }, - { type: 2, pts: 6734530662, ccData: 31071 }, - { type: 3, pts: 6734533665, ccData: 33314 }, - { type: 2, pts: 6734533665, ccData: 19823 }, - { type: 3, pts: 6734536668, ccData: 49698 }, - { type: 2, pts: 6734536668, ccData: 28013 }, - { type: 3, pts: 6734539671, ccData: 546 }, - { type: 2, pts: 6734539671, ccData: 31015 }, - { type: 3, pts: 6734542674, ccData: 16930 }, - { type: 2, pts: 6734542674, ccData: 29535 }, - { type: 3, pts: 6734545677, ccData: 33314 }, - { type: 2, pts: 6734545677, ccData: 29793 }, - { type: 3, pts: 6734548680, ccData: 49698 }, - { type: 2, pts: 6734548680, ccData: 27497 }, - { type: 3, pts: 6734551683, ccData: 546 }, - { type: 2, pts: 6734551683, ccData: 28263 }, - { type: 3, pts: 6734554686, ccData: 16930 }, - { type: 2, pts: 6734554686, ccData: 24429 }, - { type: 3, pts: 6734557689, ccData: 33314 }, - { type: 2, pts: 6734557689, ccData: 25856 }, - { type: 3, pts: 6734560692, ccData: 51761 }, - { type: 2, pts: 6734560692, ccData: 38939 }, - { type: 2, pts: 6734560692, ccData: 15360 }, - { type: 2, pts: 6734560692, ccData: 543 }, - { type: 2, pts: 6734560692, ccData: 4240 }, - { type: 2, pts: 6734560692, ccData: 1283 }, - { type: 2, pts: 6734560692, ccData: 37162 }, - { type: 2, pts: 6734560692, ccData: 0 }, - { type: 2, pts: 6734560692, ccData: 37378 }, - { type: 2, pts: 6734560692, ccData: 2048 }, - { type: 3, pts: 6734566698, ccData: 546 }, - { type: 2, pts: 6734566698, ccData: 29807 }, - { type: 3, pts: 6734569701, ccData: 16930 }, - { type: 2, pts: 6734569701, ccData: 24423 }, - { type: 3, pts: 6734572704, ccData: 33314 }, - { type: 2, pts: 6734572704, ccData: 25972 }, - { type: 3, pts: 6734575707, ccData: 49698 }, - { type: 2, pts: 6734575707, ccData: 24417 }, - { type: 3, pts: 6734578710, ccData: 546 }, - { type: 2, pts: 6734578710, ccData: 24424 }, - { type: 3, pts: 6734581713, ccData: 16930 }, - { type: 2, pts: 6734581713, ccData: 24937 }, - { type: 3, pts: 6734584716, ccData: 33314 }, - { type: 2, pts: 6734584716, ccData: 29283 }, - { type: 3, pts: 6734587719, ccData: 49698 }, - { type: 2, pts: 6734587719, ccData: 30068 }, - { type: 3, pts: 6734596728, ccData: 546 }, - { type: 2, pts: 6734596728, ccData: 35073 }, - { type: 3, pts: 6734692824, ccData: 18993 }, - { type: 2, pts: 6734692824, ccData: 39195 }, - { type: 2, pts: 6734692824, ccData: 16640 }, - { type: 2, pts: 6734692824, ccData: 31 }, - { type: 2, pts: 6734692824, ccData: 5264 }, - { type: 2, pts: 6734692824, ccData: 1283 }, - { type: 2, pts: 6734692824, ccData: 37162 }, - { type: 2, pts: 6734692824, ccData: 42 }, - { type: 2, pts: 6734692824, ccData: 37376 }, - { type: 2, pts: 6734692824, ccData: 1024 }, - { type: 3, pts: 6734698830, ccData: 33314 }, - { type: 2, pts: 6734698830, ccData: 24948 }, - { type: 3, pts: 6734701833, ccData: 49698 }, - { type: 2, pts: 6734701833, ccData: 24400 }, - { type: 3, pts: 6734704836, ccData: 546 }, - { type: 2, pts: 6734704836, ccData: 26990 }, - { type: 3, pts: 6734707839, ccData: 16930 }, - { type: 2, pts: 6734707839, ccData: 27510 }, - { type: 3, pts: 6734710842, ccData: 33314 }, - { type: 2, pts: 6734710842, ccData: 26988 }, - { type: 3, pts: 6734713845, ccData: 49698 }, - { type: 2, pts: 6734713845, ccData: 27749 }, - { type: 3, pts: 6734716848, ccData: 546 }, - { type: 2, pts: 6734716848, ccData: 10099 }, - { type: 3, pts: 6734719851, ccData: 16930 }, - { type: 2, pts: 6734719851, ccData: 24418 }, - { type: 3, pts: 6734722854, ccData: 33314 }, - { type: 2, pts: 6734722854, ccData: 29281 }, - { type: 3, pts: 6734725857, ccData: 49698 }, - { type: 2, pts: 6734725857, ccData: 28260 }, - { type: 3, pts: 6734728860, ccData: 546 }, - { type: 2, pts: 6734728860, ccData: 11630 }, - { type: 3, pts: 6734731863, ccData: 16930 }, - { type: 2, pts: 6734731863, ccData: 25975 }, - { type: 3, pts: 6734734866, ccData: 35377 }, - { type: 2, pts: 6734734866, ccData: 39195 }, - { type: 2, pts: 6734734866, ccData: 16640 }, - { type: 2, pts: 6734734866, ccData: 287 }, - { type: 2, pts: 6734734866, ccData: 4240 }, - { type: 2, pts: 6734734866, ccData: 1283 }, - { type: 2, pts: 6734734866, ccData: 37162 }, - { type: 2, pts: 6734734866, ccData: 0 }, - { type: 2, pts: 6734734866, ccData: 37377 }, - { type: 2, pts: 6734734866, ccData: 2048 }, - { type: 3, pts: 6734740872, ccData: 49955 }, - { type: 2, pts: 6734740872, ccData: 37377 }, - { type: 2, pts: 6734740872, ccData: 2560 }, - { type: 3, pts: 6734746878, ccData: 546 }, - { type: 2, pts: 6734746878, ccData: 26721 }, - { type: 3, pts: 6734749881, ccData: 16930 }, - { type: 2, pts: 6734749881, ccData: 26994 }, - { type: 3, pts: 6734752884, ccData: 33314 }, - { type: 2, pts: 6734752884, ccData: 24435 }, - { type: 3, pts: 6734755887, ccData: 49698 }, - { type: 2, pts: 6734755887, ccData: 24940 }, - { type: 3, pts: 6734758890, ccData: 546 }, - { type: 2, pts: 6734758890, ccData: 28526 }, - { type: 3, pts: 6734761893, ccData: 16930 }, - { type: 2, pts: 6734761893, ccData: 11776 }, - { type: 3, pts: 6734764896, ccData: 33314 }, - { type: 2, pts: 6734764896, ccData: 35841 }, - { type: 3, pts: 6734770902, ccData: 49698 }, - { type: 2, pts: 6734770902, ccData: 35074 }, - { type: 3, pts: 6734924055, ccData: 2609 }, - { type: 2, pts: 6734924055, ccData: 38939 }, - { type: 2, pts: 6734924055, ccData: 17920 }, - { type: 2, pts: 6734924055, ccData: 31 }, - { type: 2, pts: 6734924055, ccData: 5264 }, - { type: 2, pts: 6734924055, ccData: 1283 }, - { type: 2, pts: 6734924055, ccData: 37162 }, - { type: 2, pts: 6734924055, ccData: 42 }, - { type: 2, pts: 6734924055, ccData: 37376 }, - { type: 2, pts: 6734924055, ccData: 0 }, - { type: 3, pts: 6734930061, ccData: 17187 }, - { type: 2, pts: 6734930061, ccData: 37376 }, - { type: 2, pts: 6734930061, ccData: 512 }, - { type: 3, pts: 6734936067, ccData: 33314 }, - { type: 2, pts: 6734936067, ccData: 18804 }, - { type: 3, pts: 6734939070, ccData: 49698 }, - { type: 2, pts: 6734939070, ccData: 10099 }, - { type: 3, pts: 6734942073, ccData: 546 }, - { type: 2, pts: 6734942073, ccData: 24419 }, - { type: 3, pts: 6734945076, ccData: 16930 }, - { type: 2, pts: 6734945076, ccData: 24940 }, - { type: 3, pts: 6734948079, ccData: 33314 }, - { type: 2, pts: 6734948079, ccData: 27749 }, - { type: 3, pts: 6734951082, ccData: 49698 }, - { type: 2, pts: 6734951082, ccData: 25695 }, - { type: 3, pts: 6734954085, ccData: 546 }, - { type: 2, pts: 6734954085, ccData: 29800 }, - { type: 3, pts: 6734957088, ccData: 16930 }, - { type: 2, pts: 6734957088, ccData: 25951 }, - { type: 3, pts: 6734960091, ccData: 33314 }, - { type: 2, pts: 6734960091, ccData: 17522 }, - { type: 3, pts: 6734963094, ccData: 49698 }, - { type: 2, pts: 6734963094, ccData: 25953 }, - { type: 3, pts: 6734966097, ccData: 546 }, - { type: 2, pts: 6734966097, ccData: 27999 }, - { type: 3, pts: 6734969100, ccData: 16930 }, - { type: 2, pts: 6734969100, ccData: 21345 }, - { type: 3, pts: 6734972103, ccData: 33314 }, - { type: 2, pts: 6734972103, ccData: 27759 }, - { type: 3, pts: 6734975106, ccData: 49698 }, - { type: 2, pts: 6734975106, ccData: 28206 }, - { type: 3, pts: 6734978109, ccData: 546 }, - { type: 2, pts: 6734978109, ccData: 35842 }, - { type: 3, pts: 6734984115, ccData: 16930 }, - { type: 2, pts: 6734984115, ccData: 35073 }, - { type: 3, pts: 6735245376, ccData: 35377 }, - { type: 2, pts: 6735245376, ccData: 39195 }, - { type: 2, pts: 6735245376, ccData: 17920 }, - { type: 2, pts: 6735245376, ccData: 31 }, - { type: 2, pts: 6735245376, ccData: 5264 }, - { type: 2, pts: 6735245376, ccData: 1283 }, - { type: 2, pts: 6735245376, ccData: 37162 }, - { type: 2, pts: 6735245376, ccData: 42 }, - { type: 2, pts: 6735245376, ccData: 37376 }, - { type: 2, pts: 6735245376, ccData: 3072 }, - { type: 3, pts: 6735251382, ccData: 49955 }, - { type: 2, pts: 6735251382, ccData: 37376 }, - { type: 2, pts: 6735251382, ccData: 3584 }, - { type: 3, pts: 6735257388, ccData: 545 }, - { type: 2, pts: 6735257388, ccData: 32512 }, - { type: 3, pts: 6735260391, ccData: 16930 }, - { type: 2, pts: 6735260391, ccData: 24320 }, - { type: 3, pts: 6735263394, ccData: 33313 }, - { type: 2, pts: 6735263394, ccData: 32512 }, - { type: 3, pts: 6735266397, ccData: 49698 }, - { type: 2, pts: 6735266397, ccData: 35841 }, - { type: 3, pts: 6735272403, ccData: 546 }, - { type: 2, pts: 6735272403, ccData: 35074 }, - { type: 3, pts: 6735452583, ccData: 18993 }, - { type: 2, pts: 6735452583, ccData: 38939 }, - { type: 2, pts: 6735452583, ccData: 17920 }, - { type: 2, pts: 6735452583, ccData: 31 }, - { type: 2, pts: 6735452583, ccData: 5264 }, - { type: 2, pts: 6735452583, ccData: 1283 }, - { type: 2, pts: 6735452583, ccData: 37162 }, - { type: 2, pts: 6735452583, ccData: 42 }, - { type: 2, pts: 6735452583, ccData: 37376 }, - { type: 2, pts: 6735452583, ccData: 0 }, - { type: 3, pts: 6735458589, ccData: 33571 }, - { type: 2, pts: 6735458589, ccData: 37376 }, - { type: 2, pts: 6735458589, ccData: 512 }, - { type: 3, pts: 6735464595, ccData: 49698 }, - { type: 2, pts: 6735464595, ccData: 21089 }, - { type: 3, pts: 6735467598, ccData: 546 }, - { type: 2, pts: 6735467598, ccData: 26209 }, - { type: 3, pts: 6735470601, ccData: 16930 }, - { type: 2, pts: 6735470601, ccData: 25964 }, - { type: 3, pts: 6735473604, ccData: 33314 }, - { type: 2, pts: 6735473604, ccData: 16128 }, - { type: 3, pts: 6735476607, ccData: 49698 }, - { type: 2, pts: 6735476607, ccData: 35842 }, - { type: 3, pts: 6735482613, ccData: 546 }, - { type: 2, pts: 6735482613, ccData: 35073 }, - { type: 3, pts: 6735542673, ccData: 18993 }, - { type: 2, pts: 6735542673, ccData: 39195 }, - { type: 2, pts: 6735542673, ccData: 17920 }, - { type: 2, pts: 6735542673, ccData: 31 }, - { type: 2, pts: 6735542673, ccData: 5264 }, - { type: 2, pts: 6735542673, ccData: 1283 }, - { type: 2, pts: 6735542673, ccData: 37162 }, - { type: 2, pts: 6735542673, ccData: 42 }, - { type: 2, pts: 6735542673, ccData: 37376 }, - { type: 2, pts: 6735542673, ccData: 0 }, - { type: 3, pts: 6735548679, ccData: 33571 }, - { type: 2, pts: 6735548679, ccData: 37376 }, - { type: 2, pts: 6735548679, ccData: 768 }, - { type: 3, pts: 6735554685, ccData: 49698 }, - { type: 2, pts: 6735554685, ccData: 19809 }, - { type: 3, pts: 6735557688, ccData: 546 }, - { type: 2, pts: 6735557688, ccData: 31087 }, - { type: 3, pts: 6735560691, ccData: 16930 }, - { type: 2, pts: 6735560691, ccData: 29279 }, - { type: 3, pts: 6735563694, ccData: 33314 }, - { type: 2, pts: 6735563694, ccData: 19809 }, - { type: 3, pts: 6735566697, ccData: 49698 }, - { type: 2, pts: 6735566697, ccData: 29300 }, - { type: 3, pts: 6735569700, ccData: 546 }, - { type: 2, pts: 6735569700, ccData: 26990 }, - { type: 3, pts: 6735572703, ccData: 16930 }, - { type: 2, pts: 6735572703, ccData: 25978 }, - { type: 3, pts: 6735575706, ccData: 33314 }, - { type: 2, pts: 6735575706, ccData: 16128 }, - { type: 3, pts: 6735578709, ccData: 49698 }, - { type: 2, pts: 6735578709, ccData: 35841 }, - { type: 3, pts: 6735584715, ccData: 546 }, - { type: 2, pts: 6735584715, ccData: 35074 }, - { type: 3, pts: 6735707838, ccData: 18993 }, - { type: 2, pts: 6735707838, ccData: 38939 }, - { type: 2, pts: 6735707838, ccData: 17920 }, - { type: 2, pts: 6735707838, ccData: 31 }, - { type: 2, pts: 6735707838, ccData: 5264 }, - { type: 2, pts: 6735707838, ccData: 1283 }, - { type: 2, pts: 6735707838, ccData: 37162 }, - { type: 2, pts: 6735707838, ccData: 42 }, - { type: 2, pts: 6735707838, ccData: 37376 }, - { type: 2, pts: 6735707838, ccData: 0 }, - { type: 3, pts: 6735713844, ccData: 33571 }, - { type: 2, pts: 6735713844, ccData: 37376 }, - { type: 2, pts: 6735713844, ccData: 768 }, - { type: 3, pts: 6735719850, ccData: 49698 }, - { type: 2, pts: 6735719850, ccData: 18803 }, - { type: 3, pts: 6735722853, ccData: 546 }, - { type: 2, pts: 6735722853, ccData: 24436 }, - { type: 3, pts: 6735725856, ccData: 16930 }, - { type: 2, pts: 6735725856, ccData: 26721 }, - { type: 3, pts: 6735728859, ccData: 33314 }, - { type: 2, pts: 6735728859, ccData: 29791 }, - { type: 3, pts: 6735731862, ccData: 49698 }, - { type: 2, pts: 6735731862, ccData: 31087 }, - { type: 3, pts: 6735734865, ccData: 546 }, - { type: 2, pts: 6735734865, ccData: 30015 }, - { type: 3, pts: 6735737868, ccData: 16930 }, - { type: 2, pts: 6735737868, ccData: 35842 }, - { type: 3, pts: 6735743874, ccData: 33314 }, - { type: 2, pts: 6735743874, ccData: 35073 }, - { type: 3, pts: 6735827958, ccData: 51761 }, - { type: 2, pts: 6735827958, ccData: 39195 }, - { type: 2, pts: 6735827958, ccData: 17920 }, - { type: 2, pts: 6735827958, ccData: 31 }, - { type: 2, pts: 6735827958, ccData: 5264 }, - { type: 2, pts: 6735827958, ccData: 1283 }, - { type: 2, pts: 6735827958, ccData: 37162 }, - { type: 2, pts: 6735827958, ccData: 42 }, - { type: 2, pts: 6735827958, ccData: 37376 }, - { type: 2, pts: 6735827958, ccData: 3072 }, - { type: 3, pts: 6735833964, ccData: 803 }, - { type: 2, pts: 6735833964, ccData: 37376 }, - { type: 2, pts: 6735833964, ccData: 3584 }, - { type: 3, pts: 6735839970, ccData: 16930 }, - { type: 2, pts: 6735839970, ccData: 22885 }, - { type: 3, pts: 6735842973, ccData: 33314 }, - { type: 2, pts: 6735842973, ccData: 29473 }, - { type: 3, pts: 6735845976, ccData: 49698 }, - { type: 2, pts: 6735845976, ccData: 35841 }, - { type: 3, pts: 6735851982, ccData: 546 }, - { type: 2, pts: 6735851982, ccData: 35074 }, - { type: 3, pts: 6735891021, ccData: 18993 }, - { type: 2, pts: 6735891021, ccData: 38939 }, - { type: 2, pts: 6735891021, ccData: 17920 }, - { type: 2, pts: 6735891021, ccData: 31 }, - { type: 2, pts: 6735891021, ccData: 5264 }, - { type: 2, pts: 6735891021, ccData: 1283 }, - { type: 2, pts: 6735891021, ccData: 37162 }, - { type: 2, pts: 6735891021, ccData: 42 }, - { type: 2, pts: 6735891021, ccData: 37376 }, - { type: 2, pts: 6735891021, ccData: 0 }, - { type: 3, pts: 6735897027, ccData: 33571 }, - { type: 2, pts: 6735897027, ccData: 37376 }, - { type: 2, pts: 6735897027, ccData: 512 }, - { type: 3, pts: 6735903033, ccData: 49698 }, - { type: 2, pts: 6735903033, ccData: 21608 }, - { type: 3, pts: 6735906036, ccData: 546 }, - { type: 2, pts: 6735906036, ccData: 26995 }, - { type: 3, pts: 6735909039, ccData: 16930 }, - { type: 2, pts: 6735909039, ccData: 24424 }, - { type: 3, pts: 6735912042, ccData: 33314 }, - { type: 2, pts: 6735912042, ccData: 24937 }, - { type: 3, pts: 6735915045, ccData: 49698 }, - { type: 2, pts: 6735915045, ccData: 29279 }, - { type: 3, pts: 6735918048, ccData: 546 }, - { type: 2, pts: 6735918048, ccData: 29537 }, - { type: 3, pts: 6735921051, ccData: 16930 }, - { type: 2, pts: 6735921051, ccData: 27759 }, - { type: 3, pts: 6735924054, ccData: 33314 }, - { type: 2, pts: 6735924054, ccData: 28255 }, - { type: 3, pts: 6735927057, ccData: 49698 }, - { type: 2, pts: 6735927057, ccData: 26995 }, - { type: 3, pts: 6735930060, ccData: 546 }, - { type: 2, pts: 6735930060, ccData: 24435 }, - { type: 3, pts: 6735933063, ccData: 16930 }, - { type: 2, pts: 6735933063, ccData: 28511 }, - { type: 3, pts: 6735936066, ccData: 33314 }, - { type: 2, pts: 6735936066, ccData: 25455 }, - { type: 3, pts: 6735939069, ccData: 49698 }, - { type: 2, pts: 6735939069, ccData: 28524 }, - { type: 3, pts: 6735942072, ccData: 546 }, - { type: 2, pts: 6735942072, ccData: 11776 }, - { type: 3, pts: 6735945075, ccData: 16930 }, - { type: 2, pts: 6735945075, ccData: 35842 }, - { type: 3, pts: 6735951081, ccData: 33314 }, - { type: 2, pts: 6735951081, ccData: 35073 }, - { type: 3, pts: 6736128258, ccData: 51761 }, - { type: 2, pts: 6736128258, ccData: 39195 }, - { type: 2, pts: 6736128258, ccData: 16640 }, - { type: 2, pts: 6736128258, ccData: 31 }, - { type: 2, pts: 6736128258, ccData: 5264 }, - { type: 2, pts: 6736128258, ccData: 1283 }, - { type: 2, pts: 6736128258, ccData: 37162 }, - { type: 2, pts: 6736128258, ccData: 42 }, - { type: 2, pts: 6736128258, ccData: 37376 }, - { type: 2, pts: 6736128258, ccData: 0 }, - { type: 3, pts: 6736134264, ccData: 803 }, - { type: 2, pts: 6736134264, ccData: 37376 }, - { type: 2, pts: 6736134264, ccData: 768 }, - { type: 3, pts: 6736140270, ccData: 16930 }, - { type: 2, pts: 6736140270, ccData: 22895 }, - { type: 3, pts: 6736143273, ccData: 33314 }, - { type: 2, pts: 6736143273, ccData: 30047 }, - { type: 3, pts: 6736146276, ccData: 49698 }, - { type: 2, pts: 6736146276, ccData: 25441 }, - { type: 3, pts: 6736149279, ccData: 546 }, - { type: 2, pts: 6736149279, ccData: 28255 }, - { type: 3, pts: 6736152282, ccData: 16930 }, - { type: 2, pts: 6736152282, ccData: 26721 }, - { type: 3, pts: 6736155285, ccData: 33314 }, - { type: 2, pts: 6736155285, ccData: 30309 }, - { type: 3, pts: 6736158288, ccData: 49698 }, - { type: 2, pts: 6736158288, ccData: 24417 }, - { type: 3, pts: 6736161291, ccData: 546 }, - { type: 2, pts: 6736161291, ccData: 28281 }, - { type: 3, pts: 6736164294, ccData: 16930 }, - { type: 2, pts: 6736164294, ccData: 24424 }, - { type: 3, pts: 6736167297, ccData: 33314 }, - { type: 2, pts: 6736167297, ccData: 24937 }, - { type: 3, pts: 6736170300, ccData: 49698 }, - { type: 2, pts: 6736170300, ccData: 29299 }, - { type: 3, pts: 6736173303, ccData: 546 }, - { type: 2, pts: 6736173303, ccData: 29817 }, - { type: 3, pts: 6736176306, ccData: 16930 }, - { type: 2, pts: 6736176306, ccData: 27749 }, - { type: 3, pts: 6736179309, ccData: 35377 }, - { type: 2, pts: 6736179309, ccData: 39195 }, - { type: 2, pts: 6736179309, ccData: 16640 }, - { type: 2, pts: 6736179309, ccData: 287 }, - { type: 2, pts: 6736179309, ccData: 4240 }, - { type: 2, pts: 6736179309, ccData: 1283 }, - { type: 2, pts: 6736179309, ccData: 37162 }, - { type: 2, pts: 6736179309, ccData: 0 }, - { type: 2, pts: 6736179309, ccData: 37377 }, - { type: 2, pts: 6736179309, ccData: 2048 }, - { type: 3, pts: 6736185315, ccData: 49955 }, - { type: 2, pts: 6736185315, ccData: 37377 }, - { type: 2, pts: 6736185315, ccData: 2304 }, - { type: 3, pts: 6736191321, ccData: 546 }, - { type: 2, pts: 6736191321, ccData: 31087 }, - { type: 3, pts: 6736194324, ccData: 16930 }, - { type: 2, pts: 6736194324, ccData: 30047 }, - { type: 3, pts: 6736197327, ccData: 33314 }, - { type: 2, pts: 6736197327, ccData: 25714 }, - { type: 3, pts: 6736200330, ccData: 49698 }, - { type: 2, pts: 6736200330, ccData: 25953 }, - { type: 3, pts: 6736203333, ccData: 546 }, - { type: 2, pts: 6736203333, ccData: 27999 }, - { type: 3, pts: 6736206336, ccData: 16930 }, - { type: 2, pts: 6736206336, ccData: 28518 }, - { type: 3, pts: 6736209339, ccData: 33314 }, - { type: 2, pts: 6736209339, ccData: 11776 }, - { type: 3, pts: 6736212342, ccData: 49698 }, - { type: 2, pts: 6736212342, ccData: 35841 }, - { type: 3, pts: 6736218348, ccData: 546 }, - { type: 2, pts: 6736218348, ccData: 35074 }, - { type: 3, pts: 6736365495, ccData: 18993 }, - { type: 2, pts: 6736365495, ccData: 38939 }, - { type: 2, pts: 6736365495, ccData: 16640 }, - { type: 2, pts: 6736365495, ccData: 31 }, - { type: 2, pts: 6736365495, ccData: 5264 }, - { type: 2, pts: 6736365495, ccData: 1283 }, - { type: 2, pts: 6736365495, ccData: 37162 }, - { type: 2, pts: 6736365495, ccData: 42 }, - { type: 2, pts: 6736365495, ccData: 37376 }, - { type: 2, pts: 6736365495, ccData: 0 }, - { type: 3, pts: 6736371501, ccData: 33571 }, - { type: 2, pts: 6736371501, ccData: 37376 }, - { type: 2, pts: 6736371501, ccData: 512 }, - { type: 3, pts: 6736377507, ccData: 49698 }, - { type: 2, pts: 6736377507, ccData: 21359 }, - { type: 3, pts: 6736380510, ccData: 546 }, - { type: 2, pts: 6736380510, ccData: 24436 }, - { type: 3, pts: 6736383513, ccData: 16930 }, - { type: 2, pts: 6736383513, ccData: 26721 }, - { type: 3, pts: 6736386516, ccData: 33314 }, - { type: 2, pts: 6736386516, ccData: 29735 }, - { type: 3, pts: 6736389519, ccData: 49698 }, - { type: 2, pts: 6736389519, ccData: 29535 }, - { type: 3, pts: 6736392522, ccData: 546 }, - { type: 2, pts: 6736392522, ccData: 30568 }, - { type: 3, pts: 6736395525, ccData: 16930 }, - { type: 2, pts: 6736395525, ccData: 30976 }, - { type: 3, pts: 6736398528, ccData: 35377 }, - { type: 2, pts: 6736398528, ccData: 38939 }, - { type: 2, pts: 6736398528, ccData: 16640 }, - { type: 2, pts: 6736398528, ccData: 287 }, - { type: 2, pts: 6736398528, ccData: 4240 }, - { type: 2, pts: 6736398528, ccData: 1283 }, - { type: 2, pts: 6736398528, ccData: 37162 }, - { type: 2, pts: 6736398528, ccData: 0 }, - { type: 2, pts: 6736398528, ccData: 37377 }, - { type: 2, pts: 6736398528, ccData: 0 }, - { type: 3, pts: 6736404534, ccData: 49955 }, - { type: 2, pts: 6736404534, ccData: 37377 }, - { type: 2, pts: 6736404534, ccData: 512 }, - { type: 3, pts: 6736410540, ccData: 546 }, - { type: 2, pts: 6736410540, ccData: 26996 }, - { type: 3, pts: 6736413543, ccData: 16930 }, - { type: 2, pts: 6736413543, ccData: 10099 }, - { type: 3, pts: 6736416546, ccData: 33314 }, - { type: 2, pts: 6736416546, ccData: 24419 }, - { type: 3, pts: 6736419549, ccData: 49698 }, - { type: 2, pts: 6736419549, ccData: 24940 }, - { type: 3, pts: 6736422552, ccData: 546 }, - { type: 2, pts: 6736422552, ccData: 27749 }, - { type: 3, pts: 6736425555, ccData: 16930 }, - { type: 2, pts: 6736425555, ccData: 25695 }, - { type: 3, pts: 6736428558, ccData: 33314 }, - { type: 2, pts: 6736428558, ccData: 29800 }, - { type: 3, pts: 6736431561, ccData: 49698 }, - { type: 2, pts: 6736431561, ccData: 25951 }, - { type: 3, pts: 6736434564, ccData: 546 }, - { type: 2, pts: 6736434564, ccData: 17522 }, - { type: 3, pts: 6736437567, ccData: 16930 }, - { type: 2, pts: 6736437567, ccData: 25953 }, - { type: 3, pts: 6736440570, ccData: 33314 }, - { type: 2, pts: 6736440570, ccData: 27999 }, - { type: 3, pts: 6736443573, ccData: 49698 }, - { type: 2, pts: 6736443573, ccData: 21345 }, - { type: 3, pts: 6736446576, ccData: 546 }, - { type: 2, pts: 6736446576, ccData: 27759 }, - { type: 3, pts: 6736449579, ccData: 16930 }, - { type: 2, pts: 6736449579, ccData: 28206 }, - { type: 3, pts: 6736452582, ccData: 33314 }, - { type: 2, pts: 6736452582, ccData: 35842 }, - { type: 3, pts: 6736458588, ccData: 49698 }, - { type: 2, pts: 6736458588, ccData: 35073 }, - { type: 3, pts: 6736695825, ccData: 2609 }, - { type: 2, pts: 6736695825, ccData: 39195 }, - { type: 2, pts: 6736695825, ccData: 16640 }, - { type: 2, pts: 6736695825, ccData: 31 }, - { type: 2, pts: 6736695825, ccData: 5264 }, - { type: 2, pts: 6736695825, ccData: 1283 }, - { type: 2, pts: 6736695825, ccData: 37162 }, - { type: 2, pts: 6736695825, ccData: 42 }, - { type: 2, pts: 6736695825, ccData: 37376 }, - { type: 2, pts: 6736695825, ccData: 1024 }, - { type: 3, pts: 6736701831, ccData: 17187 }, - { type: 2, pts: 6736701831, ccData: 37376 }, - { type: 2, pts: 6736701831, ccData: 1280 }, - { type: 3, pts: 6736707837, ccData: 33314 }, - { type: 2, pts: 6736707837, ccData: 22895 }, - { type: 3, pts: 6736710840, ccData: 49698 }, - { type: 2, pts: 6736710840, ccData: 30047 }, - { type: 3, pts: 6736713843, ccData: 546 }, - { type: 2, pts: 6736713843, ccData: 25199 }, - { type: 3, pts: 6736716846, ccData: 16930 }, - { type: 2, pts: 6736716846, ccData: 29800 }, - { type: 3, pts: 6736719849, ccData: 33314 }, - { type: 2, pts: 6736719849, ccData: 24428 }, - { type: 3, pts: 6736722852, ccData: 49698 }, - { type: 2, pts: 6736722852, ccData: 28527 }, - { type: 3, pts: 6736725855, ccData: 546 }, - { type: 2, pts: 6736725855, ccData: 27392 }, - { type: 3, pts: 6736728858, ccData: 18993 }, - { type: 2, pts: 6736728858, ccData: 39195 }, - { type: 2, pts: 6736728858, ccData: 16640 }, - { type: 2, pts: 6736728858, ccData: 287 }, - { type: 2, pts: 6736728858, ccData: 4240 }, - { type: 2, pts: 6736728858, ccData: 1283 }, - { type: 2, pts: 6736728858, ccData: 37162 }, - { type: 2, pts: 6736728858, ccData: 0 }, - { type: 2, pts: 6736728858, ccData: 37377 }, - { type: 2, pts: 6736728858, ccData: 1024 }, - { type: 3, pts: 6736734864, ccData: 33571 }, - { type: 2, pts: 6736734864, ccData: 37377 }, - { type: 2, pts: 6736734864, ccData: 1280 }, - { type: 3, pts: 6736740870, ccData: 49698 }, - { type: 2, pts: 6736740870, ccData: 24941 }, - { type: 3, pts: 6736743873, ccData: 546 }, - { type: 2, pts: 6736743873, ccData: 24954 }, - { type: 3, pts: 6736746876, ccData: 16930 }, - { type: 2, pts: 6736746876, ccData: 26990 }, - { type: 3, pts: 6736749879, ccData: 33314 }, - { type: 2, pts: 6736749879, ccData: 26414 }, - { type: 3, pts: 6736752882, ccData: 49698 }, - { type: 2, pts: 6736752882, ccData: 35841 }, - { type: 3, pts: 6736758888, ccData: 546 }, - { type: 2, pts: 6736758888, ccData: 35074 }, - { type: 3, pts: 6736824954, ccData: 18993 }, - { type: 2, pts: 6736824954, ccData: 38939 }, - { type: 2, pts: 6736824954, ccData: 15360 }, - { type: 2, pts: 6736824954, ccData: 31 }, - { type: 2, pts: 6736824954, ccData: 5264 }, - { type: 2, pts: 6736824954, ccData: 1283 }, - { type: 2, pts: 6736824954, ccData: 37162 }, - { type: 2, pts: 6736824954, ccData: 42 }, - { type: 2, pts: 6736824954, ccData: 37376 }, - { type: 2, pts: 6736824954, ccData: 1024 }, - { type: 3, pts: 6736830960, ccData: 33571 }, - { type: 2, pts: 6736830960, ccData: 37376 }, - { type: 2, pts: 6736830960, ccData: 1536 }, - { type: 3, pts: 6736836966, ccData: 49698 }, - { type: 2, pts: 6736836966, ccData: 21608 }, - { type: 3, pts: 6736839969, ccData: 546 }, - { type: 2, pts: 6736839969, ccData: 24942 }, - { type: 3, pts: 6736842972, ccData: 16930 }, - { type: 2, pts: 6736842972, ccData: 27487 }, - { type: 3, pts: 6736845975, ccData: 33314 }, - { type: 2, pts: 6736845975, ccData: 31087 }, - { type: 3, pts: 6736848978, ccData: 49698 }, - { type: 2, pts: 6736848978, ccData: 29998 }, - { type: 3, pts: 6736851981, ccData: 2609 }, - { type: 2, pts: 6736851981, ccData: 38939 }, - { type: 2, pts: 6736851981, ccData: 15360 }, - { type: 2, pts: 6736851981, ccData: 543 }, - { type: 2, pts: 6736851981, ccData: 4240 }, - { type: 2, pts: 6736851981, ccData: 1283 }, - { type: 2, pts: 6736851981, ccData: 37162 }, - { type: 2, pts: 6736851981, ccData: 0 }, - { type: 2, pts: 6736851981, ccData: 37378 }, - { type: 2, pts: 6736851981, ccData: 5120 }, - { type: 3, pts: 6736857987, ccData: 17187 }, - { type: 2, pts: 6736857987, ccData: 37378 }, - { type: 2, pts: 6736857987, ccData: 5376 }, - { type: 3, pts: 6736863993, ccData: 33314 }, - { type: 2, pts: 6736863993, ccData: 21608 }, - { type: 3, pts: 6736866996, ccData: 49698 }, - { type: 2, pts: 6736866996, ccData: 24942 }, - { type: 3, pts: 6736869999, ccData: 546 }, - { type: 2, pts: 6736869999, ccData: 27507 }, - { type: 3, pts: 6736873002, ccData: 16930 }, - { type: 2, pts: 6736873002, ccData: 11776 }, - { type: 3, pts: 6736876005, ccData: 33314 }, - { type: 2, pts: 6736876005, ccData: 35842 }, - { type: 3, pts: 6736882011, ccData: 49698 }, - { type: 2, pts: 6736882011, ccData: 35073 }, - { type: 3, pts: 6736951080, ccData: 2609 }, - { type: 2, pts: 6736951080, ccData: 39195 }, - { type: 2, pts: 6736951080, ccData: 16640 }, - { type: 2, pts: 6736951080, ccData: 31 }, - { type: 2, pts: 6736951080, ccData: 5264 }, - { type: 2, pts: 6736951080, ccData: 1283 }, - { type: 2, pts: 6736951080, ccData: 37162 }, - { type: 2, pts: 6736951080, ccData: 42 }, - { type: 2, pts: 6736951080, ccData: 37376 }, - { type: 2, pts: 6736951080, ccData: 2048 }, - { type: 3, pts: 6736957086, ccData: 17187 }, - { type: 2, pts: 6736957086, ccData: 37376 }, - { type: 2, pts: 6736957086, ccData: 2304 }, - { type: 3, pts: 6736963092, ccData: 33314 }, - { type: 2, pts: 6736963092, ccData: 19823 }, - { type: 3, pts: 6736966095, ccData: 49698 }, - { type: 2, pts: 6736966095, ccData: 28013 }, - { type: 3, pts: 6736969098, ccData: 546 }, - { type: 2, pts: 6736969098, ccData: 31020 }, - { type: 3, pts: 6736972101, ccData: 16930 }, - { type: 2, pts: 6736972101, ccData: 24429 }, - { type: 3, pts: 6736975104, ccData: 33314 }, - { type: 2, pts: 6736975104, ccData: 24953 }, - { type: 3, pts: 6736978107, ccData: 49698 }, - { type: 2, pts: 6736978107, ccData: 24393 }, - { type: 3, pts: 6736981110, ccData: 546 }, - { type: 2, pts: 6736981110, ccData: 24432 }, - { type: 3, pts: 6736984113, ccData: 16930 }, - { type: 2, pts: 6736984113, ccData: 27749 }, - { type: 3, pts: 6736987116, ccData: 33314 }, - { type: 2, pts: 6736987116, ccData: 24947 }, - { type: 3, pts: 6736990119, ccData: 49698 }, - { type: 2, pts: 6736990119, ccData: 25951 }, - { type: 3, pts: 6736993122, ccData: 546 }, - { type: 2, pts: 6736993122, ccData: 29810 }, - { type: 3, pts: 6736996125, ccData: 16930 }, - { type: 2, pts: 6736996125, ccData: 30976 }, - { type: 3, pts: 6736999128, ccData: 35377 }, - { type: 2, pts: 6736999128, ccData: 39195 }, - { type: 2, pts: 6736999128, ccData: 16640 }, - { type: 2, pts: 6736999128, ccData: 287 }, - { type: 2, pts: 6736999128, ccData: 4240 }, - { type: 2, pts: 6736999128, ccData: 1283 }, - { type: 2, pts: 6736999128, ccData: 37162 }, - { type: 2, pts: 6736999128, ccData: 0 }, - { type: 2, pts: 6736999128, ccData: 37377 }, - { type: 2, pts: 6736999128, ccData: 3072 }, - { type: 3, pts: 6737005134, ccData: 49698 }, - { type: 2, pts: 6737005134, ccData: 24927 }, - { type: 3, pts: 6737008137, ccData: 546 }, - { type: 2, pts: 6737008137, ccData: 28261 }, - { type: 3, pts: 6737011140, ccData: 16930 }, - { type: 2, pts: 6737011140, ccData: 30559 }, - { type: 3, pts: 6737014143, ccData: 33314 }, - { type: 2, pts: 6737014143, ccData: 26721 }, - { type: 3, pts: 6737017146, ccData: 49698 }, - { type: 2, pts: 6737017146, ccData: 26994 }, - { type: 3, pts: 6737020149, ccData: 546 }, - { type: 2, pts: 6737020149, ccData: 29556 }, - { type: 3, pts: 6737023152, ccData: 16930 }, - { type: 2, pts: 6737023152, ccData: 31084 }, - { type: 3, pts: 6737026155, ccData: 33314 }, - { type: 2, pts: 6737026155, ccData: 25951 }, - { type: 3, pts: 6737029158, ccData: 49698 }, - { type: 2, pts: 6737029158, ccData: 29807 }, - { type: 3, pts: 6737032161, ccData: 546 }, - { type: 2, pts: 6737032161, ccData: 28479 }, - { type: 3, pts: 6737035164, ccData: 16930 }, - { type: 2, pts: 6737035164, ccData: 35841 }, - { type: 3, pts: 6737041170, ccData: 33314 }, - { type: 2, pts: 6737041170, ccData: 35074 }, - { type: 3, pts: 6737299428, ccData: 51761 }, - { type: 2, pts: 6737299428, ccData: 38939 }, - { type: 2, pts: 6737299428, ccData: 16640 }, - { type: 2, pts: 6737299428, ccData: 31 }, - { type: 2, pts: 6737299428, ccData: 5264 }, - { type: 2, pts: 6737299428, ccData: 1283 }, - { type: 2, pts: 6737299428, ccData: 37162 }, - { type: 2, pts: 6737299428, ccData: 42 }, - { type: 2, pts: 6737299428, ccData: 37376 }, - { type: 2, pts: 6737299428, ccData: 0 }, - { type: 3, pts: 6737305434, ccData: 546 }, - { type: 2, pts: 6737305434, ccData: 10343 }, - { type: 3, pts: 6737308437, ccData: 16930 }, - { type: 2, pts: 6737308437, ccData: 24947 }, - { type: 3, pts: 6737311440, ccData: 33314 }, - { type: 2, pts: 6737311440, ccData: 28787 }, - { type: 3, pts: 6737314443, ccData: 49698 }, - { type: 2, pts: 6737314443, ccData: 10554 }, - { type: 3, pts: 6737317446, ccData: 2609 }, - { type: 2, pts: 6737317446, ccData: 38939 }, - { type: 2, pts: 6737317446, ccData: 16640 }, - { type: 2, pts: 6737317446, ccData: 287 }, - { type: 2, pts: 6737317446, ccData: 4240 }, - { type: 2, pts: 6737317446, ccData: 1283 }, - { type: 2, pts: 6737317446, ccData: 37162 }, - { type: 2, pts: 6737317446, ccData: 0 }, - { type: 2, pts: 6737317446, ccData: 37377 }, - { type: 2, pts: 6737317446, ccData: 0 }, - { type: 3, pts: 6737323452, ccData: 16930 }, - { type: 2, pts: 6737323452, ccData: 20326 }, - { type: 3, pts: 6737326455, ccData: 33314 }, - { type: 2, pts: 6737326455, ccData: 24419 }, - { type: 3, pts: 6737329458, ccData: 49698 }, - { type: 2, pts: 6737329458, ccData: 28533 }, - { type: 3, pts: 6737332461, ccData: 546 }, - { type: 2, pts: 6737332461, ccData: 29299 }, - { type: 3, pts: 6737335464, ccData: 16930 }, - { type: 2, pts: 6737335464, ccData: 25902 }, - { type: 3, pts: 6737338467, ccData: 33314 }, - { type: 2, pts: 6737338467, ccData: 35842 }, - { type: 3, pts: 6737344473, ccData: 49698 }, - { type: 2, pts: 6737344473, ccData: 35073 }, - { type: 3, pts: 6737431560, ccData: 2609 }, - { type: 2, pts: 6737431560, ccData: 39195 }, - { type: 2, pts: 6737431560, ccData: 17920 }, - { type: 2, pts: 6737431560, ccData: 31 }, - { type: 2, pts: 6737431560, ccData: 5264 }, - { type: 2, pts: 6737431560, ccData: 1283 }, - { type: 2, pts: 6737431560, ccData: 37162 }, - { type: 2, pts: 6737431560, ccData: 42 }, - { type: 2, pts: 6737431560, ccData: 37376 }, - { type: 2, pts: 6737431560, ccData: 0 }, - { type: 3, pts: 6737437566, ccData: 16930 }, - { type: 2, pts: 6737437566, ccData: 21359 }, - { type: 3, pts: 6737440569, ccData: 33314 }, - { type: 2, pts: 6737440569, ccData: 30062 }, - { type: 3, pts: 6737443572, ccData: 49698 }, - { type: 2, pts: 6737443572, ccData: 25715 }, - { type: 3, pts: 6737446575, ccData: 546 }, - { type: 2, pts: 6737446575, ccData: 24428 }, - { type: 3, pts: 6737449578, ccData: 16930 }, - { type: 2, pts: 6737449578, ccData: 26987 }, - { type: 3, pts: 6737452581, ccData: 33314 }, - { type: 2, pts: 6737452581, ccData: 25951 }, - { type: 3, pts: 6737455584, ccData: 49698 }, - { type: 2, pts: 6737455584, ccData: 26229 }, - { type: 3, pts: 6737458587, ccData: 546 }, - { type: 2, pts: 6737458587, ccData: 28206 }, - { type: 3, pts: 6737461590, ccData: 16930 }, - { type: 2, pts: 6737461590, ccData: 35841 }, - { type: 3, pts: 6737467596, ccData: 33314 }, - { type: 2, pts: 6737467596, ccData: 35074 }, - { type: 3, pts: 6737512641, ccData: 51761 }, - { type: 2, pts: 6737512641, ccData: 38939 }, - { type: 2, pts: 6737512641, ccData: 17920 }, - { type: 2, pts: 6737512641, ccData: 31 }, - { type: 2, pts: 6737512641, ccData: 5264 }, - { type: 2, pts: 6737512641, ccData: 1283 }, - { type: 2, pts: 6737512641, ccData: 37162 }, - { type: 2, pts: 6737512641, ccData: 42 }, - { type: 2, pts: 6737512641, ccData: 37376 }, - { type: 2, pts: 6737512641, ccData: 2048 }, - { type: 3, pts: 6737518647, ccData: 803 }, - { type: 2, pts: 6737518647, ccData: 37376 }, - { type: 2, pts: 6737518647, ccData: 2816 }, - { type: 3, pts: 6737524653, ccData: 16930 }, - { type: 2, pts: 6737524653, ccData: 21349 }, - { type: 3, pts: 6737527656, ccData: 33314 }, - { type: 2, pts: 6737527656, ccData: 25951 }, - { type: 3, pts: 6737530659, ccData: 49698 }, - { type: 2, pts: 6737530659, ccData: 31087 }, - { type: 3, pts: 6737533662, ccData: 546 }, - { type: 2, pts: 6737533662, ccData: 30047 }, - { type: 3, pts: 6737536665, ccData: 16930 }, - { type: 2, pts: 6737536665, ccData: 24948 }, - { type: 3, pts: 6737539668, ccData: 33314 }, - { type: 2, pts: 6737539668, ccData: 24435 }, - { type: 3, pts: 6737542671, ccData: 49698 }, - { type: 2, pts: 6737542671, ccData: 28515 }, - { type: 3, pts: 6737545674, ccData: 546 }, - { type: 2, pts: 6737545674, ccData: 25445 }, - { type: 3, pts: 6737548677, ccData: 16930 }, - { type: 2, pts: 6737548677, ccData: 29217 }, - { type: 3, pts: 6737551680, ccData: 33314 }, - { type: 2, pts: 6737551680, ccData: 35842 }, - { type: 3, pts: 6737557686, ccData: 49698 }, - { type: 2, pts: 6737557686, ccData: 35073 }, - { type: 3, pts: 6737743872, ccData: 2609 }, - { type: 2, pts: 6737743872, ccData: 39195 }, - { type: 2, pts: 6737743872, ccData: 17920 }, - { type: 2, pts: 6737743872, ccData: 31 }, - { type: 2, pts: 6737743872, ccData: 5264 }, - { type: 2, pts: 6737743872, ccData: 1283 }, - { type: 2, pts: 6737743872, ccData: 37162 }, - { type: 2, pts: 6737743872, ccData: 42 }, - { type: 2, pts: 6737743872, ccData: 37376 }, - { type: 2, pts: 6737743872, ccData: 3072 }, - { type: 3, pts: 6737749878, ccData: 17187 }, - { type: 2, pts: 6737749878, ccData: 37376 }, - { type: 2, pts: 6737749878, ccData: 3584 }, - { type: 3, pts: 6737755884, ccData: 33313 }, - { type: 2, pts: 6737755884, ccData: 32512 }, - { type: 3, pts: 6737758887, ccData: 49698 }, - { type: 2, pts: 6737758887, ccData: 24320 }, - { type: 3, pts: 6737761890, ccData: 545 }, - { type: 2, pts: 6737761890, ccData: 32512 }, - { type: 3, pts: 6737764893, ccData: 16930 }, - { type: 2, pts: 6737764893, ccData: 35841 }, - { type: 3, pts: 6737770899, ccData: 33314 }, - { type: 2, pts: 6737770899, ccData: 35074 }, - { type: 3, pts: 6737969097, ccData: 49698 }, - { type: 2, pts: 6737969097, ccData: 35842 }, - { type: 3, pts: 6738164292, ccData: 2609 }, - { type: 2, pts: 6738164292, ccData: 38939 }, - { type: 2, pts: 6738164292, ccData: 17920 }, - { type: 2, pts: 6738164292, ccData: 31 }, - { type: 2, pts: 6738164292, ccData: 5264 }, - { type: 2, pts: 6738164292, ccData: 1283 }, - { type: 2, pts: 6738164292, ccData: 37162 }, - { type: 2, pts: 6738164292, ccData: 42 }, - { type: 2, pts: 6738164292, ccData: 37376 }, - { type: 2, pts: 6738164292, ccData: 1024 }, - { type: 3, pts: 6738170298, ccData: 16930 }, - { type: 2, pts: 6738170298, ccData: 18533 }, - { type: 3, pts: 6738173301, ccData: 33314 }, - { type: 2, pts: 6738173301, ccData: 31071 }, - { type: 3, pts: 6738176304, ccData: 49698 }, - { type: 2, pts: 6738176304, ccData: 29800 }, - { type: 3, pts: 6738179307, ccData: 546 }, - { type: 2, pts: 6738179307, ccData: 25970 }, - { type: 3, pts: 6738182310, ccData: 16930 }, - { type: 2, pts: 6738182310, ccData: 25889 }, - { type: 3, pts: 6738191319, ccData: 33314 }, - { type: 2, pts: 6738191319, ccData: 35073 }, - { type: 3, pts: 6738242370, ccData: 51761 }, - { type: 2, pts: 6738242370, ccData: 39195 }, - { type: 2, pts: 6738242370, ccData: 17920 }, - { type: 2, pts: 6738242370, ccData: 31 }, - { type: 2, pts: 6738242370, ccData: 5264 }, - { type: 2, pts: 6738242370, ccData: 1283 }, - { type: 2, pts: 6738242370, ccData: 37162 }, - { type: 2, pts: 6738242370, ccData: 42 }, - { type: 2, pts: 6738242370, ccData: 37376 }, - { type: 2, pts: 6738242370, ccData: 0 }, - { type: 3, pts: 6738248376, ccData: 803 }, - { type: 2, pts: 6738248376, ccData: 37376 }, - { type: 2, pts: 6738248376, ccData: 256 }, - { type: 3, pts: 6738254382, ccData: 16930 }, - { type: 2, pts: 6738254382, ccData: 22373 }, - { type: 3, pts: 6738257385, ccData: 33314 }, - { type: 2, pts: 6738257385, ccData: 27747 }, - { type: 3, pts: 6738260388, ccData: 49698 }, - { type: 2, pts: 6738260388, ccData: 28525 }, - { type: 3, pts: 6738263391, ccData: 546 }, - { type: 2, pts: 6738263391, ccData: 25951 }, - { type: 3, pts: 6738266394, ccData: 16930 }, - { type: 2, pts: 6738266394, ccData: 29807 }, - { type: 3, pts: 6738269397, ccData: 33314 }, - { type: 2, pts: 6738269397, ccData: 24436 }, - { type: 3, pts: 6738272400, ccData: 49698 }, - { type: 2, pts: 6738272400, ccData: 26725 }, - { type: 3, pts: 6738275403, ccData: 546 }, - { type: 2, pts: 6738275403, ccData: 24388 }, - { type: 3, pts: 6738278406, ccData: 16930 }, - { type: 2, pts: 6738278406, ccData: 29285 }, - { type: 3, pts: 6738281409, ccData: 33314 }, - { type: 2, pts: 6738281409, ccData: 24941 }, - { type: 3, pts: 6738284412, ccData: 49698 }, - { type: 2, pts: 6738284412, ccData: 24403 }, - { type: 3, pts: 6738287415, ccData: 546 }, - { type: 2, pts: 6738287415, ccData: 24940 }, - { type: 3, pts: 6738290418, ccData: 16930 }, - { type: 2, pts: 6738290418, ccData: 28526 }, - { type: 3, pts: 6738293421, ccData: 33314 }, - { type: 2, pts: 6738293421, ccData: 11776 }, - { type: 3, pts: 6738296424, ccData: 49698 }, - { type: 2, pts: 6738296424, ccData: 35841 }, - { type: 3, pts: 6738302430, ccData: 546 }, - { type: 2, pts: 6738302430, ccData: 35074 }, - { type: 3, pts: 6738404532, ccData: 18993 }, - { type: 2, pts: 6738404532, ccData: 38939 }, - { type: 2, pts: 6738404532, ccData: 15360 }, - { type: 2, pts: 6738404532, ccData: 31 }, - { type: 2, pts: 6738404532, ccData: 5264 }, - { type: 2, pts: 6738404532, ccData: 1283 }, - { type: 2, pts: 6738404532, ccData: 37162 }, - { type: 2, pts: 6738404532, ccData: 42 }, - { type: 2, pts: 6738404532, ccData: 37376 }, - { type: 2, pts: 6738404532, ccData: 4096 }, - { type: 3, pts: 6738410538, ccData: 33571 }, - { type: 2, pts: 6738410538, ccData: 37376 }, - { type: 2, pts: 6738410538, ccData: 4608 }, - { type: 3, pts: 6738416544, ccData: 49698 }, - { type: 2, pts: 6738416544, ccData: 18537 }, - { type: 3, pts: 6738419547, ccData: 546 }, - { type: 2, pts: 6738419547, ccData: 8448 }, - { type: 3, pts: 6738422550, ccData: 18993 }, - { type: 2, pts: 6738422550, ccData: 38939 }, - { type: 2, pts: 6738422550, ccData: 15360 }, - { type: 2, pts: 6738422550, ccData: 543 }, - { type: 2, pts: 6738422550, ccData: 4240 }, - { type: 2, pts: 6738422550, ccData: 1283 }, - { type: 2, pts: 6738422550, ccData: 37162 }, - { type: 2, pts: 6738422550, ccData: 0 }, - { type: 2, pts: 6738422550, ccData: 37378 }, - { type: 2, pts: 6738422550, ccData: 6144 }, - { type: 3, pts: 6738428556, ccData: 33314 }, - { type: 2, pts: 6738428556, ccData: 18533 }, - { type: 3, pts: 6738431559, ccData: 49698 }, - { type: 2, pts: 6738431559, ccData: 27756 }, - { type: 3, pts: 6738434562, ccData: 546 }, - { type: 2, pts: 6738434562, ccData: 28449 }, - { type: 3, pts: 6738437565, ccData: 16930 }, - { type: 2, pts: 6738437565, ccData: 35842 }, - { type: 3, pts: 6738443571, ccData: 33314 }, - { type: 2, pts: 6738443571, ccData: 35073 }, - { type: 3, pts: 6738482610, ccData: 51761 }, - { type: 2, pts: 6738482610, ccData: 39195 }, - { type: 2, pts: 6738482610, ccData: 16640 }, - { type: 2, pts: 6738482610, ccData: 31 }, - { type: 2, pts: 6738482610, ccData: 5264 }, - { type: 2, pts: 6738482610, ccData: 1283 }, - { type: 2, pts: 6738482610, ccData: 37162 }, - { type: 2, pts: 6738482610, ccData: 42 }, - { type: 2, pts: 6738482610, ccData: 37376 }, - { type: 2, pts: 6738482610, ccData: 2048 }, - { type: 3, pts: 6738488616, ccData: 803 }, - { type: 2, pts: 6738488616, ccData: 37376 }, - { type: 2, pts: 6738488616, ccData: 2560 }, - { type: 3, pts: 6738494622, ccData: 16930 }, - { type: 2, pts: 6738494622, ccData: 18727 }, - { type: 3, pts: 6738497625, ccData: 33314 }, - { type: 2, pts: 6738497625, ccData: 27999 }, - { type: 3, pts: 6738500628, ccData: 49698 }, - { type: 2, pts: 6738500628, ccData: 16750 }, - { type: 3, pts: 6738503631, ccData: 546 }, - { type: 2, pts: 6738503631, ccData: 25714 }, - { type: 3, pts: 6738506634, ccData: 16930 }, - { type: 2, pts: 6738506634, ccData: 25953 }, - { type: 3, pts: 6738509637, ccData: 33314 }, - { type: 2, pts: 6738509637, ccData: 11264 }, - { type: 3, pts: 6738512640, ccData: 51761 }, - { type: 2, pts: 6738512640, ccData: 39195 }, - { type: 2, pts: 6738512640, ccData: 16640 }, - { type: 2, pts: 6738512640, ccData: 287 }, - { type: 2, pts: 6738512640, ccData: 4240 }, - { type: 2, pts: 6738512640, ccData: 1283 }, - { type: 2, pts: 6738512640, ccData: 37162 }, - { type: 2, pts: 6738512640, ccData: 0 }, - { type: 2, pts: 6738512640, ccData: 37377 }, - { type: 2, pts: 6738512640, ccData: 0 }, - { type: 3, pts: 6738518646, ccData: 803 }, - { type: 2, pts: 6738518646, ccData: 37377 }, - { type: 2, pts: 6738518646, ccData: 256 }, - { type: 3, pts: 6738524652, ccData: 16930 }, - { type: 2, pts: 6738524652, ccData: 24942 }, - { type: 3, pts: 6738527655, ccData: 33314 }, - { type: 2, pts: 6738527655, ccData: 25695 }, - { type: 3, pts: 6738530658, ccData: 49698 }, - { type: 2, pts: 6738530658, ccData: 18727 }, - { type: 3, pts: 6738533661, ccData: 546 }, - { type: 2, pts: 6738533661, ccData: 27756 }, - { type: 3, pts: 6738536664, ccData: 16930 }, - { type: 2, pts: 6738536664, ccData: 24418 }, - { type: 3, pts: 6738539667, ccData: 33314 }, - { type: 2, pts: 6738539667, ccData: 25951 }, - { type: 3, pts: 6738542670, ccData: 49698 }, - { type: 2, pts: 6738542670, ccData: 31087 }, - { type: 3, pts: 6738545673, ccData: 546 }, - { type: 2, pts: 6738545673, ccData: 30066 }, - { type: 3, pts: 6738548676, ccData: 16930 }, - { type: 2, pts: 6738548676, ccData: 24424 }, - { type: 3, pts: 6738551679, ccData: 33314 }, - { type: 2, pts: 6738551679, ccData: 24937 }, - { type: 3, pts: 6738554682, ccData: 49698 }, - { type: 2, pts: 6738554682, ccData: 29279 }, - { type: 3, pts: 6738557685, ccData: 546 }, - { type: 2, pts: 6738557685, ccData: 29556 }, - { type: 3, pts: 6738560688, ccData: 16930 }, - { type: 2, pts: 6738560688, ccData: 31084 }, - { type: 3, pts: 6738563691, ccData: 33314 }, - { type: 2, pts: 6738563691, ccData: 26995 }, - { type: 3, pts: 6738566694, ccData: 49698 }, - { type: 2, pts: 6738566694, ccData: 29742 }, - { type: 3, pts: 6738569697, ccData: 546 }, - { type: 2, pts: 6738569697, ccData: 35841 }, - { type: 3, pts: 6738575703, ccData: 16930 }, - { type: 2, pts: 6738575703, ccData: 35074 }, - { type: 3, pts: 6738743871, ccData: 35377 }, - { type: 2, pts: 6738743871, ccData: 38939 }, - { type: 2, pts: 6738743871, ccData: 17920 }, - { type: 2, pts: 6738743871, ccData: 31 }, - { type: 2, pts: 6738743871, ccData: 5264 }, - { type: 2, pts: 6738743871, ccData: 1283 }, - { type: 2, pts: 6738743871, ccData: 37162 }, - { type: 2, pts: 6738743871, ccData: 42 }, - { type: 2, pts: 6738743871, ccData: 37376 }, - { type: 2, pts: 6738743871, ccData: 1024 }, - { type: 3, pts: 6738749877, ccData: 49955 }, - { type: 2, pts: 6738749877, ccData: 37376 }, - { type: 2, pts: 6738749877, ccData: 1792 }, - { type: 3, pts: 6738755883, ccData: 546 }, - { type: 2, pts: 6738755883, ccData: 18727 }, - { type: 3, pts: 6738758886, ccData: 16930 }, - { type: 2, pts: 6738758886, ccData: 27999 }, - { type: 3, pts: 6738761889, ccData: 33314 }, - { type: 2, pts: 6738761889, ccData: 20585 }, - { type: 3, pts: 6738764892, ccData: 49698 }, - { type: 2, pts: 6738764892, ccData: 28267 }, - { type: 3, pts: 6738767895, ccData: 546 }, - { type: 2, pts: 6738767895, ccData: 24940 }, - { type: 3, pts: 6738770898, ccData: 16930 }, - { type: 2, pts: 6738770898, ccData: 26979 }, - { type: 3, pts: 6738773901, ccData: 33314 }, - { type: 2, pts: 6738773901, ccData: 26991 }, - { type: 3, pts: 6738776904, ccData: 49698 }, - { type: 2, pts: 6738776904, ccData: 30067 }, - { type: 3, pts: 6738779907, ccData: 546 }, - { type: 2, pts: 6738779907, ccData: 11776 }, - { type: 3, pts: 6738782910, ccData: 16930 }, - { type: 2, pts: 6738782910, ccData: 35842 }, - { type: 3, pts: 6738788916, ccData: 33314 }, - { type: 2, pts: 6738788916, ccData: 35073 }, - { type: 3, pts: 6738885012, ccData: 51761 }, - { type: 2, pts: 6738885012, ccData: 39195 }, - { type: 2, pts: 6738885012, ccData: 17920 }, - { type: 2, pts: 6738885012, ccData: 31 }, - { type: 2, pts: 6738885012, ccData: 5264 }, - { type: 2, pts: 6738885012, ccData: 1283 }, - { type: 2, pts: 6738885012, ccData: 37162 }, - { type: 2, pts: 6738885012, ccData: 42 }, - { type: 2, pts: 6738885012, ccData: 37376 }, - { type: 2, pts: 6738885012, ccData: 1024 }, - { type: 3, pts: 6738891018, ccData: 803 }, - { type: 2, pts: 6738891018, ccData: 37376 }, - { type: 2, pts: 6738891018, ccData: 1792 }, - { type: 3, pts: 6738897024, ccData: 16930 }, - { type: 2, pts: 6738897024, ccData: 16750 }, - { type: 3, pts: 6738900027, ccData: 33314 }, - { type: 2, pts: 6738900027, ccData: 25695 }, - { type: 3, pts: 6738903030, ccData: 49698 }, - { type: 2, pts: 6738903030, ccData: 29800 }, - { type: 3, pts: 6738906033, ccData: 546 }, - { type: 2, pts: 6738906033, ccData: 26995 }, - { type: 3, pts: 6738909036, ccData: 16930 }, - { type: 2, pts: 6738909036, ccData: 24425 }, - { type: 3, pts: 6738912039, ccData: 33314 }, - { type: 2, pts: 6738912039, ccData: 29535 }, - { type: 3, pts: 6738915042, ccData: 49698 }, - { type: 2, pts: 6738915042, ccData: 19823 }, - { type: 3, pts: 6738918045, ccData: 546 }, - { type: 2, pts: 6738918045, ccData: 28013 }, - { type: 3, pts: 6738921048, ccData: 16930 }, - { type: 2, pts: 6738921048, ccData: 31022 }, - { type: 3, pts: 6738924051, ccData: 33314 }, - { type: 2, pts: 6738924051, ccData: 35841 }, - { type: 3, pts: 6738930057, ccData: 49698 }, - { type: 2, pts: 6738930057, ccData: 35074 }, - { type: 3, pts: 6739026153, ccData: 2609 }, - { type: 2, pts: 6739026153, ccData: 38939 }, - { type: 2, pts: 6739026153, ccData: 16640 }, - { type: 2, pts: 6739026153, ccData: 31 }, - { type: 2, pts: 6739026153, ccData: 5264 }, - { type: 2, pts: 6739026153, ccData: 1283 }, - { type: 2, pts: 6739026153, ccData: 37162 }, - { type: 2, pts: 6739026153, ccData: 42 }, - { type: 2, pts: 6739026153, ccData: 37376 }, - { type: 2, pts: 6739026153, ccData: 3072 }, - { type: 3, pts: 6739032159, ccData: 17187 }, - { type: 2, pts: 6739032159, ccData: 37376 }, - { type: 2, pts: 6739032159, ccData: 3840 }, - { type: 3, pts: 6739038165, ccData: 33314 }, - { type: 2, pts: 6739038165, ccData: 20073 }, - { type: 3, pts: 6739041168, ccData: 49698 }, - { type: 2, pts: 6739041168, ccData: 25445 }, - { type: 3, pts: 6739044171, ccData: 546 }, - { type: 2, pts: 6739044171, ccData: 24436 }, - { type: 3, pts: 6739047174, ccData: 16930 }, - { type: 2, pts: 6739047174, ccData: 28511 }, - { type: 3, pts: 6739050177, ccData: 33314 }, - { type: 2, pts: 6739050177, ccData: 28005 }, - { type: 3, pts: 6739053180, ccData: 49698 }, - { type: 2, pts: 6739053180, ccData: 25972 }, - { type: 3, pts: 6739056183, ccData: 546 }, - { type: 2, pts: 6739056183, ccData: 24441 }, - { type: 3, pts: 6739059186, ccData: 16930 }, - { type: 2, pts: 6739059186, ccData: 28533 }, - { type: 3, pts: 6739062189, ccData: 33314 }, - { type: 2, pts: 6739062189, ccData: 11264 }, - { type: 3, pts: 6739065192, ccData: 51761 }, - { type: 2, pts: 6739065192, ccData: 38939 }, - { type: 2, pts: 6739065192, ccData: 16640 }, - { type: 2, pts: 6739065192, ccData: 287 }, - { type: 2, pts: 6739065192, ccData: 4240 }, - { type: 2, pts: 6739065192, ccData: 1283 }, - { type: 2, pts: 6739065192, ccData: 37162 }, - { type: 2, pts: 6739065192, ccData: 0 }, - { type: 2, pts: 6739065192, ccData: 37377 }, - { type: 2, pts: 6739065192, ccData: 6144 }, - { type: 3, pts: 6739071198, ccData: 803 }, - { type: 2, pts: 6739071198, ccData: 37377 }, - { type: 2, pts: 6739071198, ccData: 6400 }, - { type: 3, pts: 6739077204, ccData: 16930 }, - { type: 2, pts: 6739077204, ccData: 16750 }, - { type: 3, pts: 6739080207, ccData: 33314 }, - { type: 2, pts: 6739080207, ccData: 25714 }, - { type: 3, pts: 6739083210, ccData: 49698 }, - { type: 2, pts: 6739083210, ccData: 25953 }, - { type: 3, pts: 6739086213, ccData: 546 }, - { type: 2, pts: 6739086213, ccData: 11776 }, - { type: 3, pts: 6739089216, ccData: 16930 }, - { type: 2, pts: 6739089216, ccData: 35842 }, - { type: 3, pts: 6739095222, ccData: 33314 }, - { type: 2, pts: 6739095222, ccData: 35073 }, - { type: 3, pts: 6739164291, ccData: 51761 }, - { type: 2, pts: 6739164291, ccData: 39195 }, - { type: 2, pts: 6739164291, ccData: 16640 }, - { type: 2, pts: 6739164291, ccData: 31 }, - { type: 2, pts: 6739164291, ccData: 5264 }, - { type: 2, pts: 6739164291, ccData: 1283 }, - { type: 2, pts: 6739164291, ccData: 37162 }, - { type: 2, pts: 6739164291, ccData: 42 }, - { type: 2, pts: 6739164291, ccData: 37376 }, - { type: 2, pts: 6739164291, ccData: 1024 }, - { type: 3, pts: 6739170297, ccData: 803 }, - { type: 2, pts: 6739170297, ccData: 37376 }, - { type: 2, pts: 6739170297, ccData: 1536 }, - { type: 3, pts: 6739176303, ccData: 16930 }, - { type: 2, pts: 6739176303, ccData: 18783 }, - { type: 3, pts: 6739179306, ccData: 33314 }, - { type: 2, pts: 6739179306, ccData: 25441 }, - { type: 3, pts: 6739182309, ccData: 49698 }, - { type: 2, pts: 6739182309, ccData: 28199 }, - { type: 3, pts: 6739185312, ccData: 546 }, - { type: 2, pts: 6739185312, ccData: 29791 }, - { type: 3, pts: 6739188315, ccData: 16930 }, - { type: 2, pts: 6739188315, ccData: 30561 }, - { type: 3, pts: 6739191318, ccData: 33314 }, - { type: 2, pts: 6739191318, ccData: 26996 }, - { type: 3, pts: 6739194321, ccData: 49698 }, - { type: 2, pts: 6739194321, ccData: 24436 }, - { type: 3, pts: 6739197324, ccData: 546 }, - { type: 2, pts: 6739197324, ccData: 28511 }, - { type: 3, pts: 6739200327, ccData: 16930 }, - { type: 2, pts: 6739200327, ccData: 29810 }, - { type: 3, pts: 6739203330, ccData: 33314 }, - { type: 2, pts: 6739203330, ccData: 30976 }, - { type: 3, pts: 6739206333, ccData: 51761 }, - { type: 2, pts: 6739206333, ccData: 39195 }, - { type: 2, pts: 6739206333, ccData: 16640 }, - { type: 2, pts: 6739206333, ccData: 287 }, - { type: 2, pts: 6739206333, ccData: 4240 }, - { type: 2, pts: 6739206333, ccData: 1283 }, - { type: 2, pts: 6739206333, ccData: 37162 }, - { type: 2, pts: 6739206333, ccData: 0 }, - { type: 2, pts: 6739206333, ccData: 37377 }, - { type: 2, pts: 6739206333, ccData: 2048 }, - { type: 3, pts: 6739212339, ccData: 546 }, - { type: 2, pts: 6739212339, ccData: 24927 }, - { type: 3, pts: 6739215342, ccData: 16930 }, - { type: 2, pts: 6739215342, ccData: 28261 }, - { type: 3, pts: 6739218345, ccData: 33314 }, - { type: 2, pts: 6739218345, ccData: 30559 }, - { type: 3, pts: 6739221348, ccData: 49698 }, - { type: 2, pts: 6739221348, ccData: 26721 }, - { type: 3, pts: 6739224351, ccData: 546 }, - { type: 2, pts: 6739224351, ccData: 26994 }, - { type: 3, pts: 6739227354, ccData: 16930 }, - { type: 2, pts: 6739227354, ccData: 29556 }, - { type: 3, pts: 6739230357, ccData: 33314 }, - { type: 2, pts: 6739230357, ccData: 31084 }, - { type: 3, pts: 6739233360, ccData: 49698 }, - { type: 2, pts: 6739233360, ccData: 25902 }, - { type: 3, pts: 6739236363, ccData: 546 }, - { type: 2, pts: 6739236363, ccData: 35841 }, - { type: 3, pts: 6739242369, ccData: 16930 }, - { type: 2, pts: 6739242369, ccData: 35074 }, - { type: 3, pts: 6739479606, ccData: 35377 }, - { type: 2, pts: 6739479606, ccData: 38939 }, - { type: 2, pts: 6739479606, ccData: 17920 }, - { type: 2, pts: 6739479606, ccData: 31 }, - { type: 2, pts: 6739479606, ccData: 5264 }, - { type: 2, pts: 6739479606, ccData: 1283 }, - { type: 2, pts: 6739479606, ccData: 37162 }, - { type: 2, pts: 6739479606, ccData: 42 }, - { type: 2, pts: 6739479606, ccData: 37376 }, - { type: 2, pts: 6739479606, ccData: 3072 }, - { type: 3, pts: 6739485612, ccData: 49698 }, - { type: 2, pts: 6739485612, ccData: 20581 }, - { type: 3, pts: 6739488615, ccData: 546 }, - { type: 2, pts: 6739488615, ccData: 29286 }, - { type: 3, pts: 6739491618, ccData: 16930 }, - { type: 2, pts: 6739491618, ccData: 25955 }, - { type: 3, pts: 6739494621, ccData: 33314 }, - { type: 2, pts: 6739494621, ccData: 29729 }, - { type: 3, pts: 6739497624, ccData: 49698 }, - { type: 2, pts: 6739497624, ccData: 35842 }, - { type: 3, pts: 6739503630, ccData: 546 }, - { type: 2, pts: 6739503630, ccData: 35073 }, - { type: 3, pts: 6739518645, ccData: 18993 }, - { type: 2, pts: 6739518645, ccData: 39195 }, - { type: 2, pts: 6739518645, ccData: 16640 }, - { type: 2, pts: 6739518645, ccData: 31 }, - { type: 2, pts: 6739518645, ccData: 5264 }, - { type: 2, pts: 6739518645, ccData: 1283 }, - { type: 2, pts: 6739518645, ccData: 37162 }, - { type: 2, pts: 6739518645, ccData: 42 }, - { type: 2, pts: 6739518645, ccData: 37376 }, - { type: 2, pts: 6739518645, ccData: 1024 }, - { type: 3, pts: 6739524651, ccData: 33571 }, - { type: 2, pts: 6739524651, ccData: 37376 }, - { type: 2, pts: 6739524651, ccData: 1280 }, - { type: 3, pts: 6739530657, ccData: 49698 }, - { type: 2, pts: 6739530657, ccData: 22376 }, - { type: 3, pts: 6739533660, ccData: 546 }, - { type: 2, pts: 6739533660, ccData: 24948 }, - { type: 3, pts: 6739536663, ccData: 16930 }, - { type: 2, pts: 6739536663, ccData: 24427 }, - { type: 3, pts: 6739539666, ccData: 33314 }, - { type: 2, pts: 6739539666, ccData: 26990 }, - { type: 3, pts: 6739542669, ccData: 49698 }, - { type: 2, pts: 6739542669, ccData: 25695 }, - { type: 3, pts: 6739545672, ccData: 546 }, - { type: 2, pts: 6739545672, ccData: 28518 }, - { type: 3, pts: 6739548675, ccData: 16930 }, - { type: 2, pts: 6739548675, ccData: 24424 }, - { type: 3, pts: 6739551678, ccData: 33314 }, - { type: 2, pts: 6739551678, ccData: 24937 }, - { type: 3, pts: 6739554681, ccData: 49698 }, - { type: 2, pts: 6739554681, ccData: 29299 }, - { type: 3, pts: 6739557684, ccData: 546 }, - { type: 2, pts: 6739557684, ccData: 29817 }, - { type: 3, pts: 6739560687, ccData: 16930 }, - { type: 2, pts: 6739560687, ccData: 27749 }, - { type: 3, pts: 6739563690, ccData: 35377 }, - { type: 2, pts: 6739563690, ccData: 39195 }, - { type: 2, pts: 6739563690, ccData: 16640 }, - { type: 2, pts: 6739563690, ccData: 287 }, - { type: 2, pts: 6739563690, ccData: 4240 }, - { type: 2, pts: 6739563690, ccData: 1283 }, - { type: 2, pts: 6739563690, ccData: 37162 }, - { type: 2, pts: 6739563690, ccData: 0 }, - { type: 2, pts: 6739563690, ccData: 37377 }, - { type: 2, pts: 6739563690, ccData: 2048 }, - { type: 3, pts: 6739569696, ccData: 49955 }, - { type: 2, pts: 6739569696, ccData: 37377 }, - { type: 2, pts: 6739569696, ccData: 2560 }, - { type: 3, pts: 6739575702, ccData: 546 }, - { type: 2, pts: 6739575702, ccData: 25711 }, - { type: 3, pts: 6739578705, ccData: 16930 }, - { type: 2, pts: 6739578705, ccData: 24441 }, - { type: 3, pts: 6739581708, ccData: 33314 }, - { type: 2, pts: 6739581708, ccData: 28533 }, - { type: 3, pts: 6739584711, ccData: 49698 }, - { type: 2, pts: 6739584711, ccData: 24439 }, - { type: 3, pts: 6739587714, ccData: 546 }, - { type: 2, pts: 6739587714, ccData: 24942 }, - { type: 3, pts: 6739590717, ccData: 16930 }, - { type: 2, pts: 6739590717, ccData: 29759 }, - { type: 3, pts: 6739593720, ccData: 33314 }, - { type: 2, pts: 6739593720, ccData: 35841 }, - { type: 3, pts: 6739599726, ccData: 49698 }, - { type: 2, pts: 6739599726, ccData: 35074 }, - { type: 3, pts: 6739695822, ccData: 2609 }, - { type: 2, pts: 6739695822, ccData: 38939 }, - { type: 2, pts: 6739695822, ccData: 16640 }, - { type: 2, pts: 6739695822, ccData: 31 }, - { type: 2, pts: 6739695822, ccData: 5264 }, - { type: 2, pts: 6739695822, ccData: 1283 }, - { type: 2, pts: 6739695822, ccData: 37162 }, - { type: 2, pts: 6739695822, ccData: 42 }, - { type: 2, pts: 6739695822, ccData: 37376 }, - { type: 2, pts: 6739695822, ccData: 1024 }, - { type: 3, pts: 6739701828, ccData: 16930 }, - { type: 2, pts: 6739701828, ccData: 18727 }, - { type: 3, pts: 6739704831, ccData: 33314 }, - { type: 2, pts: 6739704831, ccData: 27950 }, - { type: 3, pts: 6739707834, ccData: 49698 }, - { type: 2, pts: 6739707834, ccData: 11822 }, - { type: 3, pts: 6739710837, ccData: 546 }, - { type: 2, pts: 6739710837, ccData: 24393 }, - { type: 3, pts: 6739713840, ccData: 16930 }, - { type: 2, pts: 6739713840, ccData: 10093 }, - { type: 3, pts: 6739716843, ccData: 33314 }, - { type: 2, pts: 6739716843, ccData: 24430 }, - { type: 3, pts: 6739719846, ccData: 49698 }, - { type: 2, pts: 6739719846, ccData: 28532 }, - { type: 3, pts: 6739722849, ccData: 546 }, - { type: 2, pts: 6739722849, ccData: 24435 }, - { type: 3, pts: 6739725852, ccData: 16930 }, - { type: 2, pts: 6739725852, ccData: 30066 }, - { type: 3, pts: 6739728855, ccData: 33314 }, - { type: 2, pts: 6739728855, ccData: 25951 }, - { type: 3, pts: 6739731858, ccData: 49698 }, - { type: 2, pts: 6739731858, ccData: 31077 }, - { type: 3, pts: 6739734861, ccData: 546 }, - { type: 2, pts: 6739734861, ccData: 29740 }, - { type: 3, pts: 6739737864, ccData: 18993 }, - { type: 2, pts: 6739737864, ccData: 38939 }, - { type: 2, pts: 6739737864, ccData: 16640 }, - { type: 2, pts: 6739737864, ccData: 287 }, - { type: 2, pts: 6739737864, ccData: 4240 }, - { type: 2, pts: 6739737864, ccData: 1283 }, - { type: 2, pts: 6739737864, ccData: 37162 }, - { type: 2, pts: 6739737864, ccData: 0 }, - { type: 2, pts: 6739737864, ccData: 37377 }, - { type: 2, pts: 6739737864, ccData: 3072 }, - { type: 3, pts: 6739743870, ccData: 33314 }, - { type: 2, pts: 6739743870, ccData: 16750 }, - { type: 3, pts: 6739746873, ccData: 49698 }, - { type: 2, pts: 6739746873, ccData: 25714 }, - { type: 3, pts: 6739749876, ccData: 546 }, - { type: 2, pts: 6739749876, ccData: 25953 }, - { type: 3, pts: 6739752879, ccData: 16930 }, - { type: 2, pts: 6739752879, ccData: 11776 }, - { type: 3, pts: 6739755882, ccData: 33314 }, - { type: 2, pts: 6739755882, ccData: 35842 }, - { type: 3, pts: 6739761888, ccData: 49698 }, - { type: 2, pts: 6739761888, ccData: 35073 }, - { type: 3, pts: 6739999125, ccData: 2609 }, - { type: 2, pts: 6739999125, ccData: 39195 }, - { type: 2, pts: 6739999125, ccData: 16640 }, - { type: 2, pts: 6739999125, ccData: 31 }, - { type: 2, pts: 6739999125, ccData: 5264 }, - { type: 2, pts: 6739999125, ccData: 1283 }, - { type: 2, pts: 6739999125, ccData: 37162 }, - { type: 2, pts: 6739999125, ccData: 42 }, - { type: 2, pts: 6739999125, ccData: 37376 }, - { type: 2, pts: 6739999125, ccData: 0 }, - { type: 3, pts: 6740005131, ccData: 16930 }, - { type: 2, pts: 6740005131, ccData: 22373 }, - { type: 3, pts: 6740008134, ccData: 33314 }, - { type: 2, pts: 6740008134, ccData: 27756 }, - { type: 3, pts: 6740011137, ccData: 49698 }, - { type: 2, pts: 6740011137, ccData: 11264 }, - { type: 3, pts: 6740014140, ccData: 2609 }, - { type: 2, pts: 6740014140, ccData: 39195 }, - { type: 2, pts: 6740014140, ccData: 16640 }, - { type: 2, pts: 6740014140, ccData: 287 }, - { type: 2, pts: 6740014140, ccData: 4240 }, - { type: 2, pts: 6740014140, ccData: 1283 }, - { type: 2, pts: 6740014140, ccData: 37162 }, - { type: 2, pts: 6740014140, ccData: 0 }, - { type: 2, pts: 6740014140, ccData: 37377 }, - { type: 2, pts: 6740014140, ccData: 0 }, - { type: 3, pts: 6740020146, ccData: 16930 }, - { type: 2, pts: 6740020146, ccData: 29800 }, - { type: 3, pts: 6740023149, ccData: 33314 }, - { type: 2, pts: 6740023149, ccData: 26995 }, - { type: 3, pts: 6740026152, ccData: 49698 }, - { type: 2, pts: 6740026152, ccData: 24429 }, - { type: 3, pts: 6740029155, ccData: 546 }, - { type: 2, pts: 6740029155, ccData: 26983 }, - { type: 3, pts: 6740032158, ccData: 16930 }, - { type: 2, pts: 6740032158, ccData: 26740 }, - { type: 3, pts: 6740035161, ccData: 33314 }, - { type: 2, pts: 6740035161, ccData: 24424 }, - { type: 3, pts: 6740038164, ccData: 49698 }, - { type: 2, pts: 6740038164, ccData: 25964 }, - { type: 3, pts: 6740041167, ccData: 546 }, - { type: 2, pts: 6740041167, ccData: 28718 }, - { type: 3, pts: 6740044170, ccData: 16930 }, - { type: 2, pts: 6740044170, ccData: 35841 }, - { type: 3, pts: 6740050176, ccData: 33314 }, - { type: 2, pts: 6740050176, ccData: 35074 }, - { type: 3, pts: 6740122248, ccData: 51761 }, - { type: 2, pts: 6740122248, ccData: 38939 }, - { type: 2, pts: 6740122248, ccData: 16640 }, - { type: 2, pts: 6740122248, ccData: 31 }, - { type: 2, pts: 6740122248, ccData: 5264 }, - { type: 2, pts: 6740122248, ccData: 1283 }, - { type: 2, pts: 6740122248, ccData: 37162 }, - { type: 2, pts: 6740122248, ccData: 42 }, - { type: 2, pts: 6740122248, ccData: 37376 }, - { type: 2, pts: 6740122248, ccData: 0 }, - { type: 3, pts: 6740128254, ccData: 546 }, - { type: 2, pts: 6740128254, ccData: 18804 }, - { type: 3, pts: 6740131257, ccData: 16930 }, - { type: 2, pts: 6740131257, ccData: 10099 }, - { type: 3, pts: 6740134260, ccData: 33314 }, - { type: 2, pts: 6740134260, ccData: 24431 }, - { type: 3, pts: 6740137263, ccData: 49698 }, - { type: 2, pts: 6740137263, ccData: 30066 }, - { type: 3, pts: 6740140266, ccData: 546 }, - { type: 2, pts: 6740140266, ccData: 24418 }, - { type: 3, pts: 6740143269, ccData: 16930 }, - { type: 2, pts: 6740143269, ccData: 28527 }, - { type: 3, pts: 6740146272, ccData: 33314 }, - { type: 2, pts: 6740146272, ccData: 27392 }, - { type: 3, pts: 6740149275, ccData: 51761 }, - { type: 2, pts: 6740149275, ccData: 38939 }, - { type: 2, pts: 6740149275, ccData: 16640 }, - { type: 2, pts: 6740149275, ccData: 287 }, - { type: 2, pts: 6740149275, ccData: 4240 }, - { type: 2, pts: 6740149275, ccData: 1283 }, - { type: 2, pts: 6740149275, ccData: 37162 }, - { type: 2, pts: 6740149275, ccData: 0 }, - { type: 2, pts: 6740149275, ccData: 37377 }, - { type: 2, pts: 6740149275, ccData: 0 }, - { type: 3, pts: 6740155281, ccData: 546 }, - { type: 2, pts: 6740155281, ccData: 28518 }, - { type: 3, pts: 6740158284, ccData: 16930 }, - { type: 2, pts: 6740158284, ccData: 24424 }, - { type: 3, pts: 6740161287, ccData: 33314 }, - { type: 2, pts: 6740161287, ccData: 24937 }, - { type: 3, pts: 6740164290, ccData: 49698 }, - { type: 2, pts: 6740164290, ccData: 29299 }, - { type: 3, pts: 6740167293, ccData: 546 }, - { type: 2, pts: 6740167293, ccData: 29817 }, - { type: 3, pts: 6740170296, ccData: 16930 }, - { type: 2, pts: 6740170296, ccData: 27749 }, - { type: 3, pts: 6740173299, ccData: 33314 }, - { type: 2, pts: 6740173299, ccData: 29486 }, - { type: 3, pts: 6740176302, ccData: 49698 }, - { type: 2, pts: 6740176302, ccData: 35842 }, - { type: 3, pts: 6740182308, ccData: 546 }, - { type: 2, pts: 6740182308, ccData: 35073 }, - { type: 3, pts: 6740326452, ccData: 18993 }, - { type: 2, pts: 6740326452, ccData: 39195 }, - { type: 2, pts: 6740326452, ccData: 17920 }, - { type: 2, pts: 6740326452, ccData: 31 }, - { type: 2, pts: 6740326452, ccData: 5264 }, - { type: 2, pts: 6740326452, ccData: 1283 }, - { type: 2, pts: 6740326452, ccData: 37162 }, - { type: 2, pts: 6740326452, ccData: 42 }, - { type: 2, pts: 6740326452, ccData: 37376 }, - { type: 2, pts: 6740326452, ccData: 0 }, - { type: 3, pts: 6740332458, ccData: 33314 }, - { type: 2, pts: 6740332458, ccData: 21601 }, - { type: 3, pts: 6740335461, ccData: 49698 }, - { type: 2, pts: 6740335461, ccData: 27493 }, - { type: 3, pts: 6740338464, ccData: 546 }, - { type: 2, pts: 6740338464, ccData: 24417 }, - { type: 3, pts: 6740341467, ccData: 16930 }, - { type: 2, pts: 6740341467, ccData: 24428 }, - { type: 3, pts: 6740344470, ccData: 33314 }, - { type: 2, pts: 6740344470, ccData: 28527 }, - { type: 3, pts: 6740347473, ccData: 49698 }, - { type: 2, pts: 6740347473, ccData: 27438 }, - { type: 3, pts: 6740350476, ccData: 546 }, - { type: 2, pts: 6740350476, ccData: 35841 }, - { type: 3, pts: 6740356482, ccData: 16930 }, - { type: 2, pts: 6740356482, ccData: 35074 }, - { type: 3, pts: 6740410536, ccData: 35377 }, - { type: 2, pts: 6740410536, ccData: 38939 }, - { type: 2, pts: 6740410536, ccData: 16640 }, - { type: 2, pts: 6740410536, ccData: 31 }, - { type: 2, pts: 6740410536, ccData: 5264 }, - { type: 2, pts: 6740410536, ccData: 1283 }, - { type: 2, pts: 6740410536, ccData: 37162 }, - { type: 2, pts: 6740410536, ccData: 42 }, - { type: 2, pts: 6740410536, ccData: 37376 }, - { type: 2, pts: 6740410536, ccData: 0 }, - { type: 3, pts: 6740416542, ccData: 49698 }, - { type: 2, pts: 6740416542, ccData: 21608 }, - { type: 3, pts: 6740419545, ccData: 546 }, - { type: 2, pts: 6740419545, ccData: 25970 }, - { type: 3, pts: 6740422548, ccData: 16930 }, - { type: 2, pts: 6740422548, ccData: 25951 }, - { type: 3, pts: 6740425551, ccData: 33314 }, - { type: 2, pts: 6740425551, ccData: 28009 }, - { type: 3, pts: 6740428554, ccData: 49698 }, - { type: 2, pts: 6740428554, ccData: 26472 }, - { type: 3, pts: 6740431557, ccData: 546 }, - { type: 2, pts: 6740431557, ccData: 29791 }, - { type: 3, pts: 6740434560, ccData: 16930 }, - { type: 2, pts: 6740434560, ccData: 25189 }, - { type: 3, pts: 6740437563, ccData: 33314 }, - { type: 2, pts: 6740437563, ccData: 24431 }, - { type: 3, pts: 6740440566, ccData: 49698 }, - { type: 2, pts: 6740440566, ccData: 28261 }, - { type: 3, pts: 6740443569, ccData: 2609 }, - { type: 2, pts: 6740443569, ccData: 38939 }, - { type: 2, pts: 6740443569, ccData: 16640 }, - { type: 2, pts: 6740443569, ccData: 287 }, - { type: 2, pts: 6740443569, ccData: 4240 }, - { type: 2, pts: 6740443569, ccData: 1283 }, - { type: 2, pts: 6740443569, ccData: 37162 }, - { type: 2, pts: 6740443569, ccData: 0 }, - { type: 2, pts: 6740443569, ccData: 37377 }, - { type: 2, pts: 6740443569, ccData: 0 }, - { type: 3, pts: 6740449575, ccData: 16930 }, - { type: 2, pts: 6740449575, ccData: 31087 }, - { type: 3, pts: 6740452578, ccData: 33314 }, - { type: 2, pts: 6740452578, ccData: 30047 }, - { type: 3, pts: 6740455581, ccData: 49698 }, - { type: 2, pts: 6740455581, ccData: 27753 }, - { type: 3, pts: 6740458584, ccData: 546 }, - { type: 2, pts: 6740458584, ccData: 27493 }, - { type: 3, pts: 6740461587, ccData: 16930 }, - { type: 2, pts: 6740461587, ccData: 11776 }, - { type: 3, pts: 6740464590, ccData: 33314 }, - { type: 2, pts: 6740464590, ccData: 35842 }, - { type: 3, pts: 6740470596, ccData: 49698 }, - { type: 2, pts: 6740470596, ccData: 35073 }, - { type: 3, pts: 6740509635, ccData: 2609 }, - { type: 2, pts: 6740509635, ccData: 39195 }, - { type: 2, pts: 6740509635, ccData: 16640 }, - { type: 2, pts: 6740509635, ccData: 31 }, - { type: 2, pts: 6740509635, ccData: 5264 }, - { type: 2, pts: 6740509635, ccData: 1283 }, - { type: 2, pts: 6740509635, ccData: 37162 }, - { type: 2, pts: 6740509635, ccData: 42 }, - { type: 2, pts: 6740509635, ccData: 37376 }, - { type: 2, pts: 6740509635, ccData: 2048 }, - { type: 3, pts: 6740515641, ccData: 17187 }, - { type: 2, pts: 6740515641, ccData: 37376 }, - { type: 2, pts: 6740515641, ccData: 2304 }, - { type: 3, pts: 6740521647, ccData: 33314 }, - { type: 2, pts: 6740521647, ccData: 18541 }, - { type: 3, pts: 6740524650, ccData: 49698 }, - { type: 2, pts: 6740524650, ccData: 27948 }, - { type: 3, pts: 6740527653, ccData: 546 }, - { type: 2, pts: 6740527653, ccData: 24439 }, - { type: 3, pts: 6740530656, ccData: 16930 }, - { type: 2, pts: 6740530656, ccData: 26721 }, - { type: 3, pts: 6740533659, ccData: 33314 }, - { type: 2, pts: 6740533659, ccData: 29791 }, - { type: 3, pts: 6740536662, ccData: 49698 }, - { type: 2, pts: 6740536662, ccData: 25711 }, - { type: 3, pts: 6740539665, ccData: 546 }, - { type: 2, pts: 6740539665, ccData: 24441 }, - { type: 3, pts: 6740542668, ccData: 16930 }, - { type: 2, pts: 6740542668, ccData: 28533 }, - { type: 3, pts: 6740545671, ccData: 33314 }, - { type: 2, pts: 6740545671, ccData: 24436 }, - { type: 3, pts: 6740548674, ccData: 49698 }, - { type: 2, pts: 6740548674, ccData: 26729 }, - { type: 3, pts: 6740551677, ccData: 546 }, - { type: 2, pts: 6740551677, ccData: 28267 }, - { type: 3, pts: 6740554680, ccData: 16930 }, - { type: 2, pts: 6740554680, ccData: 11264 }, - { type: 3, pts: 6740557683, ccData: 35377 }, - { type: 2, pts: 6740557683, ccData: 39195 }, - { type: 2, pts: 6740557683, ccData: 16640 }, - { type: 2, pts: 6740557683, ccData: 287 }, - { type: 2, pts: 6740557683, ccData: 4240 }, - { type: 2, pts: 6740557683, ccData: 1283 }, - { type: 2, pts: 6740557683, ccData: 37162 }, - { type: 2, pts: 6740557683, ccData: 0 }, - { type: 2, pts: 6740557683, ccData: 37377 }, - { type: 2, pts: 6740557683, ccData: 4096 }, - { type: 3, pts: 6740563689, ccData: 49955 }, - { type: 2, pts: 6740563689, ccData: 37377 }, - { type: 2, pts: 6740563689, ccData: 4864 }, - { type: 3, pts: 6740569695, ccData: 546 }, - { type: 2, pts: 6740569695, ccData: 20585 }, - { type: 3, pts: 6740572698, ccData: 16930 }, - { type: 2, pts: 6740572698, ccData: 28267 }, - { type: 3, pts: 6740575701, ccData: 33314 }, - { type: 2, pts: 6740575701, ccData: 24940 }, - { type: 3, pts: 6740578704, ccData: 49698 }, - { type: 2, pts: 6740578704, ccData: 26979 }, - { type: 3, pts: 6740581707, ccData: 546 }, - { type: 2, pts: 6740581707, ccData: 26991 }, - { type: 3, pts: 6740584710, ccData: 16930 }, - { type: 2, pts: 6740584710, ccData: 30067 }, - { type: 3, pts: 6740587713, ccData: 33314 }, - { type: 2, pts: 6740587713, ccData: 16128 }, - { type: 3, pts: 6740590716, ccData: 49698 }, - { type: 2, pts: 6740590716, ccData: 35841 }, - { type: 3, pts: 6740596722, ccData: 546 }, - { type: 2, pts: 6740596722, ccData: 35074 }, - { type: 3, pts: 6740689815, ccData: 18993 }, - { type: 2, pts: 6740689815, ccData: 38939 }, - { type: 2, pts: 6740689815, ccData: 16640 }, - { type: 2, pts: 6740689815, ccData: 31 }, - { type: 2, pts: 6740689815, ccData: 5264 }, - { type: 2, pts: 6740689815, ccData: 1283 }, - { type: 2, pts: 6740689815, ccData: 37162 }, - { type: 2, pts: 6740689815, ccData: 42 }, - { type: 2, pts: 6740689815, ccData: 37376 }, - { type: 2, pts: 6740689815, ccData: 2048 }, - { type: 3, pts: 6740695821, ccData: 33571 }, - { type: 2, pts: 6740695821, ccData: 37376 }, - { type: 2, pts: 6740695821, ccData: 2304 }, - { type: 3, pts: 6740701827, ccData: 49698 }, - { type: 2, pts: 6740701827, ccData: 20553 }, - { type: 3, pts: 6740704830, ccData: 546 }, - { type: 2, pts: 6740704830, ccData: 20043 }, - { type: 3, pts: 6740707833, ccData: 16930 }, - { type: 2, pts: 6740707833, ccData: 16716 }, - { type: 3, pts: 6740710836, ccData: 33314 }, - { type: 2, pts: 6740710836, ccData: 18755 }, - { type: 3, pts: 6740713839, ccData: 49698 }, - { type: 2, pts: 6740713839, ccData: 18767 }, - { type: 3, pts: 6740716842, ccData: 546 }, - { type: 2, pts: 6740716842, ccData: 21843 }, - { type: 3, pts: 6740719845, ccData: 16930 }, - { type: 2, pts: 6740719845, ccData: 14848 }, - { type: 3, pts: 6740722848, ccData: 35377 }, - { type: 2, pts: 6740722848, ccData: 38939 }, - { type: 2, pts: 6740722848, ccData: 16640 }, - { type: 2, pts: 6740722848, ccData: 287 }, - { type: 2, pts: 6740722848, ccData: 4240 }, - { type: 2, pts: 6740722848, ccData: 1283 }, - { type: 2, pts: 6740722848, ccData: 37162 }, - { type: 2, pts: 6740722848, ccData: 0 }, - { type: 2, pts: 6740722848, ccData: 37377 }, - { type: 2, pts: 6740722848, ccData: 1024 }, - { type: 3, pts: 6740728854, ccData: 49955 }, - { type: 2, pts: 6740728854, ccData: 37377 }, - { type: 2, pts: 6740728854, ccData: 1280 }, - { type: 3, pts: 6740734860, ccData: 546 }, - { type: 2, pts: 6740734860, ccData: 18541 }, - { type: 3, pts: 6740737863, ccData: 16930 }, - { type: 2, pts: 6740737863, ccData: 28013 }, - { type: 3, pts: 6740740866, ccData: 33314 }, - { type: 2, pts: 6740740866, ccData: 11822 }, - { type: 3, pts: 6740743869, ccData: 49698 }, - { type: 2, pts: 6740743869, ccData: 11871 }, - { type: 3, pts: 6740746872, ccData: 546 }, - { type: 2, pts: 6740746872, ccData: 18783 }, - { type: 3, pts: 6740749875, ccData: 16930 }, - { type: 2, pts: 6740749875, ccData: 27753 }, - { type: 3, pts: 6740752878, ccData: 33314 }, - { type: 2, pts: 6740752878, ccData: 27493 }, - { type: 3, pts: 6740755881, ccData: 49698 }, - { type: 2, pts: 6740755881, ccData: 24419 }, - { type: 3, pts: 6740758884, ccData: 546 }, - { type: 2, pts: 6740758884, ccData: 30066 }, - { type: 3, pts: 6740761887, ccData: 16930 }, - { type: 2, pts: 6740761887, ccData: 27763 }, - { type: 3, pts: 6740764890, ccData: 33314 }, - { type: 2, pts: 6740764890, ccData: 11776 }, - { type: 3, pts: 6740767893, ccData: 49698 }, - { type: 2, pts: 6740767893, ccData: 35842 }, - { type: 3, pts: 6740773899, ccData: 546 }, - { type: 2, pts: 6740773899, ccData: 35073 }, - { type: 3, pts: 6741071196, ccData: 18993 }, - { type: 2, pts: 6741071196, ccData: 39195 }, - { type: 2, pts: 6741071196, ccData: 17920 }, - { type: 2, pts: 6741071196, ccData: 31 }, - { type: 2, pts: 6741071196, ccData: 5264 }, - { type: 2, pts: 6741071196, ccData: 1283 }, - { type: 2, pts: 6741071196, ccData: 37162 }, - { type: 2, pts: 6741071196, ccData: 42 }, - { type: 2, pts: 6741071196, ccData: 37376 }, - { type: 2, pts: 6741071196, ccData: 0 }, - { type: 3, pts: 6741077202, ccData: 33571 }, - { type: 2, pts: 6741077202, ccData: 37376 }, - { type: 2, pts: 6741077202, ccData: 512 }, - { type: 3, pts: 6741083208, ccData: 49698 }, - { type: 2, pts: 6741083208, ccData: 21608 }, - { type: 3, pts: 6741086211, ccData: 546 }, - { type: 2, pts: 6741086211, ccData: 25951 }, - { type: 3, pts: 6741089214, ccData: 16930 }, - { type: 2, pts: 6741089214, ccData: 26213 }, - { type: 3, pts: 6741092217, ccData: 33314 }, - { type: 2, pts: 6741092217, ccData: 24948 }, - { type: 3, pts: 6741095220, ccData: 49698 }, - { type: 2, pts: 6741095220, ccData: 26725 }, - { type: 3, pts: 6741098223, ccData: 546 }, - { type: 2, pts: 6741098223, ccData: 29279 }, - { type: 3, pts: 6741101226, ccData: 16930 }, - { type: 2, pts: 6741101226, ccData: 26725 }, - { type: 3, pts: 6741104229, ccData: 33314 }, - { type: 2, pts: 6741104229, ccData: 24932 }, - { type: 3, pts: 6741107232, ccData: 49698 }, - { type: 2, pts: 6741107232, ccData: 25185 }, - { type: 3, pts: 6741110235, ccData: 546 }, - { type: 2, pts: 6741110235, ccData: 28260 }, - { type: 3, pts: 6741113238, ccData: 16930 }, - { type: 2, pts: 6741113238, ccData: 24425 }, - { type: 3, pts: 6741116241, ccData: 33314 }, - { type: 2, pts: 6741116241, ccData: 29535 }, - { type: 3, pts: 6741119244, ccData: 49698 }, - { type: 2, pts: 6741119244, ccData: 26229 }, - { type: 3, pts: 6741122247, ccData: 546 }, - { type: 2, pts: 6741122247, ccData: 28206 }, - { type: 3, pts: 6741125250, ccData: 16930 }, - { type: 2, pts: 6741125250, ccData: 35841 }, - { type: 3, pts: 6741131256, ccData: 33314 }, - { type: 2, pts: 6741131256, ccData: 35074 }, - { type: 3, pts: 6741374499, ccData: 51761 }, - { type: 2, pts: 6741374499, ccData: 38939 }, - { type: 2, pts: 6741374499, ccData: 17920 }, - { type: 2, pts: 6741374499, ccData: 31 }, - { type: 2, pts: 6741374499, ccData: 5264 }, - { type: 2, pts: 6741374499, ccData: 1283 }, - { type: 2, pts: 6741374499, ccData: 37162 }, - { type: 2, pts: 6741374499, ccData: 42 }, - { type: 2, pts: 6741374499, ccData: 37376 }, - { type: 2, pts: 6741374499, ccData: 0 }, - { type: 3, pts: 6741380505, ccData: 803 }, - { type: 2, pts: 6741380505, ccData: 37376 }, - { type: 2, pts: 6741380505, ccData: 256 }, - { type: 3, pts: 6741386511, ccData: 16930 }, - { type: 2, pts: 6741386511, ccData: 18727 }, - { type: 3, pts: 6741389514, ccData: 33314 }, - { type: 2, pts: 6741389514, ccData: 30309 }, - { type: 3, pts: 6741392517, ccData: 49698 }, - { type: 2, pts: 6741392517, ccData: 24430 }, - { type: 3, pts: 6741395520, ccData: 546 }, - { type: 2, pts: 6741395520, ccData: 25974 }, - { type: 3, pts: 6741398523, ccData: 16930 }, - { type: 2, pts: 6741398523, ccData: 25970 }, - { type: 3, pts: 6741401526, ccData: 33314 }, - { type: 2, pts: 6741401526, ccData: 24424 }, - { type: 3, pts: 6741404529, ccData: 49698 }, - { type: 2, pts: 6741404529, ccData: 24932 }, - { type: 3, pts: 6741407532, ccData: 546 }, - { type: 2, pts: 6741407532, ccData: 24418 }, - { type: 3, pts: 6741410535, ccData: 16930 }, - { type: 2, pts: 6741410535, ccData: 29281 }, - { type: 3, pts: 6741413538, ccData: 33314 }, - { type: 2, pts: 6741413538, ccData: 26980 }, - { type: 3, pts: 6741416541, ccData: 49698 }, - { type: 2, pts: 6741416541, ccData: 29535 }, - { type: 3, pts: 6741419544, ccData: 546 }, - { type: 2, pts: 6741419544, ccData: 25189 }, - { type: 3, pts: 6741422547, ccData: 16930 }, - { type: 2, pts: 6741422547, ccData: 26223 }, - { type: 3, pts: 6741425550, ccData: 33314 }, - { type: 2, pts: 6741425550, ccData: 29285 }, - { type: 3, pts: 6741428553, ccData: 49698 }, - { type: 2, pts: 6741428553, ccData: 11776 }, - { type: 3, pts: 6741431556, ccData: 546 }, - { type: 2, pts: 6741431556, ccData: 35842 }, - { type: 3, pts: 6741437562, ccData: 16930 }, - { type: 2, pts: 6741437562, ccData: 35073 }, - { type: 3, pts: 6741629754, ccData: 35377 }, - { type: 2, pts: 6741629754, ccData: 39195 }, - { type: 2, pts: 6741629754, ccData: 16640 }, - { type: 2, pts: 6741629754, ccData: 31 }, - { type: 2, pts: 6741629754, ccData: 5264 }, - { type: 2, pts: 6741629754, ccData: 1283 }, - { type: 2, pts: 6741629754, ccData: 37162 }, - { type: 2, pts: 6741629754, ccData: 42 }, - { type: 2, pts: 6741629754, ccData: 37376 }, - { type: 2, pts: 6741629754, ccData: 0 }, - { type: 3, pts: 6741635760, ccData: 49698 }, - { type: 2, pts: 6741635760, ccData: 17513 }, - { type: 3, pts: 6741638763, ccData: 546 }, - { type: 2, pts: 6741638763, ccData: 25695 }, - { type: 3, pts: 6741641766, ccData: 16930 }, - { type: 2, pts: 6741641766, ccData: 31087 }, - { type: 3, pts: 6741644769, ccData: 33314 }, - { type: 2, pts: 6741644769, ccData: 30047 }, - { type: 3, pts: 6741647772, ccData: 49698 }, - { type: 2, pts: 6741647772, ccData: 29541 }, - { type: 3, pts: 6741650775, ccData: 546 }, - { type: 2, pts: 6741650775, ccData: 25951 }, - { type: 3, pts: 6741653778, ccData: 16930 }, - { type: 2, pts: 6741653778, ccData: 24942 }, - { type: 3, pts: 6741656781, ccData: 33314 }, - { type: 2, pts: 6741656781, ccData: 31092 }, - { type: 3, pts: 6741659784, ccData: 49698 }, - { type: 2, pts: 6741659784, ccData: 26729 }, - { type: 3, pts: 6741662787, ccData: 546 }, - { type: 2, pts: 6741662787, ccData: 28263 }, - { type: 3, pts: 6741665790, ccData: 18993 }, - { type: 2, pts: 6741665790, ccData: 39195 }, - { type: 2, pts: 6741665790, ccData: 16640 }, - { type: 2, pts: 6741665790, ccData: 287 }, - { type: 2, pts: 6741665790, ccData: 4240 }, - { type: 2, pts: 6741665790, ccData: 1283 }, - { type: 2, pts: 6741665790, ccData: 37162 }, - { type: 2, pts: 6741665790, ccData: 0 }, - { type: 2, pts: 6741665790, ccData: 37377 }, - { type: 2, pts: 6741665790, ccData: 0 }, - { type: 3, pts: 6741671796, ccData: 33314 }, - { type: 2, pts: 6741671796, ccData: 31087 }, - { type: 3, pts: 6741674799, ccData: 49698 }, - { type: 2, pts: 6741674799, ccData: 30047 }, - { type: 3, pts: 6741677802, ccData: 546 }, - { type: 2, pts: 6741677802, ccData: 27753 }, - { type: 3, pts: 6741680805, ccData: 16930 }, - { type: 2, pts: 6741680805, ccData: 27493 }, - { type: 3, pts: 6741683808, ccData: 33314 }, - { type: 2, pts: 6741683808, ccData: 16128 }, - { type: 3, pts: 6741686811, ccData: 49698 }, - { type: 2, pts: 6741686811, ccData: 35841 }, - { type: 3, pts: 6741692817, ccData: 546 }, - { type: 2, pts: 6741692817, ccData: 35074 }, - { type: 3, pts: 6741830955, ccData: 18993 }, - { type: 2, pts: 6741830955, ccData: 38939 }, - { type: 2, pts: 6741830955, ccData: 17920 }, - { type: 2, pts: 6741830955, ccData: 31 }, - { type: 2, pts: 6741830955, ccData: 5264 }, - { type: 2, pts: 6741830955, ccData: 1283 }, - { type: 2, pts: 6741830955, ccData: 37162 }, - { type: 2, pts: 6741830955, ccData: 42 }, - { type: 2, pts: 6741830955, ccData: 37376 }, - { type: 2, pts: 6741830955, ccData: 0 }, - { type: 3, pts: 6741836961, ccData: 33571 }, - { type: 2, pts: 6741836961, ccData: 37376 }, - { type: 2, pts: 6741836961, ccData: 768 }, - { type: 3, pts: 6741842967, ccData: 49698 }, - { type: 2, pts: 6741842967, ccData: 18783 }, - { type: 3, pts: 6741845970, ccData: 546 }, - { type: 2, pts: 6741845970, ccData: 27753 }, - { type: 3, pts: 6741848973, ccData: 16930 }, - { type: 2, pts: 6741848973, ccData: 27493 }, - { type: 3, pts: 6741851976, ccData: 33314 }, - { type: 2, pts: 6741851976, ccData: 24417 }, - { type: 3, pts: 6741854979, ccData: 49698 }, - { type: 2, pts: 6741854979, ccData: 27756 }, - { type: 3, pts: 6741857982, ccData: 546 }, - { type: 2, pts: 6741857982, ccData: 24436 }, - { type: 3, pts: 6741860985, ccData: 16930 }, - { type: 2, pts: 6741860985, ccData: 26725 }, - { type: 3, pts: 6741863988, ccData: 33314 }, - { type: 2, pts: 6741863988, ccData: 24424 }, - { type: 3, pts: 6741866991, ccData: 49698 }, - { type: 2, pts: 6741866991, ccData: 24937 }, - { type: 3, pts: 6741869994, ccData: 546 }, - { type: 2, pts: 6741869994, ccData: 29299 }, - { type: 3, pts: 6741872997, ccData: 16930 }, - { type: 2, pts: 6741872997, ccData: 29817 }, - { type: 3, pts: 6741876000, ccData: 33314 }, - { type: 2, pts: 6741876000, ccData: 27749 }, - { type: 3, pts: 6741879003, ccData: 49698 }, - { type: 2, pts: 6741879003, ccData: 29486 }, - { type: 3, pts: 6741882006, ccData: 546 }, - { type: 2, pts: 6741882006, ccData: 35842 }, - { type: 3, pts: 6741888012, ccData: 16930 }, - { type: 2, pts: 6741888012, ccData: 35073 }, - { type: 3, pts: 6741978102, ccData: 35377 }, - { type: 2, pts: 6741978102, ccData: 39195 }, - { type: 2, pts: 6741978102, ccData: 16640 }, - { type: 2, pts: 6741978102, ccData: 31 }, - { type: 2, pts: 6741978102, ccData: 5264 }, - { type: 2, pts: 6741978102, ccData: 1283 }, - { type: 2, pts: 6741978102, ccData: 37162 }, - { type: 2, pts: 6741978102, ccData: 42 }, - { type: 2, pts: 6741978102, ccData: 37376 }, - { type: 2, pts: 6741978102, ccData: 2048 }, - { type: 3, pts: 6741984108, ccData: 49698 }, - { type: 2, pts: 6741984108, ccData: 17013 }, - { type: 3, pts: 6741987111, ccData: 546 }, - { type: 2, pts: 6741987111, ccData: 29791 }, - { type: 3, pts: 6741990114, ccData: 16930 }, - { type: 2, pts: 6741990114, ccData: 18727 }, - { type: 3, pts: 6741993117, ccData: 33314 }, - { type: 2, pts: 6741993117, ccData: 27999 }, - { type: 3, pts: 6741996120, ccData: 49698 }, - { type: 2, pts: 6741996120, ccData: 28271 }, - { type: 3, pts: 6741999123, ccData: 546 }, - { type: 2, pts: 6741999123, ccData: 29791 }, - { type: 3, pts: 6742002126, ccData: 16930 }, - { type: 2, pts: 6742002126, ccData: 29557 }, - { type: 3, pts: 6742005129, ccData: 33314 }, - { type: 2, pts: 6742005129, ccData: 29285 }, - { type: 3, pts: 6742008132, ccData: 51761 }, - { type: 2, pts: 6742008132, ccData: 39195 }, - { type: 2, pts: 6742008132, ccData: 16640 }, - { type: 2, pts: 6742008132, ccData: 287 }, - { type: 2, pts: 6742008132, ccData: 4240 }, - { type: 2, pts: 6742008132, ccData: 1283 }, - { type: 2, pts: 6742008132, ccData: 37162 }, - { type: 2, pts: 6742008132, ccData: 0 }, - { type: 2, pts: 6742008132, ccData: 37377 }, - { type: 2, pts: 6742008132, ccData: 1024 }, - { type: 3, pts: 6742014138, ccData: 803 }, - { type: 2, pts: 6742014138, ccData: 37377 }, - { type: 2, pts: 6742014138, ccData: 1280 }, - { type: 3, pts: 6742020144, ccData: 16930 }, - { type: 2, pts: 6742020144, ccData: 29800 }, - { type: 3, pts: 6742023147, ccData: 33314 }, - { type: 2, pts: 6742023147, ccData: 25977 }, - { type: 3, pts: 6742026150, ccData: 49698 }, - { type: 2, pts: 6742026150, ccData: 10098 }, - { type: 3, pts: 6742029153, ccData: 546 }, - { type: 2, pts: 6742029153, ccData: 25951 }, - { type: 3, pts: 6742032156, ccData: 16930 }, - { type: 2, pts: 6742032156, ccData: 29289 }, - { type: 3, pts: 6742035159, ccData: 33314 }, - { type: 2, pts: 6742035159, ccData: 26472 }, - { type: 3, pts: 6742038162, ccData: 49698 }, - { type: 2, pts: 6742038162, ccData: 29791 }, - { type: 3, pts: 6742041165, ccData: 546 }, - { type: 2, pts: 6742041165, ccData: 26223 }, - { type: 3, pts: 6742044168, ccData: 16930 }, - { type: 2, pts: 6742044168, ccData: 29279 }, - { type: 3, pts: 6742047171, ccData: 33314 }, - { type: 2, pts: 6742047171, ccData: 28005 }, - { type: 3, pts: 6742050174, ccData: 49698 }, - { type: 2, pts: 6742050174, ccData: 11776 }, - { type: 3, pts: 6742053177, ccData: 546 }, - { type: 2, pts: 6742053177, ccData: 35841 }, - { type: 3, pts: 6742059183, ccData: 16930 }, - { type: 2, pts: 6742059183, ccData: 35074 }, - { type: 3, pts: 6742272396, ccData: 35377 }, - { type: 2, pts: 6742272396, ccData: 38939 }, - { type: 2, pts: 6742272396, ccData: 17920 }, - { type: 2, pts: 6742272396, ccData: 31 }, - { type: 2, pts: 6742272396, ccData: 5264 }, - { type: 2, pts: 6742272396, ccData: 1283 }, - { type: 2, pts: 6742272396, ccData: 37162 }, - { type: 2, pts: 6742272396, ccData: 42 }, - { type: 2, pts: 6742272396, ccData: 37376 }, - { type: 2, pts: 6742272396, ccData: 2048 }, - { type: 3, pts: 6742278402, ccData: 49955 }, - { type: 2, pts: 6742278402, ccData: 37376 }, - { type: 2, pts: 6742278402, ccData: 2560 }, - { type: 3, pts: 6742284408, ccData: 546 }, - { type: 2, pts: 6742284408, ccData: 21608 }, - { type: 3, pts: 6742287411, ccData: 16930 }, - { type: 2, pts: 6742287411, ccData: 24948 }, - { type: 3, pts: 6742290414, ccData: 33314 }, - { type: 2, pts: 6742290414, ccData: 10099 }, - { type: 3, pts: 6742293417, ccData: 49698 }, - { type: 2, pts: 6742293417, ccData: 24431 }, - { type: 3, pts: 6742296420, ccData: 546 }, - { type: 2, pts: 6742296420, ccData: 27489 }, - { type: 3, pts: 6742299423, ccData: 16930 }, - { type: 2, pts: 6742299423, ccData: 31022 }, - { type: 3, pts: 6742302426, ccData: 33314 }, - { type: 2, pts: 6742302426, ccData: 35842 }, - { type: 3, pts: 6742308432, ccData: 49698 }, - { type: 2, pts: 6742308432, ccData: 35073 }, - { type: 3, pts: 6742332456, ccData: 2609 }, - { type: 2, pts: 6742332456, ccData: 39195 }, - { type: 2, pts: 6742332456, ccData: 16640 }, - { type: 2, pts: 6742332456, ccData: 31 }, - { type: 2, pts: 6742332456, ccData: 5264 }, - { type: 2, pts: 6742332456, ccData: 1283 }, - { type: 2, pts: 6742332456, ccData: 37162 }, - { type: 2, pts: 6742332456, ccData: 42 }, - { type: 2, pts: 6742332456, ccData: 37376 }, - { type: 2, pts: 6742332456, ccData: 2048 }, - { type: 3, pts: 6742338462, ccData: 16930 }, - { type: 2, pts: 6742338462, ccData: 22895 }, - { type: 3, pts: 6742341465, ccData: 33314 }, - { type: 2, pts: 6742341465, ccData: 30047 }, - { type: 3, pts: 6742344468, ccData: 49698 }, - { type: 2, pts: 6742344468, ccData: 25441 }, - { type: 3, pts: 6742347471, ccData: 546 }, - { type: 2, pts: 6742347471, ccData: 28255 }, - { type: 3, pts: 6742350474, ccData: 16930 }, - { type: 2, pts: 6742350474, ccData: 28001 }, - { type: 3, pts: 6742353477, ccData: 33314 }, - { type: 2, pts: 6742353477, ccData: 27493 }, - { type: 3, pts: 6742356480, ccData: 49698 }, - { type: 2, pts: 6742356480, ccData: 24437 }, - { type: 3, pts: 6742359483, ccData: 546 }, - { type: 2, pts: 6742359483, ccData: 28672 }, - { type: 3, pts: 6742362486, ccData: 18993 }, - { type: 2, pts: 6742362486, ccData: 39195 }, - { type: 2, pts: 6742362486, ccData: 16640 }, - { type: 2, pts: 6742362486, ccData: 287 }, - { type: 2, pts: 6742362486, ccData: 4240 }, - { type: 2, pts: 6742362486, ccData: 1283 }, - { type: 2, pts: 6742362486, ccData: 37162 }, - { type: 2, pts: 6742362486, ccData: 0 }, - { type: 2, pts: 6742362486, ccData: 37377 }, - { type: 2, pts: 6742362486, ccData: 1024 }, - { type: 3, pts: 6742368492, ccData: 33571 }, - { type: 2, pts: 6742368492, ccData: 37377 }, - { type: 2, pts: 6742368492, ccData: 1536 }, - { type: 3, pts: 6742374498, ccData: 49698 }, - { type: 2, pts: 6742374498, ccData: 31087 }, - { type: 3, pts: 6742377501, ccData: 546 }, - { type: 2, pts: 6742377501, ccData: 30066 }, - { type: 3, pts: 6742380504, ccData: 16930 }, - { type: 2, pts: 6742380504, ccData: 24431 }, - { type: 3, pts: 6742383507, ccData: 33314 }, - { type: 2, pts: 6742383507, ccData: 30574 }, - { type: 3, pts: 6742386510, ccData: 49698 }, - { type: 2, pts: 6742386510, ccData: 24424 }, - { type: 3, pts: 6742389513, ccData: 546 }, - { type: 2, pts: 6742389513, ccData: 24937 }, - { type: 3, pts: 6742392516, ccData: 16930 }, - { type: 2, pts: 6742392516, ccData: 29299 }, - { type: 3, pts: 6742395519, ccData: 33314 }, - { type: 2, pts: 6742395519, ccData: 29817 }, - { type: 3, pts: 6742398522, ccData: 49698 }, - { type: 2, pts: 6742398522, ccData: 27749 }, - { type: 3, pts: 6742401525, ccData: 546 }, - { type: 2, pts: 6742401525, ccData: 11776 }, - { type: 3, pts: 6742404528, ccData: 16930 }, - { type: 2, pts: 6742404528, ccData: 35841 }, - { type: 3, pts: 6742410534, ccData: 33314 }, - { type: 2, pts: 6742410534, ccData: 35074 }, - { type: 3, pts: 6742554678, ccData: 51761 }, - { type: 2, pts: 6742554678, ccData: 38939 }, - { type: 2, pts: 6742554678, ccData: 17920 }, - { type: 2, pts: 6742554678, ccData: 31 }, - { type: 2, pts: 6742554678, ccData: 5264 }, - { type: 2, pts: 6742554678, ccData: 1283 }, - { type: 2, pts: 6742554678, ccData: 37162 }, - { type: 2, pts: 6742554678, ccData: 42 }, - { type: 2, pts: 6742554678, ccData: 37376 }, - { type: 2, pts: 6742554678, ccData: 3072 }, - { type: 3, pts: 6742560684, ccData: 803 }, - { type: 2, pts: 6742560684, ccData: 37376 }, - { type: 2, pts: 6742560684, ccData: 3328 }, - { type: 3, pts: 6742566690, ccData: 16930 }, - { type: 2, pts: 6742566690, ccData: 18783 }, - { type: 3, pts: 6742569693, ccData: 33314 }, - { type: 2, pts: 6742569693, ccData: 25441 }, - { type: 3, pts: 6742572696, ccData: 49698 }, - { type: 2, pts: 6742572696, ccData: 28223 }, - { type: 3, pts: 6742575699, ccData: 546 }, - { type: 2, pts: 6742575699, ccData: 35842 }, - { type: 3, pts: 6742581705, ccData: 16930 }, - { type: 2, pts: 6742581705, ccData: 35073 }, - { type: 3, pts: 6742740864, ccData: 35377 }, - { type: 2, pts: 6742740864, ccData: 39195 }, - { type: 2, pts: 6742740864, ccData: 17920 }, - { type: 2, pts: 6742740864, ccData: 31 }, - { type: 2, pts: 6742740864, ccData: 5264 }, - { type: 2, pts: 6742740864, ccData: 1283 }, - { type: 2, pts: 6742740864, ccData: 37162 }, - { type: 2, pts: 6742740864, ccData: 42 }, - { type: 2, pts: 6742740864, ccData: 37376 }, - { type: 2, pts: 6742740864, ccData: 1024 }, - { type: 3, pts: 6742746870, ccData: 49698 }, - { type: 2, pts: 6742746870, ccData: 21365 }, - { type: 3, pts: 6742749873, ccData: 546 }, - { type: 2, pts: 6742749873, ccData: 29285 }, - { type: 3, pts: 6742752876, ccData: 16930 }, - { type: 2, pts: 6742752876, ccData: 11776 }, - { type: 3, pts: 6742755879, ccData: 33314 }, - { type: 2, pts: 6742755879, ccData: 35841 }, - { type: 3, pts: 6742761885, ccData: 49698 }, - { type: 2, pts: 6742761885, ccData: 35074 }, - { type: 3, pts: 6742815939, ccData: 2609 }, - { type: 2, pts: 6742815939, ccData: 38939 }, - { type: 2, pts: 6742815939, ccData: 17920 }, - { type: 2, pts: 6742815939, ccData: 31 }, - { type: 2, pts: 6742815939, ccData: 5264 }, - { type: 2, pts: 6742815939, ccData: 1283 }, - { type: 2, pts: 6742815939, ccData: 37162 }, - { type: 2, pts: 6742815939, ccData: 42 }, - { type: 2, pts: 6742815939, ccData: 37376 }, - { type: 2, pts: 6742815939, ccData: 0 }, - { type: 3, pts: 6742821945, ccData: 16930 }, - { type: 2, pts: 6742821945, ccData: 17263 }, - { type: 3, pts: 6742824948, ccData: 33314 }, - { type: 2, pts: 6742824948, ccData: 28005 }, - { type: 3, pts: 6742827951, ccData: 49698 }, - { type: 2, pts: 6742827951, ccData: 24439 }, - { type: 3, pts: 6742830954, ccData: 546 }, - { type: 2, pts: 6742830954, ccData: 26996 }, - { type: 3, pts: 6742833957, ccData: 16930 }, - { type: 2, pts: 6742833957, ccData: 26719 }, - { type: 3, pts: 6742836960, ccData: 33314 }, - { type: 2, pts: 6742836960, ccData: 28005 }, - { type: 3, pts: 6742839963, ccData: 49698 }, - { type: 2, pts: 6742839963, ccData: 11776 }, - { type: 3, pts: 6742842966, ccData: 546 }, - { type: 2, pts: 6742842966, ccData: 35842 }, - { type: 3, pts: 6742848972, ccData: 16930 }, - { type: 2, pts: 6742848972, ccData: 35073 }, - { type: 3, pts: 6742921044, ccData: 35377 }, - { type: 2, pts: 6742921044, ccData: 39195 }, - { type: 2, pts: 6742921044, ccData: 16640 }, - { type: 2, pts: 6742921044, ccData: 31 }, - { type: 2, pts: 6742921044, ccData: 5264 }, - { type: 2, pts: 6742921044, ccData: 1283 }, - { type: 2, pts: 6742921044, ccData: 37162 }, - { type: 2, pts: 6742921044, ccData: 42 }, - { type: 2, pts: 6742921044, ccData: 37376 }, - { type: 2, pts: 6742921044, ccData: 0 }, - { type: 3, pts: 6742927050, ccData: 49955 }, - { type: 2, pts: 6742927050, ccData: 37376 }, - { type: 2, pts: 6742927050, ccData: 512 }, - { type: 3, pts: 6742933056, ccData: 546 }, - { type: 2, pts: 6742933056, ccData: 21608 }, - { type: 3, pts: 6742936059, ccData: 16930 }, - { type: 2, pts: 6742936059, ccData: 26995 }, - { type: 3, pts: 6742939062, ccData: 33314 }, - { type: 2, pts: 6742939062, ccData: 24425 }, - { type: 3, pts: 6742942065, ccData: 49698 }, - { type: 2, pts: 6742942065, ccData: 29535 }, - { type: 3, pts: 6742945068, ccData: 546 }, - { type: 2, pts: 6742945068, ccData: 28533 }, - { type: 3, pts: 6742948071, ccData: 16930 }, - { type: 2, pts: 6742948071, ccData: 29184 }, - { type: 3, pts: 6742951074, ccData: 35377 }, - { type: 2, pts: 6742951074, ccData: 39195 }, - { type: 2, pts: 6742951074, ccData: 16640 }, - { type: 2, pts: 6742951074, ccData: 287 }, - { type: 2, pts: 6742951074, ccData: 4240 }, - { type: 2, pts: 6742951074, ccData: 1283 }, - { type: 2, pts: 6742951074, ccData: 37162 }, - { type: 2, pts: 6742951074, ccData: 0 }, - { type: 2, pts: 6742951074, ccData: 37377 }, - { type: 2, pts: 6742951074, ccData: 0 }, - { type: 3, pts: 6742957080, ccData: 49955 }, - { type: 2, pts: 6742957080, ccData: 37377 }, - { type: 2, pts: 6742957080, ccData: 512 }, - { type: 3, pts: 6742963086, ccData: 546 }, - { type: 2, pts: 6742963086, ccData: 17522 }, - { type: 3, pts: 6742966089, ccData: 16930 }, - { type: 2, pts: 6742966089, ccData: 25953 }, - { type: 3, pts: 6742969092, ccData: 33314 }, - { type: 2, pts: 6742969092, ccData: 27999 }, - { type: 3, pts: 6742972095, ccData: 49698 }, - { type: 2, pts: 6742972095, ccData: 17522 }, - { type: 3, pts: 6742975098, ccData: 546 }, - { type: 2, pts: 6742975098, ccData: 24951 }, - { type: 3, pts: 6742978101, ccData: 16930 }, - { type: 2, pts: 6742978101, ccData: 26990 }, - { type: 3, pts: 6742981104, ccData: 33314 }, - { type: 2, pts: 6742981104, ccData: 26463 }, - { type: 3, pts: 6742984107, ccData: 49698 }, - { type: 2, pts: 6742984107, ccData: 17007 }, - { type: 3, pts: 6742987110, ccData: 546 }, - { type: 2, pts: 6742987110, ccData: 24946 }, - { type: 3, pts: 6742990113, ccData: 16930 }, - { type: 2, pts: 6742990113, ccData: 25646 }, - { type: 3, pts: 6742993116, ccData: 33314 }, - { type: 2, pts: 6742993116, ccData: 35841 }, - { type: 3, pts: 6742999122, ccData: 49698 }, - { type: 2, pts: 6742999122, ccData: 35074 }, - { type: 3, pts: 6743110233, ccData: 2609 }, - { type: 2, pts: 6743110233, ccData: 38939 }, - { type: 2, pts: 6743110233, ccData: 16640 }, - { type: 2, pts: 6743110233, ccData: 31 }, - { type: 2, pts: 6743110233, ccData: 5264 }, - { type: 2, pts: 6743110233, ccData: 1283 }, - { type: 2, pts: 6743110233, ccData: 37162 }, - { type: 2, pts: 6743110233, ccData: 42 }, - { type: 2, pts: 6743110233, ccData: 37376 }, - { type: 2, pts: 6743110233, ccData: 0 }, - { type: 3, pts: 6743116239, ccData: 17187 }, - { type: 2, pts: 6743116239, ccData: 37376 }, - { type: 2, pts: 6743116239, ccData: 512 }, - { type: 3, pts: 6743122245, ccData: 33314 }, - { type: 2, pts: 6743122245, ccData: 22895 }, - { type: 3, pts: 6743125248, ccData: 49698 }, - { type: 2, pts: 6743125248, ccData: 30047 }, - { type: 3, pts: 6743128251, ccData: 546 }, - { type: 2, pts: 6743128251, ccData: 25441 }, - { type: 3, pts: 6743131254, ccData: 16930 }, - { type: 2, pts: 6743131254, ccData: 28255 }, - { type: 3, pts: 6743134257, ccData: 33314 }, - { type: 2, pts: 6743134257, ccData: 25714 }, - { type: 3, pts: 6743137260, ccData: 49698 }, - { type: 2, pts: 6743137260, ccData: 24951 }, - { type: 3, pts: 6743140263, ccData: 546 }, - { type: 2, pts: 6743140263, ccData: 24417 }, - { type: 3, pts: 6743143266, ccData: 16930 }, - { type: 2, pts: 6743143266, ccData: 28281 }, - { type: 3, pts: 6743146269, ccData: 33314 }, - { type: 2, pts: 6743146269, ccData: 24424 }, - { type: 3, pts: 6743149272, ccData: 49698 }, - { type: 2, pts: 6743149272, ccData: 24937 }, - { type: 3, pts: 6743152275, ccData: 546 }, - { type: 2, pts: 6743152275, ccData: 29299 }, - { type: 3, pts: 6743155278, ccData: 16930 }, - { type: 2, pts: 6743155278, ccData: 29817 }, - { type: 3, pts: 6743158281, ccData: 33314 }, - { type: 2, pts: 6743158281, ccData: 27749 }, - { type: 3, pts: 6743161284, ccData: 51761 }, - { type: 2, pts: 6743161284, ccData: 38939 }, - { type: 2, pts: 6743161284, ccData: 16640 }, - { type: 2, pts: 6743161284, ccData: 287 }, - { type: 2, pts: 6743161284, ccData: 4240 }, - { type: 2, pts: 6743161284, ccData: 1283 }, - { type: 2, pts: 6743161284, ccData: 37162 }, - { type: 2, pts: 6743161284, ccData: 0 }, - { type: 2, pts: 6743161284, ccData: 37377 }, - { type: 2, pts: 6743161284, ccData: 0 }, - { type: 3, pts: 6743167290, ccData: 803 }, - { type: 2, pts: 6743167290, ccData: 37377 }, - { type: 2, pts: 6743167290, ccData: 512 }, - { type: 3, pts: 6743173296, ccData: 16930 }, - { type: 2, pts: 6743173296, ccData: 31087 }, - { type: 3, pts: 6743176299, ccData: 33314 }, - { type: 2, pts: 6743176299, ccData: 30047 }, - { type: 3, pts: 6743179302, ccData: 49698 }, - { type: 2, pts: 6743179302, ccData: 25714 }, - { type: 3, pts: 6743182305, ccData: 546 }, - { type: 2, pts: 6743182305, ccData: 25953 }, - { type: 3, pts: 6743185308, ccData: 16930 }, - { type: 2, pts: 6743185308, ccData: 27999 }, - { type: 3, pts: 6743188311, ccData: 33314 }, - { type: 2, pts: 6743188311, ccData: 30064 }, - { type: 3, pts: 6743191314, ccData: 49698 }, - { type: 2, pts: 6743191314, ccData: 11776 }, - { type: 3, pts: 6743194317, ccData: 546 }, - { type: 2, pts: 6743194317, ccData: 35842 }, - { type: 3, pts: 6743200323, ccData: 16930 }, - { type: 2, pts: 6743200323, ccData: 35073 }, - { type: 3, pts: 6743341464, ccData: 35377 }, - { type: 2, pts: 6743341464, ccData: 39195 }, - { type: 2, pts: 6743341464, ccData: 16640 }, - { type: 2, pts: 6743341464, ccData: 31 }, - { type: 2, pts: 6743341464, ccData: 5264 }, - { type: 2, pts: 6743341464, ccData: 1283 }, - { type: 2, pts: 6743341464, ccData: 37162 }, - { type: 2, pts: 6743341464, ccData: 42 }, - { type: 2, pts: 6743341464, ccData: 37376 }, - { type: 2, pts: 6743341464, ccData: 0 }, - { type: 3, pts: 6743347470, ccData: 49955 }, - { type: 2, pts: 6743347470, ccData: 37376 }, - { type: 2, pts: 6743347470, ccData: 512 }, - { type: 3, pts: 6743353476, ccData: 546 }, - { type: 2, pts: 6743353476, ccData: 16750 }, - { type: 3, pts: 6743356479, ccData: 16930 }, - { type: 2, pts: 6743356479, ccData: 25695 }, - { type: 3, pts: 6743359482, ccData: 33314 }, - { type: 2, pts: 6743359482, ccData: 29800 }, - { type: 3, pts: 6743362485, ccData: 49698 }, - { type: 2, pts: 6743362485, ccData: 25966 }, - { type: 3, pts: 6743365488, ccData: 2609 }, - { type: 2, pts: 6743365488, ccData: 39195 }, - { type: 2, pts: 6743365488, ccData: 16640 }, - { type: 2, pts: 6743365488, ccData: 287 }, - { type: 2, pts: 6743365488, ccData: 4240 }, - { type: 2, pts: 6743365488, ccData: 1283 }, - { type: 2, pts: 6743365488, ccData: 37162 }, - { type: 2, pts: 6743365488, ccData: 0 }, - { type: 2, pts: 6743365488, ccData: 37377 }, - { type: 2, pts: 6743365488, ccData: 0 }, - { type: 3, pts: 6743371494, ccData: 17187 }, - { type: 2, pts: 6743371494, ccData: 37377 }, - { type: 2, pts: 6743371494, ccData: 512 }, - { type: 3, pts: 6743377500, ccData: 33314 }, - { type: 2, pts: 6743377500, ccData: 18727 }, - { type: 3, pts: 6743380503, ccData: 49698 }, - { type: 2, pts: 6743380503, ccData: 27756 }, - { type: 3, pts: 6743383506, ccData: 546 }, - { type: 2, pts: 6743383506, ccData: 24429 }, - { type: 3, pts: 6743386509, ccData: 16930 }, - { type: 2, pts: 6743386509, ccData: 24939 }, - { type: 3, pts: 6743389512, ccData: 33314 }, - { type: 2, pts: 6743389512, ccData: 25951 }, - { type: 3, pts: 6743392515, ccData: 49698 }, - { type: 2, pts: 6743392515, ccData: 31087 }, - { type: 3, pts: 6743395518, ccData: 546 }, - { type: 2, pts: 6743395518, ccData: 30066 }, - { type: 3, pts: 6743398521, ccData: 16930 }, - { type: 2, pts: 6743398521, ccData: 24424 }, - { type: 3, pts: 6743401524, ccData: 33314 }, - { type: 2, pts: 6743401524, ccData: 24937 }, - { type: 3, pts: 6743404527, ccData: 49698 }, - { type: 2, pts: 6743404527, ccData: 29184 }, - { type: 3, pts: 6743407530, ccData: 546 }, - { type: 2, pts: 6743407530, ccData: 35841 }, - { type: 3, pts: 6743413536, ccData: 16930 }, - { type: 2, pts: 6743413536, ccData: 35074 }, - { type: 3, pts: 6743491614, ccData: 35377 }, - { type: 2, pts: 6743491614, ccData: 38939 }, - { type: 2, pts: 6743491614, ccData: 16640 }, - { type: 2, pts: 6743491614, ccData: 31 }, - { type: 2, pts: 6743491614, ccData: 5264 }, - { type: 2, pts: 6743491614, ccData: 1283 }, - { type: 2, pts: 6743491614, ccData: 37162 }, - { type: 2, pts: 6743491614, ccData: 42 }, - { type: 2, pts: 6743491614, ccData: 37376 }, - { type: 2, pts: 6743491614, ccData: 0 }, - { type: 3, pts: 6743497620, ccData: 49955 }, - { type: 2, pts: 6743497620, ccData: 37376 }, - { type: 2, pts: 6743497620, ccData: 768 }, - { type: 3, pts: 6743503626, ccData: 546 }, - { type: 2, pts: 6743503626, ccData: 27759 }, - { type: 3, pts: 6743506629, ccData: 16930 }, - { type: 2, pts: 6743506629, ccData: 28523 }, - { type: 3, pts: 6743509632, ccData: 33314 }, - { type: 2, pts: 6743509632, ccData: 24426 }, - { type: 3, pts: 6743512635, ccData: 49698 }, - { type: 2, pts: 6743512635, ccData: 30067 }, - { type: 3, pts: 6743515638, ccData: 546 }, - { type: 2, pts: 6743515638, ccData: 29696 }, - { type: 3, pts: 6743518641, ccData: 18993 }, - { type: 2, pts: 6743518641, ccData: 38939 }, - { type: 2, pts: 6743518641, ccData: 16640 }, - { type: 2, pts: 6743518641, ccData: 287 }, - { type: 2, pts: 6743518641, ccData: 4240 }, - { type: 2, pts: 6743518641, ccData: 1283 }, - { type: 2, pts: 6743518641, ccData: 37162 }, - { type: 2, pts: 6743518641, ccData: 0 }, - { type: 2, pts: 6743518641, ccData: 37377 }, - { type: 2, pts: 6743518641, ccData: 0 }, - { type: 3, pts: 6743524647, ccData: 33571 }, - { type: 2, pts: 6743524647, ccData: 37377 }, - { type: 2, pts: 6743524647, ccData: 768 }, - { type: 3, pts: 6743530653, ccData: 49698 }, - { type: 2, pts: 6743530653, ccData: 27753 }, - { type: 3, pts: 6743533656, ccData: 546 }, - { type: 2, pts: 6743533656, ccData: 27493 }, - { type: 3, pts: 6743536659, ccData: 16930 }, - { type: 2, pts: 6743536659, ccData: 24441 }, - { type: 3, pts: 6743539662, ccData: 33314 }, - { type: 2, pts: 6743539662, ccData: 28533 }, - { type: 3, pts: 6743542665, ccData: 49698 }, - { type: 2, pts: 6743542665, ccData: 29279 }, - { type: 3, pts: 6743545668, ccData: 546 }, - { type: 2, pts: 6743545668, ccData: 28777 }, - { type: 3, pts: 6743548671, ccData: 16930 }, - { type: 2, pts: 6743548671, ccData: 25460 }, - { type: 3, pts: 6743551674, ccData: 33314 }, - { type: 2, pts: 6743551674, ccData: 30066 }, - { type: 3, pts: 6743554677, ccData: 49698 }, - { type: 2, pts: 6743554677, ccData: 25902 }, - { type: 3, pts: 6743557680, ccData: 546 }, - { type: 2, pts: 6743557680, ccData: 35842 }, - { type: 3, pts: 6743563686, ccData: 16930 }, - { type: 2, pts: 6743563686, ccData: 35073 }, - { type: 3, pts: 6743644767, ccData: 35377 }, - { type: 2, pts: 6743644767, ccData: 39195 }, - { type: 2, pts: 6743644767, ccData: 17920 }, - { type: 2, pts: 6743644767, ccData: 31 }, - { type: 2, pts: 6743644767, ccData: 5264 }, - { type: 2, pts: 6743644767, ccData: 1283 }, - { type: 2, pts: 6743644767, ccData: 37162 }, - { type: 2, pts: 6743644767, ccData: 42 }, - { type: 2, pts: 6743644767, ccData: 37376 }, - { type: 2, pts: 6743644767, ccData: 1024 }, - { type: 3, pts: 6743650773, ccData: 49955 }, - { type: 2, pts: 6743650773, ccData: 37376 }, - { type: 2, pts: 6743650773, ccData: 1536 }, - { type: 3, pts: 6743656779, ccData: 546 }, - { type: 2, pts: 6743656779, ccData: 21608 }, - { type: 3, pts: 6743659782, ccData: 16930 }, - { type: 2, pts: 6743659782, ccData: 24948 }, - { type: 3, pts: 6743662785, ccData: 33314 }, - { type: 2, pts: 6743662785, ccData: 10099 }, - { type: 3, pts: 6743665788, ccData: 49698 }, - { type: 2, pts: 6743665788, ccData: 24432 }, - { type: 3, pts: 6743668791, ccData: 546 }, - { type: 2, pts: 6743668791, ccData: 26990 }, - { type: 3, pts: 6743671794, ccData: 16930 }, - { type: 2, pts: 6743671794, ccData: 27489 }, - { type: 3, pts: 6743674797, ccData: 33314 }, - { type: 2, pts: 6743674797, ccData: 28001 }, - { type: 3, pts: 6743677800, ccData: 49698 }, - { type: 2, pts: 6743677800, ccData: 31337 }, - { type: 3, pts: 6743680803, ccData: 546 }, - { type: 2, pts: 6743680803, ccData: 28263 }, - { type: 3, pts: 6743683806, ccData: 16930 }, - { type: 2, pts: 6743683806, ccData: 8448 }, - { type: 3, pts: 6743686809, ccData: 33314 }, - { type: 2, pts: 6743686809, ccData: 35841 }, - { type: 3, pts: 6743692815, ccData: 49698 }, - { type: 2, pts: 6743692815, ccData: 35074 }, - { type: 3, pts: 6743900022, ccData: 2609 }, - { type: 2, pts: 6743900022, ccData: 38939 }, - { type: 2, pts: 6743900022, ccData: 17920 }, - { type: 2, pts: 6743900022, ccData: 31 }, - { type: 2, pts: 6743900022, ccData: 5264 }, - { type: 2, pts: 6743900022, ccData: 1283 }, - { type: 2, pts: 6743900022, ccData: 37162 }, - { type: 2, pts: 6743900022, ccData: 42 }, - { type: 2, pts: 6743900022, ccData: 37376 }, - { type: 2, pts: 6743900022, ccData: 3072 }, - { type: 3, pts: 6743906028, ccData: 16930 }, - { type: 2, pts: 6743906028, ccData: 18541 }, - { type: 3, pts: 6743909031, ccData: 33314 }, - { type: 2, pts: 6743909031, ccData: 28013 }, - { type: 3, pts: 6743912034, ccData: 49698 }, - { type: 2, pts: 6743912034, ccData: 11822 }, - { type: 3, pts: 6743915037, ccData: 546 }, - { type: 2, pts: 6743915037, ccData: 11776 }, - { type: 3, pts: 6743918040, ccData: 16930 }, - { type: 2, pts: 6743918040, ccData: 35842 }, - { type: 3, pts: 6743924046, ccData: 33314 }, - { type: 2, pts: 6743924046, ccData: 35073 }, - { type: 3, pts: 6743960082, ccData: 51761 }, - { type: 2, pts: 6743960082, ccData: 39195 }, - { type: 2, pts: 6743960082, ccData: 16640 }, - { type: 2, pts: 6743960082, ccData: 31 }, - { type: 2, pts: 6743960082, ccData: 5264 }, - { type: 2, pts: 6743960082, ccData: 1283 }, - { type: 2, pts: 6743960082, ccData: 37162 }, - { type: 2, pts: 6743960082, ccData: 42 }, - { type: 2, pts: 6743960082, ccData: 37376 }, - { type: 2, pts: 6743960082, ccData: 1024 }, - { type: 3, pts: 6743966088, ccData: 803 }, - { type: 2, pts: 6743966088, ccData: 37376 }, - { type: 2, pts: 6743966088, ccData: 1280 }, - { type: 3, pts: 6743972094, ccData: 16930 }, - { type: 2, pts: 6743972094, ccData: 22376 }, - { type: 3, pts: 6743975097, ccData: 33314 }, - { type: 2, pts: 6743975097, ccData: 24948 }, - { type: 3, pts: 6743978100, ccData: 49698 }, - { type: 2, pts: 6743978100, ccData: 24427 }, - { type: 3, pts: 6743981103, ccData: 546 }, - { type: 2, pts: 6743981103, ccData: 26990 }, - { type: 3, pts: 6743984106, ccData: 16930 }, - { type: 2, pts: 6743984106, ccData: 25695 }, - { type: 3, pts: 6743987109, ccData: 33314 }, - { type: 2, pts: 6743987109, ccData: 28518 }, - { type: 3, pts: 6743990112, ccData: 49698 }, - { type: 2, pts: 6743990112, ccData: 24424 }, - { type: 3, pts: 6743993115, ccData: 546 }, - { type: 2, pts: 6743993115, ccData: 24937 }, - { type: 3, pts: 6743996118, ccData: 16930 }, - { type: 2, pts: 6743996118, ccData: 29299 }, - { type: 3, pts: 6743999121, ccData: 33314 }, - { type: 2, pts: 6743999121, ccData: 29817 }, - { type: 3, pts: 6744002124, ccData: 49698 }, - { type: 2, pts: 6744002124, ccData: 27749 }, - { type: 3, pts: 6744005127, ccData: 2609 }, - { type: 2, pts: 6744005127, ccData: 39195 }, - { type: 2, pts: 6744005127, ccData: 16640 }, - { type: 2, pts: 6744005127, ccData: 287 }, - { type: 2, pts: 6744005127, ccData: 4240 }, - { type: 2, pts: 6744005127, ccData: 1283 }, - { type: 2, pts: 6744005127, ccData: 37162 }, - { type: 2, pts: 6744005127, ccData: 0 }, - { type: 2, pts: 6744005127, ccData: 37377 }, - { type: 2, pts: 6744005127, ccData: 2048 }, - { type: 3, pts: 6744011133, ccData: 17187 }, - { type: 2, pts: 6744011133, ccData: 37377 }, - { type: 2, pts: 6744011133, ccData: 2304 }, - { type: 3, pts: 6744017139, ccData: 33314 }, - { type: 2, pts: 6744017139, ccData: 29544 }, - { type: 3, pts: 6744020142, ccData: 49698 }, - { type: 2, pts: 6744020142, ccData: 28533 }, - { type: 3, pts: 6744023145, ccData: 546 }, - { type: 2, pts: 6744023145, ccData: 27748 }, - { type: 3, pts: 6744026148, ccData: 16930 }, - { type: 2, pts: 6744026148, ccData: 24393 }, - { type: 3, pts: 6744029151, ccData: 33314 }, - { type: 2, pts: 6744029151, ccData: 24423 }, - { type: 3, pts: 6744032154, ccData: 49698 }, - { type: 2, pts: 6744032154, ccData: 25972 }, - { type: 3, pts: 6744035157, ccData: 546 }, - { type: 2, pts: 6744035157, ccData: 16128 }, - { type: 3, pts: 6744038160, ccData: 16930 }, - { type: 2, pts: 6744038160, ccData: 35841 }, - { type: 3, pts: 6744044166, ccData: 33314 }, - { type: 2, pts: 6744044166, ccData: 35074 }, - { type: 3, pts: 6744275397, ccData: 51761 }, - { type: 2, pts: 6744275397, ccData: 38939 }, - { type: 2, pts: 6744275397, ccData: 17920 }, - { type: 2, pts: 6744275397, ccData: 31 }, - { type: 2, pts: 6744275397, ccData: 5264 }, - { type: 2, pts: 6744275397, ccData: 1283 }, - { type: 2, pts: 6744275397, ccData: 37162 }, - { type: 2, pts: 6744275397, ccData: 42 }, - { type: 2, pts: 6744275397, ccData: 37376 }, - { type: 2, pts: 6744275397, ccData: 3072 }, - { type: 3, pts: 6744281403, ccData: 803 }, - { type: 2, pts: 6744281403, ccData: 37376 }, - { type: 2, pts: 6744281403, ccData: 3584 }, - { type: 3, pts: 6744287409, ccData: 16929 }, - { type: 2, pts: 6744287409, ccData: 32512 }, - { type: 3, pts: 6744290412, ccData: 33314 }, - { type: 2, pts: 6744290412, ccData: 24320 }, - { type: 3, pts: 6744293415, ccData: 49697 }, - { type: 2, pts: 6744293415, ccData: 32512 }, - { type: 3, pts: 6744296418, ccData: 546 }, - { type: 2, pts: 6744296418, ccData: 35842 }, - { type: 3, pts: 6744302424, ccData: 16930 }, - { type: 2, pts: 6744302424, ccData: 35073 }, - { type: 3, pts: 6744839961, ccData: 35377 }, - { type: 2, pts: 6744839961, ccData: 39195 }, - { type: 2, pts: 6744839961, ccData: 17920 }, - { type: 2, pts: 6744839961, ccData: 31 }, - { type: 2, pts: 6744839961, ccData: 5264 }, - { type: 2, pts: 6744839961, ccData: 1283 }, - { type: 2, pts: 6744839961, ccData: 37162 }, - { type: 2, pts: 6744839961, ccData: 42 }, - { type: 2, pts: 6744839961, ccData: 37376 }, - { type: 2, pts: 6744839961, ccData: 1024 }, - { type: 3, pts: 6744845967, ccData: 49955 }, - { type: 2, pts: 6744845967, ccData: 37376 }, - { type: 2, pts: 6744845967, ccData: 1536 }, - { type: 3, pts: 6744851973, ccData: 546 }, - { type: 2, pts: 6744851973, ccData: 20079 }, - { type: 3, pts: 6744854976, ccData: 16930 }, - { type: 2, pts: 6744854976, ccData: 11359 }, - { type: 3, pts: 6744857979, ccData: 33314 }, - { type: 2, pts: 6744857979, ccData: 29800 }, - { type: 3, pts: 6744860982, ccData: 49698 }, - { type: 2, pts: 6744860982, ccData: 26995 }, - { type: 3, pts: 6744863985, ccData: 546 }, - { type: 2, pts: 6744863985, ccData: 24425 }, - { type: 3, pts: 6744866988, ccData: 16930 }, - { type: 2, pts: 6744866988, ccData: 29535 }, - { type: 3, pts: 6744869991, ccData: 33314 }, - { type: 2, pts: 6744869991, ccData: 28271 }, - { type: 3, pts: 6744872994, ccData: 49698 }, - { type: 2, pts: 6744872994, ccData: 29791 }, - { type: 3, pts: 6744875997, ccData: 546 }, - { type: 2, pts: 6744875997, ccData: 28005 }, - { type: 3, pts: 6744879000, ccData: 16930 }, - { type: 2, pts: 6744879000, ccData: 8448 }, - { type: 3, pts: 6744882003, ccData: 33314 }, - { type: 2, pts: 6744882003, ccData: 35841 }, - { type: 3, pts: 6744888009, ccData: 49698 }, - { type: 2, pts: 6744888009, ccData: 35074 }, - { type: 3, pts: 6745128249, ccData: 2609 }, - { type: 2, pts: 6745128249, ccData: 38939 }, - { type: 2, pts: 6745128249, ccData: 17920 }, - { type: 2, pts: 6745128249, ccData: 31 }, - { type: 2, pts: 6745128249, ccData: 5264 }, - { type: 2, pts: 6745128249, ccData: 1283 }, - { type: 2, pts: 6745128249, ccData: 37162 }, - { type: 2, pts: 6745128249, ccData: 42 }, - { type: 2, pts: 6745128249, ccData: 37376 }, - { type: 2, pts: 6745128249, ccData: 3072 }, - { type: 3, pts: 6745134255, ccData: 17187 }, - { type: 2, pts: 6745134255, ccData: 37376 }, - { type: 2, pts: 6745134255, ccData: 3584 }, - { type: 3, pts: 6745140261, ccData: 33313 }, - { type: 2, pts: 6745140261, ccData: 32512 }, - { type: 3, pts: 6745143264, ccData: 49698 }, - { type: 2, pts: 6745143264, ccData: 24320 }, - { type: 3, pts: 6745146267, ccData: 545 }, - { type: 2, pts: 6745146267, ccData: 32512 }, - { type: 3, pts: 6745149270, ccData: 16930 }, - { type: 2, pts: 6745149270, ccData: 35842 }, - { type: 3, pts: 6745155276, ccData: 33314 }, - { type: 2, pts: 6745155276, ccData: 35073 }, - { type: 3, pts: 6745524645, ccData: 51761 }, - { type: 2, pts: 6745524645, ccData: 39195 }, - { type: 2, pts: 6745524645, ccData: 17920 }, - { type: 2, pts: 6745524645, ccData: 31 }, - { type: 2, pts: 6745524645, ccData: 5264 }, - { type: 2, pts: 6745524645, ccData: 1283 }, - { type: 2, pts: 6745524645, ccData: 37162 }, - { type: 2, pts: 6745524645, ccData: 42 }, - { type: 2, pts: 6745524645, ccData: 37376 }, - { type: 2, pts: 6745524645, ccData: 1024 }, - { type: 3, pts: 6745530651, ccData: 803 }, - { type: 2, pts: 6745530651, ccData: 37376 }, - { type: 2, pts: 6745530651, ccData: 1792 }, - { type: 3, pts: 6745536657, ccData: 16930 }, - { type: 2, pts: 6745536657, ccData: 18783 }, - { type: 3, pts: 6745539660, ccData: 33314 }, - { type: 2, pts: 6745539660, ccData: 25711 }, - { type: 3, pts: 6745542663, ccData: 49698 }, - { type: 2, pts: 6745542663, ccData: 28199 }, - { type: 3, pts: 6745545666, ccData: 546 }, - { type: 2, pts: 6745545666, ccData: 29791 }, - { type: 3, pts: 6745548669, ccData: 16930 }, - { type: 2, pts: 6745548669, ccData: 29800 }, - { type: 3, pts: 6745551672, ccData: 33314 }, - { type: 2, pts: 6745551672, ccData: 26990 }, - { type: 3, pts: 6745554675, ccData: 49698 }, - { type: 2, pts: 6745554675, ccData: 27487 }, - { type: 3, pts: 6745557678, ccData: 546 }, - { type: 2, pts: 6745557678, ccData: 29551 }, - { type: 3, pts: 6745560681, ccData: 16930 }, - { type: 2, pts: 6745560681, ccData: 11776 }, - { type: 3, pts: 6745563684, ccData: 33314 }, - { type: 2, pts: 6745563684, ccData: 35841 }, - { type: 3, pts: 6745569690, ccData: 49698 }, - { type: 2, pts: 6745569690, ccData: 35074 }, - { type: 3, pts: 6745800921, ccData: 2609 }, - { type: 2, pts: 6745800921, ccData: 38939 }, - { type: 2, pts: 6745800921, ccData: 17920 }, - { type: 2, pts: 6745800921, ccData: 31 }, - { type: 2, pts: 6745800921, ccData: 5264 }, - { type: 2, pts: 6745800921, ccData: 1283 }, - { type: 2, pts: 6745800921, ccData: 37162 }, - { type: 2, pts: 6745800921, ccData: 42 }, - { type: 2, pts: 6745800921, ccData: 37376 }, - { type: 2, pts: 6745800921, ccData: 3072 }, - { type: 3, pts: 6745806927, ccData: 17187 }, - { type: 2, pts: 6745806927, ccData: 37376 }, - { type: 2, pts: 6745806927, ccData: 3584 }, - { type: 3, pts: 6745812933, ccData: 33313 }, - { type: 2, pts: 6745812933, ccData: 32512 }, - { type: 3, pts: 6745815936, ccData: 49698 }, - { type: 2, pts: 6745815936, ccData: 24320 }, - { type: 3, pts: 6745818939, ccData: 545 }, - { type: 2, pts: 6745818939, ccData: 32512 }, - { type: 3, pts: 6745821942, ccData: 16930 }, - { type: 2, pts: 6745821942, ccData: 35842 }, - { type: 3, pts: 6745827948, ccData: 33314 }, - { type: 2, pts: 6745827948, ccData: 35073 }, - { type: 3, pts: 6746473593, ccData: 51761 }, - { type: 2, pts: 6746473593, ccData: 39195 }, - { type: 2, pts: 6746473593, ccData: 17920 }, - { type: 2, pts: 6746473593, ccData: 31 }, - { type: 2, pts: 6746473593, ccData: 5264 }, - { type: 2, pts: 6746473593, ccData: 1283 }, - { type: 2, pts: 6746473593, ccData: 37162 }, - { type: 2, pts: 6746473593, ccData: 42 }, - { type: 2, pts: 6746473593, ccData: 37376 }, - { type: 2, pts: 6746473593, ccData: 2048 }, - { type: 3, pts: 6746479599, ccData: 803 }, - { type: 2, pts: 6746479599, ccData: 37376 }, - { type: 2, pts: 6746479599, ccData: 2816 }, - { type: 3, pts: 6746485605, ccData: 16930 }, - { type: 2, pts: 6746485605, ccData: 21608 }, - { type: 3, pts: 6746488608, ccData: 33314 }, - { type: 2, pts: 6746488608, ccData: 24948 }, - { type: 3, pts: 6746491611, ccData: 49698 }, - { type: 2, pts: 6746491611, ccData: 10099 }, - { type: 3, pts: 6746494614, ccData: 546 }, - { type: 2, pts: 6746494614, ccData: 24425 }, - { type: 3, pts: 6746497617, ccData: 16930 }, - { type: 2, pts: 6746497617, ccData: 29729 }, - { type: 3, pts: 6746500620, ccData: 33314 }, - { type: 2, pts: 6746500620, ccData: 35841 }, - { type: 3, pts: 6746506626, ccData: 49698 }, - { type: 2, pts: 6746506626, ccData: 35074 }, - { type: 3, pts: 6746590710, ccData: 2609 }, - { type: 2, pts: 6746590710, ccData: 38939 }, - { type: 2, pts: 6746590710, ccData: 17920 }, - { type: 2, pts: 6746590710, ccData: 31 }, - { type: 2, pts: 6746590710, ccData: 5264 }, - { type: 2, pts: 6746590710, ccData: 1283 }, - { type: 2, pts: 6746590710, ccData: 37162 }, - { type: 2, pts: 6746590710, ccData: 42 }, - { type: 2, pts: 6746590710, ccData: 37376 }, - { type: 2, pts: 6746590710, ccData: 1024 }, - { type: 3, pts: 6746596716, ccData: 17187 }, - { type: 2, pts: 6746596716, ccData: 37376 }, - { type: 2, pts: 6746596716, ccData: 1792 }, - { type: 3, pts: 6746602722, ccData: 33314 }, - { type: 2, pts: 6746602722, ccData: 18783 }, - { type: 3, pts: 6746605725, ccData: 49698 }, - { type: 2, pts: 6746605725, ccData: 27253 }, - { type: 3, pts: 6746608728, ccData: 546 }, - { type: 2, pts: 6746608728, ccData: 29556 }, - { type: 3, pts: 6746611731, ccData: 16930 }, - { type: 2, pts: 6746611731, ccData: 24420 }, - { type: 3, pts: 6746614734, ccData: 33314 }, - { type: 2, pts: 6746614734, ccData: 29285 }, - { type: 3, pts: 6746617737, ccData: 49698 }, - { type: 2, pts: 6746617737, ccData: 24941 }, - { type: 3, pts: 6746620740, ccData: 546 }, - { type: 2, pts: 6746620740, ccData: 25956 }, - { type: 3, pts: 6746623743, ccData: 16930 }, - { type: 2, pts: 6746623743, ccData: 24437 }, - { type: 3, pts: 6746626746, ccData: 33314 }, - { type: 2, pts: 6746626746, ccData: 28672 }, - { type: 3, pts: 6746629749, ccData: 49698 }, - { type: 2, pts: 6746629749, ccData: 35842 }, - { type: 3, pts: 6746635755, ccData: 546 }, - { type: 2, pts: 6746635755, ccData: 35073 }, - { type: 3, pts: 6746671791, ccData: 18993 }, - { type: 2, pts: 6746671791, ccData: 39195 }, - { type: 2, pts: 6746671791, ccData: 16640 }, - { type: 2, pts: 6746671791, ccData: 31 }, - { type: 2, pts: 6746671791, ccData: 5264 }, - { type: 2, pts: 6746671791, ccData: 1283 }, - { type: 2, pts: 6746671791, ccData: 37162 }, - { type: 2, pts: 6746671791, ccData: 42 }, - { type: 2, pts: 6746671791, ccData: 37376 }, - { type: 2, pts: 6746671791, ccData: 1024 }, - { type: 3, pts: 6746677797, ccData: 33314 }, - { type: 2, pts: 6746677797, ccData: 29800 }, - { type: 3, pts: 6746680800, ccData: 49698 }, - { type: 2, pts: 6746680800, ccData: 25951 }, - { type: 3, pts: 6746683803, ccData: 546 }, - { type: 2, pts: 6746683803, ccData: 29552 }, - { type: 3, pts: 6746686806, ccData: 16930 }, - { type: 2, pts: 6746686806, ccData: 24946 }, - { type: 3, pts: 6746689809, ccData: 33314 }, - { type: 2, pts: 6746689809, ccData: 27500 }, - { type: 3, pts: 6746692812, ccData: 49698 }, - { type: 2, pts: 6746692812, ccData: 26981 }, - { type: 3, pts: 6746695815, ccData: 546 }, - { type: 2, pts: 6746695815, ccData: 29556 }, - { type: 3, pts: 6746698818, ccData: 16930 }, - { type: 2, pts: 6746698818, ccData: 24424 }, - { type: 3, pts: 6746701821, ccData: 33314 }, - { type: 2, pts: 6746701821, ccData: 24937 }, - { type: 3, pts: 6746704824, ccData: 49698 }, - { type: 2, pts: 6746704824, ccData: 29299 }, - { type: 3, pts: 6746707827, ccData: 546 }, - { type: 2, pts: 6746707827, ccData: 29817 }, - { type: 3, pts: 6746710830, ccData: 16930 }, - { type: 2, pts: 6746710830, ccData: 27749 }, - { type: 3, pts: 6746713833, ccData: 35377 }, - { type: 2, pts: 6746713833, ccData: 39195 }, - { type: 2, pts: 6746713833, ccData: 16640 }, - { type: 2, pts: 6746713833, ccData: 287 }, - { type: 2, pts: 6746713833, ccData: 4240 }, - { type: 2, pts: 6746713833, ccData: 1283 }, - { type: 2, pts: 6746713833, ccData: 37162 }, - { type: 2, pts: 6746713833, ccData: 0 }, - { type: 2, pts: 6746713833, ccData: 37377 }, - { type: 2, pts: 6746713833, ccData: 2048 }, - { type: 3, pts: 6746719839, ccData: 49955 }, - { type: 2, pts: 6746719839, ccData: 37377 }, - { type: 2, pts: 6746719839, ccData: 2304 }, - { type: 3, pts: 6746725845, ccData: 546 }, - { type: 2, pts: 6746725845, ccData: 26990 }, - { type: 3, pts: 6746728848, ccData: 16930 }, - { type: 2, pts: 6746728848, ccData: 24436 }, - { type: 3, pts: 6746731851, ccData: 33314 }, - { type: 2, pts: 6746731851, ccData: 26725 }, - { type: 3, pts: 6746734854, ccData: 49698 }, - { type: 2, pts: 6746734854, ccData: 24439 }, - { type: 3, pts: 6746737857, ccData: 546 }, - { type: 2, pts: 6746737857, ccData: 28530 }, - { type: 3, pts: 6746740860, ccData: 16930 }, - { type: 2, pts: 6746740860, ccData: 27748 }, - { type: 3, pts: 6746743863, ccData: 33314 }, - { type: 2, pts: 6746743863, ccData: 8448 }, - { type: 3, pts: 6746746866, ccData: 49698 }, - { type: 2, pts: 6746746866, ccData: 35841 }, - { type: 3, pts: 6746752872, ccData: 546 }, - { type: 2, pts: 6746752872, ccData: 35074 }, - { type: 3, pts: 6746930049, ccData: 18993 }, - { type: 2, pts: 6746930049, ccData: 38939 }, - { type: 2, pts: 6746930049, ccData: 17920 }, - { type: 2, pts: 6746930049, ccData: 31 }, - { type: 2, pts: 6746930049, ccData: 5264 }, - { type: 2, pts: 6746930049, ccData: 1283 }, - { type: 2, pts: 6746930049, ccData: 37162 }, - { type: 2, pts: 6746930049, ccData: 42 }, - { type: 2, pts: 6746930049, ccData: 37376 }, - { type: 2, pts: 6746930049, ccData: 1024 }, - { type: 3, pts: 6746936055, ccData: 33571 }, - { type: 2, pts: 6746936055, ccData: 37376 }, - { type: 2, pts: 6746936055, ccData: 1280 }, - { type: 3, pts: 6746942061, ccData: 49698 }, - { type: 2, pts: 6746942061, ccData: 18727 }, - { type: 3, pts: 6746945064, ccData: 546 }, - { type: 2, pts: 6746945064, ccData: 27756 }, - { type: 3, pts: 6746948067, ccData: 16930 }, - { type: 2, pts: 6746948067, ccData: 24420 }, - { type: 3, pts: 6746951070, ccData: 33314 }, - { type: 2, pts: 6746951070, ccData: 29281 }, - { type: 3, pts: 6746954073, ccData: 49698 }, - { type: 2, pts: 6746954073, ccData: 30559 }, - { type: 3, pts: 6746957076, ccData: 546 }, - { type: 2, pts: 6746957076, ccData: 26996 }, - { type: 3, pts: 6746960079, ccData: 16930 }, - { type: 2, pts: 6746960079, ccData: 24422 }, - { type: 3, pts: 6746963082, ccData: 33314 }, - { type: 2, pts: 6746963082, ccData: 28530 }, - { type: 3, pts: 6746966085, ccData: 49698 }, - { type: 2, pts: 6746966085, ccData: 24441 }, - { type: 3, pts: 6746969088, ccData: 546 }, - { type: 2, pts: 6746969088, ccData: 28533 }, - { type: 3, pts: 6746972091, ccData: 16930 }, - { type: 2, pts: 6746972091, ccData: 11776 }, - { type: 3, pts: 6746975094, ccData: 33314 }, - { type: 2, pts: 6746975094, ccData: 35842 }, - { type: 3, pts: 6746981100, ccData: 49698 }, - { type: 2, pts: 6746981100, ccData: 35073 }, - { type: 3, pts: 6747122241, ccData: 2609 }, - { type: 2, pts: 6747122241, ccData: 39195 }, - { type: 2, pts: 6747122241, ccData: 16640 }, - { type: 2, pts: 6747122241, ccData: 31 }, - { type: 2, pts: 6747122241, ccData: 5264 }, - { type: 2, pts: 6747122241, ccData: 1283 }, - { type: 2, pts: 6747122241, ccData: 37162 }, - { type: 2, pts: 6747122241, ccData: 42 }, - { type: 2, pts: 6747122241, ccData: 37376 }, - { type: 2, pts: 6747122241, ccData: 1024 }, - { type: 3, pts: 6747128247, ccData: 17187 }, - { type: 2, pts: 6747128247, ccData: 37376 }, - { type: 2, pts: 6747128247, ccData: 1536 }, - { type: 3, pts: 6747134253, ccData: 33314 }, - { type: 2, pts: 6747134253, ccData: 18727 }, - { type: 3, pts: 6747137256, ccData: 49698 }, - { type: 2, pts: 6747137256, ccData: 27756 }, - { type: 3, pts: 6747140259, ccData: 546 }, - { type: 2, pts: 6747140259, ccData: 24424 }, - { type: 3, pts: 6747143262, ccData: 16930 }, - { type: 2, pts: 6747143262, ccData: 24950 }, - { type: 3, pts: 6747146265, ccData: 33314 }, - { type: 2, pts: 6747146265, ccData: 25951 }, - { type: 3, pts: 6747149268, ccData: 49698 }, - { type: 2, pts: 6747149268, ccData: 27759 }, - { type: 3, pts: 6747152271, ccData: 546 }, - { type: 2, pts: 6747152271, ccData: 28263 }, - { type: 3, pts: 6747155274, ccData: 16930 }, - { type: 2, pts: 6747155274, ccData: 24424 }, - { type: 3, pts: 6747158277, ccData: 33314 }, - { type: 2, pts: 6747158277, ccData: 24937 }, - { type: 3, pts: 6747161280, ccData: 49698 }, - { type: 2, pts: 6747161280, ccData: 29184 }, - { type: 3, pts: 6747164283, ccData: 2609 }, - { type: 2, pts: 6747164283, ccData: 39195 }, - { type: 2, pts: 6747164283, ccData: 16640 }, - { type: 2, pts: 6747164283, ccData: 287 }, - { type: 2, pts: 6747164283, ccData: 4240 }, - { type: 2, pts: 6747164283, ccData: 1283 }, - { type: 2, pts: 6747164283, ccData: 37162 }, - { type: 2, pts: 6747164283, ccData: 0 }, - { type: 2, pts: 6747164283, ccData: 37377 }, - { type: 2, pts: 6747164283, ccData: 1024 }, - { type: 3, pts: 6747170289, ccData: 17187 }, - { type: 2, pts: 6747170289, ccData: 37377 }, - { type: 2, pts: 6747170289, ccData: 1792 }, - { type: 3, pts: 6747176295, ccData: 33314 }, - { type: 2, pts: 6747176295, ccData: 25711 }, - { type: 3, pts: 6747179298, ccData: 49698 }, - { type: 2, pts: 6747179298, ccData: 30574 }, - { type: 3, pts: 6747182301, ccData: 546 }, - { type: 2, pts: 6747182301, ccData: 24436 }, - { type: 3, pts: 6747185304, ccData: 16930 }, - { type: 2, pts: 6747185304, ccData: 28511 }, - { type: 3, pts: 6747188307, ccData: 33314 }, - { type: 2, pts: 6747188307, ccData: 29800 }, - { type: 3, pts: 6747191310, ccData: 49698 }, - { type: 2, pts: 6747191310, ccData: 25951 }, - { type: 3, pts: 6747194313, ccData: 546 }, - { type: 2, pts: 6747194313, ccData: 26220 }, - { type: 3, pts: 6747197316, ccData: 16930 }, - { type: 2, pts: 6747197316, ccData: 28527 }, - { type: 3, pts: 6747200319, ccData: 33314 }, - { type: 2, pts: 6747200319, ccData: 29230 }, - { type: 3, pts: 6747203322, ccData: 49698 }, - { type: 2, pts: 6747203322, ccData: 35841 }, - { type: 3, pts: 6747209328, ccData: 546 }, - { type: 2, pts: 6747209328, ccData: 35074 }, - { type: 3, pts: 6747569688, ccData: 18993 }, - { type: 2, pts: 6747569688, ccData: 38939 }, - { type: 2, pts: 6747569688, ccData: 16640 }, - { type: 2, pts: 6747569688, ccData: 31 }, - { type: 2, pts: 6747569688, ccData: 5264 }, - { type: 2, pts: 6747569688, ccData: 1283 }, - { type: 2, pts: 6747569688, ccData: 37162 }, - { type: 2, pts: 6747569688, ccData: 42 }, - { type: 2, pts: 6747569688, ccData: 37376 }, - { type: 2, pts: 6747569688, ccData: 0 }, - { type: 3, pts: 6747575694, ccData: 33571 }, - { type: 2, pts: 6747575694, ccData: 37376 }, - { type: 2, pts: 6747575694, ccData: 512 }, - { type: 3, pts: 6747581700, ccData: 49698 }, - { type: 2, pts: 6747581700, ccData: 21359 }, - { type: 3, pts: 6747584703, ccData: 546 }, - { type: 2, pts: 6747584703, ccData: 24436 }, - { type: 3, pts: 6747587706, ccData: 16930 }, - { type: 2, pts: 6747587706, ccData: 26725 }, - { type: 3, pts: 6747590709, ccData: 33314 }, - { type: 2, pts: 6747590709, ccData: 29285 }, - { type: 3, pts: 6747593712, ccData: 49698 }, - { type: 2, pts: 6747593712, ccData: 10092 }, - { type: 3, pts: 6747596715, ccData: 546 }, - { type: 2, pts: 6747596715, ccData: 27743 }, - { type: 3, pts: 6747599718, ccData: 16930 }, - { type: 2, pts: 6747599718, ccData: 25189 }, - { type: 3, pts: 6747602721, ccData: 33314 }, - { type: 2, pts: 6747602721, ccData: 24428 }, - { type: 3, pts: 6747605724, ccData: 49698 }, - { type: 2, pts: 6747605724, ccData: 28532 }, - { type: 3, pts: 6747608727, ccData: 546 }, - { type: 2, pts: 6747608727, ccData: 29535 }, - { type: 3, pts: 6747611730, ccData: 16930 }, - { type: 2, pts: 6747611730, ccData: 28518 }, - { type: 3, pts: 6747614733, ccData: 33314 }, - { type: 2, pts: 6747614733, ccData: 24434 }, - { type: 3, pts: 6747617736, ccData: 49698 }, - { type: 2, pts: 6747617736, ccData: 28527 }, - { type: 3, pts: 6747620739, ccData: 546 }, - { type: 2, pts: 6747620739, ccData: 27904 }, - { type: 3, pts: 6747623742, ccData: 18993 }, - { type: 2, pts: 6747623742, ccData: 38939 }, - { type: 2, pts: 6747623742, ccData: 16640 }, - { type: 2, pts: 6747623742, ccData: 287 }, - { type: 2, pts: 6747623742, ccData: 4240 }, - { type: 2, pts: 6747623742, ccData: 1283 }, - { type: 2, pts: 6747623742, ccData: 37162 }, - { type: 2, pts: 6747623742, ccData: 0 }, - { type: 2, pts: 6747623742, ccData: 37377 }, - { type: 2, pts: 6747623742, ccData: 2048 }, - { type: 3, pts: 6747629748, ccData: 33571 }, - { type: 2, pts: 6747629748, ccData: 37377 }, - { type: 2, pts: 6747629748, ccData: 2304 }, - { type: 3, pts: 6747635754, ccData: 49698 }, - { type: 2, pts: 6747635754, ccData: 26223 }, - { type: 3, pts: 6747638757, ccData: 546 }, - { type: 2, pts: 6747638757, ccData: 29279 }, - { type: 3, pts: 6747641760, ccData: 16930 }, - { type: 2, pts: 6747641760, ccData: 29552 }, - { type: 3, pts: 6747644763, ccData: 33314 }, - { type: 2, pts: 6747644763, ccData: 24946 }, - { type: 3, pts: 6747647766, ccData: 49698 }, - { type: 2, pts: 6747647766, ccData: 27500 }, - { type: 3, pts: 6747650769, ccData: 546 }, - { type: 2, pts: 6747650769, ccData: 25971 }, - { type: 3, pts: 6747653772, ccData: 16930 }, - { type: 2, pts: 6747653772, ccData: 11776 }, - { type: 3, pts: 6747656775, ccData: 33314 }, - { type: 2, pts: 6747656775, ccData: 35842 }, - { type: 3, pts: 6747662781, ccData: 49698 }, - { type: 2, pts: 6747662781, ccData: 35073 }, - { type: 3, pts: 6747957075, ccData: 546 }, - { type: 2, pts: 6747957075, ccData: 35841 }, - { type: 3, pts: 6748035153, ccData: 18993 }, - { type: 2, pts: 6748035153, ccData: 38939 }, - { type: 2, pts: 6748035153, ccData: 17920 }, - { type: 2, pts: 6748035153, ccData: 31 }, - { type: 2, pts: 6748035153, ccData: 5264 }, - { type: 2, pts: 6748035153, ccData: 1283 }, - { type: 2, pts: 6748035153, ccData: 37162 }, - { type: 2, pts: 6748035153, ccData: 0 }, - { type: 2, pts: 6748035153, ccData: 37376 }, - { type: 2, pts: 6748035153, ccData: 0 }, - { type: 3, pts: 6748041159, ccData: 33314 }, - { type: 2, pts: 6748041159, ccData: 21864 }, - { type: 3, pts: 6748044162, ccData: 49698 }, - { type: 2, pts: 6748044162, ccData: 11359 }, - { type: 3, pts: 6748047165, ccData: 546 }, - { type: 2, pts: 6748047165, ccData: 20585 }, - { type: 3, pts: 6748050168, ccData: 16930 }, - { type: 2, pts: 6748050168, ccData: 28267 }, - { type: 3, pts: 6748053171, ccData: 33314 }, - { type: 2, pts: 6748053171, ccData: 24940 }, - { type: 3, pts: 6748056174, ccData: 49698 }, - { type: 2, pts: 6748056174, ccData: 26979 }, - { type: 3, pts: 6748059177, ccData: 546 }, - { type: 2, pts: 6748059177, ccData: 26991 }, - { type: 3, pts: 6748062180, ccData: 16930 }, - { type: 2, pts: 6748062180, ccData: 30067 }, - { type: 3, pts: 6748065183, ccData: 33314 }, - { type: 2, pts: 6748065183, ccData: 11264 }, - { type: 3, pts: 6748074192, ccData: 49698 }, - { type: 2, pts: 6748074192, ccData: 35073 }, - { type: 3, pts: 6748131249, ccData: 2609 }, - { type: 2, pts: 6748131249, ccData: 39195 }, - { type: 2, pts: 6748131249, ccData: 16640 }, - { type: 2, pts: 6748131249, ccData: 31 }, - { type: 2, pts: 6748131249, ccData: 5264 }, - { type: 2, pts: 6748131249, ccData: 1283 }, - { type: 2, pts: 6748131249, ccData: 37162 }, - { type: 2, pts: 6748131249, ccData: 42 }, - { type: 2, pts: 6748131249, ccData: 37376 }, - { type: 2, pts: 6748131249, ccData: 0 }, - { type: 3, pts: 6748137255, ccData: 16930 }, - { type: 2, pts: 6748137255, ccData: 18783 }, - { type: 3, pts: 6748140258, ccData: 33314 }, - { type: 2, pts: 6748140258, ccData: 25711 }, - { type: 3, pts: 6748143261, ccData: 49698 }, - { type: 2, pts: 6748143261, ccData: 28199 }, - { type: 3, pts: 6748146264, ccData: 546 }, - { type: 2, pts: 6748146264, ccData: 29791 }, - { type: 3, pts: 6748149267, ccData: 16930 }, - { type: 2, pts: 6748149267, ccData: 29800 }, - { type: 3, pts: 6748152270, ccData: 33314 }, - { type: 2, pts: 6748152270, ccData: 26990 }, - { type: 3, pts: 6748155273, ccData: 49698 }, - { type: 2, pts: 6748155273, ccData: 27392 }, - { type: 3, pts: 6748158276, ccData: 2609 }, - { type: 2, pts: 6748158276, ccData: 39195 }, - { type: 2, pts: 6748158276, ccData: 16640 }, - { type: 2, pts: 6748158276, ccData: 287 }, - { type: 2, pts: 6748158276, ccData: 4240 }, - { type: 2, pts: 6748158276, ccData: 1283 }, - { type: 2, pts: 6748158276, ccData: 37162 }, - { type: 2, pts: 6748158276, ccData: 0 }, - { type: 2, pts: 6748158276, ccData: 37377 }, - { type: 2, pts: 6748158276, ccData: 0 }, - { type: 3, pts: 6748164282, ccData: 16930 }, - { type: 2, pts: 6748164282, ccData: 29800 }, - { type: 3, pts: 6748167285, ccData: 33314 }, - { type: 2, pts: 6748167285, ccData: 25977 }, - { type: 3, pts: 6748170288, ccData: 49698 }, - { type: 2, pts: 6748170288, ccData: 24419 }, - { type: 3, pts: 6748173291, ccData: 546 }, - { type: 2, pts: 6748173291, ccData: 24942 }, - { type: 3, pts: 6748176294, ccData: 16930 }, - { type: 2, pts: 6748176294, ccData: 24417 }, - { type: 3, pts: 6748179297, ccData: 33314 }, - { type: 2, pts: 6748179297, ccData: 25460 }, - { type: 3, pts: 6748182300, ccData: 49698 }, - { type: 2, pts: 6748182300, ccData: 30049 }, - { type: 3, pts: 6748185303, ccData: 546 }, - { type: 2, pts: 6748185303, ccData: 27756 }, - { type: 3, pts: 6748188306, ccData: 16930 }, - { type: 2, pts: 6748188306, ccData: 30976 }, - { type: 3, pts: 6748191309, ccData: 33314 }, - { type: 2, pts: 6748191309, ccData: 35841 }, - { type: 3, pts: 6748197315, ccData: 49698 }, - { type: 2, pts: 6748197315, ccData: 35074 }, - { type: 3, pts: 6748275393, ccData: 2609 }, - { type: 2, pts: 6748275393, ccData: 38939 }, - { type: 2, pts: 6748275393, ccData: 16640 }, - { type: 2, pts: 6748275393, ccData: 31 }, - { type: 2, pts: 6748275393, ccData: 5264 }, - { type: 2, pts: 6748275393, ccData: 1283 }, - { type: 2, pts: 6748275393, ccData: 37162 }, - { type: 2, pts: 6748275393, ccData: 42 }, - { type: 2, pts: 6748275393, ccData: 37376 }, - { type: 2, pts: 6748275393, ccData: 0 }, - { type: 3, pts: 6748281399, ccData: 16930 }, - { type: 2, pts: 6748281399, ccData: 28001 }, - { type: 3, pts: 6748284402, ccData: 33314 }, - { type: 2, pts: 6748284402, ccData: 27493 }, - { type: 3, pts: 6748287405, ccData: 49698 }, - { type: 2, pts: 6748287405, ccData: 24441 }, - { type: 3, pts: 6748290408, ccData: 546 }, - { type: 2, pts: 6748290408, ccData: 28533 }, - { type: 3, pts: 6748293411, ccData: 16930 }, - { type: 2, pts: 6748293411, ccData: 29279 }, - { type: 3, pts: 6748296414, ccData: 33314 }, - { type: 2, pts: 6748296414, ccData: 26721 }, - { type: 3, pts: 6748299417, ccData: 49698 }, - { type: 2, pts: 6748299417, ccData: 26994 }, - { type: 3, pts: 6748302420, ccData: 546 }, - { type: 2, pts: 6748302420, ccData: 24423 }, - { type: 3, pts: 6748305423, ccData: 16930 }, - { type: 2, pts: 6748305423, ccData: 29295 }, - { type: 3, pts: 6748308426, ccData: 33314 }, - { type: 2, pts: 6748308426, ccData: 30464 }, - { type: 3, pts: 6748311429, ccData: 51761 }, - { type: 2, pts: 6748311429, ccData: 38939 }, - { type: 2, pts: 6748311429, ccData: 16640 }, - { type: 2, pts: 6748311429, ccData: 287 }, - { type: 2, pts: 6748311429, ccData: 4240 }, - { type: 2, pts: 6748311429, ccData: 1283 }, - { type: 2, pts: 6748311429, ccData: 37162 }, - { type: 2, pts: 6748311429, ccData: 0 }, - { type: 2, pts: 6748311429, ccData: 37377 }, - { type: 2, pts: 6748311429, ccData: 0 }, - { type: 3, pts: 6748317435, ccData: 546 }, - { type: 2, pts: 6748317435, ccData: 27759 }, - { type: 3, pts: 6748320438, ccData: 16930 }, - { type: 2, pts: 6748320438, ccData: 28263 }, - { type: 3, pts: 6748323441, ccData: 33314 }, - { type: 2, pts: 6748323441, ccData: 25970 }, - { type: 3, pts: 6748326444, ccData: 49698 }, - { type: 2, pts: 6748326444, ccData: 11776 }, - { type: 3, pts: 6748329447, ccData: 546 }, - { type: 2, pts: 6748329447, ccData: 35842 }, - { type: 3, pts: 6748335453, ccData: 16930 }, - { type: 2, pts: 6748335453, ccData: 35073 }, - { type: 3, pts: 6748446564, ccData: 35377 }, - { type: 2, pts: 6748446564, ccData: 39195 }, - { type: 2, pts: 6748446564, ccData: 16640 }, - { type: 2, pts: 6748446564, ccData: 31 }, - { type: 2, pts: 6748446564, ccData: 5264 }, - { type: 2, pts: 6748446564, ccData: 1283 }, - { type: 2, pts: 6748446564, ccData: 37162 }, - { type: 2, pts: 6748446564, ccData: 42 }, - { type: 2, pts: 6748446564, ccData: 37376 }, - { type: 2, pts: 6748446564, ccData: 5120 }, - { type: 3, pts: 6748452570, ccData: 49955 }, - { type: 2, pts: 6748452570, ccData: 37376 }, - { type: 2, pts: 6748452570, ccData: 5376 }, - { type: 3, pts: 6748458576, ccData: 546 }, - { type: 2, pts: 6748458576, ccData: 10339 }, - { type: 3, pts: 6748461579, ccData: 16930 }, - { type: 2, pts: 6748461579, ccData: 26741 }, - { type: 3, pts: 6748464582, ccData: 33314 }, - { type: 2, pts: 6748464582, ccData: 25451 }, - { type: 3, pts: 6748467585, ccData: 49698 }, - { type: 2, pts: 6748467585, ccData: 27749 }, - { type: 3, pts: 6748470588, ccData: 546 }, - { type: 2, pts: 6748470588, ccData: 29481 }, - { type: 3, pts: 6748473591, ccData: 16930 }, - { type: 2, pts: 6748473591, ccData: 14848 }, - { type: 3, pts: 6748476594, ccData: 35377 }, - { type: 2, pts: 6748476594, ccData: 39195 }, - { type: 2, pts: 6748476594, ccData: 16640 }, - { type: 2, pts: 6748476594, ccData: 287 }, - { type: 2, pts: 6748476594, ccData: 4240 }, - { type: 2, pts: 6748476594, ccData: 1283 }, - { type: 2, pts: 6748476594, ccData: 37162 }, - { type: 2, pts: 6748476594, ccData: 0 }, - { type: 2, pts: 6748476594, ccData: 37377 }, - { type: 2, pts: 6748476594, ccData: 5120 }, - { type: 3, pts: 6748482600, ccData: 49698 }, - { type: 2, pts: 6748482600, ccData: 21365 }, - { type: 3, pts: 6748485603, ccData: 546 }, - { type: 2, pts: 6748485603, ccData: 29285 }, - { type: 3, pts: 6748488606, ccData: 16930 }, - { type: 2, pts: 6748488606, ccData: 24439 }, - { type: 3, pts: 6748491609, ccData: 33314 }, - { type: 2, pts: 6748491609, ccData: 25951 }, - { type: 3, pts: 6748494612, ccData: 49698 }, - { type: 2, pts: 6748494612, ccData: 25441 }, - { type: 3, pts: 6748497615, ccData: 546 }, - { type: 2, pts: 6748497615, ccData: 28193 }, - { type: 3, pts: 6748500618, ccData: 16930 }, - { type: 2, pts: 6748500618, ccData: 35841 }, - { type: 3, pts: 6748506624, ccData: 33314 }, - { type: 2, pts: 6748506624, ccData: 35074 }, - { type: 3, pts: 6748695813, ccData: 49698 }, - { type: 2, pts: 6748695813, ccData: 35842 }, - { type: 3, pts: 6748803921, ccData: 2609 }, - { type: 2, pts: 6748803921, ccData: 38939 }, - { type: 2, pts: 6748803921, ccData: 17920 }, - { type: 2, pts: 6748803921, ccData: 31 }, - { type: 2, pts: 6748803921, ccData: 5264 }, - { type: 2, pts: 6748803921, ccData: 1283 }, - { type: 2, pts: 6748803921, ccData: 37162 }, - { type: 2, pts: 6748803921, ccData: 42 }, - { type: 2, pts: 6748803921, ccData: 37376 }, - { type: 2, pts: 6748803921, ccData: 0 }, - { type: 3, pts: 6748809927, ccData: 17187 }, - { type: 2, pts: 6748809927, ccData: 37376 }, - { type: 2, pts: 6748809927, ccData: 512 }, - { type: 3, pts: 6748815933, ccData: 33314 }, - { type: 2, pts: 6748815933, ccData: 22377 }, - { type: 3, pts: 6748818936, ccData: 49698 }, - { type: 2, pts: 6748818936, ccData: 29800 }, - { type: 3, pts: 6748821939, ccData: 546 }, - { type: 2, pts: 6748821939, ccData: 24431 }, - { type: 3, pts: 6748824942, ccData: 16930 }, - { type: 2, pts: 6748824942, ccData: 30066 }, - { type: 3, pts: 6748827945, ccData: 33314 }, - { type: 2, pts: 6748827945, ccData: 24392 }, - { type: 3, pts: 6748830948, ccData: 49698 }, - { type: 2, pts: 6748830948, ccData: 24937 }, - { type: 3, pts: 6748833951, ccData: 546 }, - { type: 2, pts: 6748833951, ccData: 29279 }, - { type: 3, pts: 6748836954, ccData: 16930 }, - { type: 2, pts: 6748836954, ccData: 18290 }, - { type: 3, pts: 6748839957, ccData: 33314 }, - { type: 2, pts: 6748839957, ccData: 28535 }, - { type: 3, pts: 6748842960, ccData: 49698 }, - { type: 2, pts: 6748842960, ccData: 24396 }, - { type: 3, pts: 6748845963, ccData: 546 }, - { type: 2, pts: 6748845963, ccData: 28526 }, - { type: 3, pts: 6748848966, ccData: 16930 }, - { type: 2, pts: 6748848966, ccData: 26463 }, - { type: 3, pts: 6748851969, ccData: 33314 }, - { type: 2, pts: 6748851969, ccData: 18277 }, - { type: 3, pts: 6748854972, ccData: 49698 }, - { type: 2, pts: 6748854972, ccData: 27694 }, - { type: 3, pts: 6748863981, ccData: 546 }, - { type: 2, pts: 6748863981, ccData: 35073 }, - { type: 3, pts: 6749068185, ccData: 16930 }, - { type: 2, pts: 6749068185, ccData: 35841 }, - { type: 3, pts: 6749347464, ccData: 35377 }, - { type: 2, pts: 6749347464, ccData: 38939 }, - { type: 2, pts: 6749347464, ccData: 17920 }, - { type: 2, pts: 6749347464, ccData: 31 }, - { type: 2, pts: 6749347464, ccData: 5264 }, - { type: 2, pts: 6749347464, ccData: 1283 }, - { type: 2, pts: 6749347464, ccData: 37162 }, - { type: 2, pts: 6749347464, ccData: 0 }, - { type: 2, pts: 6749347464, ccData: 37376 }, - { type: 2, pts: 6749347464, ccData: 3072 }, - { type: 3, pts: 6749353470, ccData: 49698 }, - { type: 2, pts: 6749353470, ccData: 10343 }, - { type: 3, pts: 6749356473, ccData: 546 }, - { type: 2, pts: 6749356473, ccData: 24947 }, - { type: 3, pts: 6749359476, ccData: 16930 }, - { type: 2, pts: 6749359476, ccData: 28787 }, - { type: 3, pts: 6749362479, ccData: 33314 }, - { type: 2, pts: 6749362479, ccData: 10496 }, - { type: 3, pts: 6749371488, ccData: 49698 }, - { type: 2, pts: 6749371488, ccData: 35073 }, - { type: 3, pts: 6749452569, ccData: 2609 }, - { type: 2, pts: 6749452569, ccData: 39195 }, - { type: 2, pts: 6749452569, ccData: 16640 }, - { type: 2, pts: 6749452569, ccData: 31 }, - { type: 2, pts: 6749452569, ccData: 5264 }, - { type: 2, pts: 6749452569, ccData: 1283 }, - { type: 2, pts: 6749452569, ccData: 37162 }, - { type: 2, pts: 6749452569, ccData: 42 }, - { type: 2, pts: 6749452569, ccData: 37376 }, - { type: 2, pts: 6749452569, ccData: 3072 }, - { type: 3, pts: 6749458575, ccData: 16930 }, - { type: 2, pts: 6749458575, ccData: 10343 }, - { type: 3, pts: 6749461578, ccData: 33314 }, - { type: 2, pts: 6749461578, ccData: 24947 }, - { type: 3, pts: 6749464581, ccData: 49698 }, - { type: 2, pts: 6749464581, ccData: 28787 }, - { type: 3, pts: 6749467584, ccData: 546 }, - { type: 2, pts: 6749467584, ccData: 10554 }, - { type: 3, pts: 6749470587, ccData: 18993 }, - { type: 2, pts: 6749470587, ccData: 39195 }, - { type: 2, pts: 6749470587, ccData: 16640 }, - { type: 2, pts: 6749470587, ccData: 287 }, - { type: 2, pts: 6749470587, ccData: 4240 }, - { type: 2, pts: 6749470587, ccData: 1283 }, - { type: 2, pts: 6749470587, ccData: 37162 }, - { type: 2, pts: 6749470587, ccData: 0 }, - { type: 2, pts: 6749470587, ccData: 37377 }, - { type: 2, pts: 6749470587, ccData: 2048 }, - { type: 3, pts: 6749476593, ccData: 33571 }, - { type: 2, pts: 6749476593, ccData: 37377 }, - { type: 2, pts: 6749476593, ccData: 2304 }, - { type: 3, pts: 6749482599, ccData: 49698 }, - { type: 2, pts: 6749482599, ccData: 20585 }, - { type: 3, pts: 6749485602, ccData: 546 }, - { type: 2, pts: 6749485602, ccData: 28267 }, - { type: 3, pts: 6749488605, ccData: 16930 }, - { type: 2, pts: 6749488605, ccData: 24940 }, - { type: 3, pts: 6749491608, ccData: 33314 }, - { type: 2, pts: 6749491608, ccData: 26979 }, - { type: 3, pts: 6749494611, ccData: 49698 }, - { type: 2, pts: 6749494611, ccData: 26991 }, - { type: 3, pts: 6749497614, ccData: 546 }, - { type: 2, pts: 6749497614, ccData: 30067 }, - { type: 3, pts: 6749500617, ccData: 16930 }, - { type: 2, pts: 6749500617, ccData: 8448 }, - { type: 3, pts: 6749503620, ccData: 33314 }, - { type: 2, pts: 6749503620, ccData: 35841 }, - { type: 3, pts: 6749509626, ccData: 49698 }, - { type: 2, pts: 6749509626, ccData: 35074 }, - { type: 3, pts: 6749674791, ccData: 2609 }, - { type: 2, pts: 6749674791, ccData: 38939 }, - { type: 2, pts: 6749674791, ccData: 17920 }, - { type: 2, pts: 6749674791, ccData: 31 }, - { type: 2, pts: 6749674791, ccData: 5264 }, - { type: 2, pts: 6749674791, ccData: 1283 }, - { type: 2, pts: 6749674791, ccData: 37162 }, - { type: 2, pts: 6749674791, ccData: 42 }, - { type: 2, pts: 6749674791, ccData: 37376 }, - { type: 2, pts: 6749674791, ccData: 2048 }, - { type: 3, pts: 6749680797, ccData: 17187 }, - { type: 2, pts: 6749680797, ccData: 37376 }, - { type: 2, pts: 6749680797, ccData: 2560 }, - { type: 3, pts: 6749686803, ccData: 33314 }, - { type: 2, pts: 6749686803, ccData: 19567 }, - { type: 3, pts: 6749689806, ccData: 49698 }, - { type: 2, pts: 6749689806, ccData: 28523 }, - { type: 3, pts: 6749692809, ccData: 546 }, - { type: 2, pts: 6749692809, ccData: 11359 }, - { type: 3, pts: 6749695812, ccData: 16930 }, - { type: 2, pts: 6749695812, ccData: 19823 }, - { type: 3, pts: 6749698815, ccData: 33314 }, - { type: 2, pts: 6749698815, ccData: 28013 }, - { type: 3, pts: 6749701818, ccData: 49698 }, - { type: 2, pts: 6749701818, ccData: 31022 }, - { type: 3, pts: 6749704821, ccData: 546 }, - { type: 2, pts: 6749704821, ccData: 35842 }, - { type: 3, pts: 6749710827, ccData: 16930 }, - { type: 2, pts: 6749710827, ccData: 35073 }, - { type: 3, pts: 6749773890, ccData: 35377 }, - { type: 2, pts: 6749773890, ccData: 39195 }, - { type: 2, pts: 6749773890, ccData: 17920 }, - { type: 2, pts: 6749773890, ccData: 31 }, - { type: 2, pts: 6749773890, ccData: 5264 }, - { type: 2, pts: 6749773890, ccData: 1283 }, - { type: 2, pts: 6749773890, ccData: 37162 }, - { type: 2, pts: 6749773890, ccData: 42 }, - { type: 2, pts: 6749773890, ccData: 37376 }, - { type: 2, pts: 6749773890, ccData: 1024 }, - { type: 3, pts: 6749779896, ccData: 49955 }, - { type: 2, pts: 6749779896, ccData: 37376 }, - { type: 2, pts: 6749779896, ccData: 1792 }, - { type: 3, pts: 6749785902, ccData: 546 }, - { type: 2, pts: 6749785902, ccData: 19833 }, - { type: 3, pts: 6749788905, ccData: 16930 }, - { type: 2, pts: 6749788905, ccData: 24424 }, - { type: 3, pts: 6749791908, ccData: 33314 }, - { type: 2, pts: 6749791908, ccData: 24937 }, - { type: 3, pts: 6749794911, ccData: 49698 }, - { type: 2, pts: 6749794911, ccData: 29223 }, - { type: 3, pts: 6749797914, ccData: 546 }, - { type: 2, pts: 6749797914, ccData: 29535 }, - { type: 3, pts: 6749800917, ccData: 16930 }, - { type: 2, pts: 6749800917, ccData: 26482 }, - { type: 3, pts: 6749803920, ccData: 33314 }, - { type: 2, pts: 6749803920, ccData: 28535 }, - { type: 3, pts: 6749806923, ccData: 49698 }, - { type: 2, pts: 6749806923, ccData: 26990 }, - { type: 3, pts: 6749809926, ccData: 546 }, - { type: 2, pts: 6749809926, ccData: 26401 }, - { type: 3, pts: 6749812929, ccData: 16930 }, - { type: 2, pts: 6749812929, ccData: 35841 }, - { type: 3, pts: 6749818935, ccData: 33314 }, - { type: 2, pts: 6749818935, ccData: 35074 }, - { type: 3, pts: 6749987103, ccData: 49698 }, - { type: 2, pts: 6749987103, ccData: 35842 }, - { type: 3, pts: 6750200316, ccData: 2609 }, - { type: 2, pts: 6750200316, ccData: 38939 }, - { type: 2, pts: 6750200316, ccData: 17920 }, - { type: 2, pts: 6750200316, ccData: 31 }, - { type: 2, pts: 6750200316, ccData: 5264 }, - { type: 2, pts: 6750200316, ccData: 1283 }, - { type: 2, pts: 6750200316, ccData: 37162 }, - { type: 2, pts: 6750200316, ccData: 42 }, - { type: 2, pts: 6750200316, ccData: 37376 }, - { type: 2, pts: 6750200316, ccData: 0 }, - { type: 3, pts: 6750206322, ccData: 16930 }, - { type: 2, pts: 6750206322, ccData: 17519 }, - { type: 3, pts: 6750209325, ccData: 33314 }, - { type: 2, pts: 6750209325, ccData: 28261 }, - { type: 3, pts: 6750212328, ccData: 49698 }, - { type: 2, pts: 6750212328, ccData: 8448 }, - { type: 3, pts: 6750221337, ccData: 546 }, - { type: 2, pts: 6750221337, ccData: 35073 }, - { type: 3, pts: 6750278394, ccData: 18993 }, - { type: 2, pts: 6750278394, ccData: 39195 }, - { type: 2, pts: 6750278394, ccData: 17920 }, - { type: 2, pts: 6750278394, ccData: 31 }, - { type: 2, pts: 6750278394, ccData: 5264 }, - { type: 2, pts: 6750278394, ccData: 1283 }, - { type: 2, pts: 6750278394, ccData: 37162 }, - { type: 2, pts: 6750278394, ccData: 42 }, - { type: 2, pts: 6750278394, ccData: 37376 }, - { type: 2, pts: 6750278394, ccData: 0 }, - { type: 3, pts: 6750284400, ccData: 33314 }, - { type: 2, pts: 6750284400, ccData: 22376 }, - { type: 3, pts: 6750287403, ccData: 49698 }, - { type: 2, pts: 6750287403, ccData: 24948 }, - { type: 3, pts: 6750290406, ccData: 546 }, - { type: 2, pts: 6750290406, ccData: 24420 }, - { type: 3, pts: 6750293409, ccData: 16930 }, - { type: 2, pts: 6750293409, ccData: 28511 }, - { type: 3, pts: 6750296412, ccData: 33314 }, - { type: 2, pts: 6750296412, ccData: 31087 }, - { type: 3, pts: 6750299415, ccData: 49698 }, - { type: 2, pts: 6750299415, ccData: 30047 }, - { type: 3, pts: 6750302418, ccData: 546 }, - { type: 2, pts: 6750302418, ccData: 29800 }, - { type: 3, pts: 6750305421, ccData: 16930 }, - { type: 2, pts: 6750305421, ccData: 26990 }, - { type: 3, pts: 6750308424, ccData: 33314 }, - { type: 2, pts: 6750308424, ccData: 27455 }, - { type: 3, pts: 6750311427, ccData: 49698 }, - { type: 2, pts: 6750311427, ccData: 35841 }, - { type: 3, pts: 6750317433, ccData: 546 }, - { type: 2, pts: 6750317433, ccData: 35074 }, - { type: 3, pts: 6750410526, ccData: 16930 }, - { type: 2, pts: 6750410526, ccData: 35842 }, - { type: 3, pts: 6750545661, ccData: 35377 }, - { type: 2, pts: 6750545661, ccData: 38939 }, - { type: 2, pts: 6750545661, ccData: 16640 }, - { type: 2, pts: 6750545661, ccData: 31 }, - { type: 2, pts: 6750545661, ccData: 5264 }, - { type: 2, pts: 6750545661, ccData: 1283 }, - { type: 2, pts: 6750545661, ccData: 37162 }, - { type: 2, pts: 6750545661, ccData: 42 }, - { type: 2, pts: 6750545661, ccData: 37376 }, - { type: 2, pts: 6750545661, ccData: 3072 }, - { type: 3, pts: 6750551667, ccData: 49698 }, - { type: 2, pts: 6750551667, ccData: 10343 }, - { type: 3, pts: 6750554670, ccData: 546 }, - { type: 2, pts: 6750554670, ccData: 24947 }, - { type: 3, pts: 6750557673, ccData: 16930 }, - { type: 2, pts: 6750557673, ccData: 28787 }, - { type: 3, pts: 6750560676, ccData: 33314 }, - { type: 2, pts: 6750560676, ccData: 10496 }, - { type: 3, pts: 6750563679, ccData: 51761 }, - { type: 2, pts: 6750563679, ccData: 38939 }, - { type: 2, pts: 6750563679, ccData: 16640 }, - { type: 2, pts: 6750563679, ccData: 287 }, - { type: 2, pts: 6750563679, ccData: 4240 }, - { type: 2, pts: 6750563679, ccData: 1283 }, - { type: 2, pts: 6750563679, ccData: 37162 }, - { type: 2, pts: 6750563679, ccData: 0 }, - { type: 2, pts: 6750563679, ccData: 37377 }, - { type: 2, pts: 6750563679, ccData: 1024 }, - { type: 3, pts: 6750569685, ccData: 803 }, - { type: 2, pts: 6750569685, ccData: 37377 }, - { type: 2, pts: 6750569685, ccData: 1792 }, - { type: 3, pts: 6750575691, ccData: 16930 }, - { type: 2, pts: 6750575691, ccData: 18804 }, - { type: 3, pts: 6750578694, ccData: 33314 }, - { type: 2, pts: 6750578694, ccData: 10099 }, - { type: 3, pts: 6750581697, ccData: 49698 }, - { type: 2, pts: 6750581697, ccData: 24432 }, - { type: 3, pts: 6750584700, ccData: 546 }, - { type: 2, pts: 6750584700, ccData: 26990 }, - { type: 3, pts: 6750587703, ccData: 16930 }, - { type: 2, pts: 6750587703, ccData: 27489 }, - { type: 3, pts: 6750590706, ccData: 33314 }, - { type: 2, pts: 6750590706, ccData: 28773 }, - { type: 3, pts: 6750593709, ccData: 49698 }, - { type: 2, pts: 6750593709, ccData: 29286 }, - { type: 3, pts: 6750596712, ccData: 546 }, - { type: 2, pts: 6750596712, ccData: 25955 }, - { type: 3, pts: 6750599715, ccData: 16930 }, - { type: 2, pts: 6750599715, ccData: 29729 }, - { type: 3, pts: 6750608724, ccData: 33314 }, - { type: 2, pts: 6750608724, ccData: 35073 }, - { type: 3, pts: 6750737853, ccData: 51761 }, - { type: 2, pts: 6750737853, ccData: 39195 }, - { type: 2, pts: 6750737853, ccData: 17920 }, - { type: 2, pts: 6750737853, ccData: 31 }, - { type: 2, pts: 6750737853, ccData: 5264 }, - { type: 2, pts: 6750737853, ccData: 1283 }, - { type: 2, pts: 6750737853, ccData: 37162 }, - { type: 2, pts: 6750737853, ccData: 42 }, - { type: 2, pts: 6750737853, ccData: 37376 }, - { type: 2, pts: 6750737853, ccData: 4096 }, - { type: 3, pts: 6750743859, ccData: 803 }, - { type: 2, pts: 6750743859, ccData: 37376 }, - { type: 2, pts: 6750743859, ccData: 4864 }, - { type: 3, pts: 6750749865, ccData: 16930 }, - { type: 2, pts: 6750749865, ccData: 19567 }, - { type: 3, pts: 6750752868, ccData: 33314 }, - { type: 2, pts: 6750752868, ccData: 28523 }, - { type: 3, pts: 6750755871, ccData: 49698 }, - { type: 2, pts: 6750755871, ccData: 29535 }, - { type: 3, pts: 6750758874, ccData: 546 }, - { type: 2, pts: 6750758874, ccData: 26479 }, - { type: 3, pts: 6750761877, ccData: 16930 }, - { type: 2, pts: 6750761877, ccData: 28516 }, - { type: 3, pts: 6750764880, ccData: 33314 }, - { type: 2, pts: 6750764880, ccData: 11776 }, - { type: 3, pts: 6750767883, ccData: 49698 }, - { type: 2, pts: 6750767883, ccData: 35841 }, - { type: 3, pts: 6750773889, ccData: 546 }, - { type: 2, pts: 6750773889, ccData: 35074 }, - { type: 3, pts: 6750863979, ccData: 18993 }, - { type: 2, pts: 6750863979, ccData: 38939 }, - { type: 2, pts: 6750863979, ccData: 17920 }, - { type: 2, pts: 6750863979, ccData: 31 }, - { type: 2, pts: 6750863979, ccData: 5264 }, - { type: 2, pts: 6750863979, ccData: 1283 }, - { type: 2, pts: 6750863979, ccData: 37162 }, - { type: 2, pts: 6750863979, ccData: 42 }, - { type: 2, pts: 6750863979, ccData: 37376 }, - { type: 2, pts: 6750863979, ccData: 0 }, - { type: 3, pts: 6750869985, ccData: 33314 }, - { type: 2, pts: 6750869985, ccData: 22383 }, - { type: 3, pts: 6750872988, ccData: 49698 }, - { type: 2, pts: 6750872988, ccData: 30508 }, - { type: 3, pts: 6750875991, ccData: 546 }, - { type: 2, pts: 6750875991, ccData: 24436 }, - { type: 3, pts: 6750878994, ccData: 16930 }, - { type: 2, pts: 6750878994, ccData: 26721 }, - { type: 3, pts: 6750881997, ccData: 33314 }, - { type: 2, pts: 6750881997, ccData: 29735 }, - { type: 3, pts: 6750885000, ccData: 49698 }, - { type: 2, pts: 6750885000, ccData: 29535 }, - { type: 3, pts: 6750888003, ccData: 546 }, - { type: 2, pts: 6750888003, ccData: 24941 }, - { type: 3, pts: 6750891006, ccData: 16930 }, - { type: 2, pts: 6750891006, ccData: 24954 }, - { type: 3, pts: 6750894009, ccData: 33314 }, - { type: 2, pts: 6750894009, ccData: 26990 }, - { type: 3, pts: 6750897012, ccData: 49698 }, - { type: 2, pts: 6750897012, ccData: 26414 }, - { type: 3, pts: 6750900015, ccData: 546 }, - { type: 2, pts: 6750900015, ccData: 35842 }, - { type: 3, pts: 6750906021, ccData: 16930 }, - { type: 2, pts: 6750906021, ccData: 35073 }, - { type: 3, pts: 6751014129, ccData: 35377 }, - { type: 2, pts: 6751014129, ccData: 39195 }, - { type: 2, pts: 6751014129, ccData: 16640 }, - { type: 2, pts: 6751014129, ccData: 31 }, - { type: 2, pts: 6751014129, ccData: 5264 }, - { type: 2, pts: 6751014129, ccData: 1283 }, - { type: 2, pts: 6751014129, ccData: 37162 }, - { type: 2, pts: 6751014129, ccData: 42 }, - { type: 2, pts: 6751014129, ccData: 37376 }, - { type: 2, pts: 6751014129, ccData: 1024 }, - { type: 3, pts: 6751020135, ccData: 49955 }, - { type: 2, pts: 6751020135, ccData: 37376 }, - { type: 2, pts: 6751020135, ccData: 1280 }, - { type: 3, pts: 6751026141, ccData: 546 }, - { type: 2, pts: 6751026141, ccData: 16750 }, - { type: 3, pts: 6751029144, ccData: 16930 }, - { type: 2, pts: 6751029144, ccData: 25695 }, - { type: 3, pts: 6751032147, ccData: 33314 }, - { type: 2, pts: 6751032147, ccData: 26996 }, - { type: 3, pts: 6751035150, ccData: 49698 }, - { type: 2, pts: 6751035150, ccData: 24428 }, - { type: 3, pts: 6751038153, ccData: 546 }, - { type: 2, pts: 6751038153, ccData: 28527 }, - { type: 3, pts: 6751041156, ccData: 16930 }, - { type: 2, pts: 6751041156, ccData: 27507 }, - { type: 3, pts: 6751044159, ccData: 33314 }, - { type: 2, pts: 6751044159, ccData: 24426 }, - { type: 3, pts: 6751047162, ccData: 49698 }, - { type: 2, pts: 6751047162, ccData: 30067 }, - { type: 3, pts: 6751050165, ccData: 546 }, - { type: 2, pts: 6751050165, ccData: 29791 }, - { type: 3, pts: 6751053168, ccData: 16930 }, - { type: 2, pts: 6751053168, ccData: 27753 }, - { type: 3, pts: 6751056171, ccData: 33314 }, - { type: 2, pts: 6751056171, ccData: 27493 }, - { type: 3, pts: 6751059174, ccData: 51761 }, - { type: 2, pts: 6751059174, ccData: 39195 }, - { type: 2, pts: 6751059174, ccData: 16640 }, - { type: 2, pts: 6751059174, ccData: 287 }, - { type: 2, pts: 6751059174, ccData: 4240 }, - { type: 2, pts: 6751059174, ccData: 1283 }, - { type: 2, pts: 6751059174, ccData: 37162 }, - { type: 2, pts: 6751059174, ccData: 0 }, - { type: 2, pts: 6751059174, ccData: 37377 }, - { type: 2, pts: 6751059174, ccData: 2048 }, - { type: 3, pts: 6751065180, ccData: 803 }, - { type: 2, pts: 6751065180, ccData: 37377 }, - { type: 2, pts: 6751065180, ccData: 2560 }, - { type: 3, pts: 6751071186, ccData: 16930 }, - { type: 2, pts: 6751071186, ccData: 28025 }, - { type: 3, pts: 6751074189, ccData: 33314 }, - { type: 2, pts: 6751074189, ccData: 24420 }, - { type: 3, pts: 6751077192, ccData: 49698 }, - { type: 2, pts: 6751077192, ccData: 29281 }, - { type: 3, pts: 6751080195, ccData: 546 }, - { type: 2, pts: 6751080195, ccData: 30569 }, - { type: 3, pts: 6751083198, ccData: 16930 }, - { type: 2, pts: 6751083198, ccData: 28263 }, - { type: 3, pts: 6751086201, ccData: 33314 }, - { type: 2, pts: 6751086201, ccData: 11776 }, - { type: 3, pts: 6751089204, ccData: 49698 }, - { type: 2, pts: 6751089204, ccData: 35841 }, - { type: 3, pts: 6751095210, ccData: 546 }, - { type: 2, pts: 6751095210, ccData: 35074 }, - { type: 3, pts: 6751320435, ccData: 18993 }, - { type: 2, pts: 6751320435, ccData: 38939 }, - { type: 2, pts: 6751320435, ccData: 17920 }, - { type: 2, pts: 6751320435, ccData: 31 }, - { type: 2, pts: 6751320435, ccData: 5264 }, - { type: 2, pts: 6751320435, ccData: 1283 }, - { type: 2, pts: 6751320435, ccData: 37162 }, - { type: 2, pts: 6751320435, ccData: 42 }, - { type: 2, pts: 6751320435, ccData: 37376 }, - { type: 2, pts: 6751320435, ccData: 0 }, - { type: 3, pts: 6751326441, ccData: 33571 }, - { type: 2, pts: 6751326441, ccData: 37376 }, - { type: 2, pts: 6751326441, ccData: 768 }, - { type: 3, pts: 6751332447, ccData: 49698 }, - { type: 2, pts: 6751332447, ccData: 21608 }, - { type: 3, pts: 6751335450, ccData: 546 }, - { type: 2, pts: 6751335450, ccData: 24942 }, - { type: 3, pts: 6751338453, ccData: 16930 }, - { type: 2, pts: 6751338453, ccData: 27487 }, - { type: 3, pts: 6751341456, ccData: 33314 }, - { type: 2, pts: 6751341456, ccData: 31087 }, - { type: 3, pts: 6751344459, ccData: 49698 }, - { type: 2, pts: 6751344459, ccData: 30047 }, - { type: 3, pts: 6751347462, ccData: 546 }, - { type: 2, pts: 6751347462, ccData: 29551 }, - { type: 3, pts: 6751350465, ccData: 16930 }, - { type: 2, pts: 6751350465, ccData: 24429 }, - { type: 3, pts: 6751353468, ccData: 33314 }, - { type: 2, pts: 6751353468, ccData: 30051 }, - { type: 3, pts: 6751356471, ccData: 49698 }, - { type: 2, pts: 6751356471, ccData: 26668 }, - { type: 3, pts: 6751359474, ccData: 546 }, - { type: 2, pts: 6751359474, ccData: 24385 }, - { type: 3, pts: 6751362477, ccData: 16930 }, - { type: 2, pts: 6751362477, ccData: 28260 }, - { type: 3, pts: 6751365480, ccData: 33314 }, - { type: 2, pts: 6751365480, ccData: 29285 }, - { type: 3, pts: 6751368483, ccData: 49698 }, - { type: 2, pts: 6751368483, ccData: 24878 }, - { type: 3, pts: 6751371486, ccData: 546 }, - { type: 2, pts: 6751371486, ccData: 35842 }, - { type: 3, pts: 6751377492, ccData: 16930 }, - { type: 2, pts: 6751377492, ccData: 35073 }, - { type: 3, pts: 6751479594, ccData: 35377 }, - { type: 2, pts: 6751479594, ccData: 39195 }, - { type: 2, pts: 6751479594, ccData: 16640 }, - { type: 2, pts: 6751479594, ccData: 31 }, - { type: 2, pts: 6751479594, ccData: 5264 }, - { type: 2, pts: 6751479594, ccData: 1283 }, - { type: 2, pts: 6751479594, ccData: 37162 }, - { type: 2, pts: 6751479594, ccData: 42 }, - { type: 2, pts: 6751479594, ccData: 37376 }, - { type: 2, pts: 6751479594, ccData: 1024 }, - { type: 3, pts: 6751485600, ccData: 49955 }, - { type: 2, pts: 6751485600, ccData: 37376 }, - { type: 2, pts: 6751485600, ccData: 1280 }, - { type: 3, pts: 6751491606, ccData: 546 }, - { type: 2, pts: 6751491606, ccData: 22895 }, - { type: 3, pts: 6751494609, ccData: 16930 }, - { type: 2, pts: 6751494609, ccData: 30047 }, - { type: 3, pts: 6751497612, ccData: 33314 }, - { type: 2, pts: 6751497612, ccData: 24946 }, - { type: 3, pts: 6751500615, ccData: 49698 }, - { type: 2, pts: 6751500615, ccData: 25951 }, - { type: 3, pts: 6751503618, ccData: 546 }, - { type: 2, pts: 6751503618, ccData: 30309 }, - { type: 3, pts: 6751506621, ccData: 16930 }, - { type: 2, pts: 6751506621, ccData: 29305 }, - { type: 3, pts: 6751509624, ccData: 33314 }, - { type: 2, pts: 6751509624, ccData: 24439 }, - { type: 3, pts: 6751512627, ccData: 49698 }, - { type: 2, pts: 6751512627, ccData: 25964 }, - { type: 3, pts: 6751515630, ccData: 546 }, - { type: 2, pts: 6751515630, ccData: 25455 }, - { type: 3, pts: 6751518633, ccData: 16930 }, - { type: 2, pts: 6751518633, ccData: 28005 }, - { type: 3, pts: 6751521636, ccData: 33314 }, - { type: 2, pts: 6751521636, ccData: 11264 }, - { type: 3, pts: 6751524639, ccData: 51761 }, - { type: 2, pts: 6751524639, ccData: 39195 }, - { type: 2, pts: 6751524639, ccData: 16640 }, - { type: 2, pts: 6751524639, ccData: 287 }, - { type: 2, pts: 6751524639, ccData: 4240 }, - { type: 2, pts: 6751524639, ccData: 1283 }, - { type: 2, pts: 6751524639, ccData: 37162 }, - { type: 2, pts: 6751524639, ccData: 0 }, - { type: 2, pts: 6751524639, ccData: 37377 }, - { type: 2, pts: 6751524639, ccData: 2048 }, - { type: 3, pts: 6751530645, ccData: 803 }, - { type: 2, pts: 6751530645, ccData: 37377 }, - { type: 2, pts: 6751530645, ccData: 2304 }, - { type: 3, pts: 6751536651, ccData: 16930 }, - { type: 2, pts: 6751536651, ccData: 20585 }, - { type: 3, pts: 6751539654, ccData: 33314 }, - { type: 2, pts: 6751539654, ccData: 28267 }, - { type: 3, pts: 6751542657, ccData: 49698 }, - { type: 2, pts: 6751542657, ccData: 24940 }, - { type: 3, pts: 6751545660, ccData: 546 }, - { type: 2, pts: 6751545660, ccData: 26979 }, - { type: 3, pts: 6751548663, ccData: 16930 }, - { type: 2, pts: 6751548663, ccData: 26991 }, - { type: 3, pts: 6751551666, ccData: 33314 }, - { type: 2, pts: 6751551666, ccData: 30067 }, - { type: 3, pts: 6751554669, ccData: 49698 }, - { type: 2, pts: 6751554669, ccData: 11776 }, - { type: 3, pts: 6751557672, ccData: 546 }, - { type: 2, pts: 6751557672, ccData: 35841 }, - { type: 3, pts: 6751563678, ccData: 16930 }, - { type: 2, pts: 6751563678, ccData: 35074 }, - { type: 3, pts: 6751770885, ccData: 35377 }, - { type: 2, pts: 6751770885, ccData: 38939 }, - { type: 2, pts: 6751770885, ccData: 17920 }, - { type: 2, pts: 6751770885, ccData: 31 }, - { type: 2, pts: 6751770885, ccData: 5264 }, - { type: 2, pts: 6751770885, ccData: 1283 }, - { type: 2, pts: 6751770885, ccData: 37162 }, - { type: 2, pts: 6751770885, ccData: 42 }, - { type: 2, pts: 6751770885, ccData: 37376 }, - { type: 2, pts: 6751770885, ccData: 3072 }, - { type: 3, pts: 6751776891, ccData: 49955 }, - { type: 2, pts: 6751776891, ccData: 37376 }, - { type: 2, pts: 6751776891, ccData: 3328 }, - { type: 3, pts: 6751782897, ccData: 546 }, - { type: 2, pts: 6751782897, ccData: 19823 }, - { type: 3, pts: 6751785900, ccData: 16930 }, - { type: 2, pts: 6751785900, ccData: 28013 }, - { type: 3, pts: 6751788903, ccData: 33314 }, - { type: 2, pts: 6751788903, ccData: 31020 }, - { type: 3, pts: 6751791906, ccData: 49698 }, - { type: 2, pts: 6751791906, ccData: 35842 }, - { type: 3, pts: 6751797912, ccData: 546 }, - { type: 2, pts: 6751797912, ccData: 35073 }, - { type: 3, pts: 6751830945, ccData: 18993 }, - { type: 2, pts: 6751830945, ccData: 39195 }, - { type: 2, pts: 6751830945, ccData: 16640 }, - { type: 2, pts: 6751830945, ccData: 31 }, - { type: 2, pts: 6751830945, ccData: 5264 }, - { type: 2, pts: 6751830945, ccData: 1283 }, - { type: 2, pts: 6751830945, ccData: 37162 }, - { type: 2, pts: 6751830945, ccData: 42 }, - { type: 2, pts: 6751830945, ccData: 37376 }, - { type: 2, pts: 6751830945, ccData: 1024 }, - { type: 3, pts: 6751836951, ccData: 33571 }, - { type: 2, pts: 6751836951, ccData: 37376 }, - { type: 2, pts: 6751836951, ccData: 1536 }, - { type: 3, pts: 6751842957, ccData: 49698 }, - { type: 2, pts: 6751842957, ccData: 19557 }, - { type: 3, pts: 6751845960, ccData: 546 }, - { type: 2, pts: 6751845960, ccData: 29735 }, - { type: 3, pts: 6751848963, ccData: 16930 }, - { type: 2, pts: 6751848963, ccData: 29535 }, - { type: 3, pts: 6751851966, ccData: 33314 }, - { type: 2, pts: 6751851966, ccData: 26479 }, - { type: 3, pts: 6751854969, ccData: 49698 }, - { type: 2, pts: 6751854969, ccData: 24435 }, - { type: 3, pts: 6751857972, ccData: 546 }, - { type: 2, pts: 6751857972, ccData: 26735 }, - { type: 3, pts: 6751860975, ccData: 16930 }, - { type: 2, pts: 6751860975, ccData: 30559 }, - { type: 3, pts: 6751863978, ccData: 33314 }, - { type: 2, pts: 6751863978, ccData: 17505 }, - { type: 3, pts: 6751866981, ccData: 49698 }, - { type: 2, pts: 6751866981, ccData: 25700 }, - { type: 3, pts: 6751869984, ccData: 546 }, - { type: 2, pts: 6751869984, ccData: 30976 }, - { type: 3, pts: 6751872987, ccData: 18993 }, - { type: 2, pts: 6751872987, ccData: 39195 }, - { type: 2, pts: 6751872987, ccData: 16640 }, - { type: 2, pts: 6751872987, ccData: 287 }, - { type: 2, pts: 6751872987, ccData: 4240 }, - { type: 2, pts: 6751872987, ccData: 1283 }, - { type: 2, pts: 6751872987, ccData: 37162 }, - { type: 2, pts: 6751872987, ccData: 0 }, - { type: 2, pts: 6751872987, ccData: 37377 }, - { type: 2, pts: 6751872987, ccData: 2048 }, - { type: 3, pts: 6751878993, ccData: 33571 }, - { type: 2, pts: 6751878993, ccData: 37377 }, - { type: 2, pts: 6751878993, ccData: 2816 }, - { type: 3, pts: 6751884999, ccData: 49698 }, - { type: 2, pts: 6751884999, ccData: 24942 }, - { type: 3, pts: 6751888002, ccData: 546 }, - { type: 2, pts: 6751888002, ccData: 25695 }, - { type: 3, pts: 6751891005, ccData: 16930 }, - { type: 2, pts: 6751891005, ccData: 20581 }, - { type: 3, pts: 6751894008, ccData: 33314 }, - { type: 2, pts: 6751894008, ccData: 29797 }, - { type: 3, pts: 6751897011, ccData: 49698 }, - { type: 2, pts: 6751897011, ccData: 29230 }, - { type: 3, pts: 6751900014, ccData: 546 }, - { type: 2, pts: 6751900014, ccData: 35841 }, - { type: 3, pts: 6751906020, ccData: 16930 }, - { type: 2, pts: 6751906020, ccData: 35074 }, - { type: 3, pts: 6752080194, ccData: 33314 }, - { type: 2, pts: 6752080194, ccData: 35842 }, - { type: 3, pts: 6752248362, ccData: 51761 }, - { type: 2, pts: 6752248362, ccData: 38939 }, - { type: 2, pts: 6752248362, ccData: 17920 }, - { type: 2, pts: 6752248362, ccData: 31 }, - { type: 2, pts: 6752248362, ccData: 5264 }, - { type: 2, pts: 6752248362, ccData: 1283 }, - { type: 2, pts: 6752248362, ccData: 37162 }, - { type: 2, pts: 6752248362, ccData: 42 }, - { type: 2, pts: 6752248362, ccData: 37376 }, - { type: 2, pts: 6752248362, ccData: 3072 }, - { type: 3, pts: 6752254368, ccData: 803 }, - { type: 2, pts: 6752254368, ccData: 37376 }, - { type: 2, pts: 6752254368, ccData: 3584 }, - { type: 3, pts: 6752260374, ccData: 16929 }, - { type: 2, pts: 6752260374, ccData: 32512 }, - { type: 3, pts: 6752263377, ccData: 33314 }, - { type: 2, pts: 6752263377, ccData: 24320 }, - { type: 3, pts: 6752266380, ccData: 49697 }, - { type: 2, pts: 6752266380, ccData: 32512 }, - { type: 3, pts: 6752275389, ccData: 546 }, - { type: 2, pts: 6752275389, ccData: 35073 }, - { type: 3, pts: 6752512626, ccData: 16930 }, - { type: 2, pts: 6752512626, ccData: 35841 }, - { type: 3, pts: 6752584698, ccData: 35377 }, - { type: 2, pts: 6752584698, ccData: 38939 }, - { type: 2, pts: 6752584698, ccData: 16640 }, - { type: 2, pts: 6752584698, ccData: 31 }, - { type: 2, pts: 6752584698, ccData: 5264 }, - { type: 2, pts: 6752584698, ccData: 1283 }, - { type: 2, pts: 6752584698, ccData: 37162 }, - { type: 2, pts: 6752584698, ccData: 0 }, - { type: 2, pts: 6752584698, ccData: 37376 }, - { type: 2, pts: 6752584698, ccData: 0 }, - { type: 3, pts: 6752590704, ccData: 49698 }, - { type: 2, pts: 6752590704, ccData: 20553 }, - { type: 3, pts: 6752593707, ccData: 546 }, - { type: 2, pts: 6752593707, ccData: 20043 }, - { type: 3, pts: 6752596710, ccData: 16930 }, - { type: 2, pts: 6752596710, ccData: 16716 }, - { type: 3, pts: 6752599713, ccData: 33314 }, - { type: 2, pts: 6752599713, ccData: 18755 }, - { type: 3, pts: 6752602716, ccData: 49698 }, - { type: 2, pts: 6752602716, ccData: 18767 }, - { type: 3, pts: 6752605719, ccData: 546 }, - { type: 2, pts: 6752605719, ccData: 21843 }, - { type: 3, pts: 6752608722, ccData: 16930 }, - { type: 2, pts: 6752608722, ccData: 14848 }, - { type: 3, pts: 6752611725, ccData: 35377 }, - { type: 2, pts: 6752611725, ccData: 38939 }, - { type: 2, pts: 6752611725, ccData: 16640 }, - { type: 2, pts: 6752611725, ccData: 287 }, - { type: 2, pts: 6752611725, ccData: 4240 }, - { type: 2, pts: 6752611725, ccData: 1283 }, - { type: 2, pts: 6752611725, ccData: 37162 }, - { type: 2, pts: 6752611725, ccData: 0 }, - { type: 2, pts: 6752611725, ccData: 37377 }, - { type: 2, pts: 6752611725, ccData: 0 }, - { type: 3, pts: 6752617731, ccData: 49698 }, - { type: 2, pts: 6752617731, ccData: 21365 }, - { type: 3, pts: 6752620734, ccData: 546 }, - { type: 2, pts: 6752620734, ccData: 29296 }, - { type: 3, pts: 6752623737, ccData: 16930 }, - { type: 2, pts: 6752623737, ccData: 29289 }, - { type: 3, pts: 6752626740, ccData: 33314 }, - { type: 2, pts: 6752626740, ccData: 29541 }, - { type: 3, pts: 6752629743, ccData: 49698 }, - { type: 2, pts: 6752629743, ccData: 8448 }, - { type: 3, pts: 6752638752, ccData: 546 }, - { type: 2, pts: 6752638752, ccData: 35073 }, - { type: 3, pts: 6752767881, ccData: 16930 }, - { type: 2, pts: 6752767881, ccData: 35841 }, - { type: 3, pts: 6752872986, ccData: 35377 }, - { type: 2, pts: 6752872986, ccData: 38939 }, - { type: 2, pts: 6752872986, ccData: 16640 }, - { type: 2, pts: 6752872986, ccData: 31 }, - { type: 2, pts: 6752872986, ccData: 5264 }, - { type: 2, pts: 6752872986, ccData: 1283 }, - { type: 2, pts: 6752872986, ccData: 37162 }, - { type: 2, pts: 6752872986, ccData: 0 }, - { type: 2, pts: 6752872986, ccData: 37376 }, - { type: 2, pts: 6752872986, ccData: 0 }, - { type: 3, pts: 6752878992, ccData: 49698 }, - { type: 2, pts: 6752878992, ccData: 22373 }, - { type: 3, pts: 6752881995, ccData: 546 }, - { type: 2, pts: 6752881995, ccData: 27756 }, - { type: 3, pts: 6752884998, ccData: 16930 }, - { type: 2, pts: 6752884998, ccData: 11359 }, - { type: 3, pts: 6752888001, ccData: 33314 }, - { type: 2, pts: 6752888001, ccData: 26735 }, - { type: 3, pts: 6752891004, ccData: 49698 }, - { type: 2, pts: 6752891004, ccData: 30559 }, - { type: 3, pts: 6752894007, ccData: 546 }, - { type: 2, pts: 6752894007, ccData: 25705 }, - { type: 3, pts: 6752897010, ccData: 16930 }, - { type: 2, pts: 6752897010, ccData: 25695 }, - { type: 3, pts: 6752900013, ccData: 33314 }, - { type: 2, pts: 6752900013, ccData: 24927 }, - { type: 3, pts: 6752903016, ccData: 49698 }, - { type: 2, pts: 6752903016, ccData: 29552 }, - { type: 3, pts: 6752906019, ccData: 546 }, - { type: 2, pts: 6752906019, ccData: 24946 }, - { type: 3, pts: 6752909022, ccData: 16930 }, - { type: 2, pts: 6752909022, ccData: 27500 }, - { type: 3, pts: 6752912025, ccData: 33314 }, - { type: 2, pts: 6752912025, ccData: 25951 }, - { type: 3, pts: 6752915028, ccData: 49698 }, - { type: 2, pts: 6752915028, ccData: 28786 }, - { type: 3, pts: 6752918031, ccData: 546 }, - { type: 2, pts: 6752918031, ccData: 26990 }, - { type: 3, pts: 6752921034, ccData: 16930 }, - { type: 2, pts: 6752921034, ccData: 25445 }, - { type: 3, pts: 6752924037, ccData: 33314 }, - { type: 2, pts: 6752924037, ccData: 29555 }, - { type: 3, pts: 6752927040, ccData: 51761 }, - { type: 2, pts: 6752927040, ccData: 38939 }, - { type: 2, pts: 6752927040, ccData: 16640 }, - { type: 2, pts: 6752927040, ccData: 287 }, - { type: 2, pts: 6752927040, ccData: 4240 }, - { type: 2, pts: 6752927040, ccData: 1283 }, - { type: 2, pts: 6752927040, ccData: 37162 }, - { type: 2, pts: 6752927040, ccData: 0 }, - { type: 2, pts: 6752927040, ccData: 37377 }, - { type: 2, pts: 6752927040, ccData: 2048 }, - { type: 3, pts: 6752933046, ccData: 803 }, - { type: 2, pts: 6752933046, ccData: 37377 }, - { type: 2, pts: 6752933046, ccData: 2560 }, - { type: 3, pts: 6752939052, ccData: 16930 }, - { type: 2, pts: 6752939052, ccData: 26469 }, - { type: 3, pts: 6752942055, ccData: 33314 }, - { type: 2, pts: 6752942055, ccData: 29791 }, - { type: 3, pts: 6752945058, ccData: 49698 }, - { type: 2, pts: 6752945058, ccData: 26990 }, - { type: 3, pts: 6752948061, ccData: 546 }, - { type: 2, pts: 6752948061, ccData: 24424 }, - { type: 3, pts: 6752951064, ccData: 16930 }, - { type: 2, pts: 6752951064, ccData: 25970 }, - { type: 3, pts: 6752954067, ccData: 33314 }, - { type: 2, pts: 6752954067, ccData: 25919 }, - { type: 3, pts: 6752963076, ccData: 49698 }, - { type: 2, pts: 6752963076, ccData: 35073 }, - { type: 3, pts: 6753227340, ccData: 2609 }, - { type: 2, pts: 6753227340, ccData: 39195 }, - { type: 2, pts: 6753227340, ccData: 16640 }, - { type: 2, pts: 6753227340, ccData: 31 }, - { type: 2, pts: 6753227340, ccData: 5264 }, - { type: 2, pts: 6753227340, ccData: 1283 }, - { type: 2, pts: 6753227340, ccData: 37162 }, - { type: 2, pts: 6753227340, ccData: 42 }, - { type: 2, pts: 6753227340, ccData: 37376 }, - { type: 2, pts: 6753227340, ccData: 2048 }, - { type: 3, pts: 6753233346, ccData: 17187 }, - { type: 2, pts: 6753233346, ccData: 37376 }, - { type: 2, pts: 6753233346, ccData: 2816 }, - { type: 3, pts: 6753239352, ccData: 33314 }, - { type: 2, pts: 6753239352, ccData: 10343 }, - { type: 3, pts: 6753242355, ccData: 49698 }, - { type: 2, pts: 6753242355, ccData: 26983 }, - { type: 3, pts: 6753245358, ccData: 546 }, - { type: 2, pts: 6753245358, ccData: 26476 }, - { type: 3, pts: 6753248361, ccData: 16930 }, - { type: 2, pts: 6753248361, ccData: 25971 }, - { type: 3, pts: 6753251364, ccData: 33314 }, - { type: 2, pts: 6753251364, ccData: 10554 }, - { type: 3, pts: 6753254367, ccData: 51761 }, - { type: 2, pts: 6753254367, ccData: 39195 }, - { type: 2, pts: 6753254367, ccData: 16640 }, - { type: 2, pts: 6753254367, ccData: 287 }, - { type: 2, pts: 6753254367, ccData: 4240 }, - { type: 2, pts: 6753254367, ccData: 1283 }, - { type: 2, pts: 6753254367, ccData: 37162 }, - { type: 2, pts: 6753254367, ccData: 0 }, - { type: 2, pts: 6753254367, ccData: 37377 }, - { type: 2, pts: 6753254367, ccData: 2048 }, - { type: 3, pts: 6753260373, ccData: 546 }, - { type: 2, pts: 6753260373, ccData: 17505 }, - { type: 3, pts: 6753263376, ccData: 16930 }, - { type: 2, pts: 6753263376, ccData: 25700 }, - { type: 3, pts: 6753266379, ccData: 33314 }, - { type: 2, pts: 6753266379, ccData: 31020 }, - { type: 3, pts: 6753269382, ccData: 49698 }, - { type: 2, pts: 6753269382, ccData: 24425 }, - { type: 3, pts: 6753272385, ccData: 546 }, - { type: 2, pts: 6753272385, ccData: 29735 }, - { type: 3, pts: 6753275388, ccData: 16930 }, - { type: 2, pts: 6753275388, ccData: 29535 }, - { type: 3, pts: 6753278391, ccData: 33314 }, - { type: 2, pts: 6753278391, ccData: 28005 }, - { type: 3, pts: 6753281394, ccData: 49698 }, - { type: 2, pts: 6753281394, ccData: 8448 }, - { type: 3, pts: 6753284397, ccData: 546 }, - { type: 2, pts: 6753284397, ccData: 35841 }, - { type: 3, pts: 6753290403, ccData: 16930 }, - { type: 2, pts: 6753290403, ccData: 35074 }, - { type: 3, pts: 6753461574, ccData: 35377 }, - { type: 2, pts: 6753461574, ccData: 38939 }, - { type: 2, pts: 6753461574, ccData: 17920 }, - { type: 2, pts: 6753461574, ccData: 31 }, - { type: 2, pts: 6753461574, ccData: 5264 }, - { type: 2, pts: 6753461574, ccData: 1283 }, - { type: 2, pts: 6753461574, ccData: 37162 }, - { type: 2, pts: 6753461574, ccData: 42 }, - { type: 2, pts: 6753461574, ccData: 37376 }, - { type: 2, pts: 6753461574, ccData: 2048 }, - { type: 3, pts: 6753467580, ccData: 49955 }, - { type: 2, pts: 6753467580, ccData: 37376 }, - { type: 2, pts: 6753467580, ccData: 2304 }, - { type: 3, pts: 6753473586, ccData: 546 }, - { type: 2, pts: 6753473586, ccData: 20585 }, - { type: 3, pts: 6753476589, ccData: 16930 }, - { type: 2, pts: 6753476589, ccData: 28267 }, - { type: 3, pts: 6753479592, ccData: 33314 }, - { type: 2, pts: 6753479592, ccData: 24940 }, - { type: 3, pts: 6753482595, ccData: 49698 }, - { type: 2, pts: 6753482595, ccData: 26979 }, - { type: 3, pts: 6753485598, ccData: 546 }, - { type: 2, pts: 6753485598, ccData: 26991 }, - { type: 3, pts: 6753488601, ccData: 16930 }, - { type: 2, pts: 6753488601, ccData: 30067 }, - { type: 3, pts: 6753491604, ccData: 33314 }, - { type: 2, pts: 6753491604, ccData: 11776 }, - { type: 3, pts: 6753494607, ccData: 49698 }, - { type: 2, pts: 6753494607, ccData: 35842 }, - { type: 3, pts: 6753500613, ccData: 546 }, - { type: 2, pts: 6753500613, ccData: 35073 }, - { type: 3, pts: 6753593706, ccData: 18993 }, - { type: 2, pts: 6753593706, ccData: 39195 }, - { type: 2, pts: 6753593706, ccData: 17920 }, - { type: 2, pts: 6753593706, ccData: 31 }, - { type: 2, pts: 6753593706, ccData: 5264 }, - { type: 2, pts: 6753593706, ccData: 1283 }, - { type: 2, pts: 6753593706, ccData: 37162 }, - { type: 2, pts: 6753593706, ccData: 42 }, - { type: 2, pts: 6753593706, ccData: 37376 }, - { type: 2, pts: 6753593706, ccData: 1024 }, - { type: 3, pts: 6753599712, ccData: 33571 }, - { type: 2, pts: 6753599712, ccData: 37376 }, - { type: 2, pts: 6753599712, ccData: 1792 }, - { type: 3, pts: 6753605718, ccData: 49698 }, - { type: 2, pts: 6753605718, ccData: 22369 }, - { type: 3, pts: 6753608721, ccData: 546 }, - { type: 2, pts: 6753608721, ccData: 26996 }, - { type: 3, pts: 6753611724, ccData: 16930 }, - { type: 2, pts: 6753611724, ccData: 11776 }, - { type: 3, pts: 6753614727, ccData: 33314 }, - { type: 2, pts: 6753614727, ccData: 35841 }, - { type: 3, pts: 6753620733, ccData: 49698 }, - { type: 2, pts: 6753620733, ccData: 35074 }, - { type: 3, pts: 6753662775, ccData: 2609 }, - { type: 2, pts: 6753662775, ccData: 38939 }, - { type: 2, pts: 6753662775, ccData: 16640 }, - { type: 2, pts: 6753662775, ccData: 31 }, - { type: 2, pts: 6753662775, ccData: 5264 }, - { type: 2, pts: 6753662775, ccData: 1283 }, - { type: 2, pts: 6753662775, ccData: 37162 }, - { type: 2, pts: 6753662775, ccData: 42 }, - { type: 2, pts: 6753662775, ccData: 37376 }, - { type: 2, pts: 6753662775, ccData: 0 }, - { type: 3, pts: 6753668781, ccData: 17187 }, - { type: 2, pts: 6753668781, ccData: 37376 }, - { type: 2, pts: 6753668781, ccData: 256 }, - { type: 3, pts: 6753674787, ccData: 33314 }, - { type: 2, pts: 6753674787, ccData: 18543 }, - { type: 3, pts: 6753677790, ccData: 49698 }, - { type: 2, pts: 6753677790, ccData: 30559 }, - { type: 3, pts: 6753680793, ccData: 546 }, - { type: 2, pts: 6753680793, ccData: 25705 }, - { type: 3, pts: 6753683796, ccData: 16930 }, - { type: 2, pts: 6753683796, ccData: 25695 }, - { type: 3, pts: 6753686799, ccData: 33314 }, - { type: 2, pts: 6753686799, ccData: 31087 }, - { type: 3, pts: 6753689802, ccData: 49698 }, - { type: 2, pts: 6753689802, ccData: 30066 }, - { type: 3, pts: 6753692805, ccData: 546 }, - { type: 2, pts: 6753692805, ccData: 24424 }, - { type: 3, pts: 6753695808, ccData: 16930 }, - { type: 2, pts: 6753695808, ccData: 24937 }, - { type: 3, pts: 6753698811, ccData: 33314 }, - { type: 2, pts: 6753698811, ccData: 29279 }, - { type: 3, pts: 6753701814, ccData: 49698 }, - { type: 2, pts: 6753701814, ccData: 26469 }, - { type: 3, pts: 6753704817, ccData: 546 }, - { type: 2, pts: 6753704817, ccData: 29696 }, - { type: 3, pts: 6753707820, ccData: 18993 }, - { type: 2, pts: 6753707820, ccData: 38939 }, - { type: 2, pts: 6753707820, ccData: 16640 }, - { type: 2, pts: 6753707820, ccData: 287 }, - { type: 2, pts: 6753707820, ccData: 4240 }, - { type: 2, pts: 6753707820, ccData: 1283 }, - { type: 2, pts: 6753707820, ccData: 37162 }, - { type: 2, pts: 6753707820, ccData: 0 }, - { type: 2, pts: 6753707820, ccData: 37377 }, - { type: 2, pts: 6753707820, ccData: 0 }, - { type: 3, pts: 6753713826, ccData: 33571 }, - { type: 2, pts: 6753713826, ccData: 37377 }, - { type: 2, pts: 6753713826, ccData: 256 }, - { type: 3, pts: 6753719832, ccData: 49698 }, - { type: 2, pts: 6753719832, ccData: 29551 }, - { type: 3, pts: 6753722835, ccData: 546 }, - { type: 2, pts: 6753722835, ccData: 24428 }, - { type: 3, pts: 6753725838, ccData: 16930 }, - { type: 2, pts: 6753725838, ccData: 28526 }, - { type: 3, pts: 6753728841, ccData: 33314 }, - { type: 2, pts: 6753728841, ccData: 26431 }, - { type: 3, pts: 6753731844, ccData: 49698 }, - { type: 2, pts: 6753731844, ccData: 35842 }, - { type: 3, pts: 6753737850, ccData: 546 }, - { type: 2, pts: 6753737850, ccData: 35073 }, - { type: 3, pts: 6753872985, ccData: 18993 }, - { type: 2, pts: 6753872985, ccData: 39195 }, - { type: 2, pts: 6753872985, ccData: 17920 }, - { type: 2, pts: 6753872985, ccData: 31 }, - { type: 2, pts: 6753872985, ccData: 5264 }, - { type: 2, pts: 6753872985, ccData: 1283 }, - { type: 2, pts: 6753872985, ccData: 37162 }, - { type: 2, pts: 6753872985, ccData: 42 }, - { type: 2, pts: 6753872985, ccData: 37376 }, - { type: 2, pts: 6753872985, ccData: 0 }, - { type: 3, pts: 6753878991, ccData: 33571 }, - { type: 2, pts: 6753878991, ccData: 37376 }, - { type: 2, pts: 6753878991, ccData: 768 }, - { type: 3, pts: 6753884997, ccData: 49698 }, - { type: 2, pts: 6753884997, ccData: 18783 }, - { type: 3, pts: 6753888000, ccData: 546 }, - { type: 2, pts: 6753888000, ccData: 30565 }, - { type: 3, pts: 6753891003, ccData: 16930 }, - { type: 2, pts: 6753891003, ccData: 28276 }, - { type: 3, pts: 6753894006, ccData: 33314 }, - { type: 2, pts: 6753894006, ccData: 24436 }, - { type: 3, pts: 6753897009, ccData: 49698 }, - { type: 2, pts: 6753897009, ccData: 28511 }, - { type: 3, pts: 6753900012, ccData: 546 }, - { type: 2, pts: 6753900012, ccData: 29800 }, - { type: 3, pts: 6753903015, ccData: 16930 }, - { type: 2, pts: 6753903015, ccData: 25951 }, - { type: 3, pts: 6753906018, ccData: 33314 }, - { type: 2, pts: 6753906018, ccData: 17522 }, - { type: 3, pts: 6753909021, ccData: 49698 }, - { type: 2, pts: 6753909021, ccData: 25953 }, - { type: 3, pts: 6753912024, ccData: 546 }, - { type: 2, pts: 6753912024, ccData: 27999 }, - { type: 3, pts: 6753915027, ccData: 16930 }, - { type: 2, pts: 6753915027, ccData: 21345 }, - { type: 3, pts: 6753918030, ccData: 33314 }, - { type: 2, pts: 6753918030, ccData: 27759 }, - { type: 3, pts: 6753921033, ccData: 49698 }, - { type: 2, pts: 6753921033, ccData: 28206 }, - { type: 3, pts: 6753924036, ccData: 546 }, - { type: 2, pts: 6753924036, ccData: 35841 }, - { type: 3, pts: 6753930042, ccData: 16930 }, - { type: 2, pts: 6753930042, ccData: 35074 }, - { type: 3, pts: 6754065177, ccData: 35377 }, - { type: 2, pts: 6754065177, ccData: 38939 }, - { type: 2, pts: 6754065177, ccData: 16640 }, - { type: 2, pts: 6754065177, ccData: 31 }, - { type: 2, pts: 6754065177, ccData: 5264 }, - { type: 2, pts: 6754065177, ccData: 1283 }, - { type: 2, pts: 6754065177, ccData: 37162 }, - { type: 2, pts: 6754065177, ccData: 42 }, - { type: 2, pts: 6754065177, ccData: 37376 }, - { type: 2, pts: 6754065177, ccData: 0 }, - { type: 3, pts: 6754071183, ccData: 49955 }, - { type: 2, pts: 6754071183, ccData: 37376 }, - { type: 2, pts: 6754071183, ccData: 768 }, - { type: 3, pts: 6754077189, ccData: 546 }, - { type: 2, pts: 6754077189, ccData: 22895 }, - { type: 3, pts: 6754080192, ccData: 16930 }, - { type: 2, pts: 6754080192, ccData: 30047 }, - { type: 3, pts: 6754083195, ccData: 33314 }, - { type: 2, pts: 6754083195, ccData: 25441 }, - { type: 3, pts: 6754086198, ccData: 49698 }, - { type: 2, pts: 6754086198, ccData: 28255 }, - { type: 3, pts: 6754089201, ccData: 546 }, - { type: 2, pts: 6754089201, ccData: 26721 }, - { type: 3, pts: 6754092204, ccData: 16930 }, - { type: 2, pts: 6754092204, ccData: 30309 }, - { type: 3, pts: 6754095207, ccData: 33314 }, - { type: 2, pts: 6754095207, ccData: 24417 }, - { type: 3, pts: 6754098210, ccData: 49698 }, - { type: 2, pts: 6754098210, ccData: 28281 }, - { type: 3, pts: 6754101213, ccData: 546 }, - { type: 2, pts: 6754101213, ccData: 24424 }, - { type: 3, pts: 6754104216, ccData: 16930 }, - { type: 2, pts: 6754104216, ccData: 24937 }, - { type: 3, pts: 6754107219, ccData: 33314 }, - { type: 2, pts: 6754107219, ccData: 29299 }, - { type: 3, pts: 6754110222, ccData: 49698 }, - { type: 2, pts: 6754110222, ccData: 29817 }, - { type: 3, pts: 6754113225, ccData: 546 }, - { type: 2, pts: 6754113225, ccData: 27749 }, - { type: 3, pts: 6754116228, ccData: 18993 }, - { type: 2, pts: 6754116228, ccData: 38939 }, - { type: 2, pts: 6754116228, ccData: 16640 }, - { type: 2, pts: 6754116228, ccData: 287 }, - { type: 2, pts: 6754116228, ccData: 4240 }, - { type: 2, pts: 6754116228, ccData: 1283 }, - { type: 2, pts: 6754116228, ccData: 37162 }, - { type: 2, pts: 6754116228, ccData: 0 }, - { type: 2, pts: 6754116228, ccData: 37377 }, - { type: 2, pts: 6754116228, ccData: 0 }, - { type: 3, pts: 6754122234, ccData: 33571 }, - { type: 2, pts: 6754122234, ccData: 37377 }, - { type: 2, pts: 6754122234, ccData: 768 }, - { type: 3, pts: 6754128240, ccData: 49698 }, - { type: 2, pts: 6754128240, ccData: 31087 }, - { type: 3, pts: 6754131243, ccData: 546 }, - { type: 2, pts: 6754131243, ccData: 30047 }, - { type: 3, pts: 6754134246, ccData: 16930 }, - { type: 2, pts: 6754134246, ccData: 25714 }, - { type: 3, pts: 6754137249, ccData: 33314 }, - { type: 2, pts: 6754137249, ccData: 25953 }, - { type: 3, pts: 6754140252, ccData: 49698 }, - { type: 2, pts: 6754140252, ccData: 27999 }, - { type: 3, pts: 6754143255, ccData: 546 }, - { type: 2, pts: 6754143255, ccData: 28518 }, - { type: 3, pts: 6754146258, ccData: 16930 }, - { type: 2, pts: 6754146258, ccData: 11776 }, - { type: 3, pts: 6754149261, ccData: 33314 }, - { type: 2, pts: 6754149261, ccData: 35842 }, - { type: 3, pts: 6754155267, ccData: 49698 }, - { type: 2, pts: 6754155267, ccData: 35073 }, - { type: 3, pts: 6754353465, ccData: 2609 }, - { type: 2, pts: 6754353465, ccData: 39195 }, - { type: 2, pts: 6754353465, ccData: 17920 }, - { type: 2, pts: 6754353465, ccData: 31 }, - { type: 2, pts: 6754353465, ccData: 5264 }, - { type: 2, pts: 6754353465, ccData: 1283 }, - { type: 2, pts: 6754353465, ccData: 37162 }, - { type: 2, pts: 6754353465, ccData: 42 }, - { type: 2, pts: 6754353465, ccData: 37376 }, - { type: 2, pts: 6754353465, ccData: 6144 }, - { type: 3, pts: 6754359471, ccData: 17187 }, - { type: 2, pts: 6754359471, ccData: 37376 }, - { type: 2, pts: 6754359471, ccData: 6400 }, - { type: 3, pts: 6754365477, ccData: 33314 }, - { type: 2, pts: 6754365477, ccData: 16750 }, - { type: 3, pts: 6754368480, ccData: 49698 }, - { type: 2, pts: 6754368480, ccData: 25695 }, - { type: 3, pts: 6754371483, ccData: 546 }, - { type: 2, pts: 6754371483, ccData: 28271 }, - { type: 3, pts: 6754374486, ccData: 16930 }, - { type: 2, pts: 6754374486, ccData: 30464 }, - { type: 3, pts: 6754377489, ccData: 33314 }, - { type: 2, pts: 6754377489, ccData: 35841 }, - { type: 3, pts: 6754383495, ccData: 49698 }, - { type: 2, pts: 6754383495, ccData: 35074 }, - { type: 3, pts: 6754401513, ccData: 2609 }, - { type: 2, pts: 6754401513, ccData: 38939 }, - { type: 2, pts: 6754401513, ccData: 16640 }, - { type: 2, pts: 6754401513, ccData: 31 }, - { type: 2, pts: 6754401513, ccData: 5264 }, - { type: 2, pts: 6754401513, ccData: 1283 }, - { type: 2, pts: 6754401513, ccData: 37162 }, - { type: 2, pts: 6754401513, ccData: 42 }, - { type: 2, pts: 6754401513, ccData: 37376 }, - { type: 2, pts: 6754401513, ccData: 2048 }, - { type: 3, pts: 6754407519, ccData: 17187 }, - { type: 2, pts: 6754407519, ccData: 37376 }, - { type: 2, pts: 6754407519, ccData: 2560 }, - { type: 3, pts: 6754413525, ccData: 33314 }, - { type: 2, pts: 6754413525, ccData: 31087 }, - { type: 3, pts: 6754416528, ccData: 49698 }, - { type: 2, pts: 6754416528, ccData: 30047 }, - { type: 3, pts: 6754419531, ccData: 546 }, - { type: 2, pts: 6754419531, ccData: 25441 }, - { type: 3, pts: 6754422534, ccData: 16930 }, - { type: 2, pts: 6754422534, ccData: 28255 }, - { type: 3, pts: 6754425537, ccData: 33314 }, - { type: 2, pts: 6754425537, ccData: 26721 }, - { type: 3, pts: 6754428540, ccData: 49698 }, - { type: 2, pts: 6754428540, ccData: 30309 }, - { type: 3, pts: 6754431543, ccData: 546 }, - { type: 2, pts: 6754431543, ccData: 24436 }, - { type: 3, pts: 6754434546, ccData: 16930 }, - { type: 2, pts: 6754434546, ccData: 26725 }, - { type: 3, pts: 6754437549, ccData: 33314 }, - { type: 2, pts: 6754437549, ccData: 24428 }, - { type: 3, pts: 6754440552, ccData: 49698 }, - { type: 2, pts: 6754440552, ccData: 30062 }, - { type: 3, pts: 6754443555, ccData: 546 }, - { type: 2, pts: 6754443555, ccData: 25448 }, - { type: 3, pts: 6754446558, ccData: 18993 }, - { type: 2, pts: 6754446558, ccData: 38939 }, - { type: 2, pts: 6754446558, ccData: 16640 }, - { type: 2, pts: 6754446558, ccData: 287 }, - { type: 2, pts: 6754446558, ccData: 4240 }, - { type: 2, pts: 6754446558, ccData: 1283 }, - { type: 2, pts: 6754446558, ccData: 37162 }, - { type: 2, pts: 6754446558, ccData: 0 }, - { type: 2, pts: 6754446558, ccData: 37377 }, - { type: 2, pts: 6754446558, ccData: 1024 }, - { type: 3, pts: 6754452564, ccData: 33314 }, - { type: 2, pts: 6754452564, ccData: 31087 }, - { type: 3, pts: 6754455567, ccData: 49698 }, - { type: 2, pts: 6754455567, ccData: 29991 }, - { type: 3, pts: 6754458570, ccData: 546 }, - { type: 2, pts: 6754458570, ccData: 30309 }, - { type: 3, pts: 6754461573, ccData: 16930 }, - { type: 2, pts: 6754461573, ccData: 24418 }, - { type: 3, pts: 6754464576, ccData: 33314 }, - { type: 2, pts: 6754464576, ccData: 25957 }, - { type: 3, pts: 6754467579, ccData: 49698 }, - { type: 2, pts: 6754467579, ccData: 28255 }, - { type: 3, pts: 6754470582, ccData: 546 }, - { type: 2, pts: 6754470582, ccData: 25714 }, - { type: 3, pts: 6754473585, ccData: 16930 }, - { type: 2, pts: 6754473585, ccData: 25953 }, - { type: 3, pts: 6754476588, ccData: 33314 }, - { type: 2, pts: 6754476588, ccData: 28009 }, - { type: 3, pts: 6754479591, ccData: 49698 }, - { type: 2, pts: 6754479591, ccData: 28263 }, - { type: 3, pts: 6754482594, ccData: 546 }, - { type: 2, pts: 6754482594, ccData: 24431 }, - { type: 3, pts: 6754485597, ccData: 16930 }, - { type: 2, pts: 6754485597, ccData: 26207 }, - { type: 3, pts: 6754488600, ccData: 33314 }, - { type: 2, pts: 6754488600, ccData: 29807 }, - { type: 3, pts: 6754491603, ccData: 49698 }, - { type: 2, pts: 6754491603, ccData: 28462 }, - { type: 3, pts: 6754494606, ccData: 546 }, - { type: 2, pts: 6754494606, ccData: 35842 }, - { type: 3, pts: 6754500612, ccData: 16930 }, - { type: 2, pts: 6754500612, ccData: 35073 }, - { type: 3, pts: 6754728840, ccData: 35377 }, - { type: 2, pts: 6754728840, ccData: 39195 }, - { type: 2, pts: 6754728840, ccData: 17920 }, - { type: 2, pts: 6754728840, ccData: 31 }, - { type: 2, pts: 6754728840, ccData: 5264 }, - { type: 2, pts: 6754728840, ccData: 1283 }, - { type: 2, pts: 6754728840, ccData: 37162 }, - { type: 2, pts: 6754728840, ccData: 42 }, - { type: 2, pts: 6754728840, ccData: 37376 }, - { type: 2, pts: 6754728840, ccData: 3072 }, - { type: 3, pts: 6754734846, ccData: 49955 }, - { type: 2, pts: 6754734846, ccData: 37376 }, - { type: 2, pts: 6754734846, ccData: 3328 }, - { type: 3, pts: 6754740852, ccData: 546 }, - { type: 2, pts: 6754740852, ccData: 21601 }, - { type: 3, pts: 6754743855, ccData: 16930 }, - { type: 2, pts: 6754743855, ccData: 11620 }, - { type: 3, pts: 6754746858, ccData: 33314 }, - { type: 2, pts: 6754746858, ccData: 24865 }, - { type: 3, pts: 6754749861, ccData: 49698 }, - { type: 2, pts: 6754749861, ccData: 35841 }, - { type: 3, pts: 6754755867, ccData: 546 }, - { type: 2, pts: 6754755867, ccData: 35074 }, - { type: 3, pts: 6754839951, ccData: 18993 }, - { type: 2, pts: 6754839951, ccData: 38939 }, - { type: 2, pts: 6754839951, ccData: 17920 }, - { type: 2, pts: 6754839951, ccData: 31 }, - { type: 2, pts: 6754839951, ccData: 5264 }, - { type: 2, pts: 6754839951, ccData: 1283 }, - { type: 2, pts: 6754839951, ccData: 37162 }, - { type: 2, pts: 6754839951, ccData: 42 }, - { type: 2, pts: 6754839951, ccData: 37376 }, - { type: 2, pts: 6754839951, ccData: 1024 }, - { type: 3, pts: 6754845957, ccData: 33314 }, - { type: 2, pts: 6754845957, ccData: 21360 }, - { type: 3, pts: 6754848960, ccData: 49698 }, - { type: 2, pts: 6754848960, ccData: 24935 }, - { type: 3, pts: 6754851963, ccData: 546 }, - { type: 2, pts: 6754851963, ccData: 26725 }, - { type: 3, pts: 6754854966, ccData: 16930 }, - { type: 2, pts: 6754854966, ccData: 29812 }, - { type: 3, pts: 6754857969, ccData: 33314 }, - { type: 2, pts: 6754857969, ccData: 26975 }, - { type: 3, pts: 6754860972, ccData: 49698 }, - { type: 2, pts: 6754860972, ccData: 24942 }, - { type: 3, pts: 6754863975, ccData: 546 }, - { type: 2, pts: 6754863975, ccData: 25695 }, - { type: 3, pts: 6754866978, ccData: 16930 }, - { type: 2, pts: 6754866978, ccData: 28005 }, - { type: 3, pts: 6754869981, ccData: 33314 }, - { type: 2, pts: 6754869981, ccData: 24948 }, - { type: 3, pts: 6754872984, ccData: 49698 }, - { type: 2, pts: 6754872984, ccData: 25185 }, - { type: 3, pts: 6754875987, ccData: 546 }, - { type: 2, pts: 6754875987, ccData: 27756 }, - { type: 3, pts: 6754878990, ccData: 16930 }, - { type: 2, pts: 6754878990, ccData: 29486 }, - { type: 3, pts: 6754881993, ccData: 33314 }, - { type: 2, pts: 6754881993, ccData: 35842 }, - { type: 3, pts: 6754887999, ccData: 49698 }, - { type: 2, pts: 6754887999, ccData: 35073 }, - { type: 3, pts: 6755053164, ccData: 2609 }, - { type: 2, pts: 6755053164, ccData: 39195 }, - { type: 2, pts: 6755053164, ccData: 17920 }, - { type: 2, pts: 6755053164, ccData: 31 }, - { type: 2, pts: 6755053164, ccData: 5264 }, - { type: 2, pts: 6755053164, ccData: 1283 }, - { type: 2, pts: 6755053164, ccData: 37162 }, - { type: 2, pts: 6755053164, ccData: 42 }, - { type: 2, pts: 6755053164, ccData: 37376 }, - { type: 2, pts: 6755053164, ccData: 2048 }, - { type: 3, pts: 6755059170, ccData: 17187 }, - { type: 2, pts: 6755059170, ccData: 37376 }, - { type: 2, pts: 6755059170, ccData: 2560 }, - { type: 3, pts: 6755065176, ccData: 33314 }, - { type: 2, pts: 6755065176, ccData: 19833 }, - { type: 3, pts: 6755068179, ccData: 49698 }, - { type: 2, pts: 6755068179, ccData: 24422 }, - { type: 3, pts: 6755071182, ccData: 546 }, - { type: 2, pts: 6755071182, ccData: 24950 }, - { type: 3, pts: 6755074185, ccData: 16930 }, - { type: 2, pts: 6755074185, ccData: 28530 }, - { type: 3, pts: 6755077188, ccData: 33314 }, - { type: 2, pts: 6755077188, ccData: 26996 }, - { type: 3, pts: 6755080191, ccData: 49698 }, - { type: 2, pts: 6755080191, ccData: 25889 }, - { type: 3, pts: 6755083194, ccData: 546 }, - { type: 2, pts: 6755083194, ccData: 35841 }, - { type: 3, pts: 6755089200, ccData: 16930 }, - { type: 2, pts: 6755089200, ccData: 35074 }, - { type: 3, pts: 6755203314, ccData: 35377 }, - { type: 2, pts: 6755203314, ccData: 38939 }, - { type: 2, pts: 6755203314, ccData: 17920 }, - { type: 2, pts: 6755203314, ccData: 31 }, - { type: 2, pts: 6755203314, ccData: 5264 }, - { type: 2, pts: 6755203314, ccData: 1283 }, - { type: 2, pts: 6755203314, ccData: 37162 }, - { type: 2, pts: 6755203314, ccData: 42 }, - { type: 2, pts: 6755203314, ccData: 37376 }, - { type: 2, pts: 6755203314, ccData: 2048 }, - { type: 3, pts: 6755209320, ccData: 49955 }, - { type: 2, pts: 6755209320, ccData: 37376 }, - { type: 2, pts: 6755209320, ccData: 2560 }, - { type: 3, pts: 6755215326, ccData: 546 }, - { type: 2, pts: 6755215326, ccData: 18529 }, - { type: 3, pts: 6755218329, ccData: 16930 }, - { type: 2, pts: 6755218329, ccData: 30309 }, - { type: 3, pts: 6755221332, ccData: 33314 }, - { type: 2, pts: 6755221332, ccData: 24417 }, - { type: 3, pts: 6755224335, ccData: 49698 }, - { type: 2, pts: 6755224335, ccData: 24435 }, - { type: 3, pts: 6755227338, ccData: 546 }, - { type: 2, pts: 6755227338, ccData: 25953 }, - { type: 3, pts: 6755230341, ccData: 16930 }, - { type: 2, pts: 6755230341, ccData: 29742 }, - { type: 3, pts: 6755233344, ccData: 33314 }, - { type: 2, pts: 6755233344, ccData: 35842 }, - { type: 3, pts: 6755239350, ccData: 49698 }, - { type: 2, pts: 6755239350, ccData: 35073 }, - { type: 3, pts: 6755350461, ccData: 546 }, - { type: 2, pts: 6755350461, ccData: 35841 }, - { type: 3, pts: 6755644755, ccData: 18993 }, - { type: 2, pts: 6755644755, ccData: 38939 }, - { type: 2, pts: 6755644755, ccData: 17920 }, - { type: 2, pts: 6755644755, ccData: 31 }, - { type: 2, pts: 6755644755, ccData: 5264 }, - { type: 2, pts: 6755644755, ccData: 1283 }, - { type: 2, pts: 6755644755, ccData: 37162 }, - { type: 2, pts: 6755644755, ccData: 0 }, - { type: 2, pts: 6755644755, ccData: 37376 }, - { type: 2, pts: 6755644755, ccData: 3072 }, - { type: 3, pts: 6755650761, ccData: 33314 }, - { type: 2, pts: 6755650761, ccData: 10343 }, - { type: 3, pts: 6755653764, ccData: 49698 }, - { type: 2, pts: 6755653764, ccData: 29295 }, - { type: 3, pts: 6755656767, ccData: 546 }, - { type: 2, pts: 6755656767, ccData: 24942 }, - { type: 3, pts: 6755659770, ccData: 16930 }, - { type: 2, pts: 6755659770, ccData: 29481 }, - { type: 3, pts: 6755668779, ccData: 33314 }, - { type: 2, pts: 6755668779, ccData: 35073 }, - { type: 3, pts: 6755773884, ccData: 49698 }, - { type: 2, pts: 6755773884, ccData: 35841 }, - { type: 3, pts: 6755872983, ccData: 2609 }, - { type: 2, pts: 6755872983, ccData: 38939 }, - { type: 2, pts: 6755872983, ccData: 0 }, - { type: 2, pts: 6755872983, ccData: 31 }, - { type: 2, pts: 6755872983, ccData: 5264 }, - { type: 2, pts: 6755872983, ccData: 1283 }, - { type: 2, pts: 6755872983, ccData: 37162 }, - { type: 2, pts: 6755872983, ccData: 0 }, - { type: 2, pts: 6755872983, ccData: 37376 }, - { type: 2, pts: 6755872983, ccData: 3072 }, - { type: 3, pts: 6755875986, ccData: 17187 }, - { type: 2, pts: 6755875986, ccData: 37376 }, - { type: 2, pts: 6755875986, ccData: 3584 }, - { type: 3, pts: 6755881992, ccData: 33314 }, - { type: 2, pts: 6755881992, ccData: 21864 }, - { type: 3, pts: 6755884995, ccData: 49698 }, - { type: 2, pts: 6755884995, ccData: 11359 }, - { type: 3, pts: 6755887998, ccData: 546 }, - { type: 2, pts: 6755887998, ccData: 17505 }, - { type: 3, pts: 6755891001, ccData: 16930 }, - { type: 2, pts: 6755891001, ccData: 25700 }, - { type: 3, pts: 6755894004, ccData: 33314 }, - { type: 2, pts: 6755894004, ccData: 31022 }, - { type: 3, pts: 6755903013, ccData: 49698 }, - { type: 2, pts: 6755903013, ccData: 35073 }, - { type: 3, pts: 6756008118, ccData: 2609 }, - { type: 2, pts: 6756008118, ccData: 39195 }, - { type: 2, pts: 6756008118, ccData: 0 }, - { type: 2, pts: 6756008118, ccData: 31 }, - { type: 2, pts: 6756008118, ccData: 5264 }, - { type: 2, pts: 6756008118, ccData: 1283 }, - { type: 2, pts: 6756008118, ccData: 37162 }, - { type: 2, pts: 6756008118, ccData: 42 }, - { type: 2, pts: 6756008118, ccData: 37376 }, - { type: 2, pts: 6756008118, ccData: 3072 }, - { type: 3, pts: 6756011121, ccData: 17187 }, - { type: 2, pts: 6756011121, ccData: 37376 }, - { type: 2, pts: 6756011121, ccData: 3328 }, - { type: 3, pts: 6756017127, ccData: 33314 }, - { type: 2, pts: 6756017127, ccData: 22895 }, - { type: 3, pts: 6756020130, ccData: 49698 }, - { type: 2, pts: 6756020130, ccData: 29991 }, - { type: 3, pts: 6756023133, ccData: 546 }, - { type: 2, pts: 6756023133, ccData: 29285 }, - { type: 3, pts: 6756026136, ccData: 16930 }, - { type: 2, pts: 6756026136, ccData: 24435 }, - { type: 3, pts: 6756029139, ccData: 33314 }, - { type: 2, pts: 6756029139, ccData: 29793 }, - { type: 3, pts: 6756032142, ccData: 49698 }, - { type: 2, pts: 6756032142, ccData: 28260 }, - { type: 3, pts: 6756035145, ccData: 546 }, - { type: 2, pts: 6756035145, ccData: 26990 }, - { type: 3, pts: 6756038148, ccData: 16930 }, - { type: 2, pts: 6756038148, ccData: 26368 }, - { type: 3, pts: 6756041151, ccData: 35377 }, - { type: 2, pts: 6756041151, ccData: 39195 }, - { type: 2, pts: 6756041151, ccData: 0 }, - { type: 2, pts: 6756041151, ccData: 287 }, - { type: 2, pts: 6756041151, ccData: 4240 }, - { type: 2, pts: 6756041151, ccData: 1283 }, - { type: 2, pts: 6756041151, ccData: 37162 }, - { type: 2, pts: 6756041151, ccData: 0 }, - { type: 2, pts: 6756041151, ccData: 37377 }, - { type: 2, pts: 6756041151, ccData: 4096 }, - { type: 3, pts: 6756044154, ccData: 49955 }, - { type: 2, pts: 6756044154, ccData: 37377 }, - { type: 2, pts: 6756044154, ccData: 4352 }, - { type: 3, pts: 6756050160, ccData: 546 }, - { type: 2, pts: 6756050160, ccData: 28526 }, - { type: 3, pts: 6756053163, ccData: 16930 }, - { type: 2, pts: 6756053163, ccData: 24429 }, - { type: 3, pts: 6756056166, ccData: 33314 }, - { type: 2, pts: 6756056166, ccData: 31071 }, - { type: 3, pts: 6756059169, ccData: 49698 }, - { type: 2, pts: 6756059169, ccData: 26721 }, - { type: 3, pts: 6756062172, ccData: 546 }, - { type: 2, pts: 6756062172, ccData: 26994 }, - { type: 3, pts: 6756065175, ccData: 16930 }, - { type: 2, pts: 6756065175, ccData: 11776 }, - { type: 3, pts: 6756068178, ccData: 33314 }, - { type: 2, pts: 6756068178, ccData: 35841 }, - { type: 3, pts: 6756074184, ccData: 49698 }, - { type: 2, pts: 6756074184, ccData: 35074 }, - { type: 3, pts: 6756170280, ccData: 2609 }, - { type: 2, pts: 6756170280, ccData: 38939 }, - { type: 2, pts: 6756170280, ccData: 0 }, - { type: 2, pts: 6756170280, ccData: 31 }, - { type: 2, pts: 6756170280, ccData: 5264 }, - { type: 2, pts: 6756170280, ccData: 1283 }, - { type: 2, pts: 6756170280, ccData: 37162 }, - { type: 2, pts: 6756170280, ccData: 42 }, - { type: 2, pts: 6756170280, ccData: 37376 }, - { type: 2, pts: 6756170280, ccData: 1024 }, - { type: 3, pts: 6756173283, ccData: 17187 }, - { type: 2, pts: 6756173283, ccData: 37376 }, - { type: 2, pts: 6756173283, ccData: 1536 }, - { type: 3, pts: 6756179289, ccData: 33314 }, - { type: 2, pts: 6756179289, ccData: 10339 }, - { type: 3, pts: 6756182292, ccData: 49698 }, - { type: 2, pts: 6756182292, ccData: 26741 }, - { type: 3, pts: 6756185295, ccData: 546 }, - { type: 2, pts: 6756185295, ccData: 25451 }, - { type: 3, pts: 6756188298, ccData: 16930 }, - { type: 2, pts: 6756188298, ccData: 27749 }, - { type: 3, pts: 6756191301, ccData: 33314 }, - { type: 2, pts: 6756191301, ccData: 29481 }, - { type: 3, pts: 6756194304, ccData: 49698 }, - { type: 2, pts: 6756194304, ccData: 14848 }, - { type: 3, pts: 6756197307, ccData: 2609 }, - { type: 2, pts: 6756197307, ccData: 38939 }, - { type: 2, pts: 6756197307, ccData: 0 }, - { type: 2, pts: 6756197307, ccData: 287 }, - { type: 2, pts: 6756197307, ccData: 4240 }, - { type: 2, pts: 6756197307, ccData: 1283 }, - { type: 2, pts: 6756197307, ccData: 37162 }, - { type: 2, pts: 6756197307, ccData: 0 }, - { type: 2, pts: 6756197307, ccData: 37377 }, - { type: 2, pts: 6756197307, ccData: 1024 }, - { type: 3, pts: 6756200310, ccData: 17187 }, - { type: 2, pts: 6756200310, ccData: 37377 }, - { type: 2, pts: 6756200310, ccData: 1536 }, - { type: 3, pts: 6756206316, ccData: 33314 }, - { type: 2, pts: 6756206316, ccData: 20335 }, - { type: 3, pts: 6756209319, ccData: 49698 }, - { type: 2, pts: 6756209319, ccData: 28787 }, - { type: 3, pts: 6756212322, ccData: 546 }, - { type: 2, pts: 6756212322, ccData: 8448 }, - { type: 3, pts: 6756215325, ccData: 16930 }, - { type: 2, pts: 6756215325, ccData: 35842 }, - { type: 3, pts: 6756221331, ccData: 33314 }, - { type: 2, pts: 6756221331, ccData: 35073 }, - { type: 3, pts: 6756329439, ccData: 51761 }, - { type: 2, pts: 6756329439, ccData: 39195 }, - { type: 2, pts: 6756329439, ccData: 0 }, - { type: 2, pts: 6756329439, ccData: 31 }, - { type: 2, pts: 6756329439, ccData: 5264 }, - { type: 2, pts: 6756329439, ccData: 1283 }, - { type: 2, pts: 6756329439, ccData: 37162 }, - { type: 2, pts: 6756329439, ccData: 42 }, - { type: 2, pts: 6756329439, ccData: 37376 }, - { type: 2, pts: 6756329439, ccData: 0 }, - { type: 3, pts: 6756332442, ccData: 546 }, - { type: 2, pts: 6756332442, ccData: 21359 }, - { type: 3, pts: 6756335445, ccData: 16930 }, - { type: 2, pts: 6756335445, ccData: 29298 }, - { type: 3, pts: 6756338448, ccData: 33314 }, - { type: 2, pts: 6756338448, ccData: 31022 }, - { type: 3, pts: 6756341451, ccData: 51761 }, - { type: 2, pts: 6756341451, ccData: 39195 }, - { type: 2, pts: 6756341451, ccData: 0 }, - { type: 2, pts: 6756341451, ccData: 543 }, - { type: 2, pts: 6756341451, ccData: 4240 }, - { type: 2, pts: 6756341451, ccData: 1283 }, - { type: 2, pts: 6756341451, ccData: 37162 }, - { type: 2, pts: 6756341451, ccData: 0 }, - { type: 2, pts: 6756341451, ccData: 37378 }, - { type: 2, pts: 6756341451, ccData: 2048 }, - { type: 3, pts: 6756347457, ccData: 546 }, - { type: 2, pts: 6756347457, ccData: 10337 }, - { type: 3, pts: 6756350460, ccData: 16930 }, - { type: 2, pts: 6756350460, ccData: 27756 }, - { type: 3, pts: 6756353463, ccData: 33314 }, - { type: 2, pts: 6756353463, ccData: 24419 }, - { type: 3, pts: 6756356466, ccData: 49698 }, - { type: 2, pts: 6756356466, ccData: 26741 }, - { type: 3, pts: 6756359469, ccData: 546 }, - { type: 2, pts: 6756359469, ccData: 25451 }, - { type: 3, pts: 6756362472, ccData: 16930 }, - { type: 2, pts: 6756362472, ccData: 27753 }, - { type: 3, pts: 6756365475, ccData: 33314 }, - { type: 2, pts: 6756365475, ccData: 28263 }, - { type: 3, pts: 6756368478, ccData: 49698 }, - { type: 2, pts: 6756368478, ccData: 10496 }, - { type: 3, pts: 6756371481, ccData: 546 }, - { type: 2, pts: 6756371481, ccData: 35841 }, - { type: 3, pts: 6756377487, ccData: 16930 }, - { type: 2, pts: 6756377487, ccData: 35074 }, - { type: 3, pts: 6756479589, ccData: 35377 }, - { type: 2, pts: 6756479589, ccData: 38939 }, - { type: 2, pts: 6756479589, ccData: 17920 }, - { type: 2, pts: 6756479589, ccData: 31 }, - { type: 2, pts: 6756479589, ccData: 5264 }, - { type: 2, pts: 6756479589, ccData: 1283 }, - { type: 2, pts: 6756479589, ccData: 37162 }, - { type: 2, pts: 6756479589, ccData: 42 }, - { type: 2, pts: 6756479589, ccData: 37376 }, - { type: 2, pts: 6756479589, ccData: 3072 }, - { type: 3, pts: 6756485595, ccData: 49698 }, - { type: 2, pts: 6756485595, ccData: 10343 }, - { type: 3, pts: 6756488598, ccData: 546 }, - { type: 2, pts: 6756488598, ccData: 29295 }, - { type: 3, pts: 6756491601, ccData: 16930 }, - { type: 2, pts: 6756491601, ccData: 24942 }, - { type: 3, pts: 6756494604, ccData: 33314 }, - { type: 2, pts: 6756494604, ccData: 29481 }, - { type: 3, pts: 6756497607, ccData: 49698 }, - { type: 2, pts: 6756497607, ccData: 35842 }, - { type: 3, pts: 6756503613, ccData: 546 }, - { type: 2, pts: 6756503613, ccData: 35073 }, - { type: 3, pts: 6756581691, ccData: 18993 }, - { type: 2, pts: 6756581691, ccData: 39195 }, - { type: 2, pts: 6756581691, ccData: 0 }, - { type: 2, pts: 6756581691, ccData: 31 }, - { type: 2, pts: 6756581691, ccData: 5264 }, - { type: 2, pts: 6756581691, ccData: 1283 }, - { type: 2, pts: 6756581691, ccData: 37162 }, - { type: 2, pts: 6756581691, ccData: 42 }, - { type: 2, pts: 6756581691, ccData: 37376 }, - { type: 2, pts: 6756581691, ccData: 2048 }, - { type: 3, pts: 6756584694, ccData: 33571 }, - { type: 2, pts: 6756584694, ccData: 37376 }, - { type: 2, pts: 6756584694, ccData: 2816 }, - { type: 3, pts: 6756590700, ccData: 49698 }, - { type: 2, pts: 6756590700, ccData: 19823 }, - { type: 3, pts: 6756593703, ccData: 546 }, - { type: 2, pts: 6756593703, ccData: 28013 }, - { type: 3, pts: 6756596706, ccData: 16930 }, - { type: 2, pts: 6756596706, ccData: 31020 }, - { type: 3, pts: 6756599709, ccData: 33314 }, - { type: 2, pts: 6756599709, ccData: 24430 }, - { type: 3, pts: 6756602712, ccData: 49698 }, - { type: 2, pts: 6756602712, ccData: 28535 }, - { type: 3, pts: 6756605715, ccData: 546 }, - { type: 2, pts: 6756605715, ccData: 24441 }, - { type: 3, pts: 6756608718, ccData: 16930 }, - { type: 2, pts: 6756608718, ccData: 28533 }, - { type: 3, pts: 6756611721, ccData: 33314 }, - { type: 2, pts: 6756611721, ccData: 10098 }, - { type: 3, pts: 6756614724, ccData: 49698 }, - { type: 2, pts: 6756614724, ccData: 25856 }, - { type: 3, pts: 6756617727, ccData: 2609 }, - { type: 2, pts: 6756617727, ccData: 39195 }, - { type: 2, pts: 6756617727, ccData: 0 }, - { type: 2, pts: 6756617727, ccData: 287 }, - { type: 2, pts: 6756617727, ccData: 4240 }, - { type: 2, pts: 6756617727, ccData: 1283 }, - { type: 2, pts: 6756617727, ccData: 37162 }, - { type: 2, pts: 6756617727, ccData: 0 }, - { type: 2, pts: 6756617727, ccData: 37377 }, - { type: 2, pts: 6756617727, ccData: 4096 }, - { type: 3, pts: 6756620730, ccData: 17187 }, - { type: 2, pts: 6756620730, ccData: 37377 }, - { type: 2, pts: 6756620730, ccData: 4352 }, - { type: 3, pts: 6756626736, ccData: 33314 }, - { type: 2, pts: 6756626736, ccData: 28526 }, - { type: 3, pts: 6756629739, ccData: 49698 }, - { type: 2, pts: 6756629739, ccData: 24429 }, - { type: 3, pts: 6756632742, ccData: 546 }, - { type: 2, pts: 6756632742, ccData: 31071 }, - { type: 3, pts: 6756635745, ccData: 16930 }, - { type: 2, pts: 6756635745, ccData: 26721 }, - { type: 3, pts: 6756638748, ccData: 33314 }, - { type: 2, pts: 6756638748, ccData: 26994 }, - { type: 3, pts: 6756641751, ccData: 49698 }, - { type: 2, pts: 6756641751, ccData: 8448 }, - { type: 3, pts: 6756644754, ccData: 546 }, - { type: 2, pts: 6756644754, ccData: 35841 }, - { type: 3, pts: 6756650760, ccData: 16930 }, - { type: 2, pts: 6756650760, ccData: 35074 }, - { type: 3, pts: 6756842952, ccData: 35377 }, - { type: 2, pts: 6756842952, ccData: 38939 }, - { type: 2, pts: 6756842952, ccData: 0 }, - { type: 2, pts: 6756842952, ccData: 31 }, - { type: 2, pts: 6756842952, ccData: 5264 }, - { type: 2, pts: 6756842952, ccData: 1283 }, - { type: 2, pts: 6756842952, ccData: 37162 }, - { type: 2, pts: 6756842952, ccData: 42 }, - { type: 2, pts: 6756842952, ccData: 37376 }, - { type: 2, pts: 6756842952, ccData: 2048 }, - { type: 3, pts: 6756845955, ccData: 49955 }, - { type: 2, pts: 6756845955, ccData: 37376 }, - { type: 2, pts: 6756845955, ccData: 2560 }, - { type: 3, pts: 6756851961, ccData: 546 }, - { type: 2, pts: 6756851961, ccData: 20335 }, - { type: 3, pts: 6756854964, ccData: 16930 }, - { type: 2, pts: 6756854964, ccData: 28787 }, - { type: 3, pts: 6756857967, ccData: 33314 }, - { type: 2, pts: 6756857967, ccData: 11359 }, - { type: 3, pts: 6756860970, ccData: 49698 }, - { type: 2, pts: 6756860970, ccData: 29551 }, - { type: 3, pts: 6756863973, ccData: 546 }, - { type: 2, pts: 6756863973, ccData: 29298 }, - { type: 3, pts: 6756866976, ccData: 16930 }, - { type: 2, pts: 6756866976, ccData: 31022 }, - { type: 3, pts: 6756869979, ccData: 35377 }, - { type: 2, pts: 6756869979, ccData: 38939 }, - { type: 2, pts: 6756869979, ccData: 0 }, - { type: 2, pts: 6756869979, ccData: 543 }, - { type: 2, pts: 6756869979, ccData: 4240 }, - { type: 2, pts: 6756869979, ccData: 1283 }, - { type: 2, pts: 6756869979, ccData: 37162 }, - { type: 2, pts: 6756869979, ccData: 0 }, - { type: 2, pts: 6756869979, ccData: 37378 }, - { type: 2, pts: 6756869979, ccData: 2048 }, - { type: 3, pts: 6756875985, ccData: 49698 }, - { type: 2, pts: 6756875985, ccData: 10337 }, - { type: 3, pts: 6756878988, ccData: 546 }, - { type: 2, pts: 6756878988, ccData: 27756 }, - { type: 3, pts: 6756881991, ccData: 16930 }, - { type: 2, pts: 6756881991, ccData: 24419 }, - { type: 3, pts: 6756884994, ccData: 33314 }, - { type: 2, pts: 6756884994, ccData: 26741 }, - { type: 3, pts: 6756887997, ccData: 49698 }, - { type: 2, pts: 6756887997, ccData: 25451 }, - { type: 3, pts: 6756891000, ccData: 546 }, - { type: 2, pts: 6756891000, ccData: 27753 }, - { type: 3, pts: 6756894003, ccData: 16930 }, - { type: 2, pts: 6756894003, ccData: 28263 }, - { type: 3, pts: 6756897006, ccData: 33314 }, - { type: 2, pts: 6756897006, ccData: 10496 }, - { type: 3, pts: 6756900009, ccData: 49698 }, - { type: 2, pts: 6756900009, ccData: 35842 }, - { type: 3, pts: 6756906015, ccData: 546 }, - { type: 2, pts: 6756906015, ccData: 35073 }, - { type: 3, pts: 6757113222, ccData: 16930 }, - { type: 2, pts: 6757113222, ccData: 35841 }, - { type: 3, pts: 6757158267, ccData: 35377 }, - { type: 2, pts: 6757158267, ccData: 38939 }, - { type: 2, pts: 6757158267, ccData: 0 }, - { type: 2, pts: 6757158267, ccData: 31 }, - { type: 2, pts: 6757158267, ccData: 5264 }, - { type: 2, pts: 6757158267, ccData: 1283 }, - { type: 2, pts: 6757158267, ccData: 37162 }, - { type: 2, pts: 6757158267, ccData: 0 }, - { type: 2, pts: 6757158267, ccData: 37376 }, - { type: 2, pts: 6757158267, ccData: 1024 }, - { type: 3, pts: 6757161270, ccData: 49698 }, - { type: 2, pts: 6757161270, ccData: 19821 }, - { type: 3, pts: 6757164273, ccData: 546 }, - { type: 2, pts: 6757164273, ccData: 27950 }, - { type: 3, pts: 6757167276, ccData: 16930 }, - { type: 2, pts: 6757167276, ccData: 11822 }, - { type: 3, pts: 6757170279, ccData: 33314 }, - { type: 2, pts: 6757170279, ccData: 24428 }, - { type: 3, pts: 6757173282, ccData: 49698 }, - { type: 2, pts: 6757173282, ccData: 28527 }, - { type: 3, pts: 6757176285, ccData: 546 }, - { type: 2, pts: 6757176285, ccData: 27507 }, - { type: 3, pts: 6757179288, ccData: 16930 }, - { type: 2, pts: 6757179288, ccData: 24420 }, - { type: 3, pts: 6757182291, ccData: 33314 }, - { type: 2, pts: 6757182291, ccData: 25964 }, - { type: 3, pts: 6757185294, ccData: 49698 }, - { type: 2, pts: 6757185294, ccData: 26979 }, - { type: 3, pts: 6757188297, ccData: 546 }, - { type: 2, pts: 6757188297, ccData: 26991 }, - { type: 3, pts: 6757191300, ccData: 16930 }, - { type: 2, pts: 6757191300, ccData: 30067 }, - { type: 3, pts: 6757194303, ccData: 33314 }, - { type: 2, pts: 6757194303, ccData: 11264 }, - { type: 3, pts: 6757197306, ccData: 51761 }, - { type: 2, pts: 6757197306, ccData: 38939 }, - { type: 2, pts: 6757197306, ccData: 0 }, - { type: 2, pts: 6757197306, ccData: 287 }, - { type: 2, pts: 6757197306, ccData: 4240 }, - { type: 2, pts: 6757197306, ccData: 1283 }, - { type: 2, pts: 6757197306, ccData: 37162 }, - { type: 2, pts: 6757197306, ccData: 0 }, - { type: 2, pts: 6757197306, ccData: 37377 }, - { type: 2, pts: 6757197306, ccData: 3072 }, - { type: 3, pts: 6757200309, ccData: 803 }, - { type: 2, pts: 6757200309, ccData: 37377 }, - { type: 2, pts: 6757200309, ccData: 3328 }, - { type: 3, pts: 6757206315, ccData: 16930 }, - { type: 2, pts: 6757206315, ccData: 17505 }, - { type: 3, pts: 6757209318, ccData: 33314 }, - { type: 2, pts: 6757209318, ccData: 25700 }, - { type: 3, pts: 6757212321, ccData: 49698 }, - { type: 2, pts: 6757212321, ccData: 31022 }, - { type: 3, pts: 6757221330, ccData: 546 }, - { type: 2, pts: 6757221330, ccData: 35073 }, - { type: 3, pts: 6757506615, ccData: 16930 }, - { type: 2, pts: 6757506615, ccData: 35841 }, - { type: 3, pts: 6757608717, ccData: 35377 }, - { type: 2, pts: 6757608717, ccData: 38939 }, - { type: 2, pts: 6757608717, ccData: 16640 }, - { type: 2, pts: 6757608717, ccData: 31 }, - { type: 2, pts: 6757608717, ccData: 5264 }, - { type: 2, pts: 6757608717, ccData: 1283 }, - { type: 2, pts: 6757608717, ccData: 37162 }, - { type: 2, pts: 6757608717, ccData: 0 }, - { type: 2, pts: 6757608717, ccData: 37376 }, - { type: 2, pts: 6757608717, ccData: 0 }, - { type: 3, pts: 6757614723, ccData: 49955 }, - { type: 2, pts: 6757614723, ccData: 37376 }, - { type: 2, pts: 6757614723, ccData: 768 }, - { type: 3, pts: 6757620729, ccData: 546 }, - { type: 2, pts: 6757620729, ccData: 18783 }, - { type: 3, pts: 6757623732, ccData: 16930 }, - { type: 2, pts: 6757623732, ccData: 25441 }, - { type: 3, pts: 6757626735, ccData: 33314 }, - { type: 2, pts: 6757626735, ccData: 28199 }, - { type: 3, pts: 6757629738, ccData: 49698 }, - { type: 2, pts: 6757629738, ccData: 29791 }, - { type: 3, pts: 6757632741, ccData: 546 }, - { type: 2, pts: 6757632741, ccData: 30561 }, - { type: 3, pts: 6757635744, ccData: 16930 }, - { type: 2, pts: 6757635744, ccData: 26996 }, - { type: 3, pts: 6757638747, ccData: 33314 }, - { type: 2, pts: 6757638747, ccData: 24422 }, - { type: 3, pts: 6757641750, ccData: 49698 }, - { type: 2, pts: 6757641750, ccData: 28530 }, - { type: 3, pts: 6757644753, ccData: 546 }, - { type: 2, pts: 6757644753, ccData: 24441 }, - { type: 3, pts: 6757647756, ccData: 16930 }, - { type: 2, pts: 6757647756, ccData: 28533 }, - { type: 3, pts: 6757650759, ccData: 33314 }, - { type: 2, pts: 6757650759, ccData: 24436 }, - { type: 3, pts: 6757653762, ccData: 49698 }, - { type: 2, pts: 6757653762, ccData: 28511 }, - { type: 3, pts: 6757656765, ccData: 546 }, - { type: 2, pts: 6757656765, ccData: 26479 }, - { type: 3, pts: 6757659768, ccData: 18993 }, - { type: 2, pts: 6757659768, ccData: 38939 }, - { type: 2, pts: 6757659768, ccData: 16640 }, - { type: 2, pts: 6757659768, ccData: 287 }, - { type: 2, pts: 6757659768, ccData: 4240 }, - { type: 2, pts: 6757659768, ccData: 1283 }, - { type: 2, pts: 6757659768, ccData: 37162 }, - { type: 2, pts: 6757659768, ccData: 0 }, - { type: 2, pts: 6757659768, ccData: 37377 }, - { type: 2, pts: 6757659768, ccData: 1024 }, - { type: 3, pts: 6757665774, ccData: 33571 }, - { type: 2, pts: 6757665774, ccData: 37377 }, - { type: 2, pts: 6757665774, ccData: 1536 }, - { type: 3, pts: 6757671780, ccData: 49698 }, - { type: 2, pts: 6757671780, ccData: 29807 }, - { type: 3, pts: 6757674783, ccData: 546 }, - { type: 2, pts: 6757674783, ccData: 24436 }, - { type: 3, pts: 6757677786, ccData: 16930 }, - { type: 2, pts: 6757677786, ccData: 26725 }, - { type: 3, pts: 6757680789, ccData: 33314 }, - { type: 2, pts: 6757680789, ccData: 24388 }, - { type: 3, pts: 6757683792, ccData: 49698 }, - { type: 2, pts: 6757683792, ccData: 29285 }, - { type: 3, pts: 6757686795, ccData: 546 }, - { type: 2, pts: 6757686795, ccData: 24941 }, - { type: 3, pts: 6757689798, ccData: 16930 }, - { type: 2, pts: 6757689798, ccData: 24403 }, - { type: 3, pts: 6757692801, ccData: 33314 }, - { type: 2, pts: 6757692801, ccData: 24940 }, - { type: 3, pts: 6757695804, ccData: 49698 }, - { type: 2, pts: 6757695804, ccData: 28526 }, - { type: 3, pts: 6757698807, ccData: 546 }, - { type: 2, pts: 6757698807, ccData: 11776 }, - { type: 3, pts: 6757707816, ccData: 16930 }, - { type: 2, pts: 6757707816, ccData: 35073 }, - { type: 3, pts: 6757954062, ccData: 33314 }, - { type: 2, pts: 6757954062, ccData: 35841 }, - { type: 3, pts: 6758044152, ccData: 51761 }, - { type: 2, pts: 6758044152, ccData: 38939 }, - { type: 2, pts: 6758044152, ccData: 17920 }, - { type: 2, pts: 6758044152, ccData: 31 }, - { type: 2, pts: 6758044152, ccData: 5264 }, - { type: 2, pts: 6758044152, ccData: 1283 }, - { type: 2, pts: 6758044152, ccData: 37162 }, - { type: 2, pts: 6758044152, ccData: 0 }, - { type: 2, pts: 6758044152, ccData: 37376 }, - { type: 2, pts: 6758044152, ccData: 1024 }, - { type: 3, pts: 6758050158, ccData: 803 }, - { type: 2, pts: 6758050158, ccData: 37376 }, - { type: 2, pts: 6758050158, ccData: 1792 }, - { type: 3, pts: 6758056164, ccData: 16930 }, - { type: 2, pts: 6758056164, ccData: 21869 }, - { type: 3, pts: 6758059167, ccData: 33314 }, - { type: 2, pts: 6758059167, ccData: 11359 }, - { type: 3, pts: 6758062170, ccData: 49698 }, - { type: 2, pts: 6758062170, ccData: 20585 }, - { type: 3, pts: 6758065173, ccData: 546 }, - { type: 2, pts: 6758065173, ccData: 28267 }, - { type: 3, pts: 6758068176, ccData: 16930 }, - { type: 2, pts: 6758068176, ccData: 24940 }, - { type: 3, pts: 6758071179, ccData: 33314 }, - { type: 2, pts: 6758071179, ccData: 26979 }, - { type: 3, pts: 6758074182, ccData: 49698 }, - { type: 2, pts: 6758074182, ccData: 26991 }, - { type: 3, pts: 6758077185, ccData: 546 }, - { type: 2, pts: 6758077185, ccData: 30067 }, - { type: 3, pts: 6758080188, ccData: 16930 }, - { type: 2, pts: 6758080188, ccData: 16128 }, - { type: 3, pts: 6758089197, ccData: 33314 }, - { type: 2, pts: 6758089197, ccData: 35073 }, - { type: 3, pts: 6758188296, ccData: 51761 }, - { type: 2, pts: 6758188296, ccData: 39195 }, - { type: 2, pts: 6758188296, ccData: 16640 }, - { type: 2, pts: 6758188296, ccData: 31 }, - { type: 2, pts: 6758188296, ccData: 5264 }, - { type: 2, pts: 6758188296, ccData: 1283 }, - { type: 2, pts: 6758188296, ccData: 37162 }, - { type: 2, pts: 6758188296, ccData: 42 }, - { type: 2, pts: 6758188296, ccData: 37376 }, - { type: 2, pts: 6758188296, ccData: 1024 }, - { type: 3, pts: 6758194302, ccData: 803 }, - { type: 2, pts: 6758194302, ccData: 37376 }, - { type: 2, pts: 6758194302, ccData: 1280 }, - { type: 3, pts: 6758200308, ccData: 16930 }, - { type: 2, pts: 6758200308, ccData: 22895 }, - { type: 3, pts: 6758203311, ccData: 33314 }, - { type: 2, pts: 6758203311, ccData: 30047 }, - { type: 3, pts: 6758206314, ccData: 49698 }, - { type: 2, pts: 6758206314, ccData: 30575 }, - { type: 3, pts: 6758209317, ccData: 546 }, - { type: 2, pts: 6758209317, ccData: 28199 }, - { type: 3, pts: 6758212320, ccData: 16930 }, - { type: 2, pts: 6758212320, ccData: 29791 }, - { type: 3, pts: 6758215323, ccData: 33314 }, - { type: 2, pts: 6758215323, ccData: 25189 }, - { type: 3, pts: 6758218326, ccData: 49698 }, - { type: 2, pts: 6758218326, ccData: 27753 }, - { type: 3, pts: 6758221329, ccData: 546 }, - { type: 2, pts: 6758221329, ccData: 25974 }, - { type: 3, pts: 6758224332, ccData: 16930 }, - { type: 2, pts: 6758224332, ccData: 25951 }, - { type: 3, pts: 6758227335, ccData: 33314 }, - { type: 2, pts: 6758227335, ccData: 24940 }, - { type: 3, pts: 6758230338, ccData: 49698 }, - { type: 2, pts: 6758230338, ccData: 27648 }, - { type: 3, pts: 6758233341, ccData: 2609 }, - { type: 2, pts: 6758233341, ccData: 39195 }, - { type: 2, pts: 6758233341, ccData: 16640 }, - { type: 2, pts: 6758233341, ccData: 287 }, - { type: 2, pts: 6758233341, ccData: 4240 }, - { type: 2, pts: 6758233341, ccData: 1283 }, - { type: 2, pts: 6758233341, ccData: 37162 }, - { type: 2, pts: 6758233341, ccData: 0 }, - { type: 2, pts: 6758233341, ccData: 37377 }, - { type: 2, pts: 6758233341, ccData: 0 }, - { type: 3, pts: 6758239347, ccData: 17187 }, - { type: 2, pts: 6758239347, ccData: 37377 }, - { type: 2, pts: 6758239347, ccData: 256 }, - { type: 3, pts: 6758245353, ccData: 33314 }, - { type: 2, pts: 6758245353, ccData: 29800 }, - { type: 3, pts: 6758248356, ccData: 49698 }, - { type: 2, pts: 6758248356, ccData: 25951 }, - { type: 3, pts: 6758251359, ccData: 546 }, - { type: 2, pts: 6758251359, ccData: 26721 }, - { type: 3, pts: 6758254362, ccData: 16930 }, - { type: 2, pts: 6758254362, ccData: 26994 }, - { type: 3, pts: 6758257365, ccData: 33314 }, - { type: 2, pts: 6758257365, ccData: 29556 }, - { type: 3, pts: 6758260368, ccData: 49698 }, - { type: 2, pts: 6758260368, ccData: 31084 }, - { type: 3, pts: 6758263371, ccData: 546 }, - { type: 2, pts: 6758263371, ccData: 25971 }, - { type: 3, pts: 6758266374, ccData: 16930 }, - { type: 2, pts: 6758266374, ccData: 24436 }, - { type: 3, pts: 6758269377, ccData: 33314 }, - { type: 2, pts: 6758269377, ccData: 26725 }, - { type: 3, pts: 6758272380, ccData: 49698 }, - { type: 2, pts: 6758272380, ccData: 31071 }, - { type: 3, pts: 6758275383, ccData: 546 }, - { type: 2, pts: 6758275383, ccData: 25441 }, - { type: 3, pts: 6758278386, ccData: 16930 }, - { type: 2, pts: 6758278386, ccData: 28255 }, - { type: 3, pts: 6758281389, ccData: 33314 }, - { type: 2, pts: 6758281389, ccData: 28001 }, - { type: 3, pts: 6758284392, ccData: 49698 }, - { type: 2, pts: 6758284392, ccData: 27493 }, - { type: 3, pts: 6758287395, ccData: 546 }, - { type: 2, pts: 6758287395, ccData: 11776 }, - { type: 3, pts: 6758290398, ccData: 16930 }, - { type: 2, pts: 6758290398, ccData: 35841 }, - { type: 3, pts: 6758296404, ccData: 33314 }, - { type: 2, pts: 6758296404, ccData: 35074 }, - { type: 3, pts: 6758581689, ccData: 51761 }, - { type: 2, pts: 6758581689, ccData: 38939 }, - { type: 2, pts: 6758581689, ccData: 17920 }, - { type: 2, pts: 6758581689, ccData: 31 }, - { type: 2, pts: 6758581689, ccData: 5264 }, - { type: 2, pts: 6758581689, ccData: 1283 }, - { type: 2, pts: 6758581689, ccData: 37162 }, - { type: 2, pts: 6758581689, ccData: 42 }, - { type: 2, pts: 6758581689, ccData: 37376 }, - { type: 2, pts: 6758581689, ccData: 1024 }, - { type: 3, pts: 6758587695, ccData: 803 }, - { type: 2, pts: 6758587695, ccData: 37376 }, - { type: 2, pts: 6758587695, ccData: 1536 }, - { type: 3, pts: 6758593701, ccData: 16930 }, - { type: 2, pts: 6758593701, ccData: 21864 }, - { type: 3, pts: 6758596704, ccData: 33314 }, - { type: 2, pts: 6758596704, ccData: 11359 }, - { type: 3, pts: 6758599707, ccData: 49698 }, - { type: 2, pts: 6758599707, ccData: 20585 }, - { type: 3, pts: 6758602710, ccData: 546 }, - { type: 2, pts: 6758602710, ccData: 28267 }, - { type: 3, pts: 6758605713, ccData: 16930 }, - { type: 2, pts: 6758605713, ccData: 24940 }, - { type: 3, pts: 6758608716, ccData: 33314 }, - { type: 2, pts: 6758608716, ccData: 26979 }, - { type: 3, pts: 6758611719, ccData: 49698 }, - { type: 2, pts: 6758611719, ccData: 26991 }, - { type: 3, pts: 6758614722, ccData: 546 }, - { type: 2, pts: 6758614722, ccData: 30067 }, - { type: 3, pts: 6758617725, ccData: 16930 }, - { type: 2, pts: 6758617725, ccData: 11822 }, - { type: 3, pts: 6758620728, ccData: 33314 }, - { type: 2, pts: 6758620728, ccData: 11776 }, - { type: 3, pts: 6758623731, ccData: 49698 }, - { type: 2, pts: 6758623731, ccData: 35842 }, - { type: 3, pts: 6758629737, ccData: 546 }, - { type: 2, pts: 6758629737, ccData: 35073 }, - { type: 3, pts: 6758764872, ccData: 18993 }, - { type: 2, pts: 6758764872, ccData: 39195 }, - { type: 2, pts: 6758764872, ccData: 17920 }, - { type: 2, pts: 6758764872, ccData: 31 }, - { type: 2, pts: 6758764872, ccData: 5264 }, - { type: 2, pts: 6758764872, ccData: 1283 }, - { type: 2, pts: 6758764872, ccData: 37162 }, - { type: 2, pts: 6758764872, ccData: 42 }, - { type: 2, pts: 6758764872, ccData: 37376 }, - { type: 2, pts: 6758764872, ccData: 1024 }, - { type: 3, pts: 6758770878, ccData: 33314 }, - { type: 2, pts: 6758770878, ccData: 21089 }, - { type: 3, pts: 6758773881, ccData: 49698 }, - { type: 2, pts: 6758773881, ccData: 26209 }, - { type: 3, pts: 6758776884, ccData: 546 }, - { type: 2, pts: 6758776884, ccData: 25964 }, - { type: 3, pts: 6758779887, ccData: 16930 }, - { type: 2, pts: 6758779887, ccData: 24424 }, - { type: 3, pts: 6758782890, ccData: 33314 }, - { type: 2, pts: 6758782890, ccData: 24947 }, - { type: 3, pts: 6758785893, ccData: 49698 }, - { type: 2, pts: 6758785893, ccData: 24434 }, - { type: 3, pts: 6758788896, ccData: 546 }, - { type: 2, pts: 6758788896, ccData: 24937 }, - { type: 3, pts: 6758791899, ccData: 16930 }, - { type: 2, pts: 6758791899, ccData: 28258 }, - { type: 3, pts: 6758794902, ccData: 33314 }, - { type: 2, pts: 6758794902, ccData: 28535 }, - { type: 3, pts: 6758797905, ccData: 49698 }, - { type: 2, pts: 6758797905, ccData: 24424 }, - { type: 3, pts: 6758800908, ccData: 546 }, - { type: 2, pts: 6758800908, ccData: 24937 }, - { type: 3, pts: 6758803911, ccData: 16930 }, - { type: 2, pts: 6758803911, ccData: 29230 }, - { type: 3, pts: 6758806914, ccData: 33314 }, - { type: 2, pts: 6758806914, ccData: 35841 }, - { type: 3, pts: 6758812920, ccData: 49698 }, - { type: 2, pts: 6758812920, ccData: 35074 }, - { type: 3, pts: 6759017124, ccData: 546 }, - { type: 2, pts: 6759017124, ccData: 35842 }, - { type: 3, pts: 6759176283, ccData: 18993 }, - { type: 2, pts: 6759176283, ccData: 38939 }, - { type: 2, pts: 6759176283, ccData: 16640 }, - { type: 2, pts: 6759176283, ccData: 31 }, - { type: 2, pts: 6759176283, ccData: 5264 }, - { type: 2, pts: 6759176283, ccData: 1283 }, - { type: 2, pts: 6759176283, ccData: 37162 }, - { type: 2, pts: 6759176283, ccData: 42 }, - { type: 2, pts: 6759176283, ccData: 37376 }, - { type: 2, pts: 6759176283, ccData: 5120 }, - { type: 3, pts: 6759182289, ccData: 33314 }, - { type: 2, pts: 6759182289, ccData: 16716 }, - { type: 3, pts: 6759185292, ccData: 49698 }, - { type: 2, pts: 6759185292, ccData: 19514 }, - { type: 3, pts: 6759188295, ccData: 2609 }, - { type: 2, pts: 6759188295, ccData: 38939 }, - { type: 2, pts: 6759188295, ccData: 16640 }, - { type: 2, pts: 6759188295, ccData: 287 }, - { type: 2, pts: 6759188295, ccData: 4240 }, - { type: 2, pts: 6759188295, ccData: 1283 }, - { type: 2, pts: 6759188295, ccData: 37162 }, - { type: 2, pts: 6759188295, ccData: 0 }, - { type: 2, pts: 6759188295, ccData: 37377 }, - { type: 2, pts: 6759188295, ccData: 2048 }, - { type: 3, pts: 6759194301, ccData: 17187 }, - { type: 2, pts: 6759194301, ccData: 37377 }, - { type: 2, pts: 6759194301, ccData: 2816 }, - { type: 3, pts: 6759200307, ccData: 33314 }, - { type: 2, pts: 6759200307, ccData: 20585 }, - { type: 3, pts: 6759203310, ccData: 49698 }, - { type: 2, pts: 6759203310, ccData: 28267 }, - { type: 3, pts: 6759206313, ccData: 546 }, - { type: 2, pts: 6759206313, ccData: 24940 }, - { type: 3, pts: 6759209316, ccData: 16930 }, - { type: 2, pts: 6759209316, ccData: 26979 }, - { type: 3, pts: 6759212319, ccData: 33314 }, - { type: 2, pts: 6759212319, ccData: 26991 }, - { type: 3, pts: 6759215322, ccData: 49698 }, - { type: 2, pts: 6759215322, ccData: 30067 }, - { type: 3, pts: 6759218325, ccData: 546 }, - { type: 2, pts: 6759218325, ccData: 8448 }, - { type: 3, pts: 6759227334, ccData: 16930 }, - { type: 2, pts: 6759227334, ccData: 35073 }, - { type: 3, pts: 6759407514, ccData: 35377 }, - { type: 2, pts: 6759407514, ccData: 39195 }, - { type: 2, pts: 6759407514, ccData: 17920 }, - { type: 2, pts: 6759407514, ccData: 31 }, - { type: 2, pts: 6759407514, ccData: 5264 }, - { type: 2, pts: 6759407514, ccData: 1283 }, - { type: 2, pts: 6759407514, ccData: 37162 }, - { type: 2, pts: 6759407514, ccData: 42 }, - { type: 2, pts: 6759407514, ccData: 37376 }, - { type: 2, pts: 6759407514, ccData: 0 }, - { type: 3, pts: 6759413520, ccData: 49698 }, - { type: 2, pts: 6759413520, ccData: 20328 }, - { type: 3, pts: 6759416523, ccData: 546 }, - { type: 2, pts: 6759416523, ccData: 11359 }, - { type: 3, pts: 6759419526, ccData: 16930 }, - { type: 2, pts: 6759419526, ccData: 28271 }, - { type: 3, pts: 6759422529, ccData: 33314 }, - { type: 2, pts: 6759422529, ccData: 8448 }, - { type: 3, pts: 6759425532, ccData: 49698 }, - { type: 2, pts: 6759425532, ccData: 35841 }, - { type: 3, pts: 6759431538, ccData: 546 }, - { type: 2, pts: 6759431538, ccData: 35074 }, - { type: 3, pts: 6759530637, ccData: 18993 }, - { type: 2, pts: 6759530637, ccData: 38939 }, - { type: 2, pts: 6759530637, ccData: 17920 }, - { type: 2, pts: 6759530637, ccData: 31 }, - { type: 2, pts: 6759530637, ccData: 5264 }, - { type: 2, pts: 6759530637, ccData: 1283 }, - { type: 2, pts: 6759530637, ccData: 37162 }, - { type: 2, pts: 6759530637, ccData: 42 }, - { type: 2, pts: 6759530637, ccData: 37376 }, - { type: 2, pts: 6759530637, ccData: 1024 }, - { type: 3, pts: 6759536643, ccData: 33571 }, - { type: 2, pts: 6759536643, ccData: 37376 }, - { type: 2, pts: 6759536643, ccData: 1280 }, - { type: 3, pts: 6759542649, ccData: 49698 }, - { type: 2, pts: 6759542649, ccData: 10343 }, - { type: 3, pts: 6759545652, ccData: 546 }, - { type: 2, pts: 6759545652, ccData: 29295 }, - { type: 3, pts: 6759548655, ccData: 16930 }, - { type: 2, pts: 6759548655, ccData: 24942 }, - { type: 3, pts: 6759551658, ccData: 33314 }, - { type: 2, pts: 6759551658, ccData: 29481 }, - { type: 3, pts: 6759554661, ccData: 49698 }, - { type: 2, pts: 6759554661, ccData: 35842 }, - { type: 3, pts: 6759560667, ccData: 546 }, - { type: 2, pts: 6759560667, ccData: 35073 }, - { type: 3, pts: 6759587694, ccData: 18993 }, - { type: 2, pts: 6759587694, ccData: 39195 }, - { type: 2, pts: 6759587694, ccData: 16640 }, - { type: 2, pts: 6759587694, ccData: 31 }, - { type: 2, pts: 6759587694, ccData: 5264 }, - { type: 2, pts: 6759587694, ccData: 1283 }, - { type: 2, pts: 6759587694, ccData: 37162 }, - { type: 2, pts: 6759587694, ccData: 42 }, - { type: 2, pts: 6759587694, ccData: 37376 }, - { type: 2, pts: 6759587694, ccData: 0 }, - { type: 3, pts: 6759593700, ccData: 33571 }, - { type: 2, pts: 6759593700, ccData: 37376 }, - { type: 2, pts: 6759593700, ccData: 512 }, - { type: 3, pts: 6759599706, ccData: 49698 }, - { type: 2, pts: 6759599706, ccData: 21608 }, - { type: 3, pts: 6759602709, ccData: 546 }, - { type: 2, pts: 6759602709, ccData: 26995 }, - { type: 3, pts: 6759605712, ccData: 16930 }, - { type: 2, pts: 6759605712, ccData: 24424 }, - { type: 3, pts: 6759608715, ccData: 33314 }, - { type: 2, pts: 6759608715, ccData: 24937 }, - { type: 3, pts: 6759611718, ccData: 49698 }, - { type: 2, pts: 6759611718, ccData: 29299 }, - { type: 3, pts: 6759614721, ccData: 546 }, - { type: 2, pts: 6759614721, ccData: 29817 }, - { type: 3, pts: 6759617724, ccData: 16930 }, - { type: 2, pts: 6759617724, ccData: 27749 }, - { type: 3, pts: 6759620727, ccData: 33314 }, - { type: 2, pts: 6759620727, ccData: 24425 }, - { type: 3, pts: 6759623730, ccData: 49698 }, - { type: 2, pts: 6759623730, ccData: 29550 }, - { type: 3, pts: 6759626733, ccData: 546 }, - { type: 2, pts: 6759626733, ccData: 10100 }, - { type: 3, pts: 6759629736, ccData: 16930 }, - { type: 2, pts: 6759629736, ccData: 24421 }, - { type: 3, pts: 6759632739, ccData: 33314 }, - { type: 2, pts: 6759632739, ccData: 30817 }, - { type: 3, pts: 6759635742, ccData: 49698 }, - { type: 2, pts: 6759635742, ccData: 25460 }, - { type: 3, pts: 6759638745, ccData: 546 }, - { type: 2, pts: 6759638745, ccData: 27769 }, - { type: 3, pts: 6759641748, ccData: 18993 }, - { type: 2, pts: 6759641748, ccData: 39195 }, - { type: 2, pts: 6759641748, ccData: 16640 }, - { type: 2, pts: 6759641748, ccData: 287 }, - { type: 2, pts: 6759641748, ccData: 4240 }, - { type: 2, pts: 6759641748, ccData: 1283 }, - { type: 2, pts: 6759641748, ccData: 37162 }, - { type: 2, pts: 6759641748, ccData: 0 }, - { type: 2, pts: 6759641748, ccData: 37377 }, - { type: 2, pts: 6759641748, ccData: 0 }, - { type: 3, pts: 6759647754, ccData: 33314 }, - { type: 2, pts: 6759647754, ccData: 30568 }, - { type: 3, pts: 6759650757, ccData: 49698 }, - { type: 2, pts: 6759650757, ccData: 24948 }, - { type: 3, pts: 6759653760, ccData: 546 }, - { type: 2, pts: 6759653760, ccData: 24393 }, - { type: 3, pts: 6759656763, ccData: 16930 }, - { type: 2, pts: 6759656763, ccData: 24439 }, - { type: 3, pts: 6759659766, ccData: 33314 }, - { type: 2, pts: 6759659766, ccData: 24947 }, - { type: 3, pts: 6759662769, ccData: 49698 }, - { type: 2, pts: 6759662769, ccData: 24420 }, - { type: 3, pts: 6759665772, ccData: 546 }, - { type: 2, pts: 6759665772, ccData: 29285 }, - { type: 3, pts: 6759668775, ccData: 16930 }, - { type: 2, pts: 6759668775, ccData: 24941 }, - { type: 3, pts: 6759671778, ccData: 33314 }, - { type: 2, pts: 6759671778, ccData: 26990 }, - { type: 3, pts: 6759674781, ccData: 49698 }, - { type: 2, pts: 6759674781, ccData: 26463 }, - { type: 3, pts: 6759677784, ccData: 546 }, - { type: 2, pts: 6759677784, ccData: 28518 }, - { type: 3, pts: 6759680787, ccData: 16930 }, - { type: 2, pts: 6759680787, ccData: 11776 }, - { type: 3, pts: 6759683790, ccData: 33314 }, - { type: 2, pts: 6759683790, ccData: 35841 }, - { type: 3, pts: 6759689796, ccData: 49698 }, - { type: 2, pts: 6759689796, ccData: 35074 }, - { type: 3, pts: 6759957063, ccData: 2609 }, - { type: 2, pts: 6759957063, ccData: 38939 }, - { type: 2, pts: 6759957063, ccData: 16640 }, - { type: 2, pts: 6759957063, ccData: 31 }, - { type: 2, pts: 6759957063, ccData: 5264 }, - { type: 2, pts: 6759957063, ccData: 1283 }, - { type: 2, pts: 6759957063, ccData: 37162 }, - { type: 2, pts: 6759957063, ccData: 42 }, - { type: 2, pts: 6759957063, ccData: 37376 }, - { type: 2, pts: 6759957063, ccData: 1024 }, - { type: 3, pts: 6759963069, ccData: 16930 }, - { type: 2, pts: 6759963069, ccData: 18804 }, - { type: 3, pts: 6759966072, ccData: 33314 }, - { type: 2, pts: 6759966072, ccData: 10099 }, - { type: 3, pts: 6759969075, ccData: 49698 }, - { type: 2, pts: 6759969075, ccData: 24434 }, - { type: 3, pts: 6759972078, ccData: 546 }, - { type: 2, pts: 6759972078, ccData: 25953 }, - { type: 3, pts: 6759975081, ccData: 16930 }, - { type: 2, pts: 6759975081, ccData: 27756 }, - { type: 3, pts: 6759978084, ccData: 33314 }, - { type: 2, pts: 6759978084, ccData: 31071 }, - { type: 3, pts: 6759981087, ccData: 49698 }, - { type: 2, pts: 6759981087, ccData: 26469 }, - { type: 3, pts: 6759984090, ccData: 546 }, - { type: 2, pts: 6759984090, ccData: 29812 }, - { type: 3, pts: 6759987093, ccData: 16930 }, - { type: 2, pts: 6759987093, ccData: 26990 }, - { type: 3, pts: 6759990096, ccData: 33314 }, - { type: 2, pts: 6759990096, ccData: 26368 }, - { type: 3, pts: 6759993099, ccData: 51761 }, - { type: 2, pts: 6759993099, ccData: 38939 }, - { type: 2, pts: 6759993099, ccData: 16640 }, - { type: 2, pts: 6759993099, ccData: 287 }, - { type: 2, pts: 6759993099, ccData: 4240 }, - { type: 2, pts: 6759993099, ccData: 1283 }, - { type: 2, pts: 6759993099, ccData: 37162 }, - { type: 2, pts: 6759993099, ccData: 0 }, - { type: 2, pts: 6759993099, ccData: 37377 }, - { type: 2, pts: 6759993099, ccData: 1024 }, - { type: 3, pts: 6759999105, ccData: 546 }, - { type: 2, pts: 6759999105, ccData: 26990 }, - { type: 3, pts: 6760002108, ccData: 16930 }, - { type: 2, pts: 6760002108, ccData: 24429 }, - { type: 3, pts: 6760005111, ccData: 33314 }, - { type: 2, pts: 6760005111, ccData: 31071 }, - { type: 3, pts: 6760008114, ccData: 49698 }, - { type: 2, pts: 6760008114, ccData: 30561 }, - { type: 3, pts: 6760011117, ccData: 546 }, - { type: 2, pts: 6760011117, ccData: 31022 }, - { type: 3, pts: 6760014120, ccData: 16930 }, - { type: 2, pts: 6760014120, ccData: 35842 }, - { type: 3, pts: 6760020126, ccData: 33314 }, - { type: 2, pts: 6760020126, ccData: 35073 }, - { type: 3, pts: 6760125231, ccData: 51761 }, - { type: 2, pts: 6760125231, ccData: 39195 }, - { type: 2, pts: 6760125231, ccData: 16640 }, - { type: 2, pts: 6760125231, ccData: 31 }, - { type: 2, pts: 6760125231, ccData: 5264 }, - { type: 2, pts: 6760125231, ccData: 1283 }, - { type: 2, pts: 6760125231, ccData: 37162 }, - { type: 2, pts: 6760125231, ccData: 42 }, - { type: 2, pts: 6760125231, ccData: 37376 }, - { type: 2, pts: 6760125231, ccData: 0 }, - { type: 3, pts: 6760131237, ccData: 546 }, - { type: 2, pts: 6760131237, ccData: 19823 }, - { type: 3, pts: 6760134240, ccData: 16930 }, - { type: 2, pts: 6760134240, ccData: 28013 }, - { type: 3, pts: 6760137243, ccData: 33314 }, - { type: 2, pts: 6760137243, ccData: 31020 }, - { type: 3, pts: 6760140246, ccData: 49698 }, - { type: 2, pts: 6760140246, ccData: 24419 }, - { type: 3, pts: 6760143249, ccData: 546 }, - { type: 2, pts: 6760143249, ccData: 24942 }, - { type: 3, pts: 6760146252, ccData: 16930 }, - { type: 2, pts: 6760146252, ccData: 24441 }, - { type: 3, pts: 6760149255, ccData: 33314 }, - { type: 2, pts: 6760149255, ccData: 28533 }, - { type: 3, pts: 6760152258, ccData: 49698 }, - { type: 2, pts: 6760152258, ccData: 24432 }, - { type: 3, pts: 6760155261, ccData: 546 }, - { type: 2, pts: 6760155261, ccData: 27749 }, - { type: 3, pts: 6760158264, ccData: 16930 }, - { type: 2, pts: 6760158264, ccData: 24947 }, - { type: 3, pts: 6760161267, ccData: 33314 }, - { type: 2, pts: 6760161267, ccData: 25951 }, - { type: 3, pts: 6760164270, ccData: 49698 }, - { type: 2, pts: 6760164270, ccData: 29793 }, - { type: 3, pts: 6760167273, ccData: 546 }, - { type: 2, pts: 6760167273, ccData: 27493 }, - { type: 3, pts: 6760170276, ccData: 16930 }, - { type: 2, pts: 6760170276, ccData: 24429 }, - { type: 3, pts: 6760173279, ccData: 33314 }, - { type: 2, pts: 6760173279, ccData: 25856 }, - { type: 3, pts: 6760176282, ccData: 51761 }, - { type: 2, pts: 6760176282, ccData: 39195 }, - { type: 2, pts: 6760176282, ccData: 16640 }, - { type: 2, pts: 6760176282, ccData: 287 }, - { type: 2, pts: 6760176282, ccData: 4240 }, - { type: 2, pts: 6760176282, ccData: 1283 }, - { type: 2, pts: 6760176282, ccData: 37162 }, - { type: 2, pts: 6760176282, ccData: 0 }, - { type: 2, pts: 6760176282, ccData: 37377 }, - { type: 2, pts: 6760176282, ccData: 0 }, - { type: 3, pts: 6760182288, ccData: 546 }, - { type: 2, pts: 6760182288, ccData: 25185 }, - { type: 3, pts: 6760185291, ccData: 16930 }, - { type: 2, pts: 6760185291, ccData: 25451 }, - { type: 3, pts: 6760188294, ccData: 33314 }, - { type: 2, pts: 6760188294, ccData: 24436 }, - { type: 3, pts: 6760191297, ccData: 49698 }, - { type: 2, pts: 6760191297, ccData: 28511 }, - { type: 3, pts: 6760194300, ccData: 546 }, - { type: 2, pts: 6760194300, ccData: 29800 }, - { type: 3, pts: 6760197303, ccData: 16930 }, - { type: 2, pts: 6760197303, ccData: 25951 }, - { type: 3, pts: 6760200306, ccData: 33314 }, - { type: 2, pts: 6760200306, ccData: 17522 }, - { type: 3, pts: 6760203309, ccData: 49698 }, - { type: 2, pts: 6760203309, ccData: 25953 }, - { type: 3, pts: 6760206312, ccData: 546 }, - { type: 2, pts: 6760206312, ccData: 27999 }, - { type: 3, pts: 6760209315, ccData: 16930 }, - { type: 2, pts: 6760209315, ccData: 21345 }, - { type: 3, pts: 6760212318, ccData: 33314 }, - { type: 2, pts: 6760212318, ccData: 27759 }, - { type: 3, pts: 6760215321, ccData: 49698 }, - { type: 2, pts: 6760215321, ccData: 28223 }, - { type: 3, pts: 6760218324, ccData: 546 }, - { type: 2, pts: 6760218324, ccData: 35841 }, - { type: 3, pts: 6760224330, ccData: 16930 }, - { type: 2, pts: 6760224330, ccData: 35074 }, - { type: 3, pts: 6760443549, ccData: 35377 }, - { type: 2, pts: 6760443549, ccData: 38939 }, - { type: 2, pts: 6760443549, ccData: 16640 }, - { type: 2, pts: 6760443549, ccData: 31 }, - { type: 2, pts: 6760443549, ccData: 5264 }, - { type: 2, pts: 6760443549, ccData: 1283 }, - { type: 2, pts: 6760443549, ccData: 37162 }, - { type: 2, pts: 6760443549, ccData: 42 }, - { type: 2, pts: 6760443549, ccData: 37376 }, - { type: 2, pts: 6760443549, ccData: 0 }, - { type: 3, pts: 6760449555, ccData: 49955 }, - { type: 2, pts: 6760449555, ccData: 37376 }, - { type: 2, pts: 6760449555, ccData: 768 }, - { type: 3, pts: 6760455561, ccData: 546 }, - { type: 2, pts: 6760455561, ccData: 20328 }, - { type: 3, pts: 6760458564, ccData: 16930 }, - { type: 2, pts: 6760458564, ccData: 11359 }, - { type: 3, pts: 6760461567, ccData: 33314 }, - { type: 2, pts: 6760461567, ccData: 30565 }, - { type: 3, pts: 6760464570, ccData: 49698 }, - { type: 2, pts: 6760464570, ccData: 24420 }, - { type: 3, pts: 6760467573, ccData: 546 }, - { type: 2, pts: 6760467573, ccData: 28526 }, - { type: 3, pts: 6760470576, ccData: 16930 }, - { type: 2, pts: 6760470576, ccData: 10100 }, - { type: 3, pts: 6760473579, ccData: 33314 }, - { type: 2, pts: 6760473579, ccData: 24424 }, - { type: 3, pts: 6760476582, ccData: 49698 }, - { type: 2, pts: 6760476582, ccData: 24950 }, - { type: 3, pts: 6760479585, ccData: 546 }, - { type: 2, pts: 6760479585, ccData: 25951 }, - { type: 3, pts: 6760482588, ccData: 16930 }, - { type: 2, pts: 6760482588, ccData: 25966 }, - { type: 3, pts: 6760485591, ccData: 33314 }, - { type: 2, pts: 6760485591, ccData: 28533 }, - { type: 3, pts: 6760488594, ccData: 49698 }, - { type: 2, pts: 6760488594, ccData: 26472 }, - { type: 3, pts: 6760491597, ccData: 546 }, - { type: 2, pts: 6760491597, ccData: 24436 }, - { type: 3, pts: 6760494600, ccData: 16930 }, - { type: 2, pts: 6760494600, ccData: 26989 }, - { type: 3, pts: 6760497603, ccData: 33314 }, - { type: 2, pts: 6760497603, ccData: 25856 }, - { type: 3, pts: 6760500606, ccData: 51761 }, - { type: 2, pts: 6760500606, ccData: 38939 }, - { type: 2, pts: 6760500606, ccData: 16640 }, - { type: 2, pts: 6760500606, ccData: 287 }, - { type: 2, pts: 6760500606, ccData: 4240 }, - { type: 2, pts: 6760500606, ccData: 1283 }, - { type: 2, pts: 6760500606, ccData: 37162 }, - { type: 2, pts: 6760500606, ccData: 0 }, - { type: 2, pts: 6760500606, ccData: 37377 }, - { type: 2, pts: 6760500606, ccData: 5120 }, - { type: 3, pts: 6760506612, ccData: 803 }, - { type: 2, pts: 6760506612, ccData: 37377 }, - { type: 2, pts: 6760506612, ccData: 5632 }, - { type: 3, pts: 6760512618, ccData: 16930 }, - { type: 2, pts: 6760512618, ccData: 29289 }, - { type: 3, pts: 6760515621, ccData: 33314 }, - { type: 2, pts: 6760515621, ccData: 26472 }, - { type: 3, pts: 6760518624, ccData: 49698 }, - { type: 2, pts: 6760518624, ccData: 29791 }, - { type: 3, pts: 6760521627, ccData: 546 }, - { type: 2, pts: 6760521627, ccData: 28271 }, - { type: 3, pts: 6760524630, ccData: 16930 }, - { type: 2, pts: 6760524630, ccData: 30510 }, - { type: 3, pts: 6760527633, ccData: 33314 }, - { type: 2, pts: 6760527633, ccData: 35842 }, - { type: 3, pts: 6760533639, ccData: 49698 }, - { type: 2, pts: 6760533639, ccData: 35073 }, - { type: 3, pts: 6760743849, ccData: 2609 }, - { type: 2, pts: 6760743849, ccData: 39195 }, - { type: 2, pts: 6760743849, ccData: 16640 }, - { type: 2, pts: 6760743849, ccData: 31 }, - { type: 2, pts: 6760743849, ccData: 5264 }, - { type: 2, pts: 6760743849, ccData: 1283 }, - { type: 2, pts: 6760743849, ccData: 37162 }, - { type: 2, pts: 6760743849, ccData: 42 }, - { type: 2, pts: 6760743849, ccData: 37376 }, - { type: 2, pts: 6760743849, ccData: 4096 }, - { type: 3, pts: 6760749855, ccData: 17187 }, - { type: 2, pts: 6760749855, ccData: 37376 }, - { type: 2, pts: 6760749855, ccData: 4608 }, - { type: 3, pts: 6760755861, ccData: 33314 }, - { type: 2, pts: 6760755861, ccData: 22373 }, - { type: 3, pts: 6760758864, ccData: 49698 }, - { type: 2, pts: 6760758864, ccData: 24424 }, - { type: 3, pts: 6760761867, ccData: 546 }, - { type: 2, pts: 6760761867, ccData: 24950 }, - { type: 3, pts: 6760764870, ccData: 16930 }, - { type: 2, pts: 6760764870, ccData: 25951 }, - { type: 3, pts: 6760767873, ccData: 33314 }, - { type: 2, pts: 6760767873, ccData: 29807 }, - { type: 3, pts: 6760770876, ccData: 49698 }, - { type: 2, pts: 6760770876, ccData: 24423 }, - { type: 3, pts: 6760773879, ccData: 546 }, - { type: 2, pts: 6760773879, ccData: 25972 }, - { type: 3, pts: 6760776882, ccData: 18993 }, - { type: 2, pts: 6760776882, ccData: 39195 }, - { type: 2, pts: 6760776882, ccData: 16640 }, - { type: 2, pts: 6760776882, ccData: 287 }, - { type: 2, pts: 6760776882, ccData: 4240 }, - { type: 2, pts: 6760776882, ccData: 1283 }, - { type: 2, pts: 6760776882, ccData: 37162 }, - { type: 2, pts: 6760776882, ccData: 0 }, - { type: 2, pts: 6760776882, ccData: 37377 }, - { type: 2, pts: 6760776882, ccData: 3072 }, - { type: 3, pts: 6760782888, ccData: 33314 }, - { type: 2, pts: 6760782888, ccData: 29807 }, - { type: 3, pts: 6760785891, ccData: 49698 }, - { type: 2, pts: 6760785891, ccData: 24441 }, - { type: 3, pts: 6760788894, ccData: 546 }, - { type: 2, pts: 6760788894, ccData: 28533 }, - { type: 3, pts: 6760791897, ccData: 16930 }, - { type: 2, pts: 6760791897, ccData: 29279 }, - { type: 3, pts: 6760794900, ccData: 33314 }, - { type: 2, pts: 6760794900, ccData: 29551 }, - { type: 3, pts: 6760797903, ccData: 49698 }, - { type: 2, pts: 6760797903, ccData: 25443 }, - { type: 3, pts: 6760800906, ccData: 546 }, - { type: 2, pts: 6760800906, ccData: 25970 }, - { type: 3, pts: 6760803909, ccData: 16930 }, - { type: 2, pts: 6760803909, ccData: 24423 }, - { type: 3, pts: 6760806912, ccData: 33314 }, - { type: 2, pts: 6760806912, ccData: 24941 }, - { type: 3, pts: 6760809915, ccData: 49698 }, - { type: 2, pts: 6760809915, ccData: 25902 }, - { type: 3, pts: 6760812918, ccData: 546 }, - { type: 2, pts: 6760812918, ccData: 35841 }, - { type: 3, pts: 6760818924, ccData: 16930 }, - { type: 2, pts: 6760818924, ccData: 35074 }, - { type: 3, pts: 6760936041, ccData: 35377 }, - { type: 2, pts: 6760936041, ccData: 38939 }, - { type: 2, pts: 6760936041, ccData: 17920 }, - { type: 2, pts: 6760936041, ccData: 31 }, - { type: 2, pts: 6760936041, ccData: 5264 }, - { type: 2, pts: 6760936041, ccData: 1283 }, - { type: 2, pts: 6760936041, ccData: 37162 }, - { type: 2, pts: 6760936041, ccData: 42 }, - { type: 2, pts: 6760936041, ccData: 37376 }, - { type: 2, pts: 6760936041, ccData: 2048 }, - { type: 3, pts: 6760942047, ccData: 49698 }, - { type: 2, pts: 6760942047, ccData: 16750 }, - { type: 3, pts: 6760945050, ccData: 546 }, - { type: 2, pts: 6760945050, ccData: 25695 }, - { type: 3, pts: 6760948053, ccData: 16930 }, - { type: 2, pts: 6760948053, ccData: 24934 }, - { type: 3, pts: 6760951056, ccData: 33314 }, - { type: 2, pts: 6760951056, ccData: 29797 }, - { type: 3, pts: 6760954059, ccData: 49698 }, - { type: 2, pts: 6760954059, ccData: 29279 }, - { type: 3, pts: 6760957062, ccData: 546 }, - { type: 2, pts: 6760957062, ccData: 29800 }, - { type: 3, pts: 6760960065, ccData: 16930 }, - { type: 2, pts: 6760960065, ccData: 24948 }, - { type: 3, pts: 6760963068, ccData: 33314 }, - { type: 2, pts: 6760963068, ccData: 11264 }, - { type: 3, pts: 6760966071, ccData: 49698 }, - { type: 2, pts: 6760966071, ccData: 35842 }, - { type: 3, pts: 6760972077, ccData: 546 }, - { type: 2, pts: 6760972077, ccData: 35073 }, - { type: 3, pts: 6761050155, ccData: 18993 }, - { type: 2, pts: 6761050155, ccData: 39195 }, - { type: 2, pts: 6761050155, ccData: 17920 }, - { type: 2, pts: 6761050155, ccData: 31 }, - { type: 2, pts: 6761050155, ccData: 5264 }, - { type: 2, pts: 6761050155, ccData: 1283 }, - { type: 2, pts: 6761050155, ccData: 37162 }, - { type: 2, pts: 6761050155, ccData: 42 }, - { type: 2, pts: 6761050155, ccData: 37376 }, - { type: 2, pts: 6761050155, ccData: 0 }, - { type: 3, pts: 6761056161, ccData: 33571 }, - { type: 2, pts: 6761056161, ccData: 37376 }, - { type: 2, pts: 6761056161, ccData: 512 }, - { type: 3, pts: 6761062167, ccData: 49698 }, - { type: 2, pts: 6761062167, ccData: 30565 }, - { type: 3, pts: 6761065170, ccData: 546 }, - { type: 2, pts: 6761065170, ccData: 10098 }, - { type: 3, pts: 6761068173, ccData: 16930 }, - { type: 2, pts: 6761068173, ccData: 25951 }, - { type: 3, pts: 6761071176, ccData: 33314 }, - { type: 2, pts: 6761071176, ccData: 26479 }, - { type: 3, pts: 6761074179, ccData: 49698 }, - { type: 2, pts: 6761074179, ccData: 26990 }, - { type: 3, pts: 6761077182, ccData: 546 }, - { type: 2, pts: 6761077182, ccData: 26463 }, - { type: 3, pts: 6761080185, ccData: 16930 }, - { type: 2, pts: 6761080185, ccData: 28526 }, - { type: 3, pts: 6761083188, ccData: 33314 }, - { type: 2, pts: 6761083188, ccData: 24417 }, - { type: 3, pts: 6761086191, ccData: 49698 }, - { type: 2, pts: 6761086191, ccData: 24418 }, - { type: 3, pts: 6761089194, ccData: 546 }, - { type: 2, pts: 6761089194, ccData: 26987 }, - { type: 3, pts: 6761092197, ccData: 16930 }, - { type: 2, pts: 6761092197, ccData: 25951 }, - { type: 3, pts: 6761095200, ccData: 33314 }, - { type: 2, pts: 6761095200, ccData: 29289 }, - { type: 3, pts: 6761098203, ccData: 49698 }, - { type: 2, pts: 6761098203, ccData: 25701 }, - { type: 3, pts: 6761101206, ccData: 546 }, - { type: 2, pts: 6761101206, ccData: 8448 }, - { type: 3, pts: 6761104209, ccData: 16930 }, - { type: 2, pts: 6761104209, ccData: 35841 }, - { type: 3, pts: 6761110215, ccData: 33314 }, - { type: 2, pts: 6761110215, ccData: 35074 }, - { type: 3, pts: 6761260365, ccData: 51761 }, - { type: 2, pts: 6761260365, ccData: 38939 }, - { type: 2, pts: 6761260365, ccData: 17920 }, - { type: 2, pts: 6761260365, ccData: 31 }, - { type: 2, pts: 6761260365, ccData: 5264 }, - { type: 2, pts: 6761260365, ccData: 1283 }, - { type: 2, pts: 6761260365, ccData: 37162 }, - { type: 2, pts: 6761260365, ccData: 42 }, - { type: 2, pts: 6761260365, ccData: 37376 }, - { type: 2, pts: 6761260365, ccData: 2048 }, - { type: 3, pts: 6761266371, ccData: 803 }, - { type: 2, pts: 6761266371, ccData: 37376 }, - { type: 2, pts: 6761266371, ccData: 2304 }, - { type: 3, pts: 6761272377, ccData: 16930 }, - { type: 2, pts: 6761272377, ccData: 21097 }, - { type: 3, pts: 6761275380, ccData: 33314 }, - { type: 2, pts: 6761275380, ccData: 26472 }, - { type: 3, pts: 6761278383, ccData: 49698 }, - { type: 2, pts: 6761278383, ccData: 29740 }, - { type: 3, pts: 6761281386, ccData: 546 }, - { type: 2, pts: 6761281386, ccData: 24388 }, - { type: 3, pts: 6761284389, ccData: 16930 }, - { type: 2, pts: 6761284389, ccData: 24932 }, - { type: 3, pts: 6761287392, ccData: 33314 }, - { type: 2, pts: 6761287392, ccData: 25721 }, - { type: 3, pts: 6761290395, ccData: 49698 }, - { type: 2, pts: 6761290395, ccData: 16128 }, - { type: 3, pts: 6761293398, ccData: 546 }, - { type: 2, pts: 6761293398, ccData: 35842 }, - { type: 3, pts: 6761299404, ccData: 16930 }, - { type: 2, pts: 6761299404, ccData: 35073 }, - { type: 3, pts: 6761341446, ccData: 35377 }, - { type: 2, pts: 6761341446, ccData: 39195 }, - { type: 2, pts: 6761341446, ccData: 16640 }, - { type: 2, pts: 6761341446, ccData: 31 }, - { type: 2, pts: 6761341446, ccData: 5264 }, - { type: 2, pts: 6761341446, ccData: 1283 }, - { type: 2, pts: 6761341446, ccData: 37162 }, - { type: 2, pts: 6761341446, ccData: 42 }, - { type: 2, pts: 6761341446, ccData: 37376 }, - { type: 2, pts: 6761341446, ccData: 3072 }, - { type: 3, pts: 6761347452, ccData: 49698 }, - { type: 2, pts: 6761347452, ccData: 21608 }, - { type: 3, pts: 6761350455, ccData: 546 }, - { type: 2, pts: 6761350455, ccData: 24948 }, - { type: 3, pts: 6761353458, ccData: 16930 }, - { type: 2, pts: 6761353458, ccData: 10099 }, - { type: 3, pts: 6761356461, ccData: 33314 }, - { type: 2, pts: 6761356461, ccData: 24434 }, - { type: 3, pts: 6761359464, ccData: 49698 }, - { type: 2, pts: 6761359464, ccData: 26983 }, - { type: 3, pts: 6761362467, ccData: 546 }, - { type: 2, pts: 6761362467, ccData: 26740 }, - { type: 3, pts: 6761365470, ccData: 16930 }, - { type: 2, pts: 6761365470, ccData: 11264 }, - { type: 3, pts: 6761368473, ccData: 35377 }, - { type: 2, pts: 6761368473, ccData: 39195 }, - { type: 2, pts: 6761368473, ccData: 16640 }, - { type: 2, pts: 6761368473, ccData: 287 }, - { type: 2, pts: 6761368473, ccData: 4240 }, - { type: 2, pts: 6761368473, ccData: 1283 }, - { type: 2, pts: 6761368473, ccData: 37162 }, - { type: 2, pts: 6761368473, ccData: 0 }, - { type: 2, pts: 6761368473, ccData: 37377 }, - { type: 2, pts: 6761368473, ccData: 1024 }, - { type: 3, pts: 6761374479, ccData: 49955 }, - { type: 2, pts: 6761374479, ccData: 37377 }, - { type: 2, pts: 6761374479, ccData: 1536 }, - { type: 3, pts: 6761380485, ccData: 546 }, - { type: 2, pts: 6761380485, ccData: 24927 }, - { type: 3, pts: 6761383488, ccData: 16930 }, - { type: 2, pts: 6761383488, ccData: 26209 }, - { type: 3, pts: 6761386491, ccData: 33314 }, - { type: 2, pts: 6761386491, ccData: 28009 }, - { type: 3, pts: 6761389494, ccData: 49698 }, - { type: 2, pts: 6761389494, ccData: 27769 }, - { type: 3, pts: 6761392497, ccData: 546 }, - { type: 2, pts: 6761392497, ccData: 24418 }, - { type: 3, pts: 6761395500, ccData: 16930 }, - { type: 2, pts: 6761395500, ccData: 26987 }, - { type: 3, pts: 6761398503, ccData: 33314 }, - { type: 2, pts: 6761398503, ccData: 25951 }, - { type: 3, pts: 6761401506, ccData: 49698 }, - { type: 2, pts: 6761401506, ccData: 29289 }, - { type: 3, pts: 6761404509, ccData: 546 }, - { type: 2, pts: 6761404509, ccData: 25701 }, - { type: 3, pts: 6761407512, ccData: 16930 }, - { type: 2, pts: 6761407512, ccData: 11776 }, - { type: 3, pts: 6761410515, ccData: 33314 }, - { type: 2, pts: 6761410515, ccData: 35841 }, - { type: 3, pts: 6761416521, ccData: 49698 }, - { type: 2, pts: 6761416521, ccData: 35074 }, - { type: 3, pts: 6761575680, ccData: 2609 }, - { type: 2, pts: 6761575680, ccData: 38939 }, - { type: 2, pts: 6761575680, ccData: 16640 }, - { type: 2, pts: 6761575680, ccData: 31 }, - { type: 2, pts: 6761575680, ccData: 5264 }, - { type: 2, pts: 6761575680, ccData: 1283 }, - { type: 2, pts: 6761575680, ccData: 37162 }, - { type: 2, pts: 6761575680, ccData: 42 }, - { type: 2, pts: 6761575680, ccData: 37376 }, - { type: 2, pts: 6761575680, ccData: 3072 }, - { type: 3, pts: 6761581686, ccData: 16930 }, - { type: 2, pts: 6761581686, ccData: 19061 }, - { type: 3, pts: 6761584689, ccData: 33314 }, - { type: 2, pts: 6761584689, ccData: 29556 }, - { type: 3, pts: 6761587692, ccData: 49698 }, - { type: 2, pts: 6761587692, ccData: 24436 }, - { type: 3, pts: 6761590695, ccData: 546 }, - { type: 2, pts: 6761590695, ccData: 26725 }, - { type: 3, pts: 6761593698, ccData: 16930 }, - { type: 2, pts: 6761593698, ccData: 24422 }, - { type: 3, pts: 6761596701, ccData: 33314 }, - { type: 2, pts: 6761596701, ccData: 28533 }, - { type: 3, pts: 6761599704, ccData: 49698 }, - { type: 2, pts: 6761599704, ccData: 29184 }, - { type: 3, pts: 6761602707, ccData: 2609 }, - { type: 2, pts: 6761602707, ccData: 38939 }, - { type: 2, pts: 6761602707, ccData: 16640 }, - { type: 2, pts: 6761602707, ccData: 287 }, - { type: 2, pts: 6761602707, ccData: 4240 }, - { type: 2, pts: 6761602707, ccData: 1283 }, - { type: 2, pts: 6761602707, ccData: 37162 }, - { type: 2, pts: 6761602707, ccData: 0 }, - { type: 2, pts: 6761602707, ccData: 37377 }, - { type: 2, pts: 6761602707, ccData: 4096 }, - { type: 3, pts: 6761608713, ccData: 17187 }, - { type: 2, pts: 6761608713, ccData: 37377 }, - { type: 2, pts: 6761608713, ccData: 4864 }, - { type: 3, pts: 6761614719, ccData: 33314 }, - { type: 2, pts: 6761614719, ccData: 28518 }, - { type: 3, pts: 6761617722, ccData: 49698 }, - { type: 2, pts: 6761617722, ccData: 24437 }, - { type: 3, pts: 6761620725, ccData: 546 }, - { type: 2, pts: 6761620725, ccData: 29486 }, - { type: 3, pts: 6761623728, ccData: 16930 }, - { type: 2, pts: 6761623728, ccData: 35842 }, - { type: 3, pts: 6761629734, ccData: 33314 }, - { type: 2, pts: 6761629734, ccData: 35073 }, - { type: 3, pts: 6761704809, ccData: 51761 }, - { type: 2, pts: 6761704809, ccData: 39195 }, - { type: 2, pts: 6761704809, ccData: 17920 }, - { type: 2, pts: 6761704809, ccData: 31 }, - { type: 2, pts: 6761704809, ccData: 5264 }, - { type: 2, pts: 6761704809, ccData: 1283 }, - { type: 2, pts: 6761704809, ccData: 37162 }, - { type: 2, pts: 6761704809, ccData: 42 }, - { type: 2, pts: 6761704809, ccData: 37376 }, - { type: 2, pts: 6761704809, ccData: 0 }, - { type: 3, pts: 6761710815, ccData: 803 }, - { type: 2, pts: 6761710815, ccData: 37376 }, - { type: 2, pts: 6761710815, ccData: 768 }, - { type: 3, pts: 6761716821, ccData: 16930 }, - { type: 2, pts: 6761716821, ccData: 20328 }, - { type: 3, pts: 6761719824, ccData: 33314 }, - { type: 2, pts: 6761719824, ccData: 8448 }, - { type: 3, pts: 6761722827, ccData: 49698 }, - { type: 2, pts: 6761722827, ccData: 35841 }, - { type: 3, pts: 6761728833, ccData: 546 }, - { type: 2, pts: 6761728833, ccData: 35074 }, - { type: 3, pts: 6761758863, ccData: 18993 }, - { type: 2, pts: 6761758863, ccData: 38939 }, - { type: 2, pts: 6761758863, ccData: 16640 }, - { type: 2, pts: 6761758863, ccData: 31 }, - { type: 2, pts: 6761758863, ccData: 5264 }, - { type: 2, pts: 6761758863, ccData: 1283 }, - { type: 2, pts: 6761758863, ccData: 37162 }, - { type: 2, pts: 6761758863, ccData: 42 }, - { type: 2, pts: 6761758863, ccData: 37376 }, - { type: 2, pts: 6761758863, ccData: 0 }, - { type: 3, pts: 6761764869, ccData: 33314 }, - { type: 2, pts: 6761764869, ccData: 17013 }, - { type: 3, pts: 6761767872, ccData: 49698 }, - { type: 2, pts: 6761767872, ccData: 29791 }, - { type: 3, pts: 6761770875, ccData: 546 }, - { type: 2, pts: 6761770875, ccData: 26735 }, - { type: 3, pts: 6761773878, ccData: 16930 }, - { type: 2, pts: 6761773878, ccData: 30559 }, - { type: 3, pts: 6761776881, ccData: 33314 }, - { type: 2, pts: 6761776881, ccData: 24941 }, - { type: 3, pts: 6761779884, ccData: 49698 }, - { type: 2, pts: 6761779884, ccData: 24393 }, - { type: 3, pts: 6761782887, ccData: 546 }, - { type: 2, pts: 6761782887, ccData: 24423 }, - { type: 3, pts: 6761785890, ccData: 16930 }, - { type: 2, pts: 6761785890, ccData: 28521 }, - { type: 3, pts: 6761788893, ccData: 33314 }, - { type: 2, pts: 6761788893, ccData: 28263 }, - { type: 3, pts: 6761791896, ccData: 51761 }, - { type: 2, pts: 6761791896, ccData: 38939 }, - { type: 2, pts: 6761791896, ccData: 16640 }, - { type: 2, pts: 6761791896, ccData: 287 }, - { type: 2, pts: 6761791896, ccData: 4240 }, - { type: 2, pts: 6761791896, ccData: 1283 }, - { type: 2, pts: 6761791896, ccData: 37162 }, - { type: 2, pts: 6761791896, ccData: 0 }, - { type: 2, pts: 6761791896, ccData: 37377 }, - { type: 2, pts: 6761791896, ccData: 0 }, - { type: 3, pts: 6761797902, ccData: 546 }, - { type: 2, pts: 6761797902, ccData: 29807 }, - { type: 3, pts: 6761800905, ccData: 16930 }, - { type: 2, pts: 6761800905, ccData: 24432 }, - { type: 3, pts: 6761803908, ccData: 33314 }, - { type: 2, pts: 6761803908, ccData: 27745 }, - { type: 3, pts: 6761806911, ccData: 49698 }, - { type: 2, pts: 6761806911, ccData: 31071 }, - { type: 3, pts: 6761809914, ccData: 546 }, - { type: 2, pts: 6761809914, ccData: 29551 }, - { type: 3, pts: 6761812917, ccData: 16930 }, - { type: 2, pts: 6761812917, ccData: 25443 }, - { type: 3, pts: 6761815920, ccData: 33314 }, - { type: 2, pts: 6761815920, ccData: 25970 }, - { type: 3, pts: 6761818923, ccData: 49698 }, - { type: 2, pts: 6761818923, ccData: 35842 }, - { type: 3, pts: 6761824929, ccData: 546 }, - { type: 2, pts: 6761824929, ccData: 35073 }, - { type: 3, pts: 6761942046, ccData: 18993 }, - { type: 2, pts: 6761942046, ccData: 39195 }, - { type: 2, pts: 6761942046, ccData: 17920 }, - { type: 2, pts: 6761942046, ccData: 31 }, - { type: 2, pts: 6761942046, ccData: 5264 }, - { type: 2, pts: 6761942046, ccData: 1283 }, - { type: 2, pts: 6761942046, ccData: 37162 }, - { type: 2, pts: 6761942046, ccData: 42 }, - { type: 2, pts: 6761942046, ccData: 37376 }, - { type: 2, pts: 6761942046, ccData: 0 }, - { type: 3, pts: 6761948052, ccData: 33314 }, - { type: 2, pts: 6761948052, ccData: 28530 }, - { type: 3, pts: 6761951055, ccData: 49698 }, - { type: 2, pts: 6761951055, ccData: 24434 }, - { type: 3, pts: 6761954058, ccData: 546 }, - { type: 2, pts: 6761954058, ccData: 26980 }, - { type: 3, pts: 6761957061, ccData: 16930 }, - { type: 2, pts: 6761957061, ccData: 25951 }, - { type: 3, pts: 6761960064, ccData: 33314 }, - { type: 2, pts: 6761960064, ccData: 24927 }, - { type: 3, pts: 6761963067, ccData: 49698 }, - { type: 2, pts: 6761963067, ccData: 25193 }, - { type: 3, pts: 6761966070, ccData: 546 }, - { type: 2, pts: 6761966070, ccData: 27493 }, - { type: 3, pts: 6761969073, ccData: 16930 }, - { type: 2, pts: 6761969073, ccData: 16128 }, - { type: 3, pts: 6761972076, ccData: 33314 }, - { type: 2, pts: 6761972076, ccData: 35841 }, - { type: 3, pts: 6761978082, ccData: 49698 }, - { type: 2, pts: 6761978082, ccData: 35074 }, - { type: 3, pts: 6762047151, ccData: 2609 }, - { type: 2, pts: 6762047151, ccData: 38939 }, - { type: 2, pts: 6762047151, ccData: 16640 }, - { type: 2, pts: 6762047151, ccData: 31 }, - { type: 2, pts: 6762047151, ccData: 5264 }, - { type: 2, pts: 6762047151, ccData: 1283 }, - { type: 2, pts: 6762047151, ccData: 37162 }, - { type: 2, pts: 6762047151, ccData: 42 }, - { type: 2, pts: 6762047151, ccData: 37376 }, - { type: 2, pts: 6762047151, ccData: 0 }, - { type: 3, pts: 6762053157, ccData: 16930 }, - { type: 2, pts: 6762053157, ccData: 19833 }, - { type: 3, pts: 6762056160, ccData: 33314 }, - { type: 2, pts: 6762056160, ccData: 24424 }, - { type: 3, pts: 6762059163, ccData: 49698 }, - { type: 2, pts: 6762059163, ccData: 24937 }, - { type: 3, pts: 6762062166, ccData: 546 }, - { type: 2, pts: 6762062166, ccData: 29279 }, - { type: 3, pts: 6762065169, ccData: 16930 }, - { type: 2, pts: 6762065169, ccData: 27493 }, - { type: 3, pts: 6762068172, ccData: 33314 }, - { type: 2, pts: 6762068172, ccData: 25968 }, - { type: 3, pts: 6762071175, ccData: 49698 }, - { type: 2, pts: 6762071175, ccData: 29535 }, - { type: 3, pts: 6762074178, ccData: 546 }, - { type: 2, pts: 6762074178, ccData: 26469 }, - { type: 3, pts: 6762077181, ccData: 16930 }, - { type: 2, pts: 6762077181, ccData: 29812 }, - { type: 3, pts: 6762080184, ccData: 33314 }, - { type: 2, pts: 6762080184, ccData: 26990 }, - { type: 3, pts: 6762083187, ccData: 49698 }, - { type: 2, pts: 6762083187, ccData: 26368 }, - { type: 3, pts: 6762086190, ccData: 2609 }, - { type: 2, pts: 6762086190, ccData: 38939 }, - { type: 2, pts: 6762086190, ccData: 16640 }, - { type: 2, pts: 6762086190, ccData: 287 }, - { type: 2, pts: 6762086190, ccData: 4240 }, - { type: 2, pts: 6762086190, ccData: 1283 }, - { type: 2, pts: 6762086190, ccData: 37162 }, - { type: 2, pts: 6762086190, ccData: 0 }, - { type: 2, pts: 6762086190, ccData: 37377 }, - { type: 2, pts: 6762086190, ccData: 0 }, - { type: 3, pts: 6762092196, ccData: 16930 }, - { type: 2, pts: 6762092196, ccData: 26990 }, - { type: 3, pts: 6762095199, ccData: 33314 }, - { type: 2, pts: 6762095199, ccData: 24429 }, - { type: 3, pts: 6762098202, ccData: 49698 }, - { type: 2, pts: 6762098202, ccData: 31071 }, - { type: 3, pts: 6762101205, ccData: 546 }, - { type: 2, pts: 6762101205, ccData: 30561 }, - { type: 3, pts: 6762104208, ccData: 16930 }, - { type: 2, pts: 6762104208, ccData: 31022 }, - { type: 3, pts: 6762107211, ccData: 33314 }, - { type: 2, pts: 6762107211, ccData: 35842 }, - { type: 3, pts: 6762113217, ccData: 49698 }, - { type: 2, pts: 6762113217, ccData: 35073 }, - { type: 3, pts: 6762239343, ccData: 2609 }, - { type: 2, pts: 6762239343, ccData: 39195 }, - { type: 2, pts: 6762239343, ccData: 16640 }, - { type: 2, pts: 6762239343, ccData: 31 }, - { type: 2, pts: 6762239343, ccData: 5264 }, - { type: 2, pts: 6762239343, ccData: 1283 }, - { type: 2, pts: 6762239343, ccData: 37162 }, - { type: 2, pts: 6762239343, ccData: 42 }, - { type: 2, pts: 6762239343, ccData: 37376 }, - { type: 2, pts: 6762239343, ccData: 0 }, - { type: 3, pts: 6762245349, ccData: 17187 }, - { type: 2, pts: 6762245349, ccData: 37376 }, - { type: 2, pts: 6762245349, ccData: 256 }, - { type: 3, pts: 6762251355, ccData: 33314 }, - { type: 2, pts: 6762251355, ccData: 22373 }, - { type: 3, pts: 6762254358, ccData: 49698 }, - { type: 2, pts: 6762254358, ccData: 27756 }, - { type: 3, pts: 6762257361, ccData: 546 }, - { type: 2, pts: 6762257361, ccData: 11359 }, - { type: 3, pts: 6762260364, ccData: 16930 }, - { type: 2, pts: 6762260364, ccData: 30568 }, - { type: 3, pts: 6762263367, ccData: 33314 }, - { type: 2, pts: 6762263367, ccData: 24948 }, - { type: 3, pts: 6762266370, ccData: 49698 }, - { type: 2, pts: 6762266370, ccData: 24425 }, - { type: 3, pts: 6762269373, ccData: 546 }, - { type: 2, pts: 6762269373, ccData: 26207 }, - { type: 3, pts: 6762272376, ccData: 16930 }, - { type: 2, pts: 6762272376, ccData: 18783 }, - { type: 3, pts: 6762275379, ccData: 33314 }, - { type: 2, pts: 6762275379, ccData: 28789 }, - { type: 3, pts: 6762278382, ccData: 49698 }, - { type: 2, pts: 6762278382, ccData: 29791 }, - { type: 3, pts: 6762281385, ccData: 546 }, - { type: 2, pts: 6762281385, ccData: 31087 }, - { type: 3, pts: 6762284388, ccData: 16930 }, - { type: 2, pts: 6762284388, ccData: 30066 }, - { type: 3, pts: 6762287391, ccData: 33314 }, - { type: 2, pts: 6762287391, ccData: 24424 }, - { type: 3, pts: 6762290394, ccData: 49698 }, - { type: 2, pts: 6762290394, ccData: 24937 }, - { type: 3, pts: 6762293397, ccData: 546 }, - { type: 2, pts: 6762293397, ccData: 29184 }, - { type: 3, pts: 6762296400, ccData: 18993 }, - { type: 2, pts: 6762296400, ccData: 39195 }, - { type: 2, pts: 6762296400, ccData: 16640 }, - { type: 2, pts: 6762296400, ccData: 287 }, - { type: 2, pts: 6762296400, ccData: 4240 }, - { type: 2, pts: 6762296400, ccData: 1283 }, - { type: 2, pts: 6762296400, ccData: 37162 }, - { type: 2, pts: 6762296400, ccData: 0 }, - { type: 2, pts: 6762296400, ccData: 37377 }, - { type: 2, pts: 6762296400, ccData: 2048 }, - { type: 3, pts: 6762302406, ccData: 33571 }, - { type: 2, pts: 6762302406, ccData: 37377 }, - { type: 2, pts: 6762302406, ccData: 2304 }, - { type: 3, pts: 6762308412, ccData: 49698 }, - { type: 2, pts: 6762308412, ccData: 26990 }, - { type: 3, pts: 6762311415, ccData: 546 }, - { type: 2, pts: 6762311415, ccData: 24417 }, - { type: 3, pts: 6762314418, ccData: 16930 }, - { type: 2, pts: 6762314418, ccData: 24432 }, - { type: 3, pts: 6762317421, ccData: 33314 }, - { type: 2, pts: 6762317421, ccData: 28526 }, - { type: 3, pts: 6762320424, ccData: 49698 }, - { type: 2, pts: 6762320424, ccData: 31092 }, - { type: 3, pts: 6762323427, ccData: 546 }, - { type: 2, pts: 6762323427, ccData: 24937 }, - { type: 3, pts: 6762326430, ccData: 16930 }, - { type: 2, pts: 6762326430, ccData: 27711 }, - { type: 3, pts: 6762329433, ccData: 33314 }, - { type: 2, pts: 6762329433, ccData: 35841 }, - { type: 3, pts: 6762335439, ccData: 49698 }, - { type: 2, pts: 6762335439, ccData: 35074 }, - { type: 3, pts: 6762584688, ccData: 2609 }, - { type: 2, pts: 6762584688, ccData: 38939 }, - { type: 2, pts: 6762584688, ccData: 17920 }, - { type: 2, pts: 6762584688, ccData: 31 }, - { type: 2, pts: 6762584688, ccData: 5264 }, - { type: 2, pts: 6762584688, ccData: 1283 }, - { type: 2, pts: 6762584688, ccData: 37162 }, - { type: 2, pts: 6762584688, ccData: 42 }, - { type: 2, pts: 6762584688, ccData: 37376 }, - { type: 2, pts: 6762584688, ccData: 0 }, - { type: 3, pts: 6762590694, ccData: 17187 }, - { type: 2, pts: 6762590694, ccData: 37376 }, - { type: 2, pts: 6762590694, ccData: 768 }, - { type: 3, pts: 6762596700, ccData: 33314 }, - { type: 2, pts: 6762596700, ccData: 21615 }, - { type: 3, pts: 6762599703, ccData: 49698 }, - { type: 2, pts: 6762599703, ccData: 24427 }, - { type: 3, pts: 6762602706, ccData: 546 }, - { type: 2, pts: 6762602706, ccData: 25957 }, - { type: 3, pts: 6762605709, ccData: 16930 }, - { type: 2, pts: 6762605709, ccData: 28767 }, - { type: 3, pts: 6762608712, ccData: 33314 }, - { type: 2, pts: 6762608712, ccData: 26996 }, - { type: 3, pts: 6762611715, ccData: 49698 }, - { type: 2, pts: 6762611715, ccData: 24431 }, - { type: 3, pts: 6762614718, ccData: 546 }, - { type: 2, pts: 6762614718, ccData: 30068 }, - { type: 3, pts: 6762617721, ccData: 16930 }, - { type: 2, pts: 6762617721, ccData: 24431 }, - { type: 3, pts: 6762620724, ccData: 33314 }, - { type: 2, pts: 6762620724, ccData: 26207 }, - { type: 3, pts: 6762623727, ccData: 49698 }, - { type: 2, pts: 6762623727, ccData: 29800 }, - { type: 3, pts: 6762626730, ccData: 546 }, - { type: 2, pts: 6762626730, ccData: 25951 }, - { type: 3, pts: 6762629733, ccData: 16930 }, - { type: 2, pts: 6762629733, ccData: 30561 }, - { type: 3, pts: 6762632736, ccData: 33314 }, - { type: 2, pts: 6762632736, ccData: 31039 }, - { type: 3, pts: 6762635739, ccData: 49698 }, - { type: 2, pts: 6762635739, ccData: 35842 }, - { type: 3, pts: 6762641745, ccData: 546 }, - { type: 2, pts: 6762641745, ccData: 35073 }, - { type: 3, pts: 6762719823, ccData: 18993 }, - { type: 2, pts: 6762719823, ccData: 39195 }, - { type: 2, pts: 6762719823, ccData: 16640 }, - { type: 2, pts: 6762719823, ccData: 31 }, - { type: 2, pts: 6762719823, ccData: 5264 }, - { type: 2, pts: 6762719823, ccData: 1283 }, - { type: 2, pts: 6762719823, ccData: 37162 }, - { type: 2, pts: 6762719823, ccData: 42 }, - { type: 2, pts: 6762719823, ccData: 37376 }, - { type: 2, pts: 6762719823, ccData: 0 }, - { type: 3, pts: 6762725829, ccData: 33314 }, - { type: 2, pts: 6762725829, ccData: 18290 }, - { type: 3, pts: 6762728832, ccData: 49698 }, - { type: 2, pts: 6762728832, ccData: 25953 }, - { type: 3, pts: 6762731835, ccData: 546 }, - { type: 2, pts: 6762731835, ccData: 29791 }, - { type: 3, pts: 6762734838, ccData: 16930 }, - { type: 2, pts: 6762734838, ccData: 26980 }, - { type: 3, pts: 6762737841, ccData: 33314 }, - { type: 2, pts: 6762737841, ccData: 25953 }, - { type: 3, pts: 6762740844, ccData: 49698 }, - { type: 2, pts: 6762740844, ccData: 11264 }, - { type: 3, pts: 6762743847, ccData: 2609 }, - { type: 2, pts: 6762743847, ccData: 39195 }, - { type: 2, pts: 6762743847, ccData: 16640 }, - { type: 2, pts: 6762743847, ccData: 287 }, - { type: 2, pts: 6762743847, ccData: 4240 }, - { type: 2, pts: 6762743847, ccData: 1283 }, - { type: 2, pts: 6762743847, ccData: 37162 }, - { type: 2, pts: 6762743847, ccData: 0 }, - { type: 2, pts: 6762743847, ccData: 37377 }, - { type: 2, pts: 6762743847, ccData: 0 }, - { type: 3, pts: 6762749853, ccData: 16930 }, - { type: 2, pts: 6762749853, ccData: 19823 }, - { type: 3, pts: 6762752856, ccData: 33314 }, - { type: 2, pts: 6762752856, ccData: 28013 }, - { type: 3, pts: 6762755859, ccData: 49698 }, - { type: 2, pts: 6762755859, ccData: 31022 }, - { type: 3, pts: 6762758862, ccData: 546 }, - { type: 2, pts: 6762758862, ccData: 35841 }, - { type: 3, pts: 6762764868, ccData: 16930 }, - { type: 2, pts: 6762764868, ccData: 35074 }, - { type: 3, pts: 6762909012, ccData: 35377 }, - { type: 2, pts: 6762909012, ccData: 38939 }, - { type: 2, pts: 6762909012, ccData: 16640 }, - { type: 2, pts: 6762909012, ccData: 31 }, - { type: 2, pts: 6762909012, ccData: 5264 }, - { type: 2, pts: 6762909012, ccData: 1283 }, - { type: 2, pts: 6762909012, ccData: 37162 }, - { type: 2, pts: 6762909012, ccData: 42 }, - { type: 2, pts: 6762909012, ccData: 37376 }, - { type: 2, pts: 6762909012, ccData: 0 }, - { type: 3, pts: 6762915018, ccData: 49698 }, - { type: 2, pts: 6762915018, ccData: 20328 }, - { type: 3, pts: 6762918021, ccData: 546 }, - { type: 2, pts: 6762918021, ccData: 11264 }, - { type: 3, pts: 6762921024, ccData: 18993 }, - { type: 2, pts: 6762921024, ccData: 38939 }, - { type: 2, pts: 6762921024, ccData: 16640 }, - { type: 2, pts: 6762921024, ccData: 287 }, - { type: 2, pts: 6762921024, ccData: 4240 }, - { type: 2, pts: 6762921024, ccData: 1283 }, - { type: 2, pts: 6762921024, ccData: 37162 }, - { type: 2, pts: 6762921024, ccData: 0 }, - { type: 2, pts: 6762921024, ccData: 37377 }, - { type: 2, pts: 6762921024, ccData: 0 }, - { type: 3, pts: 6762927030, ccData: 33314 }, - { type: 2, pts: 6762927030, ccData: 25205 }, - { type: 3, pts: 6762930033, ccData: 49698 }, - { type: 2, pts: 6762930033, ccData: 29791 }, - { type: 3, pts: 6762933036, ccData: 546 }, - { type: 2, pts: 6762933036, ccData: 18727 }, - { type: 3, pts: 6762936039, ccData: 16930 }, - { type: 2, pts: 6762936039, ccData: 30309 }, - { type: 3, pts: 6762939042, ccData: 33314 }, - { type: 2, pts: 6762939042, ccData: 24423 }, - { type: 3, pts: 6762942045, ccData: 49698 }, - { type: 2, pts: 6762942045, ccData: 28532 }, - { type: 3, pts: 6762945048, ccData: 546 }, - { type: 2, pts: 6762945048, ccData: 24435 }, - { type: 3, pts: 6762948051, ccData: 16930 }, - { type: 2, pts: 6762948051, ccData: 28511 }, - { type: 3, pts: 6762951054, ccData: 33314 }, - { type: 2, pts: 6762951054, ccData: 28021 }, - { type: 3, pts: 6762954057, ccData: 49698 }, - { type: 2, pts: 6762954057, ccData: 25448 }, - { type: 3, pts: 6762957060, ccData: 546 }, - { type: 2, pts: 6762957060, ccData: 24424 }, - { type: 3, pts: 6762960063, ccData: 16930 }, - { type: 2, pts: 6762960063, ccData: 24937 }, - { type: 3, pts: 6762963066, ccData: 33314 }, - { type: 2, pts: 6762963066, ccData: 29230 }, - { type: 3, pts: 6762966069, ccData: 49698 }, - { type: 2, pts: 6762966069, ccData: 35842 }, - { type: 3, pts: 6762972075, ccData: 546 }, - { type: 2, pts: 6762972075, ccData: 35073 }, - { type: 3, pts: 6763143246, ccData: 18993 }, - { type: 2, pts: 6763143246, ccData: 39195 }, - { type: 2, pts: 6763143246, ccData: 15360 }, - { type: 2, pts: 6763143246, ccData: 31 }, - { type: 2, pts: 6763143246, ccData: 5264 }, - { type: 2, pts: 6763143246, ccData: 1283 }, - { type: 2, pts: 6763143246, ccData: 37162 }, - { type: 2, pts: 6763143246, ccData: 42 }, - { type: 2, pts: 6763143246, ccData: 37376 }, - { type: 2, pts: 6763143246, ccData: 0 }, - { type: 3, pts: 6763149252, ccData: 33314 }, - { type: 2, pts: 6763149252, ccData: 10343 }, - { type: 3, pts: 6763152255, ccData: 49698 }, - { type: 2, pts: 6763152255, ccData: 24947 }, - { type: 3, pts: 6763155258, ccData: 546 }, - { type: 2, pts: 6763155258, ccData: 28787 }, - { type: 3, pts: 6763158261, ccData: 16930 }, - { type: 2, pts: 6763158261, ccData: 10554 }, - { type: 3, pts: 6763161264, ccData: 35377 }, - { type: 2, pts: 6763161264, ccData: 39195 }, - { type: 2, pts: 6763161264, ccData: 15360 }, - { type: 2, pts: 6763161264, ccData: 287 }, - { type: 2, pts: 6763161264, ccData: 4240 }, - { type: 2, pts: 6763161264, ccData: 1283 }, - { type: 2, pts: 6763161264, ccData: 37162 }, - { type: 2, pts: 6763161264, ccData: 0 }, - { type: 2, pts: 6763161264, ccData: 37377 }, - { type: 2, pts: 6763161264, ccData: 0 }, - { type: 3, pts: 6763167270, ccData: 49698 }, - { type: 2, pts: 6763167270, ccData: 22895 }, - { type: 3, pts: 6763170273, ccData: 546 }, - { type: 2, pts: 6763170273, ccData: 29991 }, - { type: 3, pts: 6763173276, ccData: 16930 }, - { type: 2, pts: 6763173276, ccData: 27756 }, - { type: 3, pts: 6763176279, ccData: 33314 }, - { type: 2, pts: 6763176279, ccData: 24424 }, - { type: 3, pts: 6763179282, ccData: 49698 }, - { type: 2, pts: 6763179282, ccData: 24950 }, - { type: 3, pts: 6763182285, ccData: 546 }, - { type: 2, pts: 6763182285, ccData: 25951 }, - { type: 3, pts: 6763185288, ccData: 16930 }, - { type: 2, pts: 6763185288, ccData: 29807 }, - { type: 3, pts: 6763188291, ccData: 33314 }, - { type: 2, pts: 6763188291, ccData: 24429 }, - { type: 3, pts: 6763191294, ccData: 49698 }, - { type: 2, pts: 6763191294, ccData: 24939 }, - { type: 3, pts: 6763194297, ccData: 546 }, - { type: 2, pts: 6763194297, ccData: 25951 }, - { type: 3, pts: 6763197300, ccData: 16930 }, - { type: 2, pts: 6763197300, ccData: 27759 }, - { type: 3, pts: 6763200303, ccData: 33314 }, - { type: 2, pts: 6763200303, ccData: 29811 }, - { type: 3, pts: 6763203306, ccData: 51761 }, - { type: 2, pts: 6763203306, ccData: 39195 }, - { type: 2, pts: 6763203306, ccData: 15360 }, - { type: 2, pts: 6763203306, ccData: 543 }, - { type: 2, pts: 6763203306, ccData: 4240 }, - { type: 2, pts: 6763203306, ccData: 1283 }, - { type: 2, pts: 6763203306, ccData: 37162 }, - { type: 2, pts: 6763203306, ccData: 0 }, - { type: 2, pts: 6763203306, ccData: 37378 }, - { type: 2, pts: 6763203306, ccData: 0 }, - { type: 3, pts: 6763209312, ccData: 546 }, - { type: 2, pts: 6763209312, ccData: 24942 }, - { type: 3, pts: 6763212315, ccData: 16930 }, - { type: 2, pts: 6763212315, ccData: 25695 }, - { type: 3, pts: 6763215318, ccData: 33314 }, - { type: 2, pts: 6763215318, ccData: 27759 }, - { type: 3, pts: 6763218321, ccData: 49698 }, - { type: 2, pts: 6763218321, ccData: 29811 }, - { type: 3, pts: 6763221324, ccData: 546 }, - { type: 2, pts: 6763221324, ccData: 24431 }, - { type: 3, pts: 6763224327, ccData: 16930 }, - { type: 2, pts: 6763224327, ccData: 26207 }, - { type: 3, pts: 6763227330, ccData: 33314 }, - { type: 2, pts: 6763227330, ccData: 28783 }, - { type: 3, pts: 6763230333, ccData: 49698 }, - { type: 2, pts: 6763230333, ccData: 28281 }, - { type: 3, pts: 6763233336, ccData: 546 }, - { type: 2, pts: 6763233336, ccData: 29793 }, - { type: 3, pts: 6763236339, ccData: 16930 }, - { type: 2, pts: 6763236339, ccData: 26988 }, - { type: 3, pts: 6763239342, ccData: 33314 }, - { type: 2, pts: 6763239342, ccData: 29473 }, - { type: 3, pts: 6763242345, ccData: 49698 }, - { type: 2, pts: 6763242345, ccData: 35841 }, - { type: 3, pts: 6763248351, ccData: 546 }, - { type: 2, pts: 6763248351, ccData: 35074 }, - { type: 3, pts: 6763545648, ccData: 18993 }, - { type: 2, pts: 6763545648, ccData: 38939 }, - { type: 2, pts: 6763545648, ccData: 17920 }, - { type: 2, pts: 6763545648, ccData: 31 }, - { type: 2, pts: 6763545648, ccData: 5264 }, - { type: 2, pts: 6763545648, ccData: 1283 }, - { type: 2, pts: 6763545648, ccData: 37162 }, - { type: 2, pts: 6763545648, ccData: 42 }, - { type: 2, pts: 6763545648, ccData: 37376 }, - { type: 2, pts: 6763545648, ccData: 4096 }, - { type: 3, pts: 6763551654, ccData: 33571 }, - { type: 2, pts: 6763551654, ccData: 37376 }, - { type: 2, pts: 6763551654, ccData: 4608 }, - { type: 3, pts: 6763557660, ccData: 49698 }, - { type: 2, pts: 6763557660, ccData: 19567 }, - { type: 3, pts: 6763560663, ccData: 546 }, - { type: 2, pts: 6763560663, ccData: 29811 }, - { type: 3, pts: 6763563666, ccData: 16930 }, - { type: 2, pts: 6763563666, ccData: 24417 }, - { type: 3, pts: 6763566669, ccData: 33314 }, - { type: 2, pts: 6763566669, ccData: 28260 }, - { type: 3, pts: 6763569672, ccData: 49698 }, - { type: 2, pts: 6763569672, ccData: 24428 }, - { type: 3, pts: 6763572675, ccData: 546 }, - { type: 2, pts: 6763572675, ccData: 28532 }, - { type: 3, pts: 6763575678, ccData: 16930 }, - { type: 2, pts: 6763575678, ccData: 29503 }, - { type: 3, pts: 6763578681, ccData: 33314 }, - { type: 2, pts: 6763578681, ccData: 35842 }, - { type: 3, pts: 6763584687, ccData: 49698 }, - { type: 2, pts: 6763584687, ccData: 35073 }, - { type: 3, pts: 6763668771, ccData: 2609 }, - { type: 2, pts: 6763668771, ccData: 39195 }, - { type: 2, pts: 6763668771, ccData: 16640 }, - { type: 2, pts: 6763668771, ccData: 31 }, - { type: 2, pts: 6763668771, ccData: 5264 }, - { type: 2, pts: 6763668771, ccData: 1283 }, - { type: 2, pts: 6763668771, ccData: 37162 }, - { type: 2, pts: 6763668771, ccData: 42 }, - { type: 2, pts: 6763668771, ccData: 37376 }, - { type: 2, pts: 6763668771, ccData: 0 }, - { type: 3, pts: 6763674777, ccData: 16930 }, - { type: 2, pts: 6763674777, ccData: 18727 }, - { type: 3, pts: 6763677780, ccData: 33314 }, - { type: 2, pts: 6763677780, ccData: 27756 }, - { type: 3, pts: 6763680783, ccData: 49698 }, - { type: 2, pts: 6763680783, ccData: 24420 }, - { type: 3, pts: 6763683786, ccData: 546 }, - { type: 2, pts: 6763683786, ccData: 29281 }, - { type: 3, pts: 6763686789, ccData: 16930 }, - { type: 2, pts: 6763686789, ccData: 30559 }, - { type: 3, pts: 6763689792, ccData: 33314 }, - { type: 2, pts: 6763689792, ccData: 24927 }, - { type: 3, pts: 6763692795, ccData: 49698 }, - { type: 2, pts: 6763692795, ccData: 28777 }, - { type: 3, pts: 6763695798, ccData: 546 }, - { type: 2, pts: 6763695798, ccData: 25460 }, - { type: 3, pts: 6763698801, ccData: 16930 }, - { type: 2, pts: 6763698801, ccData: 30066 }, - { type: 3, pts: 6763701804, ccData: 33314 }, - { type: 2, pts: 6763701804, ccData: 25856 }, - { type: 3, pts: 6763704807, ccData: 51761 }, - { type: 2, pts: 6763704807, ccData: 39195 }, - { type: 2, pts: 6763704807, ccData: 16640 }, - { type: 2, pts: 6763704807, ccData: 287 }, - { type: 2, pts: 6763704807, ccData: 4240 }, - { type: 2, pts: 6763704807, ccData: 1283 }, - { type: 2, pts: 6763704807, ccData: 37162 }, - { type: 2, pts: 6763704807, ccData: 0 }, - { type: 2, pts: 6763704807, ccData: 37377 }, - { type: 2, pts: 6763704807, ccData: 0 }, - { type: 3, pts: 6763710813, ccData: 546 }, - { type: 2, pts: 6763710813, ccData: 26223 }, - { type: 3, pts: 6763713816, ccData: 16930 }, - { type: 2, pts: 6763713816, ccData: 29279 }, - { type: 3, pts: 6763716819, ccData: 33314 }, - { type: 2, pts: 6763716819, ccData: 31087 }, - { type: 3, pts: 6763719822, ccData: 49698 }, - { type: 2, pts: 6763719822, ccData: 29998 }, - { type: 3, pts: 6763722825, ccData: 546 }, - { type: 2, pts: 6763722825, ccData: 35841 }, - { type: 3, pts: 6763728831, ccData: 16930 }, - { type: 2, pts: 6763728831, ccData: 35074 }, - { type: 3, pts: 6763909011, ccData: 35377 }, - { type: 2, pts: 6763909011, ccData: 38939 }, - { type: 2, pts: 6763909011, ccData: 17920 }, - { type: 2, pts: 6763909011, ccData: 31 }, - { type: 2, pts: 6763909011, ccData: 5264 }, - { type: 2, pts: 6763909011, ccData: 1283 }, - { type: 2, pts: 6763909011, ccData: 37162 }, - { type: 2, pts: 6763909011, ccData: 42 }, - { type: 2, pts: 6763909011, ccData: 37376 }, - { type: 2, pts: 6763909011, ccData: 3072 }, - { type: 3, pts: 6763915017, ccData: 49955 }, - { type: 2, pts: 6763915017, ccData: 37376 }, - { type: 2, pts: 6763915017, ccData: 3584 }, - { type: 3, pts: 6763921023, ccData: 545 }, - { type: 2, pts: 6763921023, ccData: 32512 }, - { type: 3, pts: 6763924026, ccData: 16930 }, - { type: 2, pts: 6763924026, ccData: 24320 }, - { type: 3, pts: 6763927029, ccData: 33313 }, - { type: 2, pts: 6763927029, ccData: 32512 }, - { type: 3, pts: 6763930032, ccData: 49698 }, - { type: 2, pts: 6763930032, ccData: 35842 }, - { type: 3, pts: 6763936038, ccData: 546 }, - { type: 2, pts: 6763936038, ccData: 35073 }, - { type: 3, pts: 6764437539, ccData: 18993 }, - { type: 2, pts: 6764437539, ccData: 39195 }, - { type: 2, pts: 6764437539, ccData: 17920 }, - { type: 2, pts: 6764437539, ccData: 31 }, - { type: 2, pts: 6764437539, ccData: 5264 }, - { type: 2, pts: 6764437539, ccData: 1283 }, - { type: 2, pts: 6764437539, ccData: 37162 }, - { type: 2, pts: 6764437539, ccData: 42 }, - { type: 2, pts: 6764437539, ccData: 37376 }, - { type: 2, pts: 6764437539, ccData: 2048 }, - { type: 3, pts: 6764443545, ccData: 33571 }, - { type: 2, pts: 6764443545, ccData: 37376 }, - { type: 2, pts: 6764443545, ccData: 2560 }, - { type: 3, pts: 6764449551, ccData: 49698 }, - { type: 2, pts: 6764449551, ccData: 22881 }, - { type: 3, pts: 6764452554, ccData: 546 }, - { type: 2, pts: 6764452554, ccData: 31020 }, - { type: 3, pts: 6764455557, ccData: 16930 }, - { type: 2, pts: 6764455557, ccData: 24397 }, - { type: 3, pts: 6764458560, ccData: 33314 }, - { type: 2, pts: 6764458560, ccData: 28525 }, - { type: 3, pts: 6764461563, ccData: 49698 }, - { type: 2, pts: 6764461563, ccData: 28025 }, - { type: 3, pts: 6764464566, ccData: 546 }, - { type: 2, pts: 6764464566, ccData: 8448 }, - { type: 3, pts: 6764467569, ccData: 16930 }, - { type: 2, pts: 6764467569, ccData: 35841 }, - { type: 3, pts: 6764473575, ccData: 33314 }, - { type: 2, pts: 6764473575, ccData: 35074 }, - { type: 3, pts: 6764524626, ccData: 51761 }, - { type: 2, pts: 6764524626, ccData: 38939 }, - { type: 2, pts: 6764524626, ccData: 16640 }, - { type: 2, pts: 6764524626, ccData: 31 }, - { type: 2, pts: 6764524626, ccData: 5264 }, - { type: 2, pts: 6764524626, ccData: 1283 }, - { type: 2, pts: 6764524626, ccData: 37162 }, - { type: 2, pts: 6764524626, ccData: 42 }, - { type: 2, pts: 6764524626, ccData: 37376 }, - { type: 2, pts: 6764524626, ccData: 1024 }, - { type: 3, pts: 6764530632, ccData: 546 }, - { type: 2, pts: 6764530632, ccData: 20334 }, - { type: 3, pts: 6764533635, ccData: 16930 }, - { type: 2, pts: 6764533635, ccData: 27769 }, - { type: 3, pts: 6764536638, ccData: 33314 }, - { type: 2, pts: 6764536638, ccData: 24422 }, - { type: 3, pts: 6764539641, ccData: 49698 }, - { type: 2, pts: 6764539641, ccData: 26998 }, - { type: 3, pts: 6764542644, ccData: 546 }, - { type: 2, pts: 6764542644, ccData: 25951 }, - { type: 3, pts: 6764545647, ccData: 16930 }, - { type: 2, pts: 6764545647, ccData: 28015 }, - { type: 3, pts: 6764548650, ccData: 33314 }, - { type: 2, pts: 6764548650, ccData: 29285 }, - { type: 3, pts: 6764551653, ccData: 49698 }, - { type: 2, pts: 6764551653, ccData: 24432 }, - { type: 3, pts: 6764554656, ccData: 546 }, - { type: 2, pts: 6764554656, ccData: 28526 }, - { type: 3, pts: 6764557659, ccData: 16930 }, - { type: 2, pts: 6764557659, ccData: 31092 }, - { type: 3, pts: 6764560662, ccData: 33314 }, - { type: 2, pts: 6764560662, ccData: 24937 }, - { type: 3, pts: 6764563665, ccData: 49698 }, - { type: 2, pts: 6764563665, ccData: 27763 }, - { type: 3, pts: 6764566668, ccData: 2609 }, - { type: 2, pts: 6764566668, ccData: 38939 }, - { type: 2, pts: 6764566668, ccData: 16640 }, - { type: 2, pts: 6764566668, ccData: 287 }, - { type: 2, pts: 6764566668, ccData: 4240 }, - { type: 2, pts: 6764566668, ccData: 1283 }, - { type: 2, pts: 6764566668, ccData: 37162 }, - { type: 2, pts: 6764566668, ccData: 0 }, - { type: 2, pts: 6764566668, ccData: 37377 }, - { type: 2, pts: 6764566668, ccData: 3072 }, - { type: 3, pts: 6764572674, ccData: 17187 }, - { type: 2, pts: 6764572674, ccData: 37377 }, - { type: 2, pts: 6764572674, ccData: 3328 }, - { type: 3, pts: 6764578680, ccData: 33314 }, - { type: 2, pts: 6764578680, ccData: 29807 }, - { type: 3, pts: 6764581683, ccData: 49698 }, - { type: 2, pts: 6764581683, ccData: 24423 }, - { type: 3, pts: 6764584686, ccData: 546 }, - { type: 2, pts: 6764584686, ccData: 28462 }, - { type: 3, pts: 6764587689, ccData: 16930 }, - { type: 2, pts: 6764587689, ccData: 35842 }, - { type: 3, pts: 6764593695, ccData: 33314 }, - { type: 2, pts: 6764593695, ccData: 35073 }, - { type: 3, pts: 6764860962, ccData: 49698 }, - { type: 2, pts: 6764860962, ccData: 35841 }, - { type: 3, pts: 6765068169, ccData: 2609 }, - { type: 2, pts: 6765068169, ccData: 38939 }, - { type: 2, pts: 6765068169, ccData: 16640 }, - { type: 2, pts: 6765068169, ccData: 31 }, - { type: 2, pts: 6765068169, ccData: 5264 }, - { type: 2, pts: 6765068169, ccData: 1283 }, - { type: 2, pts: 6765068169, ccData: 37162 }, - { type: 2, pts: 6765068169, ccData: 0 }, - { type: 2, pts: 6765068169, ccData: 37376 }, - { type: 2, pts: 6765068169, ccData: 1024 }, - { type: 3, pts: 6765074175, ccData: 17187 }, - { type: 2, pts: 6765074175, ccData: 37376 }, - { type: 2, pts: 6765074175, ccData: 1280 }, - { type: 3, pts: 6765080181, ccData: 33314 }, - { type: 2, pts: 6765080181, ccData: 21608 }, - { type: 3, pts: 6765083184, ccData: 49698 }, - { type: 2, pts: 6765083184, ccData: 25951 }, - { type: 3, pts: 6765086187, ccData: 546 }, - { type: 2, pts: 6765086187, ccData: 27745 }, - { type: 3, pts: 6765089190, ccData: 16930 }, - { type: 2, pts: 6765089190, ccData: 29556 }, - { type: 3, pts: 6765092193, ccData: 33314 }, - { type: 2, pts: 6765092193, ccData: 24432 }, - { type: 3, pts: 6765095196, ccData: 49698 }, - { type: 2, pts: 6765095196, ccData: 28526 }, - { type: 3, pts: 6765098199, ccData: 546 }, - { type: 2, pts: 6765098199, ccData: 31092 }, - { type: 3, pts: 6765101202, ccData: 16930 }, - { type: 2, pts: 6765101202, ccData: 24937 }, - { type: 3, pts: 6765104205, ccData: 33314 }, - { type: 2, pts: 6765104205, ccData: 27743 }, - { type: 3, pts: 6765107208, ccData: 49698 }, - { type: 2, pts: 6765107208, ccData: 26479 }, - { type: 3, pts: 6765110211, ccData: 546 }, - { type: 2, pts: 6765110211, ccData: 25971 }, - { type: 3, pts: 6765113214, ccData: 18993 }, - { type: 2, pts: 6765113214, ccData: 38939 }, - { type: 2, pts: 6765113214, ccData: 16640 }, - { type: 2, pts: 6765113214, ccData: 287 }, - { type: 2, pts: 6765113214, ccData: 4240 }, - { type: 2, pts: 6765113214, ccData: 1283 }, - { type: 2, pts: 6765113214, ccData: 37162 }, - { type: 2, pts: 6765113214, ccData: 0 }, - { type: 2, pts: 6765113214, ccData: 37377 }, - { type: 2, pts: 6765113214, ccData: 1024 }, - { type: 3, pts: 6765119220, ccData: 33571 }, - { type: 2, pts: 6765119220, ccData: 37377 }, - { type: 2, pts: 6765119220, ccData: 1792 }, - { type: 3, pts: 6765125226, ccData: 49698 }, - { type: 2, pts: 6765125226, ccData: 28526 }, - { type: 3, pts: 6765128229, ccData: 546 }, - { type: 2, pts: 6765128229, ccData: 24436 }, - { type: 3, pts: 6765131232, ccData: 16930 }, - { type: 2, pts: 6765131232, ccData: 26725 }, - { type: 3, pts: 6765134235, ccData: 33314 }, - { type: 2, pts: 6765134235, ccData: 24436 }, - { type: 3, pts: 6765137238, ccData: 49698 }, - { type: 2, pts: 6765137238, ccData: 26992 }, - { type: 3, pts: 6765140241, ccData: 546 }, - { type: 2, pts: 6765140241, ccData: 28793 }, - { type: 3, pts: 6765143244, ccData: 16930 }, - { type: 2, pts: 6765143244, ccData: 24436 }, - { type: 3, pts: 6765146247, ccData: 33314 }, - { type: 2, pts: 6765146247, ccData: 28528 }, - { type: 3, pts: 6765149250, ccData: 49698 }, - { type: 2, pts: 6765149250, ccData: 11776 }, - { type: 3, pts: 6765158259, ccData: 546 }, - { type: 2, pts: 6765158259, ccData: 35073 }, - { type: 3, pts: 6765431532, ccData: 16930 }, - { type: 2, pts: 6765431532, ccData: 35841 }, - { type: 3, pts: 6765620721, ccData: 35377 }, - { type: 2, pts: 6765620721, ccData: 38939 }, - { type: 2, pts: 6765620721, ccData: 17920 }, - { type: 2, pts: 6765620721, ccData: 31 }, - { type: 2, pts: 6765620721, ccData: 5264 }, - { type: 2, pts: 6765620721, ccData: 1283 }, - { type: 2, pts: 6765620721, ccData: 37162 }, - { type: 2, pts: 6765620721, ccData: 0 }, - { type: 2, pts: 6765620721, ccData: 37376 }, - { type: 2, pts: 6765620721, ccData: 0 }, - { type: 3, pts: 6765626727, ccData: 49955 }, - { type: 2, pts: 6765626727, ccData: 37376 }, - { type: 2, pts: 6765626727, ccData: 768 }, - { type: 3, pts: 6765632733, ccData: 546 }, - { type: 2, pts: 6765632733, ccData: 18533 }, - { type: 3, pts: 6765635736, ccData: 16930 }, - { type: 2, pts: 6765635736, ccData: 29285 }, - { type: 3, pts: 6765638739, ccData: 33314 }, - { type: 2, pts: 6765638739, ccData: 24441 }, - { type: 3, pts: 6765641742, ccData: 49698 }, - { type: 2, pts: 6765641742, ccData: 28533 }, - { type: 3, pts: 6765644745, ccData: 546 }, - { type: 2, pts: 6765644745, ccData: 24423 }, - { type: 3, pts: 6765647748, ccData: 16930 }, - { type: 2, pts: 6765647748, ccData: 28462 }, - { type: 3, pts: 6765656757, ccData: 33314 }, - { type: 2, pts: 6765656757, ccData: 35073 }, - { type: 3, pts: 6765701802, ccData: 51761 }, - { type: 2, pts: 6765701802, ccData: 39195 }, - { type: 2, pts: 6765701802, ccData: 16640 }, - { type: 2, pts: 6765701802, ccData: 31 }, - { type: 2, pts: 6765701802, ccData: 5264 }, - { type: 2, pts: 6765701802, ccData: 1283 }, - { type: 2, pts: 6765701802, ccData: 37162 }, - { type: 2, pts: 6765701802, ccData: 42 }, - { type: 2, pts: 6765701802, ccData: 37376 }, - { type: 2, pts: 6765701802, ccData: 3072 }, - { type: 3, pts: 6765707808, ccData: 546 }, - { type: 2, pts: 6765707808, ccData: 10343 }, - { type: 3, pts: 6765710811, ccData: 16930 }, - { type: 2, pts: 6765710811, ccData: 24947 }, - { type: 3, pts: 6765713814, ccData: 33314 }, - { type: 2, pts: 6765713814, ccData: 28787 }, - { type: 3, pts: 6765716817, ccData: 49698 }, - { type: 2, pts: 6765716817, ccData: 10554 }, - { type: 3, pts: 6765719820, ccData: 2609 }, - { type: 2, pts: 6765719820, ccData: 39195 }, - { type: 2, pts: 6765719820, ccData: 16640 }, - { type: 2, pts: 6765719820, ccData: 287 }, - { type: 2, pts: 6765719820, ccData: 4240 }, - { type: 2, pts: 6765719820, ccData: 1283 }, - { type: 2, pts: 6765719820, ccData: 37162 }, - { type: 2, pts: 6765719820, ccData: 0 }, - { type: 2, pts: 6765719820, ccData: 37377 }, - { type: 2, pts: 6765719820, ccData: 0 }, - { type: 3, pts: 6765725826, ccData: 17187 }, - { type: 2, pts: 6765725826, ccData: 37377 }, - { type: 2, pts: 6765725826, ccData: 256 }, - { type: 3, pts: 6765731832, ccData: 33314 }, - { type: 2, pts: 6765731832, ccData: 18804 }, - { type: 3, pts: 6765734835, ccData: 49698 }, - { type: 2, pts: 6765734835, ccData: 24428 }, - { type: 3, pts: 6765737838, ccData: 546 }, - { type: 2, pts: 6765737838, ccData: 28527 }, - { type: 3, pts: 6765740841, ccData: 16930 }, - { type: 2, pts: 6765740841, ccData: 27507 }, - { type: 3, pts: 6765743844, ccData: 33314 }, - { type: 2, pts: 6765743844, ccData: 24426 }, - { type: 3, pts: 6765746847, ccData: 49698 }, - { type: 2, pts: 6765746847, ccData: 30067 }, - { type: 3, pts: 6765749850, ccData: 546 }, - { type: 2, pts: 6765749850, ccData: 29791 }, - { type: 3, pts: 6765752853, ccData: 16930 }, - { type: 2, pts: 6765752853, ccData: 27753 }, - { type: 3, pts: 6765755856, ccData: 33314 }, - { type: 2, pts: 6765755856, ccData: 27493 }, - { type: 3, pts: 6765758859, ccData: 49698 }, - { type: 2, pts: 6765758859, ccData: 24429 }, - { type: 3, pts: 6765761862, ccData: 546 }, - { type: 2, pts: 6765761862, ccData: 31071 }, - { type: 3, pts: 6765764865, ccData: 16930 }, - { type: 2, pts: 6765764865, ccData: 28777 }, - { type: 3, pts: 6765767868, ccData: 33314 }, - { type: 2, pts: 6765767868, ccData: 25460 }, - { type: 3, pts: 6765770871, ccData: 49698 }, - { type: 2, pts: 6765770871, ccData: 30066 }, - { type: 3, pts: 6765773874, ccData: 546 }, - { type: 2, pts: 6765773874, ccData: 25902 }, - { type: 3, pts: 6765776877, ccData: 16930 }, - { type: 2, pts: 6765776877, ccData: 35841 }, - { type: 3, pts: 6765782883, ccData: 33314 }, - { type: 2, pts: 6765782883, ccData: 35074 }, - { type: 3, pts: 6766014114, ccData: 51761 }, - { type: 2, pts: 6766014114, ccData: 38939 }, - { type: 2, pts: 6766014114, ccData: 17920 }, - { type: 2, pts: 6766014114, ccData: 31 }, - { type: 2, pts: 6766014114, ccData: 5264 }, - { type: 2, pts: 6766014114, ccData: 1283 }, - { type: 2, pts: 6766014114, ccData: 37162 }, - { type: 2, pts: 6766014114, ccData: 42 }, - { type: 2, pts: 6766014114, ccData: 37376 }, - { type: 2, pts: 6766014114, ccData: 0 }, - { type: 3, pts: 6766020120, ccData: 803 }, - { type: 2, pts: 6766020120, ccData: 37376 }, - { type: 2, pts: 6766020120, ccData: 768 }, - { type: 3, pts: 6766026126, ccData: 16930 }, - { type: 2, pts: 6766026126, ccData: 21608 }, - { type: 3, pts: 6766029129, ccData: 33314 }, - { type: 2, pts: 6766029129, ccData: 24942 }, - { type: 3, pts: 6766032132, ccData: 49698 }, - { type: 2, pts: 6766032132, ccData: 27487 }, - { type: 3, pts: 6766035135, ccData: 546 }, - { type: 2, pts: 6766035135, ccData: 31087 }, - { type: 3, pts: 6766038138, ccData: 16930 }, - { type: 2, pts: 6766038138, ccData: 30047 }, - { type: 3, pts: 6766041141, ccData: 33314 }, - { type: 2, pts: 6766041141, ccData: 29551 }, - { type: 3, pts: 6766044144, ccData: 49698 }, - { type: 2, pts: 6766044144, ccData: 24429 }, - { type: 3, pts: 6766047147, ccData: 546 }, - { type: 2, pts: 6766047147, ccData: 30051 }, - { type: 3, pts: 6766050150, ccData: 16930 }, - { type: 2, pts: 6766050150, ccData: 26668 }, - { type: 3, pts: 6766053153, ccData: 33314 }, - { type: 2, pts: 6766053153, ccData: 24397 }, - { type: 3, pts: 6766056156, ccData: 49698 }, - { type: 2, pts: 6766056156, ccData: 28525 }, - { type: 3, pts: 6766059159, ccData: 546 }, - { type: 2, pts: 6766059159, ccData: 28025 }, - { type: 3, pts: 6766062162, ccData: 16930 }, - { type: 2, pts: 6766062162, ccData: 11776 }, - { type: 3, pts: 6766065165, ccData: 33314 }, - { type: 2, pts: 6766065165, ccData: 35842 }, - { type: 3, pts: 6766071171, ccData: 49698 }, - { type: 2, pts: 6766071171, ccData: 35073 }, - { type: 3, pts: 6766173273, ccData: 2609 }, - { type: 2, pts: 6766173273, ccData: 39195 }, - { type: 2, pts: 6766173273, ccData: 16640 }, - { type: 2, pts: 6766173273, ccData: 31 }, - { type: 2, pts: 6766173273, ccData: 5264 }, - { type: 2, pts: 6766173273, ccData: 1283 }, - { type: 2, pts: 6766173273, ccData: 37162 }, - { type: 2, pts: 6766173273, ccData: 42 }, - { type: 2, pts: 6766173273, ccData: 37376 }, - { type: 2, pts: 6766173273, ccData: 2048 }, - { type: 3, pts: 6766179279, ccData: 16930 }, - { type: 2, pts: 6766179279, ccData: 22895 }, - { type: 3, pts: 6766182282, ccData: 33314 }, - { type: 2, pts: 6766182282, ccData: 30047 }, - { type: 3, pts: 6766185285, ccData: 49698 }, - { type: 2, pts: 6766185285, ccData: 29544 }, - { type: 3, pts: 6766188288, ccData: 546 }, - { type: 2, pts: 6766188288, ccData: 28533 }, - { type: 3, pts: 6766191291, ccData: 16930 }, - { type: 2, pts: 6766191291, ccData: 27748 }, - { type: 3, pts: 6766194294, ccData: 33314 }, - { type: 2, pts: 6766194294, ccData: 24439 }, - { type: 3, pts: 6766197297, ccData: 49698 }, - { type: 2, pts: 6766197297, ccData: 28530 }, - { type: 3, pts: 6766200300, ccData: 546 }, - { type: 2, pts: 6766200300, ccData: 27392 }, - { type: 3, pts: 6766203303, ccData: 18993 }, - { type: 2, pts: 6766203303, ccData: 39195 }, - { type: 2, pts: 6766203303, ccData: 16640 }, - { type: 2, pts: 6766203303, ccData: 287 }, - { type: 2, pts: 6766203303, ccData: 4240 }, - { type: 2, pts: 6766203303, ccData: 1283 }, - { type: 2, pts: 6766203303, ccData: 37162 }, - { type: 2, pts: 6766203303, ccData: 0 }, - { type: 2, pts: 6766203303, ccData: 37377 }, - { type: 2, pts: 6766203303, ccData: 1024 }, - { type: 3, pts: 6766209309, ccData: 33571 }, - { type: 2, pts: 6766209309, ccData: 37377 }, - { type: 2, pts: 6766209309, ccData: 1536 }, - { type: 3, pts: 6766215315, ccData: 49698 }, - { type: 2, pts: 6766215315, ccData: 24948 }, - { type: 3, pts: 6766218318, ccData: 546 }, - { type: 2, pts: 6766218318, ccData: 24436 }, - { type: 3, pts: 6766221321, ccData: 16930 }, - { type: 2, pts: 6766221321, ccData: 26725 }, - { type: 3, pts: 6766224324, ccData: 33314 }, - { type: 2, pts: 6766224324, ccData: 24388 }, - { type: 3, pts: 6766227327, ccData: 49698 }, - { type: 2, pts: 6766227327, ccData: 29285 }, - { type: 3, pts: 6766230330, ccData: 546 }, - { type: 2, pts: 6766230330, ccData: 24941 }, - { type: 3, pts: 6766233333, ccData: 16930 }, - { type: 2, pts: 6766233333, ccData: 24403 }, - { type: 3, pts: 6766236336, ccData: 33314 }, - { type: 2, pts: 6766236336, ccData: 24940 }, - { type: 3, pts: 6766239339, ccData: 49698 }, - { type: 2, pts: 6766239339, ccData: 28526 }, - { type: 3, pts: 6766242342, ccData: 546 }, - { type: 2, pts: 6766242342, ccData: 11776 }, - { type: 3, pts: 6766245345, ccData: 16930 }, - { type: 2, pts: 6766245345, ccData: 35841 }, - { type: 3, pts: 6766251351, ccData: 33314 }, - { type: 2, pts: 6766251351, ccData: 35074 }, - { type: 3, pts: 6766389489, ccData: 51761 }, - { type: 2, pts: 6766389489, ccData: 38939 }, - { type: 2, pts: 6766389489, ccData: 17920 }, - { type: 2, pts: 6766389489, ccData: 31 }, - { type: 2, pts: 6766389489, ccData: 5264 }, - { type: 2, pts: 6766389489, ccData: 1283 }, - { type: 2, pts: 6766389489, ccData: 37162 }, - { type: 2, pts: 6766389489, ccData: 42 }, - { type: 2, pts: 6766389489, ccData: 37376 }, - { type: 2, pts: 6766389489, ccData: 2048 }, - { type: 3, pts: 6766395495, ccData: 546 }, - { type: 2, pts: 6766395495, ccData: 10338 }, - { type: 3, pts: 6766398498, ccData: 16930 }, - { type: 2, pts: 6766398498, ccData: 28532 }, - { type: 3, pts: 6766401501, ccData: 33314 }, - { type: 2, pts: 6766401501, ccData: 26719 }, - { type: 3, pts: 6766404504, ccData: 49698 }, - { type: 2, pts: 6766404504, ccData: 27745 }, - { type: 3, pts: 6766407507, ccData: 546 }, - { type: 2, pts: 6766407507, ccData: 30055 }, - { type: 3, pts: 6766410510, ccData: 16930 }, - { type: 2, pts: 6766410510, ccData: 26729 }, - { type: 3, pts: 6766413513, ccData: 33314 }, - { type: 2, pts: 6766413513, ccData: 28263 }, - { type: 3, pts: 6766416516, ccData: 49698 }, - { type: 2, pts: 6766416516, ccData: 10496 }, - { type: 3, pts: 6766419519, ccData: 546 }, - { type: 2, pts: 6766419519, ccData: 35842 }, - { type: 3, pts: 6766425525, ccData: 16930 }, - { type: 2, pts: 6766425525, ccData: 35073 }, - { type: 3, pts: 6766533633, ccData: 35377 }, - { type: 2, pts: 6766533633, ccData: 39195 }, - { type: 2, pts: 6766533633, ccData: 17920 }, - { type: 2, pts: 6766533633, ccData: 31 }, - { type: 2, pts: 6766533633, ccData: 5264 }, - { type: 2, pts: 6766533633, ccData: 1283 }, - { type: 2, pts: 6766533633, ccData: 37162 }, - { type: 2, pts: 6766533633, ccData: 42 }, - { type: 2, pts: 6766533633, ccData: 37376 }, - { type: 2, pts: 6766533633, ccData: 3072 }, - { type: 3, pts: 6766539639, ccData: 49698 }, - { type: 2, pts: 6766539639, ccData: 20328 }, - { type: 3, pts: 6766542642, ccData: 546 }, - { type: 2, pts: 6766542642, ccData: 11359 }, - { type: 3, pts: 6766545645, ccData: 16930 }, - { type: 2, pts: 6766545645, ccData: 28271 }, - { type: 3, pts: 6766548648, ccData: 33314 }, - { type: 2, pts: 6766548648, ccData: 11776 }, - { type: 3, pts: 6766551651, ccData: 49698 }, - { type: 2, pts: 6766551651, ccData: 35841 }, - { type: 3, pts: 6766557657, ccData: 546 }, - { type: 2, pts: 6766557657, ccData: 35074 }, - { type: 3, pts: 6766599699, ccData: 18993 }, - { type: 2, pts: 6766599699, ccData: 38939 }, - { type: 2, pts: 6766599699, ccData: 16640 }, - { type: 2, pts: 6766599699, ccData: 31 }, - { type: 2, pts: 6766599699, ccData: 5264 }, - { type: 2, pts: 6766599699, ccData: 1283 }, - { type: 2, pts: 6766599699, ccData: 37162 }, - { type: 2, pts: 6766599699, ccData: 42 }, - { type: 2, pts: 6766599699, ccData: 37376 }, - { type: 2, pts: 6766599699, ccData: 1024 }, - { type: 3, pts: 6766605705, ccData: 33571 }, - { type: 2, pts: 6766605705, ccData: 37376 }, - { type: 2, pts: 6766605705, ccData: 1792 }, - { type: 3, pts: 6766611711, ccData: 49698 }, - { type: 2, pts: 6766611711, ccData: 21608 }, - { type: 3, pts: 6766614714, ccData: 546 }, - { type: 2, pts: 6766614714, ccData: 25951 }, - { type: 3, pts: 6766617717, ccData: 16930 }, - { type: 2, pts: 6766617717, ccData: 29551 }, - { type: 3, pts: 6766620720, ccData: 33314 }, - { type: 2, pts: 6766620720, ccData: 25443 }, - { type: 3, pts: 6766623723, ccData: 49698 }, - { type: 2, pts: 6766623723, ccData: 25970 }, - { type: 3, pts: 6766626726, ccData: 546 }, - { type: 2, pts: 6766626726, ccData: 24423 }, - { type: 3, pts: 6766629729, ccData: 16930 }, - { type: 2, pts: 6766629729, ccData: 24941 }, - { type: 3, pts: 6766632732, ccData: 33314 }, - { type: 2, pts: 6766632732, ccData: 25895 }, - { type: 3, pts: 6766635735, ccData: 49698 }, - { type: 2, pts: 6766635735, ccData: 29440 }, - { type: 3, pts: 6766638738, ccData: 2609 }, - { type: 2, pts: 6766638738, ccData: 38939 }, - { type: 2, pts: 6766638738, ccData: 16640 }, - { type: 2, pts: 6766638738, ccData: 287 }, - { type: 2, pts: 6766638738, ccData: 4240 }, - { type: 2, pts: 6766638738, ccData: 1283 }, - { type: 2, pts: 6766638738, ccData: 37162 }, - { type: 2, pts: 6766638738, ccData: 0 }, - { type: 2, pts: 6766638738, ccData: 37377 }, - { type: 2, pts: 6766638738, ccData: 2048 }, - { type: 3, pts: 6766644744, ccData: 16930 }, - { type: 2, pts: 6766644744, ccData: 24930 }, - { type: 3, pts: 6766647747, ccData: 33314 }, - { type: 2, pts: 6766647747, ccData: 28533 }, - { type: 3, pts: 6766650750, ccData: 49698 }, - { type: 2, pts: 6766650750, ccData: 29791 }, - { type: 3, pts: 6766653753, ccData: 546 }, - { type: 2, pts: 6766653753, ccData: 29807 }, - { type: 3, pts: 6766656756, ccData: 16930 }, - { type: 2, pts: 6766656756, ccData: 24435 }, - { type: 3, pts: 6766659759, ccData: 33314 }, - { type: 2, pts: 6766659759, ccData: 29793 }, - { type: 3, pts: 6766662762, ccData: 49698 }, - { type: 2, pts: 6766662762, ccData: 29300 }, - { type: 3, pts: 6766665765, ccData: 546 }, - { type: 2, pts: 6766665765, ccData: 11776 }, - { type: 3, pts: 6766668768, ccData: 16930 }, - { type: 2, pts: 6766668768, ccData: 35842 }, - { type: 3, pts: 6766674774, ccData: 33314 }, - { type: 2, pts: 6766674774, ccData: 35073 }, - { type: 3, pts: 6766785885, ccData: 51761 }, - { type: 2, pts: 6766785885, ccData: 39195 }, - { type: 2, pts: 6766785885, ccData: 17920 }, - { type: 2, pts: 6766785885, ccData: 31 }, - { type: 2, pts: 6766785885, ccData: 5264 }, - { type: 2, pts: 6766785885, ccData: 1283 }, - { type: 2, pts: 6766785885, ccData: 37162 }, - { type: 2, pts: 6766785885, ccData: 42 }, - { type: 2, pts: 6766785885, ccData: 37376 }, - { type: 2, pts: 6766785885, ccData: 1024 }, - { type: 3, pts: 6766791891, ccData: 803 }, - { type: 2, pts: 6766791891, ccData: 37376 }, - { type: 2, pts: 6766791891, ccData: 1536 }, - { type: 3, pts: 6766797897, ccData: 16930 }, - { type: 2, pts: 6766797897, ccData: 22373 }, - { type: 3, pts: 6766800900, ccData: 33314 }, - { type: 2, pts: 6766800900, ccData: 24418 }, - { type: 3, pts: 6766803903, ccData: 49698 }, - { type: 2, pts: 6766803903, ccData: 25972 }, - { type: 3, pts: 6766806906, ccData: 546 }, - { type: 2, pts: 6766806906, ccData: 29797 }, - { type: 3, pts: 6766809909, ccData: 16930 }, - { type: 2, pts: 6766809909, ccData: 29279 }, - { type: 3, pts: 6766812912, ccData: 33314 }, - { type: 2, pts: 6766812912, ccData: 26469 }, - { type: 3, pts: 6766815915, ccData: 49698 }, - { type: 2, pts: 6766815915, ccData: 29791 }, - { type: 3, pts: 6766818918, ccData: 546 }, - { type: 2, pts: 6766818918, ccData: 26479 }, - { type: 3, pts: 6766821921, ccData: 16930 }, - { type: 2, pts: 6766821921, ccData: 26990 }, - { type: 3, pts: 6766824924, ccData: 33314 }, - { type: 2, pts: 6766824924, ccData: 26414 }, - { type: 3, pts: 6766827927, ccData: 49698 }, - { type: 2, pts: 6766827927, ccData: 35841 }, - { type: 3, pts: 6766833933, ccData: 546 }, - { type: 2, pts: 6766833933, ccData: 35074 }, - { type: 3, pts: 6766912011, ccData: 18993 }, - { type: 2, pts: 6766912011, ccData: 38939 }, - { type: 2, pts: 6766912011, ccData: 17920 }, - { type: 2, pts: 6766912011, ccData: 31 }, - { type: 2, pts: 6766912011, ccData: 5264 }, - { type: 2, pts: 6766912011, ccData: 1283 }, - { type: 2, pts: 6766912011, ccData: 37162 }, - { type: 2, pts: 6766912011, ccData: 42 }, - { type: 2, pts: 6766912011, ccData: 37376 }, - { type: 2, pts: 6766912011, ccData: 3072 }, - { type: 3, pts: 6766918017, ccData: 33314 }, - { type: 2, pts: 6766918017, ccData: 17263 }, - { type: 3, pts: 6766921020, ccData: 49698 }, - { type: 2, pts: 6766921020, ccData: 28005 }, - { type: 3, pts: 6766924023, ccData: 546 }, - { type: 2, pts: 6766924023, ccData: 24431 }, - { type: 3, pts: 6766927026, ccData: 16930 }, - { type: 2, pts: 6766927026, ccData: 28193 }, - { type: 3, pts: 6766930029, ccData: 33314 }, - { type: 2, pts: 6766930029, ccData: 35842 }, - { type: 3, pts: 6766936035, ccData: 49698 }, - { type: 2, pts: 6766936035, ccData: 35073 }, - { type: 3, pts: 6767020119, ccData: 546 }, - { type: 2, pts: 6767020119, ccData: 35841 }, - { type: 3, pts: 6767185284, ccData: 18993 }, - { type: 2, pts: 6767185284, ccData: 38939 }, - { type: 2, pts: 6767185284, ccData: 17920 }, - { type: 2, pts: 6767185284, ccData: 31 }, - { type: 2, pts: 6767185284, ccData: 5264 }, - { type: 2, pts: 6767185284, ccData: 1283 }, - { type: 2, pts: 6767185284, ccData: 37162 }, - { type: 2, pts: 6767185284, ccData: 0 }, - { type: 2, pts: 6767185284, ccData: 37376 }, - { type: 2, pts: 6767185284, ccData: 1024 }, - { type: 3, pts: 6767191290, ccData: 33571 }, - { type: 2, pts: 6767191290, ccData: 37376 }, - { type: 2, pts: 6767191290, ccData: 1792 }, - { type: 3, pts: 6767197296, ccData: 49698 }, - { type: 2, pts: 6767197296, ccData: 10352 }, - { type: 3, pts: 6767200299, ccData: 546 }, - { type: 2, pts: 6767200299, ccData: 24946 }, - { type: 3, pts: 6767203302, ccData: 16930 }, - { type: 2, pts: 6767203302, ccData: 25966 }, - { type: 3, pts: 6767206305, ccData: 33314 }, - { type: 2, pts: 6767206305, ccData: 29811 }, - { type: 3, pts: 6767209308, ccData: 49698 }, - { type: 2, pts: 6767209308, ccData: 24419 }, - { type: 3, pts: 6767212311, ccData: 546 }, - { type: 2, pts: 6767212311, ccData: 26725 }, - { type: 3, pts: 6767215314, ccData: 16930 }, - { type: 2, pts: 6767215314, ccData: 25970 }, - { type: 3, pts: 6767218317, ccData: 33314 }, - { type: 2, pts: 6767218317, ccData: 26990 }, - { type: 3, pts: 6767221320, ccData: 49698 }, - { type: 2, pts: 6767221320, ccData: 26409 }, - { type: 3, pts: 6767230329, ccData: 546 }, - { type: 2, pts: 6767230329, ccData: 35073 }, - { type: 3, pts: 6767404503, ccData: 18993 }, - { type: 2, pts: 6767404503, ccData: 39195 }, - { type: 2, pts: 6767404503, ccData: 16640 }, - { type: 2, pts: 6767404503, ccData: 31 }, - { type: 2, pts: 6767404503, ccData: 5264 }, - { type: 2, pts: 6767404503, ccData: 1283 }, - { type: 2, pts: 6767404503, ccData: 37162 }, - { type: 2, pts: 6767404503, ccData: 42 }, - { type: 2, pts: 6767404503, ccData: 37376 }, - { type: 2, pts: 6767404503, ccData: 6144 }, - { type: 3, pts: 6767410509, ccData: 33314 }, - { type: 2, pts: 6767410509, ccData: 19305 }, - { type: 3, pts: 6767413512, ccData: 49698 }, - { type: 2, pts: 6767413512, ccData: 25451 }, - { type: 3, pts: 6767416515, ccData: 546 }, - { type: 2, pts: 6767416515, ccData: 24425 }, - { type: 3, pts: 6767419518, ccData: 16930 }, - { type: 2, pts: 6767419518, ccData: 29740 }, - { type: 3, pts: 6767422521, ccData: 35377 }, - { type: 2, pts: 6767422521, ccData: 39195 }, - { type: 2, pts: 6767422521, ccData: 16640 }, - { type: 2, pts: 6767422521, ccData: 287 }, - { type: 2, pts: 6767422521, ccData: 4240 }, - { type: 2, pts: 6767422521, ccData: 1283 }, - { type: 2, pts: 6767422521, ccData: 37162 }, - { type: 2, pts: 6767422521, ccData: 0 }, - { type: 2, pts: 6767422521, ccData: 37377 }, - { type: 2, pts: 6767422521, ccData: 4096 }, - { type: 3, pts: 6767428527, ccData: 49955 }, - { type: 2, pts: 6767428527, ccData: 37377 }, - { type: 2, pts: 6767428527, ccData: 4864 }, - { type: 3, pts: 6767434533, ccData: 546 }, - { type: 2, pts: 6767434533, ccData: 20585 }, - { type: 3, pts: 6767437536, ccData: 16930 }, - { type: 2, pts: 6767437536, ccData: 28267 }, - { type: 3, pts: 6767440539, ccData: 33314 }, - { type: 2, pts: 6767440539, ccData: 24940 }, - { type: 3, pts: 6767443542, ccData: 49698 }, - { type: 2, pts: 6767443542, ccData: 26979 }, - { type: 3, pts: 6767446545, ccData: 546 }, - { type: 2, pts: 6767446545, ccData: 26991 }, - { type: 3, pts: 6767449548, ccData: 16930 }, - { type: 2, pts: 6767449548, ccData: 30067 }, - { type: 3, pts: 6767452551, ccData: 33314 }, - { type: 2, pts: 6767452551, ccData: 8448 }, - { type: 3, pts: 6767455554, ccData: 49698 }, - { type: 2, pts: 6767455554, ccData: 35841 }, - { type: 3, pts: 6767461560, ccData: 546 }, - { type: 2, pts: 6767461560, ccData: 35074 }, - { type: 3, pts: 6767629728, ccData: 18993 }, - { type: 2, pts: 6767629728, ccData: 38939 }, - { type: 2, pts: 6767629728, ccData: 17920 }, - { type: 2, pts: 6767629728, ccData: 31 }, - { type: 2, pts: 6767629728, ccData: 5264 }, - { type: 2, pts: 6767629728, ccData: 1283 }, - { type: 2, pts: 6767629728, ccData: 37162 }, - { type: 2, pts: 6767629728, ccData: 42 }, - { type: 2, pts: 6767629728, ccData: 37376 }, - { type: 2, pts: 6767629728, ccData: 2048 }, - { type: 3, pts: 6767635734, ccData: 33571 }, - { type: 2, pts: 6767635734, ccData: 37376 }, - { type: 2, pts: 6767635734, ccData: 2304 }, - { type: 3, pts: 6767641740, ccData: 49698 }, - { type: 2, pts: 6767641740, ccData: 16750 }, - { type: 3, pts: 6767644743, ccData: 546 }, - { type: 2, pts: 6767644743, ccData: 25695 }, - { type: 3, pts: 6767647746, ccData: 16930 }, - { type: 2, pts: 6767647746, ccData: 28265 }, - { type: 3, pts: 6767650749, ccData: 33314 }, - { type: 2, pts: 6767650749, ccData: 25445 }, - { type: 3, pts: 6767653752, ccData: 49698 }, - { type: 2, pts: 6767653752, ccData: 24424 }, - { type: 3, pts: 6767656755, ccData: 546 }, - { type: 2, pts: 6767656755, ccData: 24937 }, - { type: 3, pts: 6767659758, ccData: 16930 }, - { type: 2, pts: 6767659758, ccData: 29230 }, - { type: 3, pts: 6767662761, ccData: 33314 }, - { type: 2, pts: 6767662761, ccData: 35842 }, - { type: 3, pts: 6767668767, ccData: 49698 }, - { type: 2, pts: 6767668767, ccData: 35073 }, - { type: 3, pts: 6767791890, ccData: 2609 }, - { type: 2, pts: 6767791890, ccData: 39195 }, - { type: 2, pts: 6767791890, ccData: 17920 }, - { type: 2, pts: 6767791890, ccData: 31 }, - { type: 2, pts: 6767791890, ccData: 5264 }, - { type: 2, pts: 6767791890, ccData: 1283 }, - { type: 2, pts: 6767791890, ccData: 37162 }, - { type: 2, pts: 6767791890, ccData: 42 }, - { type: 2, pts: 6767791890, ccData: 37376 }, - { type: 2, pts: 6767791890, ccData: 1024 }, - { type: 3, pts: 6767797896, ccData: 17187 }, - { type: 2, pts: 6767797896, ccData: 37376 }, - { type: 2, pts: 6767797896, ccData: 1280 }, - { type: 3, pts: 6767803902, ccData: 33314 }, - { type: 2, pts: 6767803902, ccData: 21608 }, - { type: 3, pts: 6767806905, ccData: 49698 }, - { type: 2, pts: 6767806905, ccData: 24942 }, - { type: 3, pts: 6767809908, ccData: 546 }, - { type: 2, pts: 6767809908, ccData: 27507 }, - { type: 3, pts: 6767812911, ccData: 16930 }, - { type: 2, pts: 6767812911, ccData: 8448 }, - { type: 3, pts: 6767815914, ccData: 33314 }, - { type: 2, pts: 6767815914, ccData: 35841 }, - { type: 3, pts: 6767821920, ccData: 49698 }, - { type: 2, pts: 6767821920, ccData: 35074 }, - { type: 3, pts: 6767903001, ccData: 2609 }, - { type: 2, pts: 6767903001, ccData: 38939 }, - { type: 2, pts: 6767903001, ccData: 17920 }, - { type: 2, pts: 6767903001, ccData: 31 }, - { type: 2, pts: 6767903001, ccData: 5264 }, - { type: 2, pts: 6767903001, ccData: 1283 }, - { type: 2, pts: 6767903001, ccData: 37162 }, - { type: 2, pts: 6767903001, ccData: 42 }, - { type: 2, pts: 6767903001, ccData: 37376 }, - { type: 2, pts: 6767903001, ccData: 1024 }, - { type: 3, pts: 6767909007, ccData: 16930 }, - { type: 2, pts: 6767909007, ccData: 18287 }, - { type: 3, pts: 6767912010, ccData: 33314 }, - { type: 2, pts: 6767912010, ccData: 24400 }, - { type: 3, pts: 6767915013, ccData: 49698 }, - { type: 2, pts: 6767915013, ccData: 26990 }, - { type: 3, pts: 6767918016, ccData: 546 }, - { type: 2, pts: 6767918016, ccData: 27489 }, - { type: 3, pts: 6767921019, ccData: 16930 }, - { type: 2, pts: 6767921019, ccData: 27753 }, - { type: 3, pts: 6767924022, ccData: 33314 }, - { type: 2, pts: 6767924022, ccData: 25449 }, - { type: 3, pts: 6767927025, ccData: 49698 }, - { type: 2, pts: 6767927025, ccData: 28533 }, - { type: 3, pts: 6767930028, ccData: 546 }, - { type: 2, pts: 6767930028, ccData: 29484 }, - { type: 3, pts: 6767933031, ccData: 16930 }, - { type: 2, pts: 6767933031, ccData: 24423 }, - { type: 3, pts: 6767936034, ccData: 33314 }, - { type: 2, pts: 6767936034, ccData: 28460 }, - { type: 3, pts: 6767939037, ccData: 49698 }, - { type: 2, pts: 6767939037, ccData: 24423 }, - { type: 3, pts: 6767942040, ccData: 546 }, - { type: 2, pts: 6767942040, ccData: 28449 }, - { type: 3, pts: 6767945043, ccData: 16930 }, - { type: 2, pts: 6767945043, ccData: 35842 }, - { type: 3, pts: 6767951049, ccData: 33314 }, - { type: 2, pts: 6767951049, ccData: 35073 }, - { type: 3, pts: 6768104202, ccData: 51761 }, - { type: 2, pts: 6768104202, ccData: 39195 }, - { type: 2, pts: 6768104202, ccData: 17920 }, - { type: 2, pts: 6768104202, ccData: 31 }, - { type: 2, pts: 6768104202, ccData: 5264 }, - { type: 2, pts: 6768104202, ccData: 1283 }, - { type: 2, pts: 6768104202, ccData: 37162 }, - { type: 2, pts: 6768104202, ccData: 42 }, - { type: 2, pts: 6768104202, ccData: 37376 }, - { type: 2, pts: 6768104202, ccData: 2048 }, - { type: 3, pts: 6768110208, ccData: 803 }, - { type: 2, pts: 6768110208, ccData: 37376 }, - { type: 2, pts: 6768110208, ccData: 2816 }, - { type: 3, pts: 6768116214, ccData: 16930 }, - { type: 2, pts: 6768116214, ccData: 10339 }, - { type: 3, pts: 6768119217, ccData: 33314 }, - { type: 2, pts: 6768119217, ccData: 26725 }, - { type: 3, pts: 6768122220, ccData: 49698 }, - { type: 2, pts: 6768122220, ccData: 25970 }, - { type: 3, pts: 6768125223, ccData: 546 }, - { type: 2, pts: 6768125223, ccData: 26990 }, - { type: 3, pts: 6768128226, ccData: 16930 }, - { type: 2, pts: 6768128226, ccData: 26409 }, - { type: 3, pts: 6768131229, ccData: 33314 }, - { type: 2, pts: 6768131229, ccData: 35841 }, - { type: 3, pts: 6768137235, ccData: 49698 }, - { type: 2, pts: 6768137235, ccData: 35074 }, - { type: 3, pts: 6768272370, ccData: 546 }, - { type: 2, pts: 6768272370, ccData: 35842 }, - { type: 3, pts: 6768446544, ccData: 18993 }, - { type: 2, pts: 6768446544, ccData: 38939 }, - { type: 2, pts: 6768446544, ccData: 0 }, - { type: 2, pts: 6768446544, ccData: 31 }, - { type: 2, pts: 6768446544, ccData: 5264 }, - { type: 2, pts: 6768446544, ccData: 1283 }, - { type: 2, pts: 6768446544, ccData: 37162 }, - { type: 2, pts: 6768446544, ccData: 42 }, - { type: 2, pts: 6768446544, ccData: 37376 }, - { type: 2, pts: 6768446544, ccData: 1024 }, - { type: 3, pts: 6768449547, ccData: 33314 }, - { type: 2, pts: 6768449547, ccData: 18783 }, - { type: 3, pts: 6768452550, ccData: 49698 }, - { type: 2, pts: 6768452550, ccData: 26479 }, - { type: 3, pts: 6768455553, ccData: 546 }, - { type: 2, pts: 6768455553, ccData: 29791 }, - { type: 3, pts: 6768458556, ccData: 16930 }, - { type: 2, pts: 6768458556, ccData: 26996 }, - { type: 3, pts: 6768461559, ccData: 33314 }, - { type: 2, pts: 6768461559, ccData: 8448 }, - { type: 3, pts: 6768470568, ccData: 49698 }, - { type: 2, pts: 6768470568, ccData: 35073 }, - { type: 3, pts: 6768566664, ccData: 546 }, - { type: 2, pts: 6768566664, ccData: 35841 }, - { type: 3, pts: 6768674772, ccData: 18993 }, - { type: 2, pts: 6768674772, ccData: 38939 }, - { type: 2, pts: 6768674772, ccData: 17920 }, - { type: 2, pts: 6768674772, ccData: 31 }, - { type: 2, pts: 6768674772, ccData: 5264 }, - { type: 2, pts: 6768674772, ccData: 1283 }, - { type: 2, pts: 6768674772, ccData: 37162 }, - { type: 2, pts: 6768674772, ccData: 0 }, - { type: 2, pts: 6768674772, ccData: 37376 }, - { type: 2, pts: 6768674772, ccData: 3072 }, - { type: 3, pts: 6768680778, ccData: 33571 }, - { type: 2, pts: 6768680778, ccData: 37376 }, - { type: 2, pts: 6768680778, ccData: 3584 }, - { type: 3, pts: 6768686784, ccData: 49698 }, - { type: 2, pts: 6768686784, ccData: 20079 }, - { type: 3, pts: 6768689787, ccData: 546 }, - { type: 2, pts: 6768689787, ccData: 8448 }, - { type: 3, pts: 6768698796, ccData: 16930 }, - { type: 2, pts: 6768698796, ccData: 35073 }, - { type: 3, pts: 6768833931, ccData: 35377 }, - { type: 2, pts: 6768833931, ccData: 39195 }, - { type: 2, pts: 6768833931, ccData: 17920 }, - { type: 2, pts: 6768833931, ccData: 31 }, - { type: 2, pts: 6768833931, ccData: 5264 }, - { type: 2, pts: 6768833931, ccData: 1283 }, - { type: 2, pts: 6768833931, ccData: 37162 }, - { type: 2, pts: 6768833931, ccData: 42 }, - { type: 2, pts: 6768833931, ccData: 37376 }, - { type: 2, pts: 6768833931, ccData: 3072 }, - { type: 3, pts: 6768839937, ccData: 49955 }, - { type: 2, pts: 6768839937, ccData: 37376 }, - { type: 2, pts: 6768839937, ccData: 3328 }, - { type: 3, pts: 6768845943, ccData: 546 }, - { type: 2, pts: 6768845943, ccData: 21864 }, - { type: 3, pts: 6768848946, ccData: 16930 }, - { type: 2, pts: 6768848946, ccData: 11631 }, - { type: 3, pts: 6768851949, ccData: 33314 }, - { type: 2, pts: 6768851949, ccData: 26657 }, - { type: 3, pts: 6768854952, ccData: 49698 }, - { type: 2, pts: 6768854952, ccData: 35841 }, - { type: 3, pts: 6768860958, ccData: 546 }, - { type: 2, pts: 6768860958, ccData: 35074 }, - { type: 3, pts: 6768936033, ccData: 18993 }, - { type: 2, pts: 6768936033, ccData: 38939 }, - { type: 2, pts: 6768936033, ccData: 17920 }, - { type: 2, pts: 6768936033, ccData: 31 }, - { type: 2, pts: 6768936033, ccData: 5264 }, - { type: 2, pts: 6768936033, ccData: 1283 }, - { type: 2, pts: 6768936033, ccData: 37162 }, - { type: 2, pts: 6768936033, ccData: 42 }, - { type: 2, pts: 6768936033, ccData: 37376 }, - { type: 2, pts: 6768936033, ccData: 5120 }, - { type: 3, pts: 6768942039, ccData: 33571 }, - { type: 2, pts: 6768942039, ccData: 37376 }, - { type: 2, pts: 6768942039, ccData: 5632 }, - { type: 3, pts: 6768948045, ccData: 49698 }, - { type: 2, pts: 6768948045, ccData: 20328 }, - { type: 3, pts: 6768951048, ccData: 546 }, - { type: 2, pts: 6768951048, ccData: 11359 }, - { type: 3, pts: 6768954051, ccData: 16930 }, - { type: 2, pts: 6768954051, ccData: 28271 }, - { type: 3, pts: 6768957054, ccData: 33314 }, - { type: 2, pts: 6768957054, ccData: 8448 }, - { type: 3, pts: 6768960057, ccData: 49698 }, - { type: 2, pts: 6768960057, ccData: 35842 }, - { type: 3, pts: 6768966063, ccData: 546 }, - { type: 2, pts: 6768966063, ccData: 35073 }, - { type: 3, pts: 6769050147, ccData: 16930 }, - { type: 2, pts: 6769050147, ccData: 35841 }, - { type: 3, pts: 6769083180, ccData: 35377 }, - { type: 2, pts: 6769083180, ccData: 38939 }, - { type: 2, pts: 6769083180, ccData: 17920 }, - { type: 2, pts: 6769083180, ccData: 31 }, - { type: 2, pts: 6769083180, ccData: 5264 }, - { type: 2, pts: 6769083180, ccData: 1283 }, - { type: 2, pts: 6769083180, ccData: 37162 }, - { type: 2, pts: 6769083180, ccData: 0 }, - { type: 2, pts: 6769083180, ccData: 37376 }, - { type: 2, pts: 6769083180, ccData: 3072 }, - { type: 3, pts: 6769089186, ccData: 49698 }, - { type: 2, pts: 6769089186, ccData: 10343 }, - { type: 3, pts: 6769092189, ccData: 546 }, - { type: 2, pts: 6769092189, ccData: 29295 }, - { type: 3, pts: 6769095192, ccData: 16930 }, - { type: 2, pts: 6769095192, ccData: 24942 }, - { type: 3, pts: 6769098195, ccData: 33314 }, - { type: 2, pts: 6769098195, ccData: 29481 }, - { type: 3, pts: 6769107204, ccData: 49698 }, - { type: 2, pts: 6769107204, ccData: 35073 }, - { type: 3, pts: 6769167264, ccData: 2609 }, - { type: 2, pts: 6769167264, ccData: 39195 }, - { type: 2, pts: 6769167264, ccData: 16640 }, - { type: 2, pts: 6769167264, ccData: 31 }, - { type: 2, pts: 6769167264, ccData: 5264 }, - { type: 2, pts: 6769167264, ccData: 1283 }, - { type: 2, pts: 6769167264, ccData: 37162 }, - { type: 2, pts: 6769167264, ccData: 42 }, - { type: 2, pts: 6769167264, ccData: 37376 }, - { type: 2, pts: 6769167264, ccData: 0 }, - { type: 3, pts: 6769173270, ccData: 16930 }, - { type: 2, pts: 6769173270, ccData: 16716 }, - { type: 3, pts: 6769176273, ccData: 33314 }, - { type: 2, pts: 6769176273, ccData: 19514 }, - { type: 3, pts: 6769179276, ccData: 51761 }, - { type: 2, pts: 6769179276, ccData: 39195 }, - { type: 2, pts: 6769179276, ccData: 16640 }, - { type: 2, pts: 6769179276, ccData: 287 }, - { type: 2, pts: 6769179276, ccData: 4240 }, - { type: 2, pts: 6769179276, ccData: 1283 }, - { type: 2, pts: 6769179276, ccData: 37162 }, - { type: 2, pts: 6769179276, ccData: 0 }, - { type: 2, pts: 6769179276, ccData: 37377 }, - { type: 2, pts: 6769179276, ccData: 0 }, - { type: 3, pts: 6769185282, ccData: 546 }, - { type: 2, pts: 6769185282, ccData: 20328 }, - { type: 3, pts: 6769188285, ccData: 16930 }, - { type: 2, pts: 6769188285, ccData: 8448 }, - { type: 3, pts: 6769191288, ccData: 33314 }, - { type: 2, pts: 6769191288, ccData: 35841 }, - { type: 3, pts: 6769197294, ccData: 49698 }, - { type: 2, pts: 6769197294, ccData: 35074 }, - { type: 3, pts: 6769242339, ccData: 2609 }, - { type: 2, pts: 6769242339, ccData: 38939 }, - { type: 2, pts: 6769242339, ccData: 17920 }, - { type: 2, pts: 6769242339, ccData: 31 }, - { type: 2, pts: 6769242339, ccData: 5264 }, - { type: 2, pts: 6769242339, ccData: 1283 }, - { type: 2, pts: 6769242339, ccData: 37162 }, - { type: 2, pts: 6769242339, ccData: 42 }, - { type: 2, pts: 6769242339, ccData: 37376 }, - { type: 2, pts: 6769242339, ccData: 3072 }, - { type: 3, pts: 6769248345, ccData: 17187 }, - { type: 2, pts: 6769248345, ccData: 37376 }, - { type: 2, pts: 6769248345, ccData: 3840 }, - { type: 3, pts: 6769254351, ccData: 33314 }, - { type: 2, pts: 6769254351, ccData: 10359 }, - { type: 3, pts: 6769257354, ccData: 49698 }, - { type: 2, pts: 6769257354, ccData: 26729 }, - { type: 3, pts: 6769260357, ccData: 546 }, - { type: 2, pts: 6769260357, ccData: 29556 }, - { type: 3, pts: 6769263360, ccData: 16930 }, - { type: 2, pts: 6769263360, ccData: 27749 }, - { type: 3, pts: 6769266363, ccData: 33314 }, - { type: 2, pts: 6769266363, ccData: 24418 }, - { type: 3, pts: 6769269366, ccData: 49698 }, - { type: 2, pts: 6769269366, ccData: 27759 }, - { type: 3, pts: 6769272369, ccData: 546 }, - { type: 2, pts: 6769272369, ccData: 30569 }, - { type: 3, pts: 6769275372, ccData: 16930 }, - { type: 2, pts: 6769275372, ccData: 28263 }, - { type: 3, pts: 6769278375, ccData: 33314 }, - { type: 2, pts: 6769278375, ccData: 10496 }, - { type: 3, pts: 6769281378, ccData: 49698 }, - { type: 2, pts: 6769281378, ccData: 35842 }, - { type: 3, pts: 6769287384, ccData: 546 }, - { type: 2, pts: 6769287384, ccData: 35073 }, - { type: 3, pts: 6769353450, ccData: 18993 }, - { type: 2, pts: 6769353450, ccData: 39195 }, - { type: 2, pts: 6769353450, ccData: 17920 }, - { type: 2, pts: 6769353450, ccData: 31 }, - { type: 2, pts: 6769353450, ccData: 5264 }, - { type: 2, pts: 6769353450, ccData: 1283 }, - { type: 2, pts: 6769353450, ccData: 37162 }, - { type: 2, pts: 6769353450, ccData: 42 }, - { type: 2, pts: 6769353450, ccData: 37376 }, - { type: 2, pts: 6769353450, ccData: 3072 }, - { type: 3, pts: 6769359456, ccData: 33571 }, - { type: 2, pts: 6769359456, ccData: 37376 }, - { type: 2, pts: 6769359456, ccData: 3584 }, - { type: 3, pts: 6769365462, ccData: 49698 }, - { type: 2, pts: 6769365462, ccData: 20335 }, - { type: 3, pts: 6769368465, ccData: 546 }, - { type: 2, pts: 6769368465, ccData: 26670 }, - { type: 3, pts: 6769371468, ccData: 16930 }, - { type: 2, pts: 6769371468, ccData: 35841 }, - { type: 3, pts: 6769377474, ccData: 33314 }, - { type: 2, pts: 6769377474, ccData: 35074 }, - { type: 3, pts: 6769413510, ccData: 51761 }, - { type: 2, pts: 6769413510, ccData: 38939 }, - { type: 2, pts: 6769413510, ccData: 16640 }, - { type: 2, pts: 6769413510, ccData: 31 }, - { type: 2, pts: 6769413510, ccData: 5264 }, - { type: 2, pts: 6769413510, ccData: 1283 }, - { type: 2, pts: 6769413510, ccData: 37162 }, - { type: 2, pts: 6769413510, ccData: 42 }, - { type: 2, pts: 6769413510, ccData: 37376 }, - { type: 2, pts: 6769413510, ccData: 2048 }, - { type: 3, pts: 6769419516, ccData: 803 }, - { type: 2, pts: 6769419516, ccData: 37376 }, - { type: 2, pts: 6769419516, ccData: 2304 }, - { type: 3, pts: 6769425522, ccData: 16930 }, - { type: 2, pts: 6769425522, ccData: 20585 }, - { type: 3, pts: 6769428525, ccData: 33314 }, - { type: 2, pts: 6769428525, ccData: 28267 }, - { type: 3, pts: 6769431528, ccData: 49698 }, - { type: 2, pts: 6769431528, ccData: 24940 }, - { type: 3, pts: 6769434531, ccData: 546 }, - { type: 2, pts: 6769434531, ccData: 26979 }, - { type: 3, pts: 6769437534, ccData: 16930 }, - { type: 2, pts: 6769437534, ccData: 26991 }, - { type: 3, pts: 6769440537, ccData: 33314 }, - { type: 2, pts: 6769440537, ccData: 30067 }, - { type: 3, pts: 6769443540, ccData: 49698 }, - { type: 2, pts: 6769443540, ccData: 11264 }, - { type: 3, pts: 6769446543, ccData: 2609 }, - { type: 2, pts: 6769446543, ccData: 38939 }, - { type: 2, pts: 6769446543, ccData: 16640 }, - { type: 2, pts: 6769446543, ccData: 287 }, - { type: 2, pts: 6769446543, ccData: 4240 }, - { type: 2, pts: 6769446543, ccData: 1283 }, - { type: 2, pts: 6769446543, ccData: 37162 }, - { type: 2, pts: 6769446543, ccData: 0 }, - { type: 2, pts: 6769446543, ccData: 37377 }, - { type: 2, pts: 6769446543, ccData: 2048 }, - { type: 3, pts: 6769452549, ccData: 17187 }, - { type: 2, pts: 6769452549, ccData: 37377 }, - { type: 2, pts: 6769452549, ccData: 2304 }, - { type: 3, pts: 6769458555, ccData: 33314 }, - { type: 2, pts: 6769458555, ccData: 24946 }, - { type: 3, pts: 6769461558, ccData: 49698 }, - { type: 2, pts: 6769461558, ccData: 25951 }, - { type: 3, pts: 6769464561, ccData: 546 }, - { type: 2, pts: 6769464561, ccData: 31087 }, - { type: 3, pts: 6769467564, ccData: 16930 }, - { type: 2, pts: 6769467564, ccData: 30047 }, - { type: 3, pts: 6769470567, ccData: 33314 }, - { type: 2, pts: 6769470567, ccData: 28523 }, - { type: 3, pts: 6769473570, ccData: 49698 }, - { type: 2, pts: 6769473570, ccData: 24953 }, - { type: 3, pts: 6769476573, ccData: 546 }, - { type: 2, pts: 6769476573, ccData: 16128 }, - { type: 3, pts: 6769479576, ccData: 16930 }, - { type: 2, pts: 6769479576, ccData: 35842 }, - { type: 3, pts: 6769485582, ccData: 33314 }, - { type: 2, pts: 6769485582, ccData: 35073 }, - { type: 3, pts: 6769752849, ccData: 49698 }, - { type: 2, pts: 6769752849, ccData: 35841 }, - { type: 3, pts: 6769930026, ccData: 2609 }, - { type: 2, pts: 6769930026, ccData: 38939 }, - { type: 2, pts: 6769930026, ccData: 16640 }, - { type: 2, pts: 6769930026, ccData: 31 }, - { type: 2, pts: 6769930026, ccData: 5264 }, - { type: 2, pts: 6769930026, ccData: 1283 }, - { type: 2, pts: 6769930026, ccData: 37162 }, - { type: 2, pts: 6769930026, ccData: 0 }, - { type: 2, pts: 6769930026, ccData: 37376 }, - { type: 2, pts: 6769930026, ccData: 6144 }, - { type: 3, pts: 6769936032, ccData: 17187 }, - { type: 2, pts: 6769936032, ccData: 37376 }, - { type: 2, pts: 6769936032, ccData: 6656 }, - { type: 3, pts: 6769942038, ccData: 33314 }, - { type: 2, pts: 6769942038, ccData: 21359 }, - { type: 3, pts: 6769945041, ccData: 49698 }, - { type: 2, pts: 6769945041, ccData: 29298 }, - { type: 3, pts: 6769948044, ccData: 546 }, - { type: 2, pts: 6769948044, ccData: 31020 }, - { type: 3, pts: 6769951047, ccData: 18993 }, - { type: 2, pts: 6769951047, ccData: 38939 }, - { type: 2, pts: 6769951047, ccData: 16640 }, - { type: 2, pts: 6769951047, ccData: 287 }, - { type: 2, pts: 6769951047, ccData: 4240 }, - { type: 2, pts: 6769951047, ccData: 1283 }, - { type: 2, pts: 6769951047, ccData: 37162 }, - { type: 2, pts: 6769951047, ccData: 0 }, - { type: 2, pts: 6769951047, ccData: 37377 }, - { type: 2, pts: 6769951047, ccData: 4096 }, - { type: 3, pts: 6769957053, ccData: 33571 }, - { type: 2, pts: 6769957053, ccData: 37377 }, - { type: 2, pts: 6769957053, ccData: 4864 }, - { type: 3, pts: 6769963059, ccData: 49698 }, - { type: 2, pts: 6769963059, ccData: 18783 }, - { type: 3, pts: 6769966062, ccData: 546 }, - { type: 2, pts: 6769966062, ccData: 26721 }, - { type: 3, pts: 6769969065, ccData: 16930 }, - { type: 2, pts: 6769969065, ccData: 30309 }, - { type: 3, pts: 6769972068, ccData: 33314 }, - { type: 2, pts: 6769972068, ccData: 24436 }, - { type: 3, pts: 6769975071, ccData: 49698 }, - { type: 2, pts: 6769975071, ccData: 28511 }, - { type: 3, pts: 6769978074, ccData: 546 }, - { type: 2, pts: 6769978074, ccData: 26479 }, - { type: 3, pts: 6769981077, ccData: 16930 }, - { type: 2, pts: 6769981077, ccData: 11776 }, - { type: 3, pts: 6769990086, ccData: 33314 }, - { type: 2, pts: 6769990086, ccData: 35073 }, - { type: 3, pts: 6770113209, ccData: 51761 }, - { type: 2, pts: 6770113209, ccData: 39195 }, - { type: 2, pts: 6770113209, ccData: 16640 }, - { type: 2, pts: 6770113209, ccData: 31 }, - { type: 2, pts: 6770113209, ccData: 5264 }, - { type: 2, pts: 6770113209, ccData: 1283 }, - { type: 2, pts: 6770113209, ccData: 37162 }, - { type: 2, pts: 6770113209, ccData: 42 }, - { type: 2, pts: 6770113209, ccData: 37376 }, - { type: 2, pts: 6770113209, ccData: 1024 }, - { type: 3, pts: 6770119215, ccData: 546 }, - { type: 2, pts: 6770119215, ccData: 17013 }, - { type: 3, pts: 6770122218, ccData: 16930 }, - { type: 2, pts: 6770122218, ccData: 29791 }, - { type: 3, pts: 6770125221, ccData: 33314 }, - { type: 2, pts: 6770125221, ccData: 30565 }, - { type: 3, pts: 6770128224, ccData: 49698 }, - { type: 2, pts: 6770128224, ccData: 10098 }, - { type: 3, pts: 6770131227, ccData: 546 }, - { type: 2, pts: 6770131227, ccData: 25951 }, - { type: 3, pts: 6770134230, ccData: 16930 }, - { type: 2, pts: 6770134230, ccData: 26990 }, - { type: 3, pts: 6770137233, ccData: 33314 }, - { type: 2, pts: 6770137233, ccData: 24436 }, - { type: 3, pts: 6770140236, ccData: 49698 }, - { type: 2, pts: 6770140236, ccData: 26725 }, - { type: 3, pts: 6770143239, ccData: 546 }, - { type: 2, pts: 6770143239, ccData: 24429 }, - { type: 3, pts: 6770146242, ccData: 16930 }, - { type: 2, pts: 6770146242, ccData: 26980 }, - { type: 3, pts: 6770149245, ccData: 33314 }, - { type: 2, pts: 6770149245, ccData: 25708 }, - { type: 3, pts: 6770152248, ccData: 49698 }, - { type: 2, pts: 6770152248, ccData: 25856 }, - { type: 3, pts: 6770155251, ccData: 2609 }, - { type: 2, pts: 6770155251, ccData: 39195 }, - { type: 2, pts: 6770155251, ccData: 16640 }, - { type: 2, pts: 6770155251, ccData: 287 }, - { type: 2, pts: 6770155251, ccData: 4240 }, - { type: 2, pts: 6770155251, ccData: 1283 }, - { type: 2, pts: 6770155251, ccData: 37162 }, - { type: 2, pts: 6770155251, ccData: 0 }, - { type: 2, pts: 6770155251, ccData: 37377 }, - { type: 2, pts: 6770155251, ccData: 2048 }, - { type: 3, pts: 6770161257, ccData: 17187 }, - { type: 2, pts: 6770161257, ccData: 37377 }, - { type: 2, pts: 6770161257, ccData: 2816 }, - { type: 3, pts: 6770167263, ccData: 33314 }, - { type: 2, pts: 6770167263, ccData: 28518 }, - { type: 3, pts: 6770170266, ccData: 49698 }, - { type: 2, pts: 6770170266, ccData: 24417 }, - { type: 3, pts: 6770173269, ccData: 546 }, - { type: 2, pts: 6770173269, ccData: 24423 }, - { type: 3, pts: 6770176272, ccData: 16930 }, - { type: 2, pts: 6770176272, ccData: 24941 }, - { type: 3, pts: 6770179275, ccData: 33314 }, - { type: 2, pts: 6770179275, ccData: 25889 }, - { type: 3, pts: 6770182278, ccData: 49698 }, - { type: 2, pts: 6770182278, ccData: 35841 }, - { type: 3, pts: 6770188284, ccData: 546 }, - { type: 2, pts: 6770188284, ccData: 35074 }, - { type: 3, pts: 6770356452, ccData: 18993 }, - { type: 2, pts: 6770356452, ccData: 38939 }, - { type: 2, pts: 6770356452, ccData: 16640 }, - { type: 2, pts: 6770356452, ccData: 31 }, - { type: 2, pts: 6770356452, ccData: 5264 }, - { type: 2, pts: 6770356452, ccData: 1283 }, - { type: 2, pts: 6770356452, ccData: 37162 }, - { type: 2, pts: 6770356452, ccData: 42 }, - { type: 2, pts: 6770356452, ccData: 37376 }, - { type: 2, pts: 6770356452, ccData: 6144 }, - { type: 3, pts: 6770362458, ccData: 33571 }, - { type: 2, pts: 6770362458, ccData: 37376 }, - { type: 2, pts: 6770362458, ccData: 6400 }, - { type: 3, pts: 6770368464, ccData: 49698 }, - { type: 2, pts: 6770368464, ccData: 18783 }, - { type: 3, pts: 6770371467, ccData: 546 }, - { type: 2, pts: 6770371467, ccData: 27502 }, - { type: 3, pts: 6770374470, ccData: 16930 }, - { type: 2, pts: 6770374470, ccData: 28535 }, - { type: 3, pts: 6770377473, ccData: 33314 }, - { type: 2, pts: 6770377473, ccData: 11264 }, - { type: 3, pts: 6770380476, ccData: 51761 }, - { type: 2, pts: 6770380476, ccData: 38939 }, - { type: 2, pts: 6770380476, ccData: 16640 }, - { type: 2, pts: 6770380476, ccData: 287 }, - { type: 2, pts: 6770380476, ccData: 4240 }, - { type: 2, pts: 6770380476, ccData: 1283 }, - { type: 2, pts: 6770380476, ccData: 37162 }, - { type: 2, pts: 6770380476, ccData: 0 }, - { type: 2, pts: 6770380476, ccData: 37377 }, - { type: 2, pts: 6770380476, ccData: 5120 }, - { type: 3, pts: 6770386482, ccData: 803 }, - { type: 2, pts: 6770386482, ccData: 37377 }, - { type: 2, pts: 6770386482, ccData: 5632 }, - { type: 3, pts: 6770392488, ccData: 16930 }, - { type: 2, pts: 6770392488, ccData: 18727 }, - { type: 3, pts: 6770395491, ccData: 33314 }, - { type: 2, pts: 6770395491, ccData: 27999 }, - { type: 3, pts: 6770398494, ccData: 49698 }, - { type: 2, pts: 6770398494, ccData: 29551 }, - { type: 3, pts: 6770401497, ccData: 546 }, - { type: 2, pts: 6770401497, ccData: 29298 }, - { type: 3, pts: 6770404500, ccData: 16930 }, - { type: 2, pts: 6770404500, ccData: 31022 }, - { type: 3, pts: 6770407503, ccData: 33314 }, - { type: 2, pts: 6770407503, ccData: 35842 }, - { type: 3, pts: 6770413509, ccData: 49698 }, - { type: 2, pts: 6770413509, ccData: 35073 }, - { type: 3, pts: 6770452548, ccData: 2609 }, - { type: 2, pts: 6770452548, ccData: 39195 }, - { type: 2, pts: 6770452548, ccData: 16640 }, - { type: 2, pts: 6770452548, ccData: 31 }, - { type: 2, pts: 6770452548, ccData: 5264 }, - { type: 2, pts: 6770452548, ccData: 1283 }, - { type: 2, pts: 6770452548, ccData: 37162 }, - { type: 2, pts: 6770452548, ccData: 42 }, - { type: 2, pts: 6770452548, ccData: 37376 }, - { type: 2, pts: 6770452548, ccData: 2048 }, - { type: 3, pts: 6770458554, ccData: 17187 }, - { type: 2, pts: 6770458554, ccData: 37376 }, - { type: 2, pts: 6770458554, ccData: 2304 }, - { type: 3, pts: 6770464560, ccData: 33314 }, - { type: 2, pts: 6770464560, ccData: 17013 }, - { type: 3, pts: 6770467563, ccData: 49698 }, - { type: 2, pts: 6770467563, ccData: 29791 }, - { type: 3, pts: 6770470566, ccData: 546 }, - { type: 2, pts: 6770470566, ccData: 18727 }, - { type: 3, pts: 6770473569, ccData: 16930 }, - { type: 2, pts: 6770473569, ccData: 27999 }, - { type: 3, pts: 6770476572, ccData: 33314 }, - { type: 2, pts: 6770476572, ccData: 26721 }, - { type: 3, pts: 6770479575, ccData: 49698 }, - { type: 2, pts: 6770479575, ccData: 30313 }, - { type: 3, pts: 6770482578, ccData: 546 }, - { type: 2, pts: 6770482578, ccData: 28263 }, - { type: 3, pts: 6770485581, ccData: 16930 }, - { type: 2, pts: 6770485581, ccData: 24432 }, - { type: 3, pts: 6770488584, ccData: 33314 }, - { type: 2, pts: 6770488584, ccData: 28526 }, - { type: 3, pts: 6770491587, ccData: 49698 }, - { type: 2, pts: 6770491587, ccData: 31092 }, - { type: 3, pts: 6770494590, ccData: 546 }, - { type: 2, pts: 6770494590, ccData: 24937 }, - { type: 3, pts: 6770497593, ccData: 16930 }, - { type: 2, pts: 6770497593, ccData: 27648 }, - { type: 3, pts: 6770500596, ccData: 35377 }, - { type: 2, pts: 6770500596, ccData: 39195 }, - { type: 2, pts: 6770500596, ccData: 16640 }, - { type: 2, pts: 6770500596, ccData: 287 }, - { type: 2, pts: 6770500596, ccData: 4240 }, - { type: 2, pts: 6770500596, ccData: 1283 }, - { type: 2, pts: 6770500596, ccData: 37162 }, - { type: 2, pts: 6770500596, ccData: 0 }, - { type: 2, pts: 6770500596, ccData: 37377 }, - { type: 2, pts: 6770500596, ccData: 5120 }, - { type: 3, pts: 6770506602, ccData: 49955 }, - { type: 2, pts: 6770506602, ccData: 37377 }, - { type: 2, pts: 6770506602, ccData: 5888 }, - { type: 3, pts: 6770512608, ccData: 546 }, - { type: 2, pts: 6770512608, ccData: 28786 }, - { type: 3, pts: 6770515611, ccData: 16930 }, - { type: 2, pts: 6770515611, ccData: 28514 }, - { type: 3, pts: 6770518614, ccData: 33314 }, - { type: 2, pts: 6770518614, ccData: 27749 }, - { type: 3, pts: 6770521617, ccData: 49698 }, - { type: 2, pts: 6770521617, ccData: 28019 }, - { type: 3, pts: 6770524620, ccData: 546 }, - { type: 2, pts: 6770524620, ccData: 11776 }, - { type: 3, pts: 6770527623, ccData: 16930 }, - { type: 2, pts: 6770527623, ccData: 35841 }, - { type: 3, pts: 6770533629, ccData: 33314 }, - { type: 2, pts: 6770533629, ccData: 35074 }, - { type: 3, pts: 6770740836, ccData: 51761 }, - { type: 2, pts: 6770740836, ccData: 38939 }, - { type: 2, pts: 6770740836, ccData: 15360 }, - { type: 2, pts: 6770740836, ccData: 31 }, - { type: 2, pts: 6770740836, ccData: 5264 }, - { type: 2, pts: 6770740836, ccData: 1283 }, - { type: 2, pts: 6770740836, ccData: 37162 }, - { type: 2, pts: 6770740836, ccData: 42 }, - { type: 2, pts: 6770740836, ccData: 37376 }, - { type: 2, pts: 6770740836, ccData: 2048 }, - { type: 3, pts: 6770746842, ccData: 546 }, - { type: 2, pts: 6770746842, ccData: 20328 }, - { type: 3, pts: 6770749845, ccData: 16930 }, - { type: 2, pts: 6770749845, ccData: 11776 }, - { type: 3, pts: 6770752848, ccData: 35377 }, - { type: 2, pts: 6770752848, ccData: 38939 }, - { type: 2, pts: 6770752848, ccData: 15360 }, - { type: 2, pts: 6770752848, ccData: 543 }, - { type: 2, pts: 6770752848, ccData: 4240 }, - { type: 2, pts: 6770752848, ccData: 1283 }, - { type: 2, pts: 6770752848, ccData: 37162 }, - { type: 2, pts: 6770752848, ccData: 0 }, - { type: 2, pts: 6770752848, ccData: 37378 }, - { type: 2, pts: 6770752848, ccData: 5120 }, - { type: 3, pts: 6770758854, ccData: 49955 }, - { type: 2, pts: 6770758854, ccData: 37378 }, - { type: 2, pts: 6770758854, ccData: 5632 }, - { type: 3, pts: 6770764860, ccData: 546 }, - { type: 2, pts: 6770764860, ccData: 20328 }, - { type: 3, pts: 6770767863, ccData: 16930 }, - { type: 2, pts: 6770767863, ccData: 11776 }, - { type: 3, pts: 6770770866, ccData: 33314 }, - { type: 2, pts: 6770770866, ccData: 35842 }, - { type: 3, pts: 6770776872, ccData: 49698 }, - { type: 2, pts: 6770776872, ccData: 35073 }, - { type: 3, pts: 6770921016, ccData: 2609 }, - { type: 2, pts: 6770921016, ccData: 39195 }, - { type: 2, pts: 6770921016, ccData: 17920 }, - { type: 2, pts: 6770921016, ccData: 31 }, - { type: 2, pts: 6770921016, ccData: 5264 }, - { type: 2, pts: 6770921016, ccData: 1283 }, - { type: 2, pts: 6770921016, ccData: 37162 }, - { type: 2, pts: 6770921016, ccData: 42 }, - { type: 2, pts: 6770921016, ccData: 37376 }, - { type: 2, pts: 6770921016, ccData: 4096 }, - { type: 3, pts: 6770927022, ccData: 17187 }, - { type: 2, pts: 6770927022, ccData: 37376 }, - { type: 2, pts: 6770927022, ccData: 4608 }, - { type: 3, pts: 6770933028, ccData: 33314 }, - { type: 2, pts: 6770933028, ccData: 10341 }, - { type: 3, pts: 6770936031, ccData: 49698 }, - { type: 2, pts: 6770936031, ccData: 30824 }, - { type: 3, pts: 6770939034, ccData: 546 }, - { type: 2, pts: 6770939034, ccData: 24940 }, - { type: 3, pts: 6770942037, ccData: 16930 }, - { type: 2, pts: 6770942037, ccData: 26990 }, - { type: 3, pts: 6770945040, ccData: 33314 }, - { type: 2, pts: 6770945040, ccData: 26409 }, - { type: 3, pts: 6770948043, ccData: 49698 }, - { type: 2, pts: 6770948043, ccData: 35841 }, - { type: 3, pts: 6770954049, ccData: 546 }, - { type: 2, pts: 6770954049, ccData: 35074 }, - { type: 3, pts: 6771080175, ccData: 16930 }, - { type: 2, pts: 6771080175, ccData: 35842 }, - { type: 3, pts: 6771374469, ccData: 35377 }, - { type: 2, pts: 6771374469, ccData: 38939 }, - { type: 2, pts: 6771374469, ccData: 17920 }, - { type: 2, pts: 6771374469, ccData: 31 }, - { type: 2, pts: 6771374469, ccData: 5264 }, - { type: 2, pts: 6771374469, ccData: 1283 }, - { type: 2, pts: 6771374469, ccData: 37162 }, - { type: 2, pts: 6771374469, ccData: 42 }, - { type: 2, pts: 6771374469, ccData: 37376 }, - { type: 2, pts: 6771374469, ccData: 3072 }, - { type: 3, pts: 6771380475, ccData: 49955 }, - { type: 2, pts: 6771380475, ccData: 37376 }, - { type: 2, pts: 6771380475, ccData: 3584 }, - { type: 3, pts: 6771386481, ccData: 545 }, - { type: 2, pts: 6771386481, ccData: 32512 }, - { type: 3, pts: 6771389484, ccData: 16930 }, - { type: 2, pts: 6771389484, ccData: 24320 }, - { type: 3, pts: 6771392487, ccData: 33313 }, - { type: 2, pts: 6771392487, ccData: 32512 }, - { type: 3, pts: 6771401496, ccData: 49698 }, - { type: 2, pts: 6771401496, ccData: 35073 }, - { type: 3, pts: 6771596691, ccData: 546 }, - { type: 2, pts: 6771596691, ccData: 35841 }, - { type: 3, pts: 6771683778, ccData: 18993 }, - { type: 2, pts: 6771683778, ccData: 38939 }, - { type: 2, pts: 6771683778, ccData: 17920 }, - { type: 2, pts: 6771683778, ccData: 31 }, - { type: 2, pts: 6771683778, ccData: 5264 }, - { type: 2, pts: 6771683778, ccData: 1283 }, - { type: 2, pts: 6771683778, ccData: 37162 }, - { type: 2, pts: 6771683778, ccData: 0 }, - { type: 2, pts: 6771683778, ccData: 37376 }, - { type: 2, pts: 6771683778, ccData: 0 }, - { type: 3, pts: 6771689784, ccData: 33571 }, - { type: 2, pts: 6771689784, ccData: 37376 }, - { type: 2, pts: 6771689784, ccData: 512 }, - { type: 3, pts: 6771695790, ccData: 49698 }, - { type: 2, pts: 6771695790, ccData: 20585 }, - { type: 3, pts: 6771698793, ccData: 546 }, - { type: 2, pts: 6771698793, ccData: 28267 }, - { type: 3, pts: 6771701796, ccData: 16930 }, - { type: 2, pts: 6771701796, ccData: 24940 }, - { type: 3, pts: 6771704799, ccData: 33314 }, - { type: 2, pts: 6771704799, ccData: 26979 }, - { type: 3, pts: 6771707802, ccData: 49698 }, - { type: 2, pts: 6771707802, ccData: 26991 }, - { type: 3, pts: 6771710805, ccData: 546 }, - { type: 2, pts: 6771710805, ccData: 30067 }, - { type: 3, pts: 6771713808, ccData: 16930 }, - { type: 2, pts: 6771713808, ccData: 11776 }, - { type: 3, pts: 6771722817, ccData: 33314 }, - { type: 2, pts: 6771722817, ccData: 35073 }, - { type: 3, pts: 6771785880, ccData: 51761 }, - { type: 2, pts: 6771785880, ccData: 39195 }, - { type: 2, pts: 6771785880, ccData: 17920 }, - { type: 2, pts: 6771785880, ccData: 31 }, - { type: 2, pts: 6771785880, ccData: 5264 }, - { type: 2, pts: 6771785880, ccData: 1283 }, - { type: 2, pts: 6771785880, ccData: 37162 }, - { type: 2, pts: 6771785880, ccData: 42 }, - { type: 2, pts: 6771785880, ccData: 37376 }, - { type: 2, pts: 6771785880, ccData: 0 }, - { type: 3, pts: 6771791886, ccData: 803 }, - { type: 2, pts: 6771791886, ccData: 37376 }, - { type: 2, pts: 6771791886, ccData: 768 }, - { type: 3, pts: 6771797892, ccData: 16930 }, - { type: 2, pts: 6771797892, ccData: 22895 }, - { type: 3, pts: 6771800895, ccData: 33314 }, - { type: 2, pts: 6771800895, ccData: 29991 }, - { type: 3, pts: 6771803898, ccData: 49698 }, - { type: 2, pts: 6771803898, ccData: 29285 }, - { type: 3, pts: 6771806901, ccData: 546 }, - { type: 2, pts: 6771806901, ccData: 24418 }, - { type: 3, pts: 6771809904, ccData: 16930 }, - { type: 2, pts: 6771809904, ccData: 24931 }, - { type: 3, pts: 6771812907, ccData: 33314 }, - { type: 2, pts: 6771812907, ccData: 27455 }, - { type: 3, pts: 6771815910, ccData: 49698 }, - { type: 2, pts: 6771815910, ccData: 35841 }, - { type: 3, pts: 6771821916, ccData: 546 }, - { type: 2, pts: 6771821916, ccData: 35074 }, - { type: 3, pts: 6771893988, ccData: 18993 }, - { type: 2, pts: 6771893988, ccData: 38939 }, - { type: 2, pts: 6771893988, ccData: 16640 }, - { type: 2, pts: 6771893988, ccData: 31 }, - { type: 2, pts: 6771893988, ccData: 5264 }, - { type: 2, pts: 6771893988, ccData: 1283 }, - { type: 2, pts: 6771893988, ccData: 37162 }, - { type: 2, pts: 6771893988, ccData: 42 }, - { type: 2, pts: 6771893988, ccData: 37376 }, - { type: 2, pts: 6771893988, ccData: 4096 }, - { type: 3, pts: 6771899994, ccData: 33314 }, - { type: 2, pts: 6771899994, ccData: 10355 }, - { type: 3, pts: 6771902997, ccData: 49698 }, - { type: 2, pts: 6771902997, ccData: 26983 }, - { type: 3, pts: 6771906000, ccData: 546 }, - { type: 2, pts: 6771906000, ccData: 26739 }, - { type: 3, pts: 6771909003, ccData: 16930 }, - { type: 2, pts: 6771909003, ccData: 10496 }, - { type: 3, pts: 6771912006, ccData: 35377 }, - { type: 2, pts: 6771912006, ccData: 38939 }, - { type: 2, pts: 6771912006, ccData: 16640 }, - { type: 2, pts: 6771912006, ccData: 287 }, - { type: 2, pts: 6771912006, ccData: 4240 }, - { type: 2, pts: 6771912006, ccData: 1283 }, - { type: 2, pts: 6771912006, ccData: 37162 }, - { type: 2, pts: 6771912006, ccData: 0 }, - { type: 2, pts: 6771912006, ccData: 37377 }, - { type: 2, pts: 6771912006, ccData: 4096 }, - { type: 3, pts: 6771918012, ccData: 49955 }, - { type: 2, pts: 6771918012, ccData: 37377 }, - { type: 2, pts: 6771918012, ccData: 4864 }, - { type: 3, pts: 6771924018, ccData: 546 }, - { type: 2, pts: 6771924018, ccData: 22885 }, - { type: 3, pts: 6771927021, ccData: 16930 }, - { type: 2, pts: 6771927021, ccData: 29486 }, - { type: 3, pts: 6771930024, ccData: 33314 }, - { type: 2, pts: 6771930024, ccData: 35842 }, - { type: 3, pts: 6771936030, ccData: 49698 }, - { type: 2, pts: 6771936030, ccData: 35073 }, - { type: 3, pts: 6772017111, ccData: 2609 }, - { type: 2, pts: 6772017111, ccData: 39195 }, - { type: 2, pts: 6772017111, ccData: 17920 }, - { type: 2, pts: 6772017111, ccData: 31 }, - { type: 2, pts: 6772017111, ccData: 5264 }, - { type: 2, pts: 6772017111, ccData: 1283 }, - { type: 2, pts: 6772017111, ccData: 37162 }, - { type: 2, pts: 6772017111, ccData: 42 }, - { type: 2, pts: 6772017111, ccData: 37376 }, - { type: 2, pts: 6772017111, ccData: 2048 }, - { type: 3, pts: 6772023117, ccData: 17187 }, - { type: 2, pts: 6772023117, ccData: 37376 }, - { type: 2, pts: 6772023117, ccData: 2304 }, - { type: 3, pts: 6772029123, ccData: 33314 }, - { type: 2, pts: 6772029123, ccData: 18783 }, - { type: 3, pts: 6772032126, ccData: 49698 }, - { type: 2, pts: 6772032126, ccData: 27759 }, - { type: 3, pts: 6772035129, ccData: 546 }, - { type: 2, pts: 6772035129, ccData: 30309 }, - { type: 3, pts: 6772038132, ccData: 16930 }, - { type: 2, pts: 6772038132, ccData: 24429 }, - { type: 3, pts: 6772041135, ccData: 33314 }, - { type: 2, pts: 6772041135, ccData: 31071 }, - { type: 3, pts: 6772044138, ccData: 49698 }, - { type: 2, pts: 6772044138, ccData: 26721 }, - { type: 3, pts: 6772047141, ccData: 546 }, - { type: 2, pts: 6772047141, ccData: 26994 }, - { type: 3, pts: 6772050144, ccData: 16930 }, - { type: 2, pts: 6772050144, ccData: 29556 }, - { type: 3, pts: 6772053147, ccData: 33314 }, - { type: 2, pts: 6772053147, ccData: 31084 }, - { type: 3, pts: 6772056150, ccData: 49698 }, - { type: 2, pts: 6772056150, ccData: 25900 }, - { type: 3, pts: 6772059153, ccData: 546 }, - { type: 2, pts: 6772059153, ccData: 35841 }, - { type: 3, pts: 6772065159, ccData: 16930 }, - { type: 2, pts: 6772065159, ccData: 35074 }, - { type: 3, pts: 6772113207, ccData: 35377 }, - { type: 2, pts: 6772113207, ccData: 38939 }, - { type: 2, pts: 6772113207, ccData: 16640 }, - { type: 2, pts: 6772113207, ccData: 31 }, - { type: 2, pts: 6772113207, ccData: 5264 }, - { type: 2, pts: 6772113207, ccData: 1283 }, - { type: 2, pts: 6772113207, ccData: 37162 }, - { type: 2, pts: 6772113207, ccData: 42 }, - { type: 2, pts: 6772113207, ccData: 37376 }, - { type: 2, pts: 6772113207, ccData: 1024 }, - { type: 3, pts: 6772119213, ccData: 49955 }, - { type: 2, pts: 6772119213, ccData: 37376 }, - { type: 2, pts: 6772119213, ccData: 1536 }, - { type: 3, pts: 6772125219, ccData: 546 }, - { type: 2, pts: 6772125219, ccData: 25205 }, - { type: 3, pts: 6772128222, ccData: 16930 }, - { type: 2, pts: 6772128222, ccData: 29791 }, - { type: 3, pts: 6772131225, ccData: 33314 }, - { type: 2, pts: 6772131225, ccData: 26996 }, - { type: 3, pts: 6772134228, ccData: 49698 }, - { type: 2, pts: 6772134228, ccData: 24427 }, - { type: 3, pts: 6772137231, ccData: 546 }, - { type: 2, pts: 6772137231, ccData: 25957 }, - { type: 3, pts: 6772140234, ccData: 16930 }, - { type: 2, pts: 6772140234, ccData: 28787 }, - { type: 3, pts: 6772143237, ccData: 33314 }, - { type: 2, pts: 6772143237, ccData: 24423 }, - { type: 3, pts: 6772146240, ccData: 49698 }, - { type: 2, pts: 6772146240, ccData: 25972 }, - { type: 3, pts: 6772149243, ccData: 546 }, - { type: 2, pts: 6772149243, ccData: 29801 }, - { type: 3, pts: 6772152246, ccData: 16930 }, - { type: 2, pts: 6772152246, ccData: 28263 }, - { type: 3, pts: 6772155249, ccData: 35377 }, - { type: 2, pts: 6772155249, ccData: 38939 }, - { type: 2, pts: 6772155249, ccData: 16640 }, - { type: 2, pts: 6772155249, ccData: 287 }, - { type: 2, pts: 6772155249, ccData: 4240 }, - { type: 2, pts: 6772155249, ccData: 1283 }, - { type: 2, pts: 6772155249, ccData: 37162 }, - { type: 2, pts: 6772155249, ccData: 0 }, - { type: 2, pts: 6772155249, ccData: 37377 }, - { type: 2, pts: 6772155249, ccData: 4096 }, - { type: 3, pts: 6772161255, ccData: 49698 }, - { type: 2, pts: 6772161255, ccData: 26990 }, - { type: 3, pts: 6772164258, ccData: 546 }, - { type: 2, pts: 6772164258, ccData: 24429 }, - { type: 3, pts: 6772167261, ccData: 16930 }, - { type: 2, pts: 6772167261, ccData: 31071 }, - { type: 3, pts: 6772170264, ccData: 33314 }, - { type: 2, pts: 6772170264, ccData: 30561 }, - { type: 3, pts: 6772173267, ccData: 49698 }, - { type: 2, pts: 6772173267, ccData: 31022 }, - { type: 3, pts: 6772176270, ccData: 546 }, - { type: 2, pts: 6772176270, ccData: 35842 }, - { type: 3, pts: 6772182276, ccData: 16930 }, - { type: 2, pts: 6772182276, ccData: 35073 }, - { type: 3, pts: 6772314408, ccData: 35377 }, - { type: 2, pts: 6772314408, ccData: 39195 }, - { type: 2, pts: 6772314408, ccData: 16640 }, - { type: 2, pts: 6772314408, ccData: 31 }, - { type: 2, pts: 6772314408, ccData: 5264 }, - { type: 2, pts: 6772314408, ccData: 1283 }, - { type: 2, pts: 6772314408, ccData: 37162 }, - { type: 2, pts: 6772314408, ccData: 42 }, - { type: 2, pts: 6772314408, ccData: 37376 }, - { type: 2, pts: 6772314408, ccData: 3072 }, - { type: 3, pts: 6772320414, ccData: 49955 }, - { type: 2, pts: 6772320414, ccData: 37376 }, - { type: 2, pts: 6772320414, ccData: 3328 }, - { type: 3, pts: 6772326420, ccData: 546 }, - { type: 2, pts: 6772326420, ccData: 18783 }, - { type: 3, pts: 6772329423, ccData: 16930 }, - { type: 2, pts: 6772329423, ccData: 25974 }, - { type: 3, pts: 6772332426, ccData: 33314 }, - { type: 2, pts: 6772332426, ccData: 25966 }, - { type: 3, pts: 6772335429, ccData: 49698 }, - { type: 2, pts: 6772335429, ccData: 24429 }, - { type: 3, pts: 6772338432, ccData: 546 }, - { type: 2, pts: 6772338432, ccData: 26995 }, - { type: 3, pts: 6772341435, ccData: 16930 }, - { type: 2, pts: 6772341435, ccData: 29541 }, - { type: 3, pts: 6772344438, ccData: 33314 }, - { type: 2, pts: 6772344438, ccData: 25600 }, - { type: 3, pts: 6772347441, ccData: 51761 }, - { type: 2, pts: 6772347441, ccData: 39195 }, - { type: 2, pts: 6772347441, ccData: 16640 }, - { type: 2, pts: 6772347441, ccData: 287 }, - { type: 2, pts: 6772347441, ccData: 4240 }, - { type: 2, pts: 6772347441, ccData: 1283 }, - { type: 2, pts: 6772347441, ccData: 37162 }, - { type: 2, pts: 6772347441, ccData: 0 }, - { type: 2, pts: 6772347441, ccData: 37377 }, - { type: 2, pts: 6772347441, ccData: 4096 }, - { type: 3, pts: 6772353447, ccData: 803 }, - { type: 2, pts: 6772353447, ccData: 37377 }, - { type: 2, pts: 6772353447, ccData: 4864 }, - { type: 3, pts: 6772359453, ccData: 16930 }, - { type: 2, pts: 6772359453, ccData: 24927 }, - { type: 3, pts: 6772362456, ccData: 33314 }, - { type: 2, pts: 6772362456, ccData: 26479 }, - { type: 3, pts: 6772365459, ccData: 49698 }, - { type: 2, pts: 6772365459, ccData: 24940 }, - { type: 3, pts: 6772368462, ccData: 546 }, - { type: 2, pts: 6772368462, ccData: 11776 }, - { type: 3, pts: 6772371465, ccData: 16930 }, - { type: 2, pts: 6772371465, ccData: 35841 }, - { type: 3, pts: 6772377471, ccData: 33314 }, - { type: 2, pts: 6772377471, ccData: 35074 }, - { type: 3, pts: 6772515609, ccData: 51761 }, - { type: 2, pts: 6772515609, ccData: 38939 }, - { type: 2, pts: 6772515609, ccData: 16640 }, - { type: 2, pts: 6772515609, ccData: 31 }, - { type: 2, pts: 6772515609, ccData: 5264 }, - { type: 2, pts: 6772515609, ccData: 1283 }, - { type: 2, pts: 6772515609, ccData: 37162 }, - { type: 2, pts: 6772515609, ccData: 42 }, - { type: 2, pts: 6772515609, ccData: 37376 }, - { type: 2, pts: 6772515609, ccData: 1024 }, - { type: 3, pts: 6772521615, ccData: 803 }, - { type: 2, pts: 6772521615, ccData: 37376 }, - { type: 2, pts: 6772521615, ccData: 1792 }, - { type: 3, pts: 6772527621, ccData: 16930 }, - { type: 2, pts: 6772527621, ccData: 19809 }, - { type: 3, pts: 6772530624, ccData: 33314 }, - { type: 2, pts: 6772530624, ccData: 31071 }, - { type: 3, pts: 6772533627, ccData: 49698 }, - { type: 2, pts: 6772533627, ccData: 18783 }, - { type: 3, pts: 6772536630, ccData: 546 }, - { type: 2, pts: 6772536630, ccData: 28780 }, - { type: 3, pts: 6772539633, ccData: 16930 }, - { type: 2, pts: 6772539633, ccData: 25953 }, - { type: 3, pts: 6772542636, ccData: 33314 }, - { type: 2, pts: 6772542636, ccData: 29541 }, - { type: 3, pts: 6772545639, ccData: 49698 }, - { type: 2, pts: 6772545639, ccData: 24420 }, - { type: 3, pts: 6772548642, ccData: 546 }, - { type: 2, pts: 6772548642, ccData: 29285 }, - { type: 3, pts: 6772551645, ccData: 16930 }, - { type: 2, pts: 6772551645, ccData: 24941 }, - { type: 3, pts: 6772554648, ccData: 33314 }, - { type: 2, pts: 6772554648, ccData: 24437 }, - { type: 3, pts: 6772557651, ccData: 49698 }, - { type: 2, pts: 6772557651, ccData: 28672 }, - { type: 3, pts: 6772560654, ccData: 2609 }, - { type: 2, pts: 6772560654, ccData: 38939 }, - { type: 2, pts: 6772560654, ccData: 16640 }, - { type: 2, pts: 6772560654, ccData: 287 }, - { type: 2, pts: 6772560654, ccData: 4240 }, - { type: 2, pts: 6772560654, ccData: 1283 }, - { type: 2, pts: 6772560654, ccData: 37162 }, - { type: 2, pts: 6772560654, ccData: 0 }, - { type: 2, pts: 6772560654, ccData: 37377 }, - { type: 2, pts: 6772560654, ccData: 2048 }, - { type: 3, pts: 6772566660, ccData: 17187 }, - { type: 2, pts: 6772566660, ccData: 37377 }, - { type: 2, pts: 6772566660, ccData: 2560 }, - { type: 3, pts: 6772572666, ccData: 33314 }, - { type: 2, pts: 6772572666, ccData: 24942 }, - { type: 3, pts: 6772575669, ccData: 49698 }, - { type: 2, pts: 6772575669, ccData: 28532 }, - { type: 3, pts: 6772578672, ccData: 546 }, - { type: 2, pts: 6772578672, ccData: 26725 }, - { type: 3, pts: 6772581675, ccData: 16930 }, - { type: 2, pts: 6772581675, ccData: 29279 }, - { type: 3, pts: 6772584678, ccData: 33314 }, - { type: 2, pts: 6772584678, ccData: 26721 }, - { type: 3, pts: 6772587681, ccData: 49698 }, - { type: 2, pts: 6772587681, ccData: 26994 }, - { type: 3, pts: 6772590684, ccData: 546 }, - { type: 2, pts: 6772590684, ccData: 29556 }, - { type: 3, pts: 6772593687, ccData: 16930 }, - { type: 2, pts: 6772593687, ccData: 31084 }, - { type: 3, pts: 6772596690, ccData: 33314 }, - { type: 2, pts: 6772596690, ccData: 25919 }, - { type: 3, pts: 6772599693, ccData: 49698 }, - { type: 2, pts: 6772599693, ccData: 35842 }, - { type: 3, pts: 6772605699, ccData: 546 }, - { type: 2, pts: 6772605699, ccData: 35073 }, - { type: 3, pts: 6772818912, ccData: 18993 }, - { type: 2, pts: 6772818912, ccData: 39195 }, - { type: 2, pts: 6772818912, ccData: 17920 }, - { type: 2, pts: 6772818912, ccData: 31 }, - { type: 2, pts: 6772818912, ccData: 5264 }, - { type: 2, pts: 6772818912, ccData: 1283 }, - { type: 2, pts: 6772818912, ccData: 37162 }, - { type: 2, pts: 6772818912, ccData: 42 }, - { type: 2, pts: 6772818912, ccData: 37376 }, - { type: 2, pts: 6772818912, ccData: 0 }, - { type: 3, pts: 6772824918, ccData: 33314 }, - { type: 2, pts: 6772824918, ccData: 20328 }, - { type: 3, pts: 6772827921, ccData: 49698 }, - { type: 2, pts: 6772827921, ccData: 11359 }, - { type: 3, pts: 6772830924, ccData: 546 }, - { type: 2, pts: 6772830924, ccData: 28518 }, - { type: 3, pts: 6772833927, ccData: 16930 }, - { type: 2, pts: 6772833927, ccData: 24419 }, - { type: 3, pts: 6772836930, ccData: 33314 }, - { type: 2, pts: 6772836930, ccData: 28533 }, - { type: 3, pts: 6772839933, ccData: 49698 }, - { type: 2, pts: 6772839933, ccData: 29299 }, - { type: 3, pts: 6772842936, ccData: 546 }, - { type: 2, pts: 6772842936, ccData: 25889 }, - { type: 3, pts: 6772845939, ccData: 16930 }, - { type: 2, pts: 6772845939, ccData: 35841 }, - { type: 3, pts: 6772851945, ccData: 33314 }, - { type: 2, pts: 6772851945, ccData: 35074 }, - { type: 3, pts: 6772978071, ccData: 49698 }, - { type: 2, pts: 6772978071, ccData: 35842 }, - { type: 3, pts: 6773170263, ccData: 2609 }, - { type: 2, pts: 6773170263, ccData: 38939 }, - { type: 2, pts: 6773170263, ccData: 16640 }, - { type: 2, pts: 6773170263, ccData: 31 }, - { type: 2, pts: 6773170263, ccData: 5264 }, - { type: 2, pts: 6773170263, ccData: 1283 }, - { type: 2, pts: 6773170263, ccData: 37162 }, - { type: 2, pts: 6773170263, ccData: 42 }, - { type: 2, pts: 6773170263, ccData: 37376 }, - { type: 2, pts: 6773170263, ccData: 2048 }, - { type: 3, pts: 6773176269, ccData: 17187 }, - { type: 2, pts: 6773176269, ccData: 37376 }, - { type: 2, pts: 6773176269, ccData: 2560 }, - { type: 3, pts: 6773182275, ccData: 33314 }, - { type: 2, pts: 6773182275, ccData: 18727 }, - { type: 3, pts: 6773185278, ccData: 49698 }, - { type: 2, pts: 6773185278, ccData: 27999 }, - { type: 3, pts: 6773188281, ccData: 546 }, - { type: 2, pts: 6773188281, ccData: 25714 }, - { type: 3, pts: 6773191284, ccData: 16930 }, - { type: 2, pts: 6773191284, ccData: 25953 }, - { type: 3, pts: 6773194287, ccData: 33314 }, - { type: 2, pts: 6773194287, ccData: 28009 }, - { type: 3, pts: 6773197290, ccData: 49698 }, - { type: 2, pts: 6773197290, ccData: 28263 }, - { type: 3, pts: 6773200293, ccData: 2609 }, - { type: 2, pts: 6773200293, ccData: 38939 }, - { type: 2, pts: 6773200293, ccData: 16640 }, - { type: 2, pts: 6773200293, ccData: 287 }, - { type: 2, pts: 6773200293, ccData: 4240 }, - { type: 2, pts: 6773200293, ccData: 1283 }, - { type: 2, pts: 6773200293, ccData: 37162 }, - { type: 2, pts: 6773200293, ccData: 0 }, - { type: 2, pts: 6773200293, ccData: 37377 }, - { type: 2, pts: 6773200293, ccData: 2048 }, - { type: 3, pts: 6773206299, ccData: 17187 }, - { type: 2, pts: 6773206299, ccData: 37377 }, - { type: 2, pts: 6773206299, ccData: 2304 }, - { type: 3, pts: 6773212305, ccData: 33314 }, - { type: 2, pts: 6773212305, ccData: 28518 }, - { type: 3, pts: 6773215308, ccData: 49698 }, - { type: 2, pts: 6773215308, ccData: 24417 }, - { type: 3, pts: 6773218311, ccData: 546 }, - { type: 2, pts: 6773218311, ccData: 24424 }, - { type: 3, pts: 6773221314, ccData: 16930 }, - { type: 2, pts: 6773221314, ccData: 24937 }, - { type: 3, pts: 6773224317, ccData: 33314 }, - { type: 2, pts: 6773224317, ccData: 29299 }, - { type: 3, pts: 6773227320, ccData: 49698 }, - { type: 2, pts: 6773227320, ccData: 29817 }, - { type: 3, pts: 6773230323, ccData: 546 }, - { type: 2, pts: 6773230323, ccData: 27749 }, - { type: 3, pts: 6773239332, ccData: 16930 }, - { type: 2, pts: 6773239332, ccData: 35073 }, - { type: 3, pts: 6773317410, ccData: 35377 }, - { type: 2, pts: 6773317410, ccData: 39195 }, - { type: 2, pts: 6773317410, ccData: 16640 }, - { type: 2, pts: 6773317410, ccData: 31 }, - { type: 2, pts: 6773317410, ccData: 5264 }, - { type: 2, pts: 6773317410, ccData: 1283 }, - { type: 2, pts: 6773317410, ccData: 37162 }, - { type: 2, pts: 6773317410, ccData: 42 }, - { type: 2, pts: 6773317410, ccData: 37376 }, - { type: 2, pts: 6773317410, ccData: 0 }, - { type: 3, pts: 6773323416, ccData: 49698 }, - { type: 2, pts: 6773323416, ccData: 29800 }, - { type: 3, pts: 6773326419, ccData: 546 }, - { type: 2, pts: 6773326419, ccData: 24948 }, - { type: 3, pts: 6773329422, ccData: 16930 }, - { type: 2, pts: 6773329422, ccData: 24439 }, - { type: 3, pts: 6773332425, ccData: 33314 }, - { type: 2, pts: 6773332425, ccData: 28526 }, - { type: 3, pts: 6773335428, ccData: 49698 }, - { type: 2, pts: 6773335428, ccData: 10100 }, - { type: 3, pts: 6773338431, ccData: 546 }, - { type: 2, pts: 6773338431, ccData: 24423 }, - { type: 3, pts: 6773341434, ccData: 16930 }, - { type: 2, pts: 6773341434, ccData: 25972 }, - { type: 3, pts: 6773344437, ccData: 35377 }, - { type: 2, pts: 6773344437, ccData: 39195 }, - { type: 2, pts: 6773344437, ccData: 16640 }, - { type: 2, pts: 6773344437, ccData: 287 }, - { type: 2, pts: 6773344437, ccData: 4240 }, - { type: 2, pts: 6773344437, ccData: 1283 }, - { type: 2, pts: 6773344437, ccData: 37162 }, - { type: 2, pts: 6773344437, ccData: 0 }, - { type: 2, pts: 6773344437, ccData: 37377 }, - { type: 2, pts: 6773344437, ccData: 0 }, - { type: 3, pts: 6773350443, ccData: 49698 }, - { type: 2, pts: 6773350443, ccData: 29556 }, - { type: 3, pts: 6773353446, ccData: 546 }, - { type: 2, pts: 6773353446, ccData: 25968 }, - { type: 3, pts: 6773356449, ccData: 16930 }, - { type: 2, pts: 6773356449, ccData: 28773 }, - { type: 3, pts: 6773359452, ccData: 33314 }, - { type: 2, pts: 6773359452, ccData: 25695 }, - { type: 3, pts: 6773362455, ccData: 49698 }, - { type: 2, pts: 6773362455, ccData: 28526 }, - { type: 3, pts: 6773365458, ccData: 546 }, - { type: 2, pts: 6773365458, ccData: 11822 }, - { type: 3, pts: 6773368461, ccData: 16930 }, - { type: 2, pts: 6773368461, ccData: 11776 }, - { type: 3, pts: 6773371464, ccData: 33314 }, - { type: 2, pts: 6773371464, ccData: 35841 }, - { type: 3, pts: 6773377470, ccData: 49698 }, - { type: 2, pts: 6773377470, ccData: 35074 }, - { type: 3, pts: 6773749842, ccData: 2609 }, - { type: 2, pts: 6773749842, ccData: 38939 }, - { type: 2, pts: 6773749842, ccData: 17920 }, - { type: 2, pts: 6773749842, ccData: 31 }, - { type: 2, pts: 6773749842, ccData: 5264 }, - { type: 2, pts: 6773749842, ccData: 1283 }, - { type: 2, pts: 6773749842, ccData: 37162 }, - { type: 2, pts: 6773749842, ccData: 42 }, - { type: 2, pts: 6773749842, ccData: 37376 }, - { type: 2, pts: 6773749842, ccData: 2048 }, - { type: 3, pts: 6773755848, ccData: 16930 }, - { type: 2, pts: 6773755848, ccData: 28530 }, - { type: 3, pts: 6773758851, ccData: 33314 }, - { type: 2, pts: 6773758851, ccData: 24435 }, - { type: 3, pts: 6773761854, ccData: 49698 }, - { type: 2, pts: 6773761854, ccData: 29813 }, - { type: 3, pts: 6773764857, ccData: 546 }, - { type: 2, pts: 6773764857, ccData: 25451 }, - { type: 3, pts: 6773767860, ccData: 16930 }, - { type: 2, pts: 6773767860, ccData: 24425 }, - { type: 3, pts: 6773770863, ccData: 33314 }, - { type: 2, pts: 6773770863, ccData: 28255 }, - { type: 3, pts: 6773773866, ccData: 49698 }, - { type: 2, pts: 6773773866, ccData: 29552 }, - { type: 3, pts: 6773776869, ccData: 546 }, - { type: 2, pts: 6773776869, ccData: 24935 }, - { type: 3, pts: 6773779872, ccData: 16930 }, - { type: 2, pts: 6773779872, ccData: 26725 }, - { type: 3, pts: 6773782875, ccData: 33314 }, - { type: 2, pts: 6773782875, ccData: 29812 }, - { type: 3, pts: 6773785878, ccData: 49698 }, - { type: 2, pts: 6773785878, ccData: 26926 }, - { type: 3, pts: 6773788881, ccData: 546 }, - { type: 2, pts: 6773788881, ccData: 11822 }, - { type: 3, pts: 6773791884, ccData: 16930 }, - { type: 2, pts: 6773791884, ccData: 35842 }, - { type: 3, pts: 6773797890, ccData: 33314 }, - { type: 2, pts: 6773797890, ccData: 35073 }, - { type: 3, pts: 6774137229, ccData: 51761 }, - { type: 2, pts: 6774137229, ccData: 39195 }, - { type: 2, pts: 6774137229, ccData: 16640 }, - { type: 2, pts: 6774137229, ccData: 31 }, - { type: 2, pts: 6774137229, ccData: 5264 }, - { type: 2, pts: 6774137229, ccData: 1283 }, - { type: 2, pts: 6774137229, ccData: 37162 }, - { type: 2, pts: 6774137229, ccData: 42 }, - { type: 2, pts: 6774137229, ccData: 37376 }, - { type: 2, pts: 6774137229, ccData: 4096 }, - { type: 3, pts: 6774143235, ccData: 546 }, - { type: 2, pts: 6774143235, ccData: 24942 }, - { type: 3, pts: 6774146238, ccData: 16930 }, - { type: 2, pts: 6774146238, ccData: 25695 }, - { type: 3, pts: 6774149241, ccData: 33314 }, - { type: 2, pts: 6774149241, ccData: 18783 }, - { type: 3, pts: 6774152244, ccData: 49698 }, - { type: 2, pts: 6774152244, ccData: 30575 }, - { type: 3, pts: 6774155247, ccData: 546 }, - { type: 2, pts: 6774155247, ccData: 28199 }, - { type: 3, pts: 6774158250, ccData: 16930 }, - { type: 2, pts: 6774158250, ccData: 29791 }, - { type: 3, pts: 6774161253, ccData: 33314 }, - { type: 2, pts: 6774161253, ccData: 29810 }, - { type: 3, pts: 6774164256, ccData: 49698 }, - { type: 2, pts: 6774164256, ccData: 26992 }, - { type: 3, pts: 6774167259, ccData: 2609 }, - { type: 2, pts: 6774167259, ccData: 39195 }, - { type: 2, pts: 6774167259, ccData: 16640 }, - { type: 2, pts: 6774167259, ccData: 287 }, - { type: 2, pts: 6774167259, ccData: 4240 }, - { type: 2, pts: 6774167259, ccData: 1283 }, - { type: 2, pts: 6774167259, ccData: 37162 }, - { type: 2, pts: 6774167259, ccData: 0 }, - { type: 2, pts: 6774167259, ccData: 37377 }, - { type: 2, pts: 6774167259, ccData: 4096 }, - { type: 3, pts: 6774173265, ccData: 17187 }, - { type: 2, pts: 6774173265, ccData: 37377 }, - { type: 2, pts: 6774173265, ccData: 4352 }, - { type: 3, pts: 6774179271, ccData: 33314 }, - { type: 2, pts: 6774179271, ccData: 28534 }, - { type: 3, pts: 6774182274, ccData: 49698 }, - { type: 2, pts: 6774182274, ccData: 25970 }, - { type: 3, pts: 6774185277, ccData: 546 }, - { type: 2, pts: 6774185277, ccData: 24425 }, - { type: 3, pts: 6774188280, ccData: 16930 }, - { type: 2, pts: 6774188280, ccData: 29791 }, - { type: 3, pts: 6774191283, ccData: 33314 }, - { type: 2, pts: 6774191283, ccData: 25961 }, - { type: 3, pts: 6774194286, ccData: 49698 }, - { type: 2, pts: 6774194286, ccData: 29800 }, - { type: 3, pts: 6774197289, ccData: 546 }, - { type: 2, pts: 6774197289, ccData: 25970 }, - { type: 3, pts: 6774200292, ccData: 16930 }, - { type: 2, pts: 6774200292, ccData: 11776 }, - { type: 3, pts: 6774203295, ccData: 33314 }, - { type: 2, pts: 6774203295, ccData: 35841 }, - { type: 3, pts: 6774209301, ccData: 49698 }, - { type: 2, pts: 6774209301, ccData: 35074 }, - { type: 3, pts: 6774689781, ccData: 546 }, - { type: 2, pts: 6774689781, ccData: 35842 }, - { type: 3, pts: 6774902994, ccData: 18993 }, - { type: 2, pts: 6774902994, ccData: 38939 }, - { type: 2, pts: 6774902994, ccData: 17920 }, - { type: 2, pts: 6774902994, ccData: 31 }, - { type: 2, pts: 6774902994, ccData: 5264 }, - { type: 2, pts: 6774902994, ccData: 1283 }, - { type: 2, pts: 6774902994, ccData: 37162 }, - { type: 2, pts: 6774902994, ccData: 42 }, - { type: 2, pts: 6774902994, ccData: 37376 }, - { type: 2, pts: 6774902994, ccData: 7168 }, - { type: 3, pts: 6774909000, ccData: 33314 }, - { type: 2, pts: 6774909000, ccData: 20335 }, - { type: 3, pts: 6774912003, ccData: 49698 }, - { type: 2, pts: 6774912003, ccData: 26657 }, - { type: 3, pts: 6774921012, ccData: 546 }, - { type: 2, pts: 6774921012, ccData: 35073 }, - { type: 3, pts: 6774945036, ccData: 18993 }, - { type: 2, pts: 6774945036, ccData: 39195 }, - { type: 2, pts: 6774945036, ccData: 16640 }, - { type: 2, pts: 6774945036, ccData: 31 }, - { type: 2, pts: 6774945036, ccData: 5264 }, - { type: 2, pts: 6774945036, ccData: 1283 }, - { type: 2, pts: 6774945036, ccData: 37162 }, - { type: 2, pts: 6774945036, ccData: 42 }, - { type: 2, pts: 6774945036, ccData: 37376 }, - { type: 2, pts: 6774945036, ccData: 3072 }, - { type: 3, pts: 6774951042, ccData: 33571 }, - { type: 2, pts: 6774951042, ccData: 37376 }, - { type: 2, pts: 6774951042, ccData: 3328 }, - { type: 3, pts: 6774957048, ccData: 49698 }, - { type: 2, pts: 6774957048, ccData: 16750 }, - { type: 3, pts: 6774960051, ccData: 546 }, - { type: 2, pts: 6774960051, ccData: 25695 }, - { type: 3, pts: 6774963054, ccData: 16930 }, - { type: 2, pts: 6774963054, ccData: 29800 }, - { type: 3, pts: 6774966057, ccData: 33314 }, - { type: 2, pts: 6774966057, ccData: 25970 }, - { type: 3, pts: 6774969060, ccData: 49698 }, - { type: 2, pts: 6774969060, ccData: 25895 }, - { type: 3, pts: 6774972063, ccData: 546 }, - { type: 2, pts: 6774972063, ccData: 29535 }, - { type: 3, pts: 6774975066, ccData: 16930 }, - { type: 2, pts: 6774975066, ccData: 24927 }, - { type: 3, pts: 6774978069, ccData: 33314 }, - { type: 2, pts: 6774978069, ccData: 29801 }, - { type: 3, pts: 6774981072, ccData: 49698 }, - { type: 2, pts: 6774981072, ccData: 24946 }, - { type: 3, pts: 6774984075, ccData: 546 }, - { type: 2, pts: 6774984075, ccData: 24832 }, - { type: 3, pts: 6774987078, ccData: 18993 }, - { type: 2, pts: 6774987078, ccData: 39195 }, - { type: 2, pts: 6774987078, ccData: 16640 }, - { type: 2, pts: 6774987078, ccData: 287 }, - { type: 2, pts: 6774987078, ccData: 4240 }, - { type: 2, pts: 6774987078, ccData: 1283 }, - { type: 2, pts: 6774987078, ccData: 37162 }, - { type: 2, pts: 6774987078, ccData: 0 }, - { type: 2, pts: 6774987078, ccData: 37377 }, - { type: 2, pts: 6774987078, ccData: 5120 }, - { type: 3, pts: 6774993084, ccData: 33571 }, - { type: 2, pts: 6774993084, ccData: 37377 }, - { type: 2, pts: 6774993084, ccData: 5376 }, - { type: 3, pts: 6774999090, ccData: 49698 }, - { type: 2, pts: 6774999090, ccData: 24948 }, - { type: 3, pts: 6775002093, ccData: 546 }, - { type: 2, pts: 6775002093, ccData: 24436 }, - { type: 3, pts: 6775005096, ccData: 16930 }, - { type: 2, pts: 6775005096, ccData: 26725 }, - { type: 3, pts: 6775008099, ccData: 33314 }, - { type: 2, pts: 6775008099, ccData: 24436 }, - { type: 3, pts: 6775011102, ccData: 49698 }, - { type: 2, pts: 6775011102, ccData: 28528 }, - { type: 3, pts: 6775014105, ccData: 546 }, - { type: 2, pts: 6775014105, ccData: 11776 }, - { type: 3, pts: 6775017108, ccData: 16930 }, - { type: 2, pts: 6775017108, ccData: 35841 }, - { type: 3, pts: 6775023114, ccData: 33314 }, - { type: 2, pts: 6775023114, ccData: 35074 }, - { type: 3, pts: 6775206297, ccData: 49698 }, - { type: 2, pts: 6775206297, ccData: 35842 }, - { type: 3, pts: 6775551642, ccData: 2609 }, - { type: 2, pts: 6775551642, ccData: 38939 }, - { type: 2, pts: 6775551642, ccData: 17920 }, - { type: 2, pts: 6775551642, ccData: 31 }, - { type: 2, pts: 6775551642, ccData: 5264 }, - { type: 2, pts: 6775551642, ccData: 1283 }, - { type: 2, pts: 6775551642, ccData: 37162 }, - { type: 2, pts: 6775551642, ccData: 42 }, - { type: 2, pts: 6775551642, ccData: 37376 }, - { type: 2, pts: 6775551642, ccData: 0 }, - { type: 3, pts: 6775557648, ccData: 17187 }, - { type: 2, pts: 6775557648, ccData: 37376 }, - { type: 2, pts: 6775557648, ccData: 512 }, - { type: 3, pts: 6775563654, ccData: 33314 }, - { type: 2, pts: 6775563654, ccData: 18803 }, - { type: 3, pts: 6775566657, ccData: 49698 }, - { type: 2, pts: 6775566657, ccData: 28199 }, - { type: 3, pts: 6775569660, ccData: 546 }, - { type: 2, pts: 6775569660, ccData: 29791 }, - { type: 3, pts: 6775572663, ccData: 16930 }, - { type: 2, pts: 6775572663, ccData: 26996 }, - { type: 3, pts: 6775581672, ccData: 33314 }, - { type: 2, pts: 6775581672, ccData: 35073 }, - { type: 3, pts: 6775593684, ccData: 51761 }, - { type: 2, pts: 6775593684, ccData: 39195 }, - { type: 2, pts: 6775593684, ccData: 16640 }, - { type: 2, pts: 6775593684, ccData: 31 }, - { type: 2, pts: 6775593684, ccData: 5264 }, - { type: 2, pts: 6775593684, ccData: 1283 }, - { type: 2, pts: 6775593684, ccData: 37162 }, - { type: 2, pts: 6775593684, ccData: 42 }, - { type: 2, pts: 6775593684, ccData: 37376 }, - { type: 2, pts: 6775593684, ccData: 0 }, - { type: 3, pts: 6775599690, ccData: 803 }, - { type: 2, pts: 6775599690, ccData: 37376 }, - { type: 2, pts: 6775599690, ccData: 512 }, - { type: 3, pts: 6775605696, ccData: 16930 }, - { type: 2, pts: 6775605696, ccData: 29800 }, - { type: 3, pts: 6775608699, ccData: 33314 }, - { type: 2, pts: 6775608699, ccData: 25951 }, - { type: 3, pts: 6775611702, ccData: 49698 }, - { type: 2, pts: 6775611702, ccData: 28015 }, - { type: 3, pts: 6775614705, ccData: 546 }, - { type: 2, pts: 6775614705, ccData: 29556 }, - { type: 3, pts: 6775617708, ccData: 16930 }, - { type: 2, pts: 6775617708, ccData: 24432 }, - { type: 3, pts: 6775620711, ccData: 33314 }, - { type: 2, pts: 6775620711, ccData: 26990 }, - { type: 3, pts: 6775623714, ccData: 49698 }, - { type: 2, pts: 6775623714, ccData: 27491 }, - { type: 3, pts: 6775626717, ccData: 546 }, - { type: 2, pts: 6775626717, ccData: 29285 }, - { type: 3, pts: 6775629720, ccData: 16930 }, - { type: 2, pts: 6775629720, ccData: 25705 }, - { type: 3, pts: 6775632723, ccData: 33314 }, - { type: 2, pts: 6775632723, ccData: 25196 }, - { type: 3, pts: 6775635726, ccData: 49698 }, - { type: 2, pts: 6775635726, ccData: 25856 }, - { type: 3, pts: 6775638729, ccData: 2609 }, - { type: 2, pts: 6775638729, ccData: 39195 }, - { type: 2, pts: 6775638729, ccData: 16640 }, - { type: 2, pts: 6775638729, ccData: 287 }, - { type: 2, pts: 6775638729, ccData: 4240 }, - { type: 2, pts: 6775638729, ccData: 1283 }, - { type: 2, pts: 6775638729, ccData: 37162 }, - { type: 2, pts: 6775638729, ccData: 0 }, - { type: 2, pts: 6775638729, ccData: 37377 }, - { type: 2, pts: 6775638729, ccData: 0 }, - { type: 3, pts: 6775644735, ccData: 17187 }, - { type: 2, pts: 6775644735, ccData: 37377 }, - { type: 2, pts: 6775644735, ccData: 512 }, - { type: 3, pts: 6775650741, ccData: 33314 }, - { type: 2, pts: 6775650741, ccData: 26721 }, - { type: 3, pts: 6775653744, ccData: 49698 }, - { type: 2, pts: 6775653744, ccData: 26994 }, - { type: 3, pts: 6775656747, ccData: 546 }, - { type: 2, pts: 6775656747, ccData: 29556 }, - { type: 3, pts: 6775659750, ccData: 16930 }, - { type: 2, pts: 6775659750, ccData: 31084 }, - { type: 3, pts: 6775662753, ccData: 33314 }, - { type: 2, pts: 6775662753, ccData: 25951 }, - { type: 3, pts: 6775665756, ccData: 49698 }, - { type: 2, pts: 6775665756, ccData: 25974 }, - { type: 3, pts: 6775668759, ccData: 546 }, - { type: 2, pts: 6775668759, ccData: 25970 }, - { type: 3, pts: 6775671762, ccData: 16930 }, - { type: 2, pts: 6775671762, ccData: 16128 }, - { type: 3, pts: 6775674765, ccData: 33314 }, - { type: 2, pts: 6775674765, ccData: 35841 }, - { type: 3, pts: 6775680771, ccData: 49698 }, - { type: 2, pts: 6775680771, ccData: 35074 }, - { type: 3, pts: 6775860951, ccData: 2609 }, - { type: 2, pts: 6775860951, ccData: 38939 }, - { type: 2, pts: 6775860951, ccData: 17920 }, - { type: 2, pts: 6775860951, ccData: 31 }, - { type: 2, pts: 6775860951, ccData: 5264 }, - { type: 2, pts: 6775860951, ccData: 1283 }, - { type: 2, pts: 6775860951, ccData: 37162 }, - { type: 2, pts: 6775860951, ccData: 42 }, - { type: 2, pts: 6775860951, ccData: 37376 }, - { type: 2, pts: 6775860951, ccData: 3072 }, - { type: 3, pts: 6775866957, ccData: 17187 }, - { type: 2, pts: 6775866957, ccData: 37376 }, - { type: 2, pts: 6775866957, ccData: 3840 }, - { type: 3, pts: 6775872963, ccData: 33314 }, - { type: 2, pts: 6775872963, ccData: 16744 }, - { type: 3, pts: 6775875966, ccData: 49698 }, - { type: 2, pts: 6775875966, ccData: 11359 }, - { type: 3, pts: 6775878969, ccData: 546 }, - { type: 2, pts: 6775878969, ccData: 28777 }, - { type: 3, pts: 6775881972, ccData: 16930 }, - { type: 2, pts: 6775881972, ccData: 28267 }, - { type: 3, pts: 6775884975, ccData: 33314 }, - { type: 2, pts: 6775884975, ccData: 25458 }, - { type: 3, pts: 6775887978, ccData: 49698 }, - { type: 2, pts: 6775887978, ccData: 25956 }, - { type: 3, pts: 6775890981, ccData: 546 }, - { type: 2, pts: 6775890981, ccData: 26978 }, - { type: 3, pts: 6775893984, ccData: 16930 }, - { type: 2, pts: 6775893984, ccData: 27749 }, - { type: 3, pts: 6775896987, ccData: 33314 }, - { type: 2, pts: 6775896987, ccData: 11776 }, - { type: 3, pts: 6775899990, ccData: 49698 }, - { type: 2, pts: 6775899990, ccData: 35842 }, - { type: 3, pts: 6775905996, ccData: 546 }, - { type: 2, pts: 6775905996, ccData: 35073 }, - { type: 3, pts: 6776071161, ccData: 18993 }, - { type: 2, pts: 6776071161, ccData: 39195 }, - { type: 2, pts: 6776071161, ccData: 17920 }, - { type: 2, pts: 6776071161, ccData: 31 }, - { type: 2, pts: 6776071161, ccData: 5264 }, - { type: 2, pts: 6776071161, ccData: 1283 }, - { type: 2, pts: 6776071161, ccData: 37162 }, - { type: 2, pts: 6776071161, ccData: 42 }, - { type: 2, pts: 6776071161, ccData: 37376 }, - { type: 2, pts: 6776071161, ccData: 1024 }, - { type: 3, pts: 6776077167, ccData: 33571 }, - { type: 2, pts: 6776077167, ccData: 37376 }, - { type: 2, pts: 6776077167, ccData: 1280 }, - { type: 3, pts: 6776083173, ccData: 49698 }, - { type: 2, pts: 6776083173, ccData: 19557 }, - { type: 3, pts: 6776086176, ccData: 546 }, - { type: 2, pts: 6776086176, ccData: 29735 }, - { type: 3, pts: 6776089179, ccData: 16930 }, - { type: 2, pts: 6776089179, ccData: 29535 }, - { type: 3, pts: 6776092182, ccData: 33314 }, - { type: 2, pts: 6776092182, ccData: 26479 }, - { type: 3, pts: 6776095185, ccData: 49698 }, - { type: 2, pts: 6776095185, ccData: 8448 }, - { type: 3, pts: 6776098188, ccData: 546 }, - { type: 2, pts: 6776098188, ccData: 35841 }, - { type: 3, pts: 6776104194, ccData: 16930 }, - { type: 2, pts: 6776104194, ccData: 35074 }, - { type: 3, pts: 6776206296, ccData: 33314 }, - { type: 2, pts: 6776206296, ccData: 35842 }, - { type: 3, pts: 6776437527, ccData: 51761 }, - { type: 2, pts: 6776437527, ccData: 38939 }, - { type: 2, pts: 6776437527, ccData: 17920 }, - { type: 2, pts: 6776437527, ccData: 31 }, - { type: 2, pts: 6776437527, ccData: 5264 }, - { type: 2, pts: 6776437527, ccData: 1283 }, - { type: 2, pts: 6776437527, ccData: 37162 }, - { type: 2, pts: 6776437527, ccData: 42 }, - { type: 2, pts: 6776437527, ccData: 37376 }, - { type: 2, pts: 6776437527, ccData: 3072 }, - { type: 3, pts: 6776443533, ccData: 803 }, - { type: 2, pts: 6776443533, ccData: 37376 }, - { type: 2, pts: 6776443533, ccData: 3584 }, - { type: 3, pts: 6776449539, ccData: 16929 }, - { type: 2, pts: 6776449539, ccData: 32512 }, - { type: 3, pts: 6776452542, ccData: 33314 }, - { type: 2, pts: 6776452542, ccData: 24320 }, - { type: 3, pts: 6776455545, ccData: 49697 }, - { type: 2, pts: 6776455545, ccData: 32512 }, - { type: 3, pts: 6776464554, ccData: 546 }, - { type: 2, pts: 6776464554, ccData: 35073 }, - { type: 3, pts: 6776893983, ccData: 16930 }, - { type: 2, pts: 6776893983, ccData: 35841 }, - { type: 3, pts: 6777002091, ccData: 35377 }, - { type: 2, pts: 6777002091, ccData: 38939 }, - { type: 2, pts: 6777002091, ccData: 17920 }, - { type: 2, pts: 6777002091, ccData: 31 }, - { type: 2, pts: 6777002091, ccData: 5264 }, - { type: 2, pts: 6777002091, ccData: 1283 }, - { type: 2, pts: 6777002091, ccData: 37162 }, - { type: 2, pts: 6777002091, ccData: 0 }, - { type: 2, pts: 6777002091, ccData: 37376 }, - { type: 2, pts: 6777002091, ccData: 4096 }, - { type: 3, pts: 6777008097, ccData: 49955 }, - { type: 2, pts: 6777008097, ccData: 37376 }, - { type: 2, pts: 6777008097, ccData: 4864 }, - { type: 3, pts: 6777014103, ccData: 546 }, - { type: 2, pts: 6777014103, ccData: 21601 }, - { type: 3, pts: 6777017106, ccData: 16930 }, - { type: 2, pts: 6777017106, ccData: 11620 }, - { type: 3, pts: 6777020109, ccData: 33314 }, - { type: 2, pts: 6777020109, ccData: 24865 }, - { type: 3, pts: 6777029118, ccData: 49698 }, - { type: 2, pts: 6777029118, ccData: 35073 }, - { type: 3, pts: 6777146235, ccData: 2609 }, - { type: 2, pts: 6777146235, ccData: 39195 }, - { type: 2, pts: 6777146235, ccData: 16640 }, - { type: 2, pts: 6777146235, ccData: 31 }, - { type: 2, pts: 6777146235, ccData: 5264 }, - { type: 2, pts: 6777146235, ccData: 1283 }, - { type: 2, pts: 6777146235, ccData: 37162 }, - { type: 2, pts: 6777146235, ccData: 42 }, - { type: 2, pts: 6777146235, ccData: 37376 }, - { type: 2, pts: 6777146235, ccData: 3072 }, - { type: 3, pts: 6777152241, ccData: 16930 }, - { type: 2, pts: 6777152241, ccData: 22376 }, - { type: 3, pts: 6777155244, ccData: 33314 }, - { type: 2, pts: 6777155244, ccData: 24948 }, - { type: 3, pts: 6777158247, ccData: 49698 }, - { type: 2, pts: 6777158247, ccData: 24420 }, - { type: 3, pts: 6777161250, ccData: 546 }, - { type: 2, pts: 6777161250, ccData: 28511 }, - { type: 3, pts: 6777164253, ccData: 16930 }, - { type: 2, pts: 6777164253, ccData: 31087 }, - { type: 3, pts: 6777167256, ccData: 33314 }, - { type: 2, pts: 6777167256, ccData: 30047 }, - { type: 3, pts: 6777170259, ccData: 49698 }, - { type: 2, pts: 6777170259, ccData: 29800 }, - { type: 3, pts: 6777173262, ccData: 546 }, - { type: 2, pts: 6777173262, ccData: 26990 }, - { type: 3, pts: 6777176265, ccData: 16930 }, - { type: 2, pts: 6777176265, ccData: 27436 }, - { type: 3, pts: 6777179268, ccData: 35377 }, - { type: 2, pts: 6777179268, ccData: 39195 }, - { type: 2, pts: 6777179268, ccData: 16640 }, - { type: 2, pts: 6777179268, ccData: 287 }, - { type: 2, pts: 6777179268, ccData: 4240 }, - { type: 2, pts: 6777179268, ccData: 1283 }, - { type: 2, pts: 6777179268, ccData: 37162 }, - { type: 2, pts: 6777179268, ccData: 0 }, - { type: 2, pts: 6777179268, ccData: 37377 }, - { type: 2, pts: 6777179268, ccData: 4096 }, - { type: 3, pts: 6777185274, ccData: 49955 }, - { type: 2, pts: 6777185274, ccData: 37377 }, - { type: 2, pts: 6777185274, ccData: 4352 }, - { type: 3, pts: 6777191280, ccData: 546 }, - { type: 2, pts: 6777191280, ccData: 20585 }, - { type: 3, pts: 6777194283, ccData: 16930 }, - { type: 2, pts: 6777194283, ccData: 28267 }, - { type: 3, pts: 6777197286, ccData: 33314 }, - { type: 2, pts: 6777197286, ccData: 24940 }, - { type: 3, pts: 6777200289, ccData: 49698 }, - { type: 2, pts: 6777200289, ccData: 26979 }, - { type: 3, pts: 6777203292, ccData: 546 }, - { type: 2, pts: 6777203292, ccData: 26991 }, - { type: 3, pts: 6777206295, ccData: 16930 }, - { type: 2, pts: 6777206295, ccData: 30067 }, - { type: 3, pts: 6777209298, ccData: 33314 }, - { type: 2, pts: 6777209298, ccData: 16128 }, - { type: 3, pts: 6777212301, ccData: 49698 }, - { type: 2, pts: 6777212301, ccData: 35841 }, - { type: 3, pts: 6777218307, ccData: 546 }, - { type: 2, pts: 6777218307, ccData: 35074 }, - { type: 3, pts: 6777329418, ccData: 18993 }, - { type: 2, pts: 6777329418, ccData: 38939 }, - { type: 2, pts: 6777329418, ccData: 17920 }, - { type: 2, pts: 6777329418, ccData: 31 }, - { type: 2, pts: 6777329418, ccData: 5264 }, - { type: 2, pts: 6777329418, ccData: 1283 }, - { type: 2, pts: 6777329418, ccData: 37162 }, - { type: 2, pts: 6777329418, ccData: 42 }, - { type: 2, pts: 6777329418, ccData: 37376 }, - { type: 2, pts: 6777329418, ccData: 2048 }, - { type: 3, pts: 6777335424, ccData: 33571 }, - { type: 2, pts: 6777335424, ccData: 37376 }, - { type: 2, pts: 6777335424, ccData: 2304 }, - { type: 3, pts: 6777341430, ccData: 49698 }, - { type: 2, pts: 6777341430, ccData: 18541 }, - { type: 3, pts: 6777344433, ccData: 546 }, - { type: 2, pts: 6777344433, ccData: 27950 }, - { type: 3, pts: 6777347436, ccData: 16930 }, - { type: 2, pts: 6777347436, ccData: 11822 }, - { type: 3, pts: 6777350439, ccData: 33314 }, - { type: 2, pts: 6777350439, ccData: 35842 }, - { type: 3, pts: 6777356445, ccData: 49698 }, - { type: 2, pts: 6777356445, ccData: 35073 }, - { type: 3, pts: 6777518607, ccData: 2609 }, - { type: 2, pts: 6777518607, ccData: 39195 }, - { type: 2, pts: 6777518607, ccData: 17920 }, - { type: 2, pts: 6777518607, ccData: 31 }, - { type: 2, pts: 6777518607, ccData: 5264 }, - { type: 2, pts: 6777518607, ccData: 1283 }, - { type: 2, pts: 6777518607, ccData: 37162 }, - { type: 2, pts: 6777518607, ccData: 42 }, - { type: 2, pts: 6777518607, ccData: 37376 }, - { type: 2, pts: 6777518607, ccData: 2048 }, - { type: 3, pts: 6777524613, ccData: 17187 }, - { type: 2, pts: 6777524613, ccData: 37376 }, - { type: 2, pts: 6777524613, ccData: 2816 }, - { type: 3, pts: 6777530619, ccData: 33314 }, - { type: 2, pts: 6777530619, ccData: 18783 }, - { type: 3, pts: 6777533622, ccData: 49698 }, - { type: 2, pts: 6777533622, ccData: 27759 }, - { type: 3, pts: 6777536625, ccData: 546 }, - { type: 2, pts: 6777536625, ccData: 30309 }, - { type: 3, pts: 6777539628, ccData: 16930 }, - { type: 2, pts: 6777539628, ccData: 24425 }, - { type: 3, pts: 6777542631, ccData: 33314 }, - { type: 2, pts: 6777542631, ccData: 29729 }, - { type: 3, pts: 6777545634, ccData: 49698 }, - { type: 2, pts: 6777545634, ccData: 35841 }, - { type: 3, pts: 6777551640, ccData: 546 }, - { type: 2, pts: 6777551640, ccData: 35074 }, - { type: 3, pts: 6777770859, ccData: 18993 }, - { type: 2, pts: 6777770859, ccData: 38939 }, - { type: 2, pts: 6777770859, ccData: 17920 }, - { type: 2, pts: 6777770859, ccData: 31 }, - { type: 2, pts: 6777770859, ccData: 5264 }, - { type: 2, pts: 6777770859, ccData: 1283 }, - { type: 2, pts: 6777770859, ccData: 37162 }, - { type: 2, pts: 6777770859, ccData: 42 }, - { type: 2, pts: 6777770859, ccData: 37376 }, - { type: 2, pts: 6777770859, ccData: 3072 }, - { type: 3, pts: 6777776865, ccData: 33571 }, - { type: 2, pts: 6777776865, ccData: 37376 }, - { type: 2, pts: 6777776865, ccData: 3584 }, - { type: 3, pts: 6777782871, ccData: 49697 }, - { type: 2, pts: 6777782871, ccData: 32512 }, - { type: 3, pts: 6777785874, ccData: 546 }, - { type: 2, pts: 6777785874, ccData: 24320 }, - { type: 3, pts: 6777788877, ccData: 16929 }, - { type: 2, pts: 6777788877, ccData: 32512 }, - { type: 3, pts: 6777791880, ccData: 33314 }, - { type: 2, pts: 6777791880, ccData: 35842 }, - { type: 3, pts: 6777797886, ccData: 49698 }, - { type: 2, pts: 6777797886, ccData: 35073 }, - { type: 3, pts: 6777981069, ccData: 546 }, - { type: 2, pts: 6777981069, ccData: 35841 }, - { type: 3, pts: 6778551639, ccData: 18993 }, - { type: 2, pts: 6778551639, ccData: 38939 }, - { type: 2, pts: 6778551639, ccData: 16640 }, - { type: 2, pts: 6778551639, ccData: 31 }, - { type: 2, pts: 6778551639, ccData: 5264 }, - { type: 2, pts: 6778551639, ccData: 1283 }, - { type: 2, pts: 6778551639, ccData: 37162 }, - { type: 2, pts: 6778551639, ccData: 0 }, - { type: 2, pts: 6778551639, ccData: 37376 }, - { type: 2, pts: 6778551639, ccData: 4096 }, - { type: 3, pts: 6778557645, ccData: 33571 }, - { type: 2, pts: 6778557645, ccData: 37376 }, - { type: 2, pts: 6778557645, ccData: 4608 }, - { type: 3, pts: 6778563651, ccData: 49698 }, - { type: 2, pts: 6778563651, ccData: 10343 }, - { type: 3, pts: 6778566654, ccData: 546 }, - { type: 2, pts: 6778566654, ccData: 26983 }, - { type: 3, pts: 6778569657, ccData: 16930 }, - { type: 2, pts: 6778569657, ccData: 26476 }, - { type: 3, pts: 6778572660, ccData: 33314 }, - { type: 2, pts: 6778572660, ccData: 25971 }, - { type: 3, pts: 6778575663, ccData: 49698 }, - { type: 2, pts: 6778575663, ccData: 10554 }, - { type: 3, pts: 6778578666, ccData: 2609 }, - { type: 2, pts: 6778578666, ccData: 38939 }, - { type: 2, pts: 6778578666, ccData: 16640 }, - { type: 2, pts: 6778578666, ccData: 287 }, - { type: 2, pts: 6778578666, ccData: 4240 }, - { type: 2, pts: 6778578666, ccData: 1283 }, - { type: 2, pts: 6778578666, ccData: 37162 }, - { type: 2, pts: 6778578666, ccData: 0 }, - { type: 2, pts: 6778578666, ccData: 37377 }, - { type: 2, pts: 6778578666, ccData: 5120 }, - { type: 3, pts: 6778584672, ccData: 17187 }, - { type: 2, pts: 6778584672, ccData: 37377 }, - { type: 2, pts: 6778584672, ccData: 5888 }, - { type: 3, pts: 6778590678, ccData: 33314 }, - { type: 2, pts: 6778590678, ccData: 22376 }, - { type: 3, pts: 6778593681, ccData: 49698 }, - { type: 2, pts: 6778593681, ccData: 28513 }, - { type: 3, pts: 6778596684, ccData: 546 }, - { type: 2, pts: 6778596684, ccData: 8448 }, - { type: 3, pts: 6778605693, ccData: 16930 }, - { type: 2, pts: 6778605693, ccData: 35073 }, - { type: 3, pts: 6778719807, ccData: 35377 }, - { type: 2, pts: 6778719807, ccData: 39195 }, - { type: 2, pts: 6778719807, ccData: 16640 }, - { type: 2, pts: 6778719807, ccData: 31 }, - { type: 2, pts: 6778719807, ccData: 5264 }, - { type: 2, pts: 6778719807, ccData: 1283 }, - { type: 2, pts: 6778719807, ccData: 37162 }, - { type: 2, pts: 6778719807, ccData: 42 }, - { type: 2, pts: 6778719807, ccData: 37376 }, - { type: 2, pts: 6778719807, ccData: 2048 }, - { type: 3, pts: 6778725813, ccData: 49698 }, - { type: 2, pts: 6778725813, ccData: 18783 }, - { type: 3, pts: 6778728816, ccData: 546 }, - { type: 2, pts: 6778728816, ccData: 26485 }, - { type: 3, pts: 6778731819, ccData: 16930 }, - { type: 2, pts: 6778731819, ccData: 25971 }, - { type: 3, pts: 6778734822, ccData: 33314 }, - { type: 2, pts: 6778734822, ccData: 29535 }, - { type: 3, pts: 6778737825, ccData: 49698 }, - { type: 2, pts: 6778737825, ccData: 18727 }, - { type: 3, pts: 6778740828, ccData: 546 }, - { type: 2, pts: 6778740828, ccData: 27756 }, - { type: 3, pts: 6778743831, ccData: 16930 }, - { type: 2, pts: 6778743831, ccData: 24426 }, - { type: 3, pts: 6778746834, ccData: 33314 }, - { type: 2, pts: 6778746834, ccData: 30067 }, - { type: 3, pts: 6778749837, ccData: 49698 }, - { type: 2, pts: 6778749837, ccData: 29791 }, - { type: 3, pts: 6778752840, ccData: 546 }, - { type: 2, pts: 6778752840, ccData: 26721 }, - { type: 3, pts: 6778755843, ccData: 16930 }, - { type: 2, pts: 6778755843, ccData: 30309 }, - { type: 3, pts: 6778758846, ccData: 35377 }, - { type: 2, pts: 6778758846, ccData: 39195 }, - { type: 2, pts: 6778758846, ccData: 16640 }, - { type: 2, pts: 6778758846, ccData: 287 }, - { type: 2, pts: 6778758846, ccData: 4240 }, - { type: 2, pts: 6778758846, ccData: 1283 }, - { type: 2, pts: 6778758846, ccData: 37162 }, - { type: 2, pts: 6778758846, ccData: 0 }, - { type: 2, pts: 6778758846, ccData: 37377 }, - { type: 2, pts: 6778758846, ccData: 2048 }, - { type: 3, pts: 6778764852, ccData: 49955 }, - { type: 2, pts: 6778764852, ccData: 37377 }, - { type: 2, pts: 6778764852, ccData: 2816 }, - { type: 3, pts: 6778770858, ccData: 546 }, - { type: 2, pts: 6778770858, ccData: 29807 }, - { type: 3, pts: 6778773861, ccData: 16930 }, - { type: 2, pts: 6778773861, ccData: 24420 }, - { type: 3, pts: 6778776864, ccData: 33314 }, - { type: 2, pts: 6778776864, ccData: 30051 }, - { type: 3, pts: 6778779867, ccData: 49698 }, - { type: 2, pts: 6778779867, ccData: 27487 }, - { type: 3, pts: 6778782870, ccData: 546 }, - { type: 2, pts: 6778782870, ccData: 24927 }, - { type: 3, pts: 6778785873, ccData: 16930 }, - { type: 2, pts: 6778785873, ccData: 27753 }, - { type: 3, pts: 6778788876, ccData: 33314 }, - { type: 2, pts: 6778788876, ccData: 29812 }, - { type: 3, pts: 6778791879, ccData: 49698 }, - { type: 2, pts: 6778791879, ccData: 27749 }, - { type: 3, pts: 6778794882, ccData: 546 }, - { type: 2, pts: 6778794882, ccData: 24418 }, - { type: 3, pts: 6778797885, ccData: 16930 }, - { type: 2, pts: 6778797885, ccData: 26996 }, - { type: 3, pts: 6778800888, ccData: 33314 }, - { type: 2, pts: 6778800888, ccData: 11776 }, - { type: 3, pts: 6778803891, ccData: 49698 }, - { type: 2, pts: 6778803891, ccData: 35841 }, - { type: 3, pts: 6778809897, ccData: 546 }, - { type: 2, pts: 6778809897, ccData: 35074 }, - { type: 3, pts: 6779104191, ccData: 16930 }, - { type: 2, pts: 6779104191, ccData: 35842 }, - { type: 3, pts: 6779284371, ccData: 35377 }, - { type: 2, pts: 6779284371, ccData: 38939 }, - { type: 2, pts: 6779284371, ccData: 17920 }, - { type: 2, pts: 6779284371, ccData: 31 }, - { type: 2, pts: 6779284371, ccData: 5264 }, - { type: 2, pts: 6779284371, ccData: 1283 }, - { type: 2, pts: 6779284371, ccData: 37162 }, - { type: 2, pts: 6779284371, ccData: 42 }, - { type: 2, pts: 6779284371, ccData: 37376 }, - { type: 2, pts: 6779284371, ccData: 1024 }, - { type: 3, pts: 6779290377, ccData: 49955 }, - { type: 2, pts: 6779290377, ccData: 37376 }, - { type: 2, pts: 6779290377, ccData: 1536 }, - { type: 3, pts: 6779296383, ccData: 546 }, - { type: 2, pts: 6779296383, ccData: 19809 }, - { type: 3, pts: 6779299386, ccData: 16930 }, - { type: 2, pts: 6779299386, ccData: 31074 }, - { type: 3, pts: 6779302389, ccData: 33314 }, - { type: 2, pts: 6779302389, ccData: 25951 }, - { type: 3, pts: 6779305392, ccData: 49698 }, - { type: 2, pts: 6779305392, ccData: 24927 }, - { type: 3, pts: 6779308395, ccData: 546 }, - { type: 2, pts: 6779308395, ccData: 27753 }, - { type: 3, pts: 6779311398, ccData: 16930 }, - { type: 2, pts: 6779311398, ccData: 29812 }, - { type: 3, pts: 6779314401, ccData: 33314 }, - { type: 2, pts: 6779314401, ccData: 27749 }, - { type: 3, pts: 6779317404, ccData: 49698 }, - { type: 2, pts: 6779317404, ccData: 24429 }, - { type: 3, pts: 6779320407, ccData: 546 }, - { type: 2, pts: 6779320407, ccData: 28530 }, - { type: 3, pts: 6779323410, ccData: 16930 }, - { type: 2, pts: 6779323410, ccData: 25902 }, - { type: 3, pts: 6779332419, ccData: 33314 }, - { type: 2, pts: 6779332419, ccData: 35073 } -]; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/id3-generator.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/id3-generator.js deleted file mode 100644 index 0eba8f21fd..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/id3-generator.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Helper functions for creating ID3 metadata. - */ - -'use strict'; - -var stringToInts, stringToCString, id3Tag, id3Frame; - -stringToInts = function(string) { - var result = [], i; - for (i = 0; i < string.length; i++) { - result[i] = string.charCodeAt(i); - } - return result; -}; - -stringToCString = function(string) { - return stringToInts(string).concat([0x00]); -}; - -id3Tag = function() { - var - frames = Array.prototype.concat.apply([], Array.prototype.slice.call(arguments)), - result = stringToInts('ID3').concat([ - 0x03, 0x00, // version 3.0 of ID3v2 (aka ID3v.2.3.0) - 0x40, // flags. include an extended header - 0x00, 0x00, 0x00, 0x00, // size. set later - - // extended header - 0x00, 0x00, 0x00, 0x06, // extended header size. no CRC - 0x00, 0x00, // extended flags - 0x00, 0x00, 0x00, 0x02 // size of padding - ], frames), - size; - - // size is stored as a sequence of four 7-bit integers with the - // high bit of each byte set to zero - size = result.length - 10; - - result[6] = (size >>> 21) & 0x7f; - result[7] = (size >>> 14) & 0x7f; - result[8] = (size >>> 7) & 0x7f; - result[9] = size & 0x7f; - - return result; -}; - -id3Frame = function(type) { - var result = stringToInts(type).concat([ - 0x00, 0x00, 0x00, 0x00, // size - 0xe0, 0x00 // flags. tag/file alter preservation, read-only - ]), - size = result.length - 10; - - // append the fields of the ID3 frame - result = result.concat.apply(result, Array.prototype.slice.call(arguments, 1)); - - // set the size - size = result.length - 10; - - result[4] = (size >>> 21) & 0x7f; - result[5] = (size >>> 14) & 0x7f; - result[6] = (size >>> 7) & 0x7f; - result[7] = size & 0x7f; - - return result; -}; - -module.exports = { - stringToInts: stringToInts, - stringToCString: stringToCString, - id3Tag: id3Tag, - id3Frame: id3Frame -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mixed-608-708-captions.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mixed-608-708-captions.js deleted file mode 100644 index ea114e99da..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mixed-608-708-captions.js +++ /dev/null @@ -1,996 +0,0 @@ -module.exports = [ - { type: 1, pts: 7192231956, ccData: 36782 }, - { type: 0, pts: 7192231956, ccData: 38062 }, - { type: 3, pts: 7192231956, ccData: 17186 }, - { type: 2, pts: 7192234926, ccData: 0 }, - { type: 1, pts: 7192234926, ccData: 387 }, - { type: 2, pts: 7192234926, ccData: 36094 }, - { type: 0, pts: 7192234926, ccData: 38062 }, - { type: 2, pts: 7192240866, ccData: 16640 }, - { type: 2, pts: 7192240866, ccData: 39195 }, - { type: 2, pts: 7192240866, ccData: 1283 }, - { type: 2, pts: 7192240866, ccData: 37162 }, - { type: 2, pts: 7192240866, ccData: 42 }, - { type: 2, pts: 7192240866, ccData: 37376 }, - { type: 2, pts: 7192240866, ccData: 1024 }, - { type: 2, pts: 7192240866, ccData: 31 }, - { type: 0, pts: 7192240866, ccData: 37970 }, - { type: 1, pts: 7192240866, ccData: 62196 }, - { type: 2, pts: 7192240866, ccData: 5264 }, - { type: 1, pts: 7192243926, ccData: 26656 }, - { type: 3, pts: 7192243926, ccData: 49955 }, - { type: 0, pts: 7192243926, ccData: 38817 }, - { type: 1, pts: 7192246896, ccData: 22511 }, - { type: 0, pts: 7192246896, ccData: 38817 }, - { type: 2, pts: 7192246896, ccData: 37376 }, - { type: 2, pts: 7192246896, ccData: 1280 }, - { type: 1, pts: 7192249956, ccData: 61284 }, - { type: 0, pts: 7192249956, ccData: 49877 }, - { type: 3, pts: 7192249956, ccData: 802 }, - { type: 1, pts: 7192253016, ccData: 29472 }, - { type: 2, pts: 7192253016, ccData: 0 }, - { type: 0, pts: 7192253016, ccData: 21536 }, - { type: 2, pts: 7192253016, ccData: 16981 }, - { type: 3, pts: 7192253016, ccData: 17186 }, - { type: 3, pts: 7192255986, ccData: 33570 }, - { type: 1, pts: 7192255986, ccData: 19553 }, - { type: 0, pts: 7192255986, ccData: 18772 }, - { type: 2, pts: 7192255986, ccData: 21536 }, - { type: 2, pts: 7192255986, ccData: 0 }, - { type: 0, pts: 7192258956, ccData: 42963 }, - { type: 2, pts: 7192258956, ccData: 18772 }, - { type: 2, pts: 7192258956, ccData: 0 }, - { type: 3, pts: 7192258956, ccData: 49954 }, - { type: 1, pts: 7192258956, ccData: 63418 }, - { type: 0, pts: 7192261926, ccData: 8398 }, - { type: 1, pts: 7192261926, ccData: 8271 }, - { type: 2, pts: 7192261926, ccData: 10067 }, - { type: 2, pts: 7192261926, ccData: 0 }, - { type: 3, pts: 7192261926, ccData: 802 }, - { type: 3, pts: 7192264896, ccData: 17186 }, - { type: 2, pts: 7192264896, ccData: 0 }, - { type: 2, pts: 7192264896, ccData: 8270 }, - { type: 1, pts: 7192264896, ccData: 28192 }, - { type: 0, pts: 7192264896, ccData: 20308 }, - { type: 2, pts: 7192267956, ccData: 0 }, - { type: 2, pts: 7192267956, ccData: 20308 }, - { type: 1, pts: 7192267956, ccData: 62568 }, - { type: 0, pts: 7192267956, ccData: 8403 }, - { type: 3, pts: 7192267956, ccData: 33570 }, - { type: 3, pts: 7192270926, ccData: 49954 }, - { type: 0, pts: 7192270926, ccData: 54598 }, - { type: 2, pts: 7192270926, ccData: 8275 }, - { type: 2, pts: 7192270926, ccData: 0 }, - { type: 1, pts: 7192270926, ccData: 58656 }, - { type: 1, pts: 7192273986, ccData: 51317 }, - { type: 0, pts: 7192273986, ccData: 17989 }, - { type: 2, pts: 7192273986, ccData: 21830 }, - { type: 2, pts: 7192273986, ccData: 0 }, - { type: 3, pts: 7192273986, ccData: 802 }, - { type: 3, pts: 7192277046, ccData: 17186 }, - { type: 2, pts: 7192277046, ccData: 17989 }, - { type: 1, pts: 7192277046, ccData: 28404 }, - { type: 0, pts: 7192277046, ccData: 21065 }, - { type: 2, pts: 7192277046, ccData: 0 }, - { type: 1, pts: 7192279926, ccData: 8360 }, - { type: 2, pts: 7192279926, ccData: 21065 }, - { type: 2, pts: 7192279926, ccData: 0 }, - { type: 3, pts: 7192279926, ccData: 33570 }, - { type: 0, pts: 7192279926, ccData: 52935 }, - { type: 1, pts: 7192282986, ccData: 54245 }, - { type: 0, pts: 7192282986, ccData: 38132 }, - { type: 2, pts: 7192282986, ccData: 20039 }, - { type: 2, pts: 7192282986, ccData: 0 }, - { type: 3, pts: 7192282986, ccData: 51761 }, - { type: 1, pts: 7192285956, ccData: 36667 }, - { type: 2, pts: 7192285956, ccData: 2048 }, - { type: 2, pts: 7192285956, ccData: 39195 }, - { type: 2, pts: 7192285956, ccData: 16640 }, - { type: 2, pts: 7192285956, ccData: 287 }, - { type: 2, pts: 7192285956, ccData: 4240 }, - { type: 2, pts: 7192285956, ccData: 1283 }, - { type: 2, pts: 7192285956, ccData: 37162 }, - { type: 2, pts: 7192285956, ccData: 0 }, - { type: 0, pts: 7192285956, ccData: 38132 }, - { type: 2, pts: 7192285956, ccData: 37377 }, - { type: 3, pts: 7192288926, ccData: 803 }, - { type: 1, pts: 7192288926, ccData: 258 }, - { type: 0, pts: 7192288926, ccData: 38691 }, - { type: 1, pts: 7192291986, ccData: 16448 }, - { type: 2, pts: 7192291986, ccData: 37377 }, - { type: 2, pts: 7192291986, ccData: 2816 }, - { type: 0, pts: 7192291986, ccData: 38691 }, - { type: 1, pts: 7192294956, ccData: 16448 }, - { type: 0, pts: 7192294956, ccData: 21065 }, - { type: 3, pts: 7192294956, ccData: 17186 }, - { type: 0, pts: 7192298016, ccData: 51144 }, - { type: 2, pts: 7192298016, ccData: 21065 }, - { type: 2, pts: 7192298016, ccData: 0 }, - { type: 3, pts: 7192298016, ccData: 33570 }, - { type: 1, pts: 7192298016, ccData: 16512 }, - { type: 1, pts: 7192300986, ccData: 36782 }, - { type: 2, pts: 7192300986, ccData: 0 }, - { type: 2, pts: 7192300986, ccData: 18248 }, - { type: 3, pts: 7192309986, ccData: 33828 }, - { type: 2, pts: 7192309986, ccData: 0 }, - { type: 2, pts: 7192309986, ccData: 22318 }, - { type: 0, pts: 7192309986, ccData: 22446 }, - { type: 1, pts: 7192309986, ccData: 62196 }, - { type: 0, pts: 7192309986, ccData: 37935 }, - { type: 3, pts: 7192309986, ccData: 17186 }, - { type: 2, pts: 7192313046, ccData: 0 }, - { type: 0, pts: 7192313046, ccData: 37935 }, - { type: 1, pts: 7192313046, ccData: 26656 }, - { type: 2, pts: 7192313046, ccData: 35074 }, - { type: 2, pts: 7192313046, ccData: 35841 }, - { type: 0, pts: 7192316016, ccData: 32896 }, - { type: 1, pts: 7192316016, ccData: 22511 }, - { type: 1, pts: 7192318986, ccData: 61284 }, - { type: 0, pts: 7192318986, ccData: 32896 }, - { type: 1, pts: 7192322046, ccData: 29472 }, - { type: 0, pts: 7192322046, ccData: 32896 }, - { type: 1, pts: 7192324926, ccData: 389 }, - { type: 0, pts: 7192324926, ccData: 32896 }, - { type: 0, pts: 7192327986, ccData: 32896 }, - { type: 1, pts: 7192327986, ccData: 51396 }, - { type: 1, pts: 7192331046, ccData: 36831 }, - { type: 0, pts: 7192331046, ccData: 32896 }, - { type: 0, pts: 7192334016, ccData: 32896 }, - { type: 1, pts: 7192334016, ccData: 258 }, - { type: 0, pts: 7192337076, ccData: 32896 }, - { type: 1, pts: 7192337076, ccData: 16448 }, - { type: 1, pts: 7192340046, ccData: 16448 }, - { type: 0, pts: 7192340046, ccData: 32896 }, - { type: 0, pts: 7192343016, ccData: 32896 }, - { type: 1, pts: 7192343016, ccData: 16512 }, - { type: 1, pts: 7192346076, ccData: 36782 }, - { type: 0, pts: 7192346076, ccData: 32896 }, - { type: 0, pts: 7192348956, ccData: 32896 }, - { type: 1, pts: 7192348956, ccData: 387 }, - { type: 1, pts: 7192352016, ccData: 52975 }, - { type: 0, pts: 7192352016, ccData: 32896 }, - { type: 1, pts: 7192355076, ccData: 62196 }, - { type: 0, pts: 7192355076, ccData: 32896 }, - { type: 0, pts: 7192358046, ccData: 32896 }, - { type: 1, pts: 7192358046, ccData: 26656 }, - { type: 1, pts: 7192361106, ccData: 22511 }, - { type: 0, pts: 7192361106, ccData: 32896 }, - { type: 1, pts: 7192364076, ccData: 61284 }, - { type: 0, pts: 7192364076, ccData: 32896 }, - { type: 1, pts: 7192367046, ccData: 29472 }, - { type: 0, pts: 7192367046, ccData: 32896 }, - { type: 1, pts: 7192370016, ccData: 19553 }, - { type: 0, pts: 7192370016, ccData: 32896 }, - { type: 0, pts: 7192372986, ccData: 32896 }, - { type: 1, pts: 7192372986, ccData: 63418 }, - { type: 0, pts: 7192376046, ccData: 32896 }, - { type: 1, pts: 7192376046, ccData: 8271 }, - { type: 0, pts: 7192379106, ccData: 32896 }, - { type: 1, pts: 7192379106, ccData: 28192 }, - { type: 1, pts: 7192382076, ccData: 62568 }, - { type: 0, pts: 7192382076, ccData: 32896 }, - { type: 1, pts: 7192385136, ccData: 58656 }, - { type: 0, pts: 7192385136, ccData: 32896 }, - { type: 0, pts: 7192388106, ccData: 32896 }, - { type: 1, pts: 7192388106, ccData: 51317 }, - { type: 1, pts: 7192391076, ccData: 28404 }, - { type: 0, pts: 7192391076, ccData: 32896 }, - { type: 0, pts: 7192394046, ccData: 32896 }, - { type: 1, pts: 7192394046, ccData: 8360 }, - { type: 1, pts: 7192397016, ccData: 54245 }, - { type: 0, pts: 7192397016, ccData: 32896 }, - { type: 1, pts: 7192400076, ccData: 36667 }, - { type: 0, pts: 7192400076, ccData: 32896 }, - { type: 1, pts: 7192403046, ccData: 258 }, - { type: 0, pts: 7192403046, ccData: 32896 }, - { type: 1, pts: 7192406106, ccData: 16448 }, - { type: 0, pts: 7192406106, ccData: 32896 }, - { type: 1, pts: 7192409166, ccData: 16448 }, - { type: 0, pts: 7192409166, ccData: 32896 }, - { type: 1, pts: 7192412136, ccData: 16512 }, - { type: 0, pts: 7192412136, ccData: 32896 }, - { type: 0, pts: 7192415106, ccData: 32896 }, - { type: 1, pts: 7192415106, ccData: 36782 }, - { type: 1, pts: 7192418076, ccData: 387 }, - { type: 0, pts: 7192418076, ccData: 32896 }, - { type: 1, pts: 7192421046, ccData: 52975 }, - { type: 0, pts: 7192421046, ccData: 32896 }, - { type: 1, pts: 7192424106, ccData: 62196 }, - { type: 0, pts: 7192424106, ccData: 32896 }, - { type: 0, pts: 7192427076, ccData: 32896 }, - { type: 1, pts: 7192427076, ccData: 26656 }, - { type: 1, pts: 7192430136, ccData: 22511 }, - { type: 0, pts: 7192430136, ccData: 32896 }, - { type: 1, pts: 7192433196, ccData: 61284 }, - { type: 0, pts: 7192433196, ccData: 32896 }, - { type: 1, pts: 7192436166, ccData: 29472 }, - { type: 0, pts: 7192436166, ccData: 32896 }, - { type: 0, pts: 7192439136, ccData: 32896 }, - { type: 1, pts: 7192439136, ccData: 19553 }, - { type: 1, pts: 7192442106, ccData: 63418 }, - { type: 0, pts: 7192442106, ccData: 37920 }, - { type: 0, pts: 7192445076, ccData: 37920 }, - { type: 1, pts: 7192445076, ccData: 8271 }, - { type: 1, pts: 7192448136, ccData: 28192 }, - { type: 3, pts: 7192448136, ccData: 49954 }, - { type: 0, pts: 7192448136, ccData: 38062 }, - { type: 2, pts: 7192451106, ccData: 36093 }, - { type: 1, pts: 7192451106, ccData: 62568 }, - { type: 0, pts: 7192451106, ccData: 38062 }, - { type: 2, pts: 7192451106, ccData: 0 }, - { type: 0, pts: 7192454166, ccData: 38000 }, - { type: 3, pts: 7192454166, ccData: 2609 }, - { type: 1, pts: 7192454166, ccData: 58656 }, - { type: 0, pts: 7192457226, ccData: 38000 }, - { type: 2, pts: 7192457226, ccData: 38939 }, - { type: 2, pts: 7192457226, ccData: 17920 }, - { type: 2, pts: 7192457226, ccData: 31 }, - { type: 2, pts: 7192457226, ccData: 5264 }, - { type: 2, pts: 7192457226, ccData: 1283 }, - { type: 2, pts: 7192457226, ccData: 37162 }, - { type: 2, pts: 7192457226, ccData: 42 }, - { type: 2, pts: 7192457226, ccData: 37376 }, - { type: 2, pts: 7192457226, ccData: 0 }, - { type: 1, pts: 7192457226, ccData: 51317 }, - { type: 1, pts: 7192460106, ccData: 28404 }, - { type: 0, pts: 7192460106, ccData: 38818 }, - { type: 3, pts: 7192460106, ccData: 17187 }, - { type: 2, pts: 7192463166, ccData: 512 }, - { type: 1, pts: 7192463166, ccData: 8360 }, - { type: 0, pts: 7192463166, ccData: 38818 }, - { type: 2, pts: 7192463166, ccData: 37376 }, - { type: 0, pts: 7192466136, ccData: 18772 }, - { type: 1, pts: 7192466136, ccData: 54245 }, - { type: 3, pts: 7192466136, ccData: 33570 }, - { type: 3, pts: 7192469106, ccData: 49954 }, - { type: 2, pts: 7192469106, ccData: 0 }, - { type: 0, pts: 7192469106, ccData: 42963 }, - { type: 1, pts: 7192469106, ccData: 36667 }, - { type: 2, pts: 7192469106, ccData: 18772 }, - { type: 2, pts: 7192472166, ccData: 10067 }, - { type: 2, pts: 7192472166, ccData: 0 }, - { type: 3, pts: 7192472166, ccData: 802 }, - { type: 0, pts: 7192472166, ccData: 8398 }, - { type: 1, pts: 7192472166, ccData: 258 }, - { type: 2, pts: 7192475136, ccData: 8270 }, - { type: 0, pts: 7192475136, ccData: 20308 }, - { type: 3, pts: 7192475136, ccData: 17186 }, - { type: 2, pts: 7192475136, ccData: 0 }, - { type: 1, pts: 7192475136, ccData: 16448 }, - { type: 1, pts: 7192478196, ccData: 16448 }, - { type: 0, pts: 7192478196, ccData: 8385 }, - { type: 2, pts: 7192478196, ccData: 20308 }, - { type: 2, pts: 7192478196, ccData: 0 }, - { type: 3, pts: 7192478196, ccData: 33570 }, - { type: 2, pts: 7192481166, ccData: 8257 }, - { type: 0, pts: 7192481166, ccData: 8276 }, - { type: 2, pts: 7192481166, ccData: 0 }, - { type: 1, pts: 7192481166, ccData: 16512 }, - { type: 3, pts: 7192481166, ccData: 49954 }, - { type: 3, pts: 7192484136, ccData: 802 }, - { type: 2, pts: 7192484136, ccData: 0 }, - { type: 1, pts: 7192484136, ccData: 36782 }, - { type: 0, pts: 7192484136, ccData: 51282 }, - { type: 2, pts: 7192484136, ccData: 8276 }, - { type: 3, pts: 7192487196, ccData: 17186 }, - { type: 0, pts: 7192487196, ccData: 17857 }, - { type: 2, pts: 7192487196, ccData: 18514 }, - { type: 2, pts: 7192487196, ccData: 0 }, - { type: 1, pts: 7192487196, ccData: 387 }, - { type: 3, pts: 7192490166, ccData: 33570 }, - { type: 1, pts: 7192490166, ccData: 52975 }, - { type: 0, pts: 7192490166, ccData: 21536 }, - { type: 2, pts: 7192490166, ccData: 17729 }, - { type: 2, pts: 7192490166, ccData: 0 }, - { type: 2, pts: 7192493226, ccData: 21536 }, - { type: 3, pts: 7192493226, ccData: 49954 }, - { type: 2, pts: 7192493226, ccData: 0 }, - { type: 0, pts: 7192493226, ccData: 21583 }, - { type: 1, pts: 7192493226, ccData: 62196 }, - { type: 1, pts: 7192496196, ccData: 26656 }, - { type: 0, pts: 7192496196, ccData: 8385 }, - { type: 2, pts: 7192496196, ccData: 21583 }, - { type: 2, pts: 7192496196, ccData: 0 }, - { type: 3, pts: 7192496196, ccData: 802 }, - { type: 1, pts: 7192499166, ccData: 22511 }, - { type: 0, pts: 7192499166, ccData: 52953 }, - { type: 2, pts: 7192499166, ccData: 8257 }, - { type: 2, pts: 7192499166, ccData: 0 }, - { type: 3, pts: 7192499166, ccData: 17186 }, - { type: 2, pts: 7192502226, ccData: 0 }, - { type: 2, pts: 7192502226, ccData: 20057 }, - { type: 3, pts: 7192502226, ccData: 33570 }, - { type: 1, pts: 7192502226, ccData: 61284 }, - { type: 0, pts: 7192502226, ccData: 49743 }, - { type: 3, pts: 7192505106, ccData: 49954 }, - { type: 2, pts: 7192505106, ccData: 0 }, - { type: 0, pts: 7192505106, ccData: 50393 }, - { type: 1, pts: 7192505106, ccData: 29472 }, - { type: 2, pts: 7192505106, ccData: 16975 }, - { type: 2, pts: 7192508166, ccData: 17497 }, - { type: 3, pts: 7192508166, ccData: 802 }, - { type: 0, pts: 7192508166, ccData: 44672 }, - { type: 2, pts: 7192508166, ccData: 0 }, - { type: 1, pts: 7192508166, ccData: 389 }, - { type: 2, pts: 7192511226, ccData: 11776 }, - { type: 2, pts: 7192511226, ccData: 0 }, - { type: 1, pts: 7192511226, ccData: 51396 }, - { type: 0, pts: 7192511226, ccData: 37935 }, - { type: 3, pts: 7192511226, ccData: 17444 }, - { type: 0, pts: 7192514196, ccData: 37935 }, - { type: 2, pts: 7192514196, ccData: 35842 }, - { type: 2, pts: 7192514196, ccData: 35073 }, - { type: 2, pts: 7192514196, ccData: 0 }, - { type: 1, pts: 7192514196, ccData: 36831 }, - { type: 0, pts: 7192517256, ccData: 32896 }, - { type: 1, pts: 7192517256, ccData: 258 }, - { type: 1, pts: 7192520226, ccData: 16448 }, - { type: 0, pts: 7192520226, ccData: 32896 }, - { type: 1, pts: 7192523196, ccData: 16448 }, - { type: 0, pts: 7192523196, ccData: 32896 }, - { type: 1, pts: 7192526256, ccData: 16512 }, - { type: 0, pts: 7192526256, ccData: 32896 }, - { type: 1, pts: 7192529136, ccData: 36782 }, - { type: 0, pts: 7192529136, ccData: 32896 }, - { type: 1, pts: 7192532196, ccData: 387 }, - { type: 0, pts: 7192532196, ccData: 32896 }, - { type: 1, pts: 7192535256, ccData: 52975 }, - { type: 0, pts: 7192535256, ccData: 32896 }, - { type: 1, pts: 7192538226, ccData: 62196 }, - { type: 0, pts: 7192538226, ccData: 32896 }, - { type: 1, pts: 7192541286, ccData: 26656 }, - { type: 0, pts: 7192541286, ccData: 32896 }, - { type: 1, pts: 7192544256, ccData: 22511 }, - { type: 0, pts: 7192544256, ccData: 32896 }, - { type: 1, pts: 7192547226, ccData: 61284 }, - { type: 0, pts: 7192547226, ccData: 32896 }, - { type: 1, pts: 7192550196, ccData: 29472 }, - { type: 0, pts: 7192550196, ccData: 32896 }, - { type: 0, pts: 7192553166, ccData: 32896 }, - { type: 1, pts: 7192553166, ccData: 19553 }, - { type: 0, pts: 7192556226, ccData: 32896 }, - { type: 1, pts: 7192556226, ccData: 63418 }, - { type: 1, pts: 7192559286, ccData: 8271 }, - { type: 0, pts: 7192559286, ccData: 32896 }, - { type: 1, pts: 7192562256, ccData: 28192 }, - { type: 0, pts: 7192562256, ccData: 32896 }, - { type: 1, pts: 7192565316, ccData: 62568 }, - { type: 0, pts: 7192565316, ccData: 32896 }, - { type: 1, pts: 7192568286, ccData: 58656 }, - { type: 0, pts: 7192568286, ccData: 32896 }, - { type: 1, pts: 7192571256, ccData: 51317 }, - { type: 0, pts: 7192571256, ccData: 32896 }, - { type: 1, pts: 7192574226, ccData: 28404 }, - { type: 0, pts: 7192574226, ccData: 32896 }, - { type: 1, pts: 7192577196, ccData: 8360 }, - { type: 0, pts: 7192577196, ccData: 32896 }, - { type: 0, pts: 7192580256, ccData: 32896 }, - { type: 1, pts: 7192580256, ccData: 54245 }, - { type: 1, pts: 7192583226, ccData: 36667 }, - { type: 0, pts: 7192583226, ccData: 32896 }, - { type: 1, pts: 7192586286, ccData: 258 }, - { type: 0, pts: 7192586286, ccData: 32896 }, - { type: 0, pts: 7192589346, ccData: 32896 }, - { type: 1, pts: 7192589346, ccData: 16448 }, - { type: 1, pts: 7192592316, ccData: 16448 }, - { type: 0, pts: 7192592316, ccData: 32896 }, - { type: 0, pts: 7192595286, ccData: 32896 }, - { type: 1, pts: 7192595286, ccData: 16512 }, - { type: 0, pts: 7192598256, ccData: 32896 }, - { type: 1, pts: 7192598256, ccData: 36782 }, - { type: 1, pts: 7192601226, ccData: 387 }, - { type: 0, pts: 7192601226, ccData: 32896 }, - { type: 0, pts: 7192604286, ccData: 32896 }, - { type: 1, pts: 7192604286, ccData: 52975 }, - { type: 1, pts: 7192607256, ccData: 62196 }, - { type: 0, pts: 7192607256, ccData: 32896 }, - { type: 1, pts: 7192610316, ccData: 26656 }, - { type: 0, pts: 7192610316, ccData: 32896 }, - { type: 0, pts: 7192613376, ccData: 32896 }, - { type: 1, pts: 7192613376, ccData: 22511 }, - { type: 0, pts: 7192616346, ccData: 32896 }, - { type: 1, pts: 7192616346, ccData: 61284 }, - { type: 0, pts: 7192619316, ccData: 32896 }, - { type: 1, pts: 7192619316, ccData: 29472 }, - { type: 0, pts: 7192622286, ccData: 32896 }, - { type: 1, pts: 7192622286, ccData: 19553 }, - { type: 1, pts: 7192625256, ccData: 63418 }, - { type: 0, pts: 7192625256, ccData: 32896 }, - { type: 1, pts: 7192628316, ccData: 8271 }, - { type: 0, pts: 7192628316, ccData: 32896 }, - { type: 0, pts: 7192631286, ccData: 37920 }, - { type: 1, pts: 7192631286, ccData: 28192 }, - { type: 1, pts: 7192634346, ccData: 62568 }, - { type: 0, pts: 7192634346, ccData: 37920 }, - { type: 1, pts: 7192637406, ccData: 58656 }, - { type: 3, pts: 7192637406, ccData: 33570 }, - { type: 0, pts: 7192637406, ccData: 38062 }, - { type: 2, pts: 7192640286, ccData: 0 }, - { type: 1, pts: 7192640286, ccData: 51317 }, - { type: 0, pts: 7192640286, ccData: 38062 }, - { type: 2, pts: 7192640286, ccData: 36094 }, - { type: 1, pts: 7192643346, ccData: 28404 }, - { type: 3, pts: 7192643346, ccData: 51761 }, - { type: 0, pts: 7192643346, ccData: 38096 }, - { type: 1, pts: 7192646316, ccData: 8360 }, - { type: 0, pts: 7192646316, ccData: 38096 }, - { type: 2, pts: 7192646316, ccData: 39195 }, - { type: 2, pts: 7192646316, ccData: 16640 }, - { type: 2, pts: 7192646316, ccData: 31 }, - { type: 2, pts: 7192646316, ccData: 5264 }, - { type: 2, pts: 7192646316, ccData: 1283 }, - { type: 2, pts: 7192646316, ccData: 37162 }, - { type: 2, pts: 7192646316, ccData: 42 }, - { type: 2, pts: 7192646316, ccData: 37376 }, - { type: 2, pts: 7192646316, ccData: 0 }, - { type: 3, pts: 7192649286, ccData: 802 }, - { type: 0, pts: 7192649286, ccData: 22341 }, - { type: 1, pts: 7192649286, ccData: 54245 }, - { type: 0, pts: 7192652346, ccData: 8276 }, - { type: 1, pts: 7192652346, ccData: 36667 }, - { type: 2, pts: 7192652346, ccData: 0 }, - { type: 3, pts: 7192652346, ccData: 17186 }, - { type: 2, pts: 7192652346, ccData: 22341 }, - { type: 0, pts: 7192655316, ccData: 21209 }, - { type: 2, pts: 7192655316, ccData: 8276 }, - { type: 1, pts: 7192655316, ccData: 258 }, - { type: 3, pts: 7192655316, ccData: 33570 }, - { type: 2, pts: 7192655316, ccData: 0 }, - { type: 1, pts: 7192658376, ccData: 16448 }, - { type: 0, pts: 7192658376, ccData: 8398 }, - { type: 2, pts: 7192658376, ccData: 21081 }, - { type: 2, pts: 7192658376, ccData: 0 }, - { type: 3, pts: 7192658376, ccData: 49954 }, - { type: 0, pts: 7192661346, ccData: 20308 }, - { type: 2, pts: 7192661346, ccData: 8270 }, - { type: 2, pts: 7192661346, ccData: 0 }, - { type: 3, pts: 7192661346, ccData: 802 }, - { type: 1, pts: 7192661346, ccData: 16448 }, - { type: 0, pts: 7192664316, ccData: 8276 }, - { type: 2, pts: 7192664316, ccData: 20308 }, - { type: 2, pts: 7192664316, ccData: 0 }, - { type: 3, pts: 7192664316, ccData: 17186 }, - { type: 1, pts: 7192664316, ccData: 16512 }, - { type: 0, pts: 7192667376, ccData: 20256 }, - { type: 1, pts: 7192667376, ccData: 36782 }, - { type: 2, pts: 7192667376, ccData: 8276 }, - { type: 2, pts: 7192667376, ccData: 0 }, - { type: 3, pts: 7192667376, ccData: 33570 }, - { type: 3, pts: 7192670346, ccData: 49954 }, - { type: 1, pts: 7192670346, ccData: 387 }, - { type: 0, pts: 7192670346, ccData: 53461 }, - { type: 2, pts: 7192670346, ccData: 20256 }, - { type: 2, pts: 7192670346, ccData: 0 }, - { type: 0, pts: 7192673406, ccData: 21536 }, - { type: 3, pts: 7192673406, ccData: 802 }, - { type: 2, pts: 7192673406, ccData: 0 }, - { type: 2, pts: 7192673406, ccData: 20565 }, - { type: 1, pts: 7192673406, ccData: 52975 }, - { type: 1, pts: 7192676376, ccData: 62196 }, - { type: 2, pts: 7192676376, ccData: 21536 }, - { type: 2, pts: 7192676376, ccData: 0 }, - { type: 3, pts: 7192676376, ccData: 17186 }, - { type: 0, pts: 7192676376, ccData: 49614 }, - { type: 0, pts: 7192679346, ccData: 8385 }, - { type: 2, pts: 7192679346, ccData: 16718 }, - { type: 1, pts: 7192679346, ccData: 26656 }, - { type: 3, pts: 7192679346, ccData: 33570 }, - { type: 2, pts: 7192679346, ccData: 0 }, - { type: 1, pts: 7192682406, ccData: 22511 }, - { type: 0, pts: 7192682406, ccData: 52809 }, - { type: 2, pts: 7192682406, ccData: 8257 }, - { type: 2, pts: 7192682406, ccData: 0 }, - { type: 3, pts: 7192682406, ccData: 49954 }, - { type: 0, pts: 7192685286, ccData: 52673 }, - { type: 2, pts: 7192685286, ccData: 20041 }, - { type: 2, pts: 7192685286, ccData: 0 }, - { type: 3, pts: 7192685286, ccData: 802 }, - { type: 1, pts: 7192685286, ccData: 61284 }, - { type: 1, pts: 7192688346, ccData: 389 }, - { type: 0, pts: 7192688346, ccData: 19488 }, - { type: 2, pts: 7192688346, ccData: 19777 }, - { type: 2, pts: 7192688346, ccData: 0 }, - { type: 3, pts: 7192688346, ccData: 17186 }, - { type: 3, pts: 7192691406, ccData: 33570 }, - { type: 2, pts: 7192691406, ccData: 0 }, - { type: 2, pts: 7192691406, ccData: 19488 }, - { type: 0, pts: 7192691406, ccData: 50255 }, - { type: 1, pts: 7192691406, ccData: 51396 }, - { type: 1, pts: 7192694376, ccData: 36831 }, - { type: 0, pts: 7192694376, ccData: 22478 }, - { type: 2, pts: 7192694376, ccData: 17487 }, - { type: 2, pts: 7192694376, ccData: 0 }, - { type: 3, pts: 7192694376, ccData: 49954 }, - { type: 3, pts: 7192697436, ccData: 2609 }, - { type: 1, pts: 7192697436, ccData: 258 }, - { type: 2, pts: 7192697436, ccData: 22350 }, - { type: 2, pts: 7192697436, ccData: 0 }, - { type: 0, pts: 7192697436, ccData: 38130 }, - { type: 2, pts: 7192700406, ccData: 1024 }, - { type: 0, pts: 7192700406, ccData: 38130 }, - { type: 2, pts: 7192700406, ccData: 16640 }, - { type: 2, pts: 7192700406, ccData: 287 }, - { type: 2, pts: 7192700406, ccData: 4240 }, - { type: 2, pts: 7192700406, ccData: 1283 }, - { type: 2, pts: 7192700406, ccData: 37162 }, - { type: 2, pts: 7192700406, ccData: 0 }, - { type: 2, pts: 7192700406, ccData: 37377 }, - { type: 2, pts: 7192700406, ccData: 39195 }, - { type: 1, pts: 7192700406, ccData: 16448 }, - { type: 0, pts: 7192703376, ccData: 38818 }, - { type: 3, pts: 7192703376, ccData: 17187 }, - { type: 1, pts: 7192703376, ccData: 16448 }, - { type: 1, pts: 7192706436, ccData: 16512 }, - { type: 0, pts: 7192706436, ccData: 38818 }, - { type: 2, pts: 7192706436, ccData: 37377 }, - { type: 2, pts: 7192706436, ccData: 1536 }, - { type: 3, pts: 7192709316, ccData: 33570 }, - { type: 1, pts: 7192709316, ccData: 36782 }, - { type: 0, pts: 7192709316, ccData: 18758 }, - { type: 1, pts: 7192712376, ccData: 387 }, - { type: 0, pts: 7192712376, ccData: 8279 }, - { type: 2, pts: 7192712376, ccData: 18758 }, - { type: 2, pts: 7192712376, ccData: 0 }, - { type: 3, pts: 7192712376, ccData: 49954 }, - { type: 1, pts: 7192715436, ccData: 52975 }, - { type: 0, pts: 7192715436, ccData: 17696 }, - { type: 2, pts: 7192715436, ccData: 8279 }, - { type: 2, pts: 7192715436, ccData: 0 }, - { type: 3, pts: 7192715436, ccData: 802 }, - { type: 3, pts: 7192718406, ccData: 17186 }, - { type: 1, pts: 7192718406, ccData: 62196 }, - { type: 2, pts: 7192718406, ccData: 0 }, - { type: 0, pts: 7192718406, ccData: 50255 }, - { type: 2, pts: 7192718406, ccData: 17696 }, - { type: 3, pts: 7192721466, ccData: 33570 }, - { type: 2, pts: 7192721466, ccData: 17487 }, - { type: 0, pts: 7192721466, ccData: 52903 }, - { type: 1, pts: 7192721466, ccData: 26656 }, - { type: 2, pts: 7192721466, ccData: 0 }, - { type: 1, pts: 7192724436, ccData: 22511 }, - { type: 0, pts: 7192724436, ccData: 21536 }, - { type: 2, pts: 7192724436, ccData: 20007 }, - { type: 2, pts: 7192724436, ccData: 0 }, - { type: 3, pts: 7192724436, ccData: 49954 }, - { type: 2, pts: 7192727406, ccData: 0 }, - { type: 2, pts: 7192727406, ccData: 21536 }, - { type: 0, pts: 7192727406, ccData: 51393 }, - { type: 1, pts: 7192727406, ccData: 61284 }, - { type: 3, pts: 7192727406, ccData: 802 }, - { type: 0, pts: 7192730376, ccData: 54853 }, - { type: 1, pts: 7192730376, ccData: 29472 }, - { type: 2, pts: 7192730376, ccData: 18497 }, - { type: 2, pts: 7192730376, ccData: 0 }, - { type: 3, pts: 7192730376, ccData: 17186 }, - { type: 2, pts: 7192733346, ccData: 22085 }, - { type: 3, pts: 7192733346, ccData: 33570 }, - { type: 0, pts: 7192733346, ccData: 8276 }, - { type: 1, pts: 7192733346, ccData: 19553 }, - { type: 2, pts: 7192733346, ccData: 0 }, - { type: 1, pts: 7192736406, ccData: 63418 }, - { type: 2, pts: 7192736406, ccData: 0 }, - { type: 3, pts: 7192736406, ccData: 49954 }, - { type: 2, pts: 7192736406, ccData: 8276 }, - { type: 0, pts: 7192736406, ccData: 20398 }, - { type: 1, pts: 7192739466, ccData: 8271 }, - { type: 0, pts: 7192739466, ccData: 37935 }, - { type: 2, pts: 7192739466, ccData: 20270 }, - { type: 2, pts: 7192739466, ccData: 0 }, - { type: 3, pts: 7192739466, ccData: 1060 }, - { type: 0, pts: 7192742436, ccData: 37935 }, - { type: 2, pts: 7192742436, ccData: 35841 }, - { type: 2, pts: 7192742436, ccData: 35074 }, - { type: 2, pts: 7192742436, ccData: 0 }, - { type: 1, pts: 7192742436, ccData: 28192 }, - { type: 1, pts: 7192745496, ccData: 62568 }, - { type: 0, pts: 7192745496, ccData: 32896 }, - { type: 1, pts: 7192748466, ccData: 58656 }, - { type: 0, pts: 7192748466, ccData: 32896 }, - { type: 1, pts: 7192751436, ccData: 51317 }, - { type: 0, pts: 7192751436, ccData: 32896 }, - { type: 1, pts: 7192754406, ccData: 28404 }, - { type: 0, pts: 7192754406, ccData: 32896 }, - { type: 0, pts: 7192757376, ccData: 32896 }, - { type: 1, pts: 7192757376, ccData: 8360 }, - { type: 1, pts: 7192760436, ccData: 54245 }, - { type: 0, pts: 7192760436, ccData: 32896 }, - { type: 1, pts: 7192763406, ccData: 36667 }, - { type: 0, pts: 7192763406, ccData: 32896 }, - { type: 1, pts: 7192766466, ccData: 258 }, - { type: 0, pts: 7192766466, ccData: 32896 }, - { type: 1, pts: 7192769526, ccData: 16448 }, - { type: 0, pts: 7192769526, ccData: 32896 }, - { type: 1, pts: 7192772496, ccData: 16448 }, - { type: 0, pts: 7192772496, ccData: 32896 }, - { type: 1, pts: 7192775466, ccData: 16512 }, - { type: 0, pts: 7192775466, ccData: 32896 }, - { type: 1, pts: 7192778436, ccData: 36782 }, - { type: 0, pts: 7192778436, ccData: 32896 }, - { type: 1, pts: 7192781406, ccData: 387 }, - { type: 0, pts: 7192781406, ccData: 32896 }, - { type: 1, pts: 7192784466, ccData: 52975 }, - { type: 0, pts: 7192784466, ccData: 32896 }, - { type: 0, pts: 7192787436, ccData: 32896 }, - { type: 1, pts: 7192787436, ccData: 62196 }, - { type: 1, pts: 7192790496, ccData: 26656 }, - { type: 0, pts: 7192790496, ccData: 32896 }, - { type: 0, pts: 7192793556, ccData: 32896 }, - { type: 1, pts: 7192793556, ccData: 22511 }, - { type: 0, pts: 7192796526, ccData: 32896 }, - { type: 1, pts: 7192796526, ccData: 61284 }, - { type: 1, pts: 7192799496, ccData: 29472 }, - { type: 0, pts: 7192799496, ccData: 32896 }, - { type: 1, pts: 7192802466, ccData: 19553 }, - { type: 0, pts: 7192802466, ccData: 32896 }, - { type: 1, pts: 7192805436, ccData: 63418 }, - { type: 0, pts: 7192805436, ccData: 32896 }, - { type: 1, pts: 7192808496, ccData: 8271 }, - { type: 0, pts: 7192808496, ccData: 32896 }, - { type: 0, pts: 7192811466, ccData: 32896 }, - { type: 1, pts: 7192811466, ccData: 28192 }, - { type: 1, pts: 7192814526, ccData: 62568 }, - { type: 0, pts: 7192814526, ccData: 32896 }, - { type: 1, pts: 7192817586, ccData: 58656 }, - { type: 0, pts: 7192817586, ccData: 32896 }, - { type: 0, pts: 7192820466, ccData: 32896 }, - { type: 1, pts: 7192820466, ccData: 51317 }, - { type: 0, pts: 7192823526, ccData: 32896 }, - { type: 1, pts: 7192823526, ccData: 28404 }, - { type: 1, pts: 7192826496, ccData: 8360 }, - { type: 0, pts: 7192826496, ccData: 32896 }, - { type: 0, pts: 7192829466, ccData: 32896 }, - { type: 1, pts: 7192829466, ccData: 54245 }, - { type: 1, pts: 7192832526, ccData: 36667 }, - { type: 0, pts: 7192832526, ccData: 32896 }, - { type: 1, pts: 7192835496, ccData: 258 }, - { type: 0, pts: 7192835496, ccData: 32896 }, - { type: 1, pts: 7192838556, ccData: 16448 }, - { type: 0, pts: 7192838556, ccData: 32896 }, - { type: 0, pts: 7192841526, ccData: 32896 }, - { type: 1, pts: 7192841526, ccData: 16448 }, - { type: 1, pts: 7192844496, ccData: 16512 }, - { type: 0, pts: 7192844496, ccData: 32896 }, - { type: 1, pts: 7192847556, ccData: 36782 }, - { type: 0, pts: 7192847556, ccData: 32896 }, - { type: 1, pts: 7192850526, ccData: 387 }, - { type: 0, pts: 7192850526, ccData: 32896 }, - { type: 1, pts: 7192853586, ccData: 52975 }, - { type: 0, pts: 7192853586, ccData: 37920 }, - { type: 0, pts: 7192856556, ccData: 37920 }, - { type: 1, pts: 7192856556, ccData: 62196 }, - { type: 1, pts: 7192859526, ccData: 26656 }, - { type: 0, pts: 7192859526, ccData: 38062 }, - { type: 3, pts: 7192859526, ccData: 17186 }, - { type: 1, pts: 7192862586, ccData: 22511 }, - { type: 0, pts: 7192862586, ccData: 38062 }, - { type: 2, pts: 7192862586, ccData: 36093 }, - { type: 2, pts: 7192862586, ccData: 0 }, - { type: 0, pts: 7192865466, ccData: 4982 }, - { type: 1, pts: 7192865466, ccData: 61284 }, - { type: 3, pts: 7192865466, ccData: 35377 }, - { type: 2, pts: 7192868526, ccData: 3072 }, - { type: 2, pts: 7192868526, ccData: 37376 }, - { type: 2, pts: 7192868526, ccData: 42 }, - { type: 2, pts: 7192868526, ccData: 37162 }, - { type: 1, pts: 7192868526, ccData: 29472 }, - { type: 0, pts: 7192868526, ccData: 4982 }, - { type: 2, pts: 7192868526, ccData: 38939 }, - { type: 2, pts: 7192868526, ccData: 15360 }, - { type: 2, pts: 7192868526, ccData: 31 }, - { type: 2, pts: 7192868526, ccData: 5264 }, - { type: 2, pts: 7192868526, ccData: 1283 }, - { type: 1, pts: 7192871586, ccData: 389 }, - { type: 0, pts: 7192871586, ccData: 52833 }, - { type: 3, pts: 7192871586, ccData: 49954 }, - { type: 2, pts: 7192874556, ccData: 0 }, - { type: 1, pts: 7192874556, ccData: 51396 }, - { type: 0, pts: 7192874556, ccData: 62194 }, - { type: 2, pts: 7192874556, ccData: 20065 }, - { type: 3, pts: 7192874556, ccData: 802 }, - { type: 0, pts: 7192877616, ccData: 25076 }, - { type: 2, pts: 7192877616, ccData: 29298 }, - { type: 3, pts: 7192877616, ccData: 17186 }, - { type: 1, pts: 7192877616, ccData: 36831 }, - { type: 2, pts: 7192877616, ccData: 0 }, - { type: 3, pts: 7192880586, ccData: 33570 }, - { type: 2, pts: 7192880586, ccData: 0 }, - { type: 2, pts: 7192880586, ccData: 24948 }, - { type: 0, pts: 7192880586, ccData: 61426 }, - { type: 1, pts: 7192880586, ccData: 258 }, - { type: 3, pts: 7192883556, ccData: 49954 }, - { type: 2, pts: 7192883556, ccData: 0 }, - { type: 2, pts: 7192883556, ccData: 28530 }, - { type: 0, pts: 7192883556, ccData: 47744 }, - { type: 1, pts: 7192883556, ccData: 16448 }, - { type: 3, pts: 7192886616, ccData: 2609 }, - { type: 1, pts: 7192886616, ccData: 16448 }, - { type: 0, pts: 7192886616, ccData: 38096 }, - { type: 2, pts: 7192886616, ccData: 14848 }, - { type: 2, pts: 7192886616, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 287 }, - { type: 2, pts: 7192889496, ccData: 15360 }, - { type: 2, pts: 7192889496, ccData: 38939 }, - { type: 0, pts: 7192889496, ccData: 38096 }, - { type: 2, pts: 7192889496, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 37162 }, - { type: 2, pts: 7192889496, ccData: 1283 }, - { type: 2, pts: 7192889496, ccData: 4240 }, - { type: 2, pts: 7192889496, ccData: 0 }, - { type: 2, pts: 7192889496, ccData: 37377 }, - { type: 1, pts: 7192889496, ccData: 16512 }, - { type: 1, pts: 7192892556, ccData: 36782 }, - { type: 3, pts: 7192892556, ccData: 17187 }, - { type: 0, pts: 7192892556, ccData: 38817 }, - { type: 0, pts: 7192895616, ccData: 38817 }, - { type: 1, pts: 7192895616, ccData: 387 }, - { type: 2, pts: 7192895616, ccData: 256 }, - { type: 2, pts: 7192895616, ccData: 37377 }, - { type: 1, pts: 7192898586, ccData: 52975 }, - { type: 0, pts: 7192898586, ccData: 18758 }, - { type: 3, pts: 7192898586, ccData: 33570 }, - { type: 0, pts: 7192901646, ccData: 8276 }, - { type: 2, pts: 7192901646, ccData: 18758 }, - { type: 2, pts: 7192901646, ccData: 0 }, - { type: 3, pts: 7192901646, ccData: 49954 }, - { type: 1, pts: 7192901646, ccData: 62196 }, - { type: 1, pts: 7192904616, ccData: 26656 }, - { type: 0, pts: 7192904616, ccData: 51269 }, - { type: 2, pts: 7192904616, ccData: 8276 }, - { type: 2, pts: 7192904616, ccData: 0 }, - { type: 3, pts: 7192904616, ccData: 802 }, - { type: 3, pts: 7192907586, ccData: 17186 }, - { type: 2, pts: 7192907586, ccData: 0 }, - { type: 2, pts: 7192907586, ccData: 18501 }, - { type: 0, pts: 7192907586, ccData: 8403 }, - { type: 1, pts: 7192907586, ccData: 22511 }, - { type: 1, pts: 7192910556, ccData: 61284 }, - { type: 0, pts: 7192910556, ccData: 18755 }, - { type: 2, pts: 7192910556, ccData: 8275 }, - { type: 2, pts: 7192910556, ccData: 0 }, - { type: 3, pts: 7192910556, ccData: 33570 }, - { type: 3, pts: 7192913526, ccData: 49954 }, - { type: 1, pts: 7192913526, ccData: 29472 }, - { type: 2, pts: 7192913526, ccData: 18755 }, - { type: 2, pts: 7192913526, ccData: 0 }, - { type: 0, pts: 7192913526, ccData: 52000 }, - { type: 0, pts: 7192916586, ccData: 49614 }, - { type: 2, pts: 7192916586, ccData: 19232 }, - { type: 2, pts: 7192916586, ccData: 0 }, - { type: 3, pts: 7192916586, ccData: 802 }, - { type: 1, pts: 7192916586, ccData: 19553 }, - { type: 0, pts: 7192919646, ccData: 50208 }, - { type: 1, pts: 7192919646, ccData: 63418 }, - { type: 2, pts: 7192919646, ccData: 16718 }, - { type: 2, pts: 7192919646, ccData: 0 }, - { type: 3, pts: 7192919646, ccData: 17186 }, - { type: 3, pts: 7192922616, ccData: 33570 }, - { type: 1, pts: 7192922616, ccData: 8271 }, - { type: 0, pts: 7192922616, ccData: 17989 }, - { type: 2, pts: 7192922616, ccData: 17440 }, - { type: 2, pts: 7192922616, ccData: 0 }, - { type: 2, pts: 7192925676, ccData: 17989 }, - { type: 3, pts: 7192925676, ccData: 49954 }, - { type: 0, pts: 7192925676, ccData: 49490 }, - { type: 1, pts: 7192925676, ccData: 28192 }, - { type: 2, pts: 7192925676, ccData: 0 }, - { type: 0, pts: 7192928646, ccData: 19525 }, - { type: 2, pts: 7192928646, ccData: 16722 }, - { type: 2, pts: 7192928646, ccData: 0 }, - { type: 3, pts: 7192928646, ccData: 802 }, - { type: 1, pts: 7192928646, ccData: 62568 }, - { type: 0, pts: 7192931616, ccData: 54227 }, - { type: 1, pts: 7192931616, ccData: 58656 }, - { type: 3, pts: 7192931616, ccData: 17186 }, - { type: 2, pts: 7192931616, ccData: 19525 }, - { type: 2, pts: 7192931616, ccData: 0 }, - { type: 1, pts: 7192934586, ccData: 51317 }, - { type: 0, pts: 7192934586, ccData: 8397 }, - { type: 2, pts: 7192934586, ccData: 21331 }, - { type: 2, pts: 7192934586, ccData: 0 }, - { type: 3, pts: 7192934586, ccData: 33570 }, - { type: 2, pts: 7192937556, ccData: 0 }, - { type: 0, pts: 7192937556, ccData: 20303 }, - { type: 2, pts: 7192937556, ccData: 8269 }, - { type: 1, pts: 7192937556, ccData: 28404 }, - { type: 3, pts: 7192937556, ccData: 49954 }, - { type: 1, pts: 7192940616, ccData: 8360 }, - { type: 0, pts: 7192940616, ccData: 54085 }, - { type: 2, pts: 7192940616, ccData: 20303 }, - { type: 2, pts: 7192940616, ccData: 0 }, - { type: 3, pts: 7192940616, ccData: 802 }, - { type: 0, pts: 7192943586, ccData: 38000 }, - { type: 3, pts: 7192943586, ccData: 18993 }, - { type: 1, pts: 7192943586, ccData: 54245 }, - { type: 2, pts: 7192943586, ccData: 0 }, - { type: 2, pts: 7192943586, ccData: 21317 }, - { type: 2, pts: 7192946646, ccData: 1283 }, - { type: 1, pts: 7192946646, ccData: 36667 }, - { type: 2, pts: 7192946646, ccData: 38939 }, - { type: 2, pts: 7192946646, ccData: 15360 }, - { type: 2, pts: 7192946646, ccData: 543 }, - { type: 2, pts: 7192946646, ccData: 4240 }, - { type: 0, pts: 7192946646, ccData: 38000 }, - { type: 2, pts: 7192946646, ccData: 37162 }, - { type: 2, pts: 7192946646, ccData: 0 }, - { type: 2, pts: 7192946646, ccData: 37378 }, - { type: 2, pts: 7192946646, ccData: 0 }, - { type: 3, pts: 7192949706, ccData: 33571 }, - { type: 0, pts: 7192949706, ccData: 38817 }, - { type: 1, pts: 7192949706, ccData: 258 }, - { type: 2, pts: 7192952676, ccData: 256 }, - { type: 1, pts: 7192952676, ccData: 16448 }, - { type: 0, pts: 7192952676, ccData: 38817 }, - { type: 2, pts: 7192952676, ccData: 37378 }, - { type: 1, pts: 7192955646, ccData: 16448 }, - { type: 0, pts: 7192955646, ccData: 22465 }, - { type: 3, pts: 7192955646, ccData: 49954 }, - { type: 3, pts: 7192958616, ccData: 802 }, - { type: 2, pts: 7192958616, ccData: 22337 }, - { type: 2, pts: 7192958616, ccData: 0 }, - { type: 1, pts: 7192958616, ccData: 16512 }, - { type: 0, pts: 7192958616, ccData: 54048 }, - { type: 0, pts: 7192961586, ccData: 17228 }, - { type: 2, pts: 7192961586, ccData: 21280 }, - { type: 2, pts: 7192961586, ccData: 0 }, - { type: 3, pts: 7192961586, ccData: 17186 }, - { type: 1, pts: 7192961586, ccData: 36782 }, - { type: 0, pts: 7192964646, ccData: 20435 }, - { type: 2, pts: 7192964646, ccData: 17228 }, - { type: 2, pts: 7192964646, ccData: 0 }, - { type: 3, pts: 7192964646, ccData: 33570 }, - { type: 1, pts: 7192964646, ccData: 387 }, - { type: 0, pts: 7192967616, ccData: 17746 }, - { type: 1, pts: 7192967616, ccData: 52975 }, - { type: 2, pts: 7192967616, ccData: 0 }, - { type: 2, pts: 7192967616, ccData: 20307 }, - { type: 3, pts: 7192967616, ccData: 49954 }, - { type: 1, pts: 7192970676, ccData: 62196 }, - { type: 0, pts: 7192970676, ccData: 8276 }, - { type: 2, pts: 7192970676, ccData: 17746 }, - { type: 2, pts: 7192970676, ccData: 0 }, - { type: 3, pts: 7192970676, ccData: 802 }, - { type: 2, pts: 7192973736, ccData: 0 }, - { type: 2, pts: 7192973736, ccData: 8276 }, - { type: 3, pts: 7192973736, ccData: 17186 }, - { type: 0, pts: 7192973736, ccData: 20256 }, - { type: 1, pts: 7192973736, ccData: 26656 }, - { type: 1, pts: 7192976706, ccData: 22511 }, - { type: 0, pts: 7192976706, ccData: 49440 }, - { type: 2, pts: 7192976706, ccData: 20256 }, - { type: 2, pts: 7192976706, ccData: 0 }, - { type: 3, pts: 7192976706, ccData: 33570 }, - { type: 3, pts: 7192979676, ccData: 49954 }, - { type: 2, pts: 7192979676, ccData: 0 }, - { type: 2, pts: 7192979676, ccData: 16672 }, - { type: 0, pts: 7192979676, ccData: 53327 }, - { type: 1, pts: 7192979676, ccData: 61284 }, - { type: 1, pts: 7192982646, ccData: 29472 }, - { type: 0, pts: 7192982646, ccData: 53461 }, - { type: 2, pts: 7192982646, ccData: 20559 }, - { type: 2, pts: 7192982646, ccData: 0 }, - { type: 3, pts: 7192982646, ccData: 802 }, - { type: 3, pts: 7192985616, ccData: 17186 }, - { type: 1, pts: 7192985616, ccData: 19553 }, - { type: 2, pts: 7192985616, ccData: 20565 }, - { type: 2, pts: 7192985616, ccData: 0 }, - { type: 0, pts: 7192985616, ccData: 19649 }, - { type: 2, pts: 7192988676, ccData: 19521 }, - { type: 1, pts: 7192988676, ccData: 63418 }, - { type: 0, pts: 7192988676, ccData: 21573 }, - { type: 2, pts: 7192988676, ccData: 0 }, - { type: 3, pts: 7192988676, ccData: 33570 }, - { type: 2, pts: 7192991646, ccData: 0 }, - { type: 2, pts: 7192991646, ccData: 21573 }, - { type: 3, pts: 7192991646, ccData: 49954 }, - { type: 1, pts: 7192991646, ccData: 8271 }, - { type: 0, pts: 7192991646, ccData: 50208 }, - { type: 1, pts: 7192994706, ccData: 28192 }, - { type: 0, pts: 7192994706, ccData: 49490 }, - { type: 2, pts: 7192994706, ccData: 17440 }, - { type: 2, pts: 7192994706, ccData: 0 }, - { type: 3, pts: 7192994706, ccData: 802 }, - { type: 2, pts: 7192997766, ccData: 0 }, - { type: 0, pts: 7192997766, ccData: 17857 }, - { type: 3, pts: 7192997766, ccData: 17186 }, - { type: 1, pts: 7192997766, ccData: 62568 }, - { type: 2, pts: 7192997766, ccData: 16722 }, - { type: 3, pts: 7193000646, ccData: 33570 }, - { type: 1, pts: 7193000646, ccData: 58656 }, - { type: 0, pts: 7193000646, ccData: 11392 }, - { type: 2, pts: 7193000646, ccData: 17729 }, - { type: 2, pts: 7193000646, ccData: 0 }, - { type: 1, pts: 7193003706, ccData: 51317 }, - { type: 2, pts: 7193003706, ccData: 11264 }, - { type: 2, pts: 7193003706, ccData: 0 }, - { type: 3, pts: 7193003706, ccData: 50212 }, - { type: 0, pts: 7193003706, ccData: 37935 }, - { type: 1, pts: 7193006676, ccData: 28404 }, - { type: 0, pts: 7193006676, ccData: 37935 }, - { type: 2, pts: 7193006676, ccData: 35842 }, - { type: 2, pts: 7193006676, ccData: 35073 }, - { type: 2, pts: 7193006676, ccData: 0 }, - { type: 1, pts: 7193009646, ccData: 8360 }, - { type: 0, pts: 7193009646, ccData: 32896 }, - { type: 1, pts: 7193012706, ccData: 54245 }, - { type: 0, pts: 7193012706, ccData: 32896 }, - { type: 1, pts: 7193015676, ccData: 36667 }, - { type: 0, pts: 7193015676, ccData: 32896 }, - { type: 0, pts: 7193018736, ccData: 32896 }, - { type: 1, pts: 7193018736, ccData: 258 }, - { type: 0, pts: 7193021706, ccData: 32896 }, - { type: 1, pts: 7193021706, ccData: 16448 }, - { type: 1, pts: 7193024676, ccData: 16448 }, - { type: 0, pts: 7193024676, ccData: 32896 }, - { type: 1, pts: 7193027736, ccData: 16512 }, - { type: 0, pts: 7193027736, ccData: 32896 }, - { type: 0, pts: 7193030706, ccData: 32896 }, - { type: 1, pts: 7193030706, ccData: 36782 }, - { type: 1, pts: 7193033766, ccData: 387 }, - { type: 0, pts: 7193033766, ccData: 32896 }, - { type: 1, pts: 7193036736, ccData: 52975 }, - { type: 0, pts: 7193036736, ccData: 32896 }, - { type: 1, pts: 7193039706, ccData: 62196 }, - { type: 0, pts: 7193039706, ccData: 32896 }, - { type: 1, pts: 7193042766, ccData: 26656 }, - { type: 0, pts: 7193042766, ccData: 32896 }, - { type: 1, pts: 7193045646, ccData: 22511 }, - { type: 0, pts: 7193045646, ccData: 32896 }, - { type: 1, pts: 7193048706, ccData: 61284 }, - { type: 0, pts: 7193048706, ccData: 32896 }, - { type: 1, pts: 7193051766, ccData: 29472 }, - { type: 0, pts: 7193051766, ccData: 32896 }, - { type: 1, pts: 7193054736, ccData: 389 }, - { type: 0, pts: 7193054736, ccData: 32896 }, - { type: 1, pts: 7193057796, ccData: 51396 }, - { type: 0, pts: 7193057796, ccData: 32896 }, - { type: 1, pts: 7193060766, ccData: 36831 }, - { type: 0, pts: 7193060766, ccData: 32896 }, - { type: 1, pts: 7193063736, ccData: 258 }, - { type: 0, pts: 7193063736, ccData: 32896 }, - { type: 0, pts: 7193066796, ccData: 32896 }, - { type: 1, pts: 7193066796, ccData: 16448 }, - { type: 0, pts: 7193069676, ccData: 32896 }, - { type: 1, pts: 7193069676, ccData: 16448 }, - { type: 1, pts: 7193072736, ccData: 16512 }, - { type: 0, pts: 7193072736, ccData: 32896 }, - { type: 0, pts: 7193075796, ccData: 32896 }, - { type: 1, pts: 7193075796, ccData: 36782 }, - { type: 1, pts: 7193078766, ccData: 387 }, - { type: 0, pts: 7193078766, ccData: 32896 }, - { type: 1, pts: 7193081826, ccData: 52975 }, - { type: 0, pts: 7193081826, ccData: 32896 }, - { type: 1, pts: 7193084796, ccData: 62196 }, - { type: 0, pts: 7193084796, ccData: 32896 }, - { type: 0, pts: 7193087766, ccData: 32896 }, - { type: 1, pts: 7193087766, ccData: 26656 }, - { type: 0, pts: 7193090736, ccData: 32896 }, - { type: 1, pts: 7193090736, ccData: 22511 }, - { type: 0, pts: 7193093706, ccData: 32896 }, - { type: 1, pts: 7193093706, ccData: 61284 }, - { type: 1, pts: 7193096766, ccData: 29472 }, - { type: 0, pts: 7193096766, ccData: 32896 }, - { type: 1, pts: 7193099826, ccData: 19553 }, - { type: 0, pts: 7193099826, ccData: 32896 }, - { type: 1, pts: 7193102796, ccData: 63418 }, - { type: 0, pts: 7193102796, ccData: 32896 }, - { type: 0, pts: 7193105856, ccData: 32896 }, - { type: 1, pts: 7193105856, ccData: 8271 }, - { type: 0, pts: 7193108826, ccData: 32896 }, - { type: 1, pts: 7193108826, ccData: 28192 }, - { type: 1, pts: 7193111796, ccData: 62568 }, - { type: 0, pts: 7193111796, ccData: 32896 }, - { type: 1, pts: 7193114766, ccData: 58656 }, - { type: 0, pts: 7193114766, ccData: 32896 }, - { type: 0, pts: 7193117736, ccData: 32896 }, - { type: 1, pts: 7193117736, ccData: 51317 }, - { type: 0, pts: 7193120796, ccData: 32896 }, - { type: 1, pts: 7193120796, ccData: 28404 }, - { type: 1, pts: 7193123766, ccData: 8360 }, - { type: 0, pts: 7193123766, ccData: 32896 }, - { type: 1, pts: 7193126826, ccData: 54245 }, - { type: 0, pts: 7193126826, ccData: 32896 }, - { type: 0, pts: 7193129886, ccData: 32896 }, - { type: 1, pts: 7193129886, ccData: 36667 }, - { type: 1, pts: 7193138796, ccData: 16448 }, - { type: 0, pts: 7193138796, ccData: 32896 } -]; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mp4-helpers.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mp4-helpers.js deleted file mode 100644 index efdc9f739a..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/mp4-helpers.js +++ /dev/null @@ -1,380 +0,0 @@ -/** - * Helper functions for creating test MP4 data. - */ -'use strict'; - -// ---------------------- -// Box Generation Helpers -// ---------------------- - -var typeBytes = function(type) { - return [ - type.charCodeAt(0), - type.charCodeAt(1), - type.charCodeAt(2), - type.charCodeAt(3) - ]; -}; - -var box = function(type) { - var - array = Array.prototype.slice.call(arguments, 1), - result = [], - size, - i; - - // "unwrap" any arrays that were passed as arguments - // e.g. box('etc', 1, [2, 3], 4) -> box('etc', 1, 2, 3, 4) - for (i = 0; i < array.length; i++) { - if (array[i] instanceof Array) { - array.splice.apply(array, [i, 1].concat(array[i])); - } - } - - size = 8 + array.length; - - result[0] = (size & 0xFF000000) >> 24; - result[1] = (size & 0x00FF0000) >> 16; - result[2] = (size & 0x0000FF00) >> 8; - result[3] = size & 0xFF; - result = result.concat(typeBytes(type)); - result = result.concat(array); - return result; -}; - -var unityMatrix = unityMatrix = [ - 0, 0, 0x10, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - - 0, 0, 0, 0, - 0, 0, 0x10, 0, - 0, 0, 0, 0, - - 0, 0, 0, 0, - 0, 0, 0, 0, - 0x40, 0, 0, 0 -]; - -// ------------ -// Example Data -// ------------ - -var sampleMoov = - box('moov', - box('mvhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // modification_time - 0x00, 0x00, 0x03, 0xe8, // timescale = 1000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x01, 0x00, 0x00, // 1.0 rate - 0x01, 0x00, // 1.0 volume - 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - unityMatrix, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // pre_defined - 0x00, 0x00, 0x00, 0x02), // next_track_ID - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x01, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('edts', - box('elst', - 0x00, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x00, // segment_duration - 0x00, 0x00, 0x04, 0x00, // media_time - 0x00, 0x01, 0x80, 0x00)), // media_rate - box('mdia', - box('mdhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale = 90000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - typeBytes('vide'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - typeBytes('one'), 0x00), // name - box('minf', - box('dinf', - box('dref', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('url ', - 0x00, // version - 0x00, 0x00, 0x01))), // flags - box('stbl', - box('stsd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // entry_count - box('avc1', - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, // box content - typeBytes('avcC'), // codec profile type - 0x00, 0x4d, 0x40, 0x0d)), // codec parameters - box('stts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01), // sample_delta - box('stsc', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x02, // first_chunk - 0x00, 0x00, 0x00, 0x03, // samples_per_chunk - 0x00, 0x00, 0x00, 0x01), // sample_description_index - box('stco', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01), // chunk_offset - box('stss', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01), // sync_sample - box('ctts', - 0x00, // version 0 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01))))), // sample_offset - box('trak', - box('tkhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x00, 0x00, 0x02, // track_ID - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, // layer - 0x00, 0x00, // alternate_group - 0x00, 0x00, // non-audio track volume - 0x00, 0x00, // reserved - unityMatrix, - 0x01, 0x2c, 0x00, 0x00, // 300 in 16.16 fixed-point - 0x00, 0x96, 0x00, 0x00), // 150 in 16.16 fixed-point - box('edts', - box('elst', - 0x01, // version - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // segment_duration - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // media_time - 0x00, 0x01, 0x80, 0x00)), // media_rate - box('mdia', - box('mdhd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x02, // creation_time - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, // modification_time - 0x00, 0x01, 0x5f, 0x90, // timescale = 90000 - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x58, // 600 = 0x258 duration - 0x15, 0xc7, // 'eng' language - 0x00, 0x00), - box('hdlr', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // pre_defined - typeBytes('soun'), // handler_type - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - 0x00, 0x00, 0x00, 0x00, // reserved - typeBytes('one'), 0x00), // name - box('minf', - box('dinf', - box('dref', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - box('url ', - 0x00, // version - 0x00, 0x00, 0x01))), // flags - box('stbl', - box('stsd', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x00, // entry_count - box('mp4a', - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - typeBytes('esds'), // codec profile type - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, 0x00, // box content - 0x00, 0x00, 0x00, // box content - 0x40, 0x0a, // codec params - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00)), // codec params - box('stts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0x00, 0x00, 0x00, 0x01), // sample_delta - box('stsc', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x02, // first_chunk - 0x00, 0x00, 0x00, 0x03, // samples_per_chunk - 0x00, 0x00, 0x00, 0x01), // sample_description_index - box('ctts', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01, // sample_count - 0xff, 0xff, 0xff, 0xff), // sample_offset - box('stco', - 0x01, // version 1 - 0x00, 0x00, 0x00, // flags - 0x00, 0x00, 0x00, 0x01, // entry_count - 0x00, 0x00, 0x00, 0x01)))))); // chunk_offset - -/** - * Generates generic emsg box data for both v0 and v1 boxes concats the messageData - * and returns the result as a Uint8Array. Passing any version other than 0 or 1 will - * return an invalid EMSG box. - */ -var generateEmsgBoxData = function(version, messageData) { - var emsgProps; - if (version === 0) { - emsgProps = new Uint8Array([ - 0x00, // version - 0x00, 0x00, 0x00, //flags - 0x75, 0x72, 0x6E, 0x3A, 0x66, 0x6F, 0x6F, 0x3A, 0x62, 0x61, 0x72, 0x3A, 0x32, 0x30, 0x32, 0x33, 0x00, // urn:foo:bar:2023\0 - 0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00, // foo.bar.value\0 - 0x00, 0x00, 0x00, 0x64, // timescale = 100 - 0x00, 0x00, 0x03, 0xE8, // presentation_time_delta = 1000 - 0x00, 0x00, 0x00, 0x00, // event_duration = 0 - 0x00, 0x00, 0x00, 0x01 // id = 1 - ]); - } else if (version === 1) { - emsgProps = new Uint8Array([ - 0x01, // version - 0x00, 0x00, 0x00, //flags - 0x00, 0x00, 0x00, 0x64, // timescale = 100 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x10, // presentation_time = 10000 - 0x00, 0x00, 0x00, 0x01, // event_duration = 1 - 0x00, 0x00, 0x00, 0x02, // id = 2 - 0x75, 0x72, 0x6E, 0x3A, 0x66, 0x6F, 0x6F, 0x3A, 0x62, 0x61, 0x72, 0x3A, 0x32, 0x30, 0x32, 0x33, 0x00, // urn:foo:bar:2023\0 - 0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00 // foo.bar.value\0 - ]); - } else if (version === 2) { - // Invalid version only - emsgProps = new Uint8Array([ - 0x02, // version - 0x00, 0x00, 0x00, //flags - 0x00, 0x00, 0x00, 0x64, // timescale = 100 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x10, // presentation_time = 10000 - 0x00, 0x00, 0x00, 0x01, // event_duration = 1 - 0x00, 0x00, 0x00, 0x02, // id = 2 - 0x75, 0x72, 0x6E, 0x3A, 0x66, 0x6F, 0x6F, 0x3A, 0x62, 0x61, 0x72, 0x3A, 0x32, 0x30, 0x32, 0x33, 0x00, // urn:foo:bar:2023\0 - 0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00 // foo.bar.value\0 - ]); - } else { - emsgProps = new Uint8Array([ - // malformed emsg data - 0x00, 0x00, 0x00, 0x64, // timescale = 100 - // no presentation_time - 0x00, 0x00, 0x00, 0x01, // event_duration = 1 - // no id - 0x75, 0x72, 0x6E, 0x3A, 0x66, 0x6F, 0x6F, 0x3A, 0x62, 0x61, 0x72, 0x3A, 0x32, 0x30, 0x32, 0x33, 0x00, // urn:foo:bar:2023\0 - 0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00 // foo.bar.value\0 - ]); - } - - // concat the props and messageData - var retArr = new Uint8Array(emsgProps.length + messageData.length); - retArr.set(emsgProps); - retArr.set(messageData, emsgProps.length); - return retArr; -}; - -module.exports = { - typeBytes, - sampleMoov, - unityMatrix, - box, - generateEmsgBoxData -}; diff --git a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/sei-nal-unit-generator.js b/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/sei-nal-unit-generator.js deleted file mode 100644 index e0c2a397dc..0000000000 --- a/node_modules/@videojs/http-streaming/node_modules/mux.js/test/utils/sei-nal-unit-generator.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Helper functions for creating 608/708 SEI NAL units - */ - -'use strict'; - -var box = require('./mp4-helpers').box; - -// Create SEI nal-units from Caption packets -var makeSeiFromCaptionPacket = function(caption) { - return { - pts: caption.pts, - dts: caption.dts, - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - 0x0e, // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - 0xc1, // process_cc_data, cc_count - 0xff, // reserved - // 1111 1100 - (0xfc | caption.type), // cc_valid, cc_type (608, field 1) - (caption.ccData & 0xff00) >> 8, // cc_data_1 - caption.ccData & 0xff, // cc_data_2 without parity bit set - - 0xff // marker_bits - ]) - }; -}; - -// Create SEI nal-units from Caption packets -var makeSeiFromMultipleCaptionPackets = function(captionHash) { - var pts = captionHash.pts, - dts = captionHash.dts, - captions = captionHash.captions; - - var data = []; - captions.forEach(function(caption) { - data.push(0xfc | caption.type); - data.push((caption.ccData & 0xff00) >> 8); - data.push(caption.ccData & 0xff); - }); - - return { - pts: pts, - dts: dts, - nalUnitType: 'sei_rbsp', - escapedRBSP: new Uint8Array([ - 0x04, // payload_type === user_data_registered_itu_t_t35 - - (0x0b + (captions.length * 3)), // payload_size - - 181, // itu_t_t35_country_code - 0x00, 0x31, // itu_t_t35_provider_code - 0x47, 0x41, 0x39, 0x34, // user_identifier, "GA94" - 0x03, // user_data_type_code, 0x03 is cc_data - - // 110 00001 - (0x6 << 5) | captions.length, // process_cc_data, cc_count - 0xff // reserved - ].concat(data).concat([0xff /* marker bits */]) - ) - }; -}; - -var makeMdatFromCaptionPackets = function(packets) { - var mdat = ['mdat']; - var seis = packets.map(makeSeiFromCaptionPacket); - - seis.forEach(function(sei) { - mdat.push(0x00); - mdat.push(0x00); - mdat.push(0x00); - mdat.push(sei.escapedRBSP.length + 1); // nal length - mdat.push(0x06); // declare nal type as SEI - // SEI message - for (var i = 0; i < sei.escapedRBSP.length; i++) { - var byte = sei.escapedRBSP[i]; - - mdat.push(byte); - } - }); - - return box.apply(null, mdat); -}; - -// Returns a ccData byte-pair for a two character string. That is, -// it converts a string like 'hi' into the two-byte number that -// would be parsed back as 'hi' when provided as ccData. -var characters = function(text) { - if (text.length !== 2) { - throw new Error('ccdata must be specified two characters at a time'); - } - return (text.charCodeAt(0) << 8) | text.charCodeAt(1); -}; - -// Returns a ccData byte-pair including -// Header for 708 packet -// Header for the first service block -// seq should increment by 1 for each byte pair mod 3 (0,1,2,0,1,2,...) -// sizeCode is the number of byte pairs in the packet (including header) -// serviceNum is the service number of the first service block -// blockSize is the size of the first service block in bytes (no header) -// If there's only one service block, the blockSize should be (sizeCode-1)*2 -var packetHeader708 = function(seq, sizeCode, serviceNum, blockSize) { - var b1 = (seq << 6) | sizeCode; - var b2 = (serviceNum << 5) | blockSize; - return (b1 << 8) | b2; -}; - -// Returns a ccData byte-pair to execute a 708 DSW command -// Takes an array of window indicies to display -var displayWindows708 = function(windows) { - var cmd = 0x8900; - - windows.forEach(function(winIdx) { - cmd |= (0x01 << winIdx); - }); - - return cmd; -}; - -module.exports = { - makeSeiFromCaptionPacket: makeSeiFromCaptionPacket, - makeSeiFromMultipleCaptionPackets: makeSeiFromMultipleCaptionPackets, - makeMdatFromCaptionPackets: makeMdatFromCaptionPackets, - characters: characters, - packetHeader708: packetHeader708, - displayWindows708: displayWindows708 -}; diff --git a/node_modules/@videojs/http-streaming/package.json b/node_modules/@videojs/http-streaming/package.json index 5f88808abf..b4adf61144 100644 --- a/node_modules/@videojs/http-streaming/package.json +++ b/node_modules/@videojs/http-streaming/package.json @@ -1,6 +1,6 @@ { "name": "@videojs/http-streaming", - "version": "3.6.0", + "version": "3.7.0", "description": "Play back HLS and DASH with Video.js, even where it's not natively supported", "main": "dist/videojs-http-streaming.cjs.js", "module": "dist/videojs-http-streaming.es.js", @@ -63,7 +63,7 @@ "global": "^4.4.0", "m3u8-parser": "^7.1.0", "mpd-parser": "^1.2.2", - "mux.js": "7.0.0", + "mux.js": "7.0.1", "video.js": "^7 || ^8" }, "peerDependencies": { diff --git a/node_modules/@videojs/http-streaming/src/content-steering-controller.js b/node_modules/@videojs/http-streaming/src/content-steering-controller.js index 64ab486639..4596ed4fa8 100644 --- a/node_modules/@videojs/http-streaming/src/content-steering-controller.js +++ b/node_modules/@videojs/http-streaming/src/content-steering-controller.js @@ -66,26 +66,27 @@ class SteeringManifest { * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf * - * @param {Object} segmentLoader a reference to the mainSegmentLoader + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. */ export default class ContentSteeringController extends videojs.EventTarget { - // pass a segment loader reference for throughput rate and xhr - constructor(segmentLoader) { + constructor(xhr, bandwidth) { super(); this.currentPathway = null; this.defaultPathway = null; this.queryBeforeStart = null; this.availablePathways_ = new Set(); - // TODO: Implement exclusion. this.excludedPathways_ = new Set(); this.steeringManifest = new SteeringManifest(); this.proxyServerUrl_ = null; this.manifestType_ = null; this.ttlTimeout_ = null; this.request_ = null; - this.mainSegmentLoader_ = segmentLoader; + this.excludedSteeringManifestURLs = new Set(); this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; } /** @@ -109,57 +110,93 @@ export default class ContentSteeringController extends videojs.EventTarget { this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); return; } - this.steeringManifest.reloadUri = resolveUrl(baseUrl, steeringUri); + // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. - if (this.manifestType_ === 'DASH') { - this.queryBeforeStart = steeringTag.queryBeforeStart || false; - this.proxyServerUrl_ = steeringTag.proxyServerURL; - } + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. // this tells VHS which segment pathway to start with. - if (this.defaultPathway) { + // If queryBeforeStart is true we need to wait for the steering manifest response. + if (this.defaultPathway && !this.queryBeforeStart) { this.trigger('content-steering'); } + + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } } /** * Requests the content steering manifest and parse the response. This should only be called after * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. */ - requestSteeringManifest() { - // add parameters to the steering uri + requestSteeringManifest(initialUri) { const reloadUri = this.steeringManifest.reloadUri; + + if (!initialUri && !reloadUri) { + return; + } + // We currently don't support passing MPD query parameters directly to the content steering URL as this requires // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. - const uri = this.proxyServerUrl_ ? this.setProxyServerUrl_(reloadUri) : this.setSteeringParams_(reloadUri); - this.request_ = this.mainSegmentLoader_.vhs_.xhr({ + // This request URI accounts for manifest URIs that have been excluded. + const uri = initialUri || this.getRequestURI(reloadUri); + + // If there are no valid manifest URIs, we should stop content steering. + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + + this.request_ = this.xhr_({ uri - }, (error) => { - // TODO: HLS CASES THAT NEED ADDRESSED: - // If the client receives HTTP 410 Gone in response to a manifest request, - // it MUST NOT issue another request for that URI for the remainder of the - // playback session. It MAY continue to use the most-recently obtained set - // of Pathways. - // If the client receives HTTP 429 Too Many Requests with a Retry-After - // header in response to a manifest request, it SHOULD wait until the time - // specified by the Retry-After header to reissue the request. + }, (error, errorInfo) => { if (error) { - // TODO: HLS RETRY CASE: + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + + this.excludedSteeringManifestURLs.add(uri); + return; + } + // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the // client SHOULD continue to use the previous values and attempt to reload // it after waiting for the previously-specified TTL (or 5 minutes if // none). this.logger_(`manifest failed to load ${error}.`); - // TODO: we may want to expose the error object here. - this.trigger('error'); + this.startTTLTimeout_(); return; } const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); this.assignSteeringProperties_(steeringManifestJson); }); } @@ -200,6 +237,7 @@ export default class ContentSteeringController extends videojs.EventTarget { setSteeringParams_(url) { const urlObject = new window.URL(url); const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); if (path) { const pathwayKey = `_${this.manifestType_}_pathway`; @@ -207,11 +245,10 @@ export default class ContentSteeringController extends videojs.EventTarget { urlObject.searchParams.set(pathwayKey, path); } - if (this.mainSegmentLoader_.throughput.rate) { + if (networkThroughput) { const throughputKey = `_${this.manifestType_}_throughput`; - const rateInteger = Math.round(this.mainSegmentLoader_.throughput.rate); - urlObject.searchParams.set(throughputKey, rateInteger); + urlObject.searchParams.set(throughputKey, networkThroughput); } return urlObject.toString(); } @@ -234,44 +271,91 @@ export default class ContentSteeringController extends videojs.EventTarget { this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ - // TODO: fully implement priority logic. // 1. apply first pathway from the array. - // 2. if first first pathway doesn't exist in manifest, try next pathway. + // 2. if first pathway doesn't exist in manifest, try next pathway. // a. if all pathways are exhausted, ignore the steering manifest priority. // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, // the excluded pathway will be ignored. - const chooseNextPathway = (pathways) => { - for (const path of pathways) { + // See excludePathway usage in excludePlaylist(). + + // If there are no available pathways, we need to stop content steering. + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + + const chooseNextPathway = (pathwaysByPriority) => { + for (const path of pathwaysByPriority) { if (this.availablePathways_.has(path)) { return path; } } + + // If no pathway matches, ignore the manifest and choose the first available. + return [...this.availablePathways_][0]; }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); if (this.currentPathway !== nextPathway) { this.currentPathway = nextPathway; this.trigger('content-steering'); } - this.startTTLTimeout_(); } /** * Returns the pathway to use for steering decisions * - * @return returns the current pathway or the default + * @return {string} returns the current pathway or the default */ getPathway() { return this.currentPathway || this.defaultPathway; } /** - * Start the timeout for re-requesting the steering manifest at the TTL interval. + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. */ - startTTLTimeout_() { + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + + const isExcluded = (uri) => this.excludedSteeringManifestURLs.has(uri); + + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + + const steeringURI = this.setSteeringParams_(reloadUri); + + if (!isExcluded(steeringURI)) { + return steeringURI; + } + + // Return nothing if all valid manifest URIs are excluded. + return null; + } + + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + startTTLTimeout_(ttl = this.steeringManifest.ttl) { // 300 (5 minutes) is the default value. - const ttlMS = this.steeringManifest.ttl * 1000; + const ttlMS = ttl * 1000; this.ttlTimeout_ = window.setTimeout(() => { this.requestSteeringManifest(); @@ -300,6 +384,8 @@ export default class ContentSteeringController extends videojs.EventTarget { * aborts steering requests clears the ttl timeout and resets all properties. */ dispose() { + this.off('content-steering'); + this.off('error'); this.abort(); this.clearTTLTimeout_(); this.currentPathway = null; @@ -309,6 +395,7 @@ export default class ContentSteeringController extends videojs.EventTarget { this.manifestType_ = null; this.ttlTimeout_ = null; this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); this.availablePathways_ = new Set(); this.excludedPathways_ = new Set(); this.steeringManifest = new SteeringManifest(); @@ -320,6 +407,19 @@ export default class ContentSteeringController extends videojs.EventTarget { * @param {string} pathway the pathway string to add */ addAvailablePathway(pathway) { - this.availablePathways_.add(pathway); + if (pathway) { + this.availablePathways_.add(pathway); + } + } + + /** + * clears all pathways from the available pathways set + */ + clearAvailablePathways() { + this.availablePathways_.clear(); + } + + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); } } diff --git a/node_modules/@videojs/http-streaming/src/dash-playlist-loader.js b/node_modules/@videojs/http-streaming/src/dash-playlist-loader.js index bb6523cc7f..9a57fc7813 100644 --- a/node_modules/@videojs/http-streaming/src/dash-playlist-loader.js +++ b/node_modules/@videojs/http-streaming/src/dash-playlist-loader.js @@ -325,7 +325,10 @@ export default class DashPlaylistLoader extends EventTarget { // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; diff --git a/node_modules/@videojs/http-streaming/src/media-groups.js b/node_modules/@videojs/http-streaming/src/media-groups.js index 66b7011a2e..b6861e9e3e 100644 --- a/node_modules/@videojs/http-streaming/src/media-groups.js +++ b/node_modules/@videojs/http-streaming/src/media-groups.js @@ -250,13 +250,10 @@ export const onError = { */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { [type]: segmentLoader}, mediaTypes: { [type]: mediaType }, excludePlaylist } = settings; - stopLoaders(segmentLoader, mediaType); - // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -295,15 +292,12 @@ export const onError = { */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { [type]: segmentLoader}, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); - const track = mediaType.activeTrack(); if (track) { diff --git a/node_modules/@videojs/http-streaming/src/media-segment-request.js b/node_modules/@videojs/http-streaming/src/media-segment-request.js index bc43779fde..fabced1cb9 100644 --- a/node_modules/@videojs/http-streaming/src/media-segment-request.js +++ b/node_modules/@videojs/http-streaming/src/media-segment-request.js @@ -500,7 +500,7 @@ const handleSegmentBytes = ({ // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } diff --git a/node_modules/@videojs/http-streaming/src/playlist-controller.js b/node_modules/@videojs/http-streaming/src/playlist-controller.js index 98ac9149d3..3fe78e8d04 100644 --- a/node_modules/@videojs/http-streaming/src/playlist-controller.js +++ b/node_modules/@videojs/http-streaming/src/playlist-controller.js @@ -27,6 +27,7 @@ import { createMediaTypes, setupMediaGroups } from './media-groups'; import logger from './util/logger'; import {merge, createTimeRanges} from './util/vjs-compat'; import { addMetadata, createMetadataTrackIfNotExists, addDateRangeMetadata } from './util/text-tracks'; +import ContentSteeringController from './content-steering-controller'; const ABORT_EARLY_EXCLUSION_SECONDS = 10; @@ -306,6 +307,11 @@ export class PlaylistController extends videojs.EventTarget { }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { @@ -407,6 +413,35 @@ export class PlaylistController extends videojs.EventTarget { this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach((type) => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + + const dashMediaPlaylists = mediaPlaylists.filter((p) => p.attributes.serviceLocation === pathway); + + // Switch the current active playlist to the correct CDN + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } + /** * Start a timer that periodically calls checkABR_ * @@ -573,6 +608,7 @@ export class PlaylistController extends videojs.EventTarget { let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support this.excludeUnsupportedVariants_(); @@ -1223,6 +1259,19 @@ export class PlaylistController extends videojs.EventTarget { } if (isFinalRendition) { + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); + // Ignore at least 1 steering manifest refresh. + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been @@ -1641,6 +1690,7 @@ export class PlaylistController extends videojs.EventTarget { this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); @@ -2053,4 +2103,128 @@ export class PlaylistController extends videojs.EventTarget { videoDuration }); } + + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + initContentSteeringController_() { + const initialMain = this.main(); + + if (!initialMain.contentSteering) { + return; + } + + const updateSteeringValues = (main) => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + + updateSteeringValues(initialMain); + + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); + + // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); + + // clear past values + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + + updateSteeringValues(this.main()); + }); + } + + // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + + /** + * Simple exclude and change playlist logic for content steering. + */ + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + + Object.keys(playlists).forEach((key) => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; + // TODO: kind of spammy, maybe move this. + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach((key) => { + const type = this.mediaTypes_[key]; + + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; + + // Check if the current media playlist matches the current CDN + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + + this.pauseLoading(); + + // Switch audio and text track playlists if necessary in DASH + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + + this.switchMedia_(nextPlaylist, 'content-steering'); + } } diff --git a/node_modules/@videojs/http-streaming/src/playlist.js b/node_modules/@videojs/http-streaming/src/playlist.js index 5c62a61b79..f6b99fb3f1 100644 --- a/node_modules/@videojs/http-streaming/src/playlist.js +++ b/node_modules/@videojs/http-streaming/src/playlist.js @@ -391,11 +391,17 @@ export const playlistEnd = function(playlist, expired, useSafeLiveEnd, liveEdgeP export const seekable = function(playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); } + + // Clamp seekable end since it can not be less than the seekable start + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; + } + return createTimeRanges(seekableStart, seekableEnd); }; diff --git a/node_modules/font-awesome/.npmignore b/node_modules/font-awesome/.npmignore new file mode 100644 index 0000000000..54a691f815 --- /dev/null +++ b/node_modules/font-awesome/.npmignore @@ -0,0 +1,42 @@ +*.pyc +*.egg-info +*.db +*.db.old +*.swp +*.db-journal + +.coverage +.DS_Store +.installed.cfg +_gh_pages/* + +.idea/* +.svn/* +src/website/static/* +src/website/media/* + +bin +cfcache +develop-eggs +dist +downloads +eggs +parts +tmp +.sass-cache +node_modules + +src/website/settingslocal.py +stunnel.log + +.ruby-version + +# don't need these in the npm package. +src/ +_config.yml +bower.json +component.json +composer.json +CONTRIBUTING.md +Gemfile +Gemfile.lock diff --git a/node_modules/font-awesome/HELP-US-OUT.txt b/node_modules/font-awesome/HELP-US-OUT.txt new file mode 100644 index 0000000000..83d083dd77 --- /dev/null +++ b/node_modules/font-awesome/HELP-US-OUT.txt @@ -0,0 +1,7 @@ +I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project, +Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome, +comprehensive icon sets or copy and paste your own. + +Please. Check it out. + +-Dave Gandy diff --git a/node_modules/font-awesome/README.md b/node_modules/font-awesome/README.md new file mode 100644 index 0000000000..3e1c1cfc1f --- /dev/null +++ b/node_modules/font-awesome/README.md @@ -0,0 +1,106 @@ +# [Font Awesome v4.7.0](http://fontawesome.io) +### The iconic font and CSS framework + +Font Awesome is a full suite of 675 pictographic icons for easy scalable vector graphics on websites, +created and maintained by [Dave Gandy](https://twitter.com/davegandy). +Stay up to date with the latest release and announcements on Twitter: +[@fontawesome](http://twitter.com/fontawesome). + +Get started at http://fontawesome.io! + +## License +- The Font Awesome font is licensed under the SIL OFL 1.1: + - http://scripts.sil.org/OFL +- Font Awesome CSS, LESS, and Sass files are licensed under the MIT License: + - https://opensource.org/licenses/mit-license.html +- The Font Awesome documentation is licensed under the CC BY 3.0 License: + - http://creativecommons.org/licenses/by/3.0/ +- Attribution is no longer required as of Font Awesome 3.0, but much appreciated: + - `Font Awesome by Dave Gandy - http://fontawesome.io` +- Full details: http://fontawesome.io/license/ + +## Changelog +- [v4.7.0 GitHub pull request](https://github.com/FortAwesome/Font-Awesome/pull/10012) +- [v4.6.3 GitHub pull request](https://github.com/FortAwesome/Font-Awesome/pull/9189) +- [v4.6.3 GitHub pull request](https://github.com/FortAwesome/Font-Awesome/pull/9189) +- [v4.6.2 GitHub pull request](https://github.com/FortAwesome/Font-Awesome/pull/9117) +- [v4.6.1 GitHub pull request](https://github.com/FortAwesome/Font-Awesome/pull/8962) +- [v4.6.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.6.0+is%3Aclosed) +- [v4.5.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.5.0+is%3Aclosed) +- [v4.4.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.4.0+is%3Aclosed) +- [v4.3.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.3.0+is%3Aclosed) +- [v4.2.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=12&page=1&state=closed) +- [v4.1.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=6&page=1&state=closed) +- [v4.0.3 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=9&page=1&state=closed) +- [v4.0.2 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=8&page=1&state=closed) +- [v4.0.1 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=7&page=1&state=closed) +- [v4.0.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=2&page=1&state=closed) +- [v3.2.1 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=5&page=1&state=closed) +- [v3.2.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=3&page=1&state=closed) +- [v3.1.1 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?milestone=4&page=1&state=closed) +- v3.1.0 - Added 54 icons, icon stacking styles, flipping and rotating icons, removed Sass support +- v3.0.2 - much improved rendering and alignment in IE7 +- v3.0.1 - much improved rendering in webkit, various bug fixes +- v3.0.0 - all icons redesigned from scratch, optimized for Bootstrap's 14px default + +## Contributing + +Please read through our [contributing guidelines](https://github.com/FortAwesome/Font-Awesome/blob/master/CONTRIBUTING.md). +Included are directions for opening issues, coding standards, and notes on development. + +## Versioning + +Font Awesome will be maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered +with the following format: + +`..` + +And constructed with the following guidelines: + +* Breaking backward compatibility bumps the major (and resets the minor and patch) +* New additions, including new icons, without breaking backward compatibility bumps the minor (and resets the patch) +* Bug fixes, changes to brand logos, and misc changes bumps the patch + +For more information on SemVer, please visit http://semver.org. + +## Author +- Email: dave@fontawesome.io +- Twitter: http://twitter.com/davegandy +- GitHub: https://github.com/davegandy + +## Component +To include as a [component](https://github.com/componentjs/component), just run + + $ component install FortAwesome/Font-Awesome + +Or add + + "FortAwesome/Font-Awesome": "*" + +to the `dependencies` in your `component.json`. + +## Hacking on Font Awesome + +**Before you can build the project**, you must first have the following installed: + +- [Ruby](https://www.ruby-lang.org/en/) +- Ruby Development Headers + - **Ubuntu:** `sudo apt-get install ruby-dev` *(Only if you're __NOT__ using `rbenv` or `rvm`)* + - **Windows:** [DevKit](http://rubyinstaller.org/) +- [Bundler](http://bundler.io/) (Run `gem install bundler` to install). +- [Node Package Manager (AKA NPM)](https://docs.npmjs.com/getting-started/installing-node) +- [Less](http://lesscss.org/) (Run `npm install -g less` to install). +- [Less Plugin: Clean CSS](https://github.com/less/less-plugin-clean-css) (Run `npm install -g less-plugin-clean-css` to install). + +From the root of the repository, install the tools used to develop. + + $ bundle install + $ npm install + +Build the project and documentation: + + $ bundle exec jekyll build + +Or serve it on a local server on http://localhost:7998/Font-Awesome/: + + $ bundle exec jekyll -w serve diff --git a/node_modules/font-awesome/css/font-awesome.css b/node_modules/font-awesome/css/font-awesome.css new file mode 100644 index 0000000000..ee906a8196 --- /dev/null +++ b/node_modules/font-awesome/css/font-awesome.css @@ -0,0 +1,2337 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ +/* FONT PATH + * -------------------------- */ +@font-face { + font-family: 'FontAwesome'; + src: url('../fonts/fontawesome-webfont.eot?v=4.7.0'); + src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg'); + font-weight: normal; + font-style: normal; +} +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +/* makes the font 33% larger relative to the icon container */ +.fa-lg { + font-size: 1.33333333em; + line-height: 0.75em; + vertical-align: -15%; +} +.fa-2x { + font-size: 2em; +} +.fa-3x { + font-size: 3em; +} +.fa-4x { + font-size: 4em; +} +.fa-5x { + font-size: 5em; +} +.fa-fw { + width: 1.28571429em; + text-align: center; +} +.fa-ul { + padding-left: 0; + margin-left: 2.14285714em; + list-style-type: none; +} +.fa-ul > li { + position: relative; +} +.fa-li { + position: absolute; + left: -2.14285714em; + width: 2.14285714em; + top: 0.14285714em; + text-align: center; +} +.fa-li.fa-lg { + left: -1.85714286em; +} +.fa-border { + padding: .2em .25em .15em; + border: solid 0.08em #eeeeee; + border-radius: .1em; +} +.fa-pull-left { + float: left; +} +.fa-pull-right { + float: right; +} +.fa.fa-pull-left { + margin-right: .3em; +} +.fa.fa-pull-right { + margin-left: .3em; +} +/* Deprecated as of 4.4.0 */ +.pull-right { + float: right; +} +.pull-left { + float: left; +} +.fa.pull-left { + margin-right: .3em; +} +.fa.pull-right { + margin-left: .3em; +} +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +.fa-rotate-90 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} +.fa-rotate-180 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} +.fa-rotate-270 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} +.fa-flip-horizontal { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)"; + -webkit-transform: scale(-1, 1); + -ms-transform: scale(-1, 1); + transform: scale(-1, 1); +} +.fa-flip-vertical { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"; + -webkit-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); +} +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical { + filter: none; +} +.fa-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} +.fa-stack-1x, +.fa-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} +.fa-stack-1x { + line-height: inherit; +} +.fa-stack-2x { + font-size: 2em; +} +.fa-inverse { + color: #ffffff; +} +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ +.fa-glass:before { + content: "\f000"; +} +.fa-music:before { + content: "\f001"; +} +.fa-search:before { + content: "\f002"; +} +.fa-envelope-o:before { + content: "\f003"; +} +.fa-heart:before { + content: "\f004"; +} +.fa-star:before { + content: "\f005"; +} +.fa-star-o:before { + content: "\f006"; +} +.fa-user:before { + content: "\f007"; +} +.fa-film:before { + content: "\f008"; +} +.fa-th-large:before { + content: "\f009"; +} +.fa-th:before { + content: "\f00a"; +} +.fa-th-list:before { + content: "\f00b"; +} +.fa-check:before { + content: "\f00c"; +} +.fa-remove:before, +.fa-close:before, +.fa-times:before { + content: "\f00d"; +} +.fa-search-plus:before { + content: "\f00e"; +} +.fa-search-minus:before { + content: "\f010"; +} +.fa-power-off:before { + content: "\f011"; +} +.fa-signal:before { + content: "\f012"; +} +.fa-gear:before, +.fa-cog:before { + content: "\f013"; +} +.fa-trash-o:before { + content: "\f014"; +} +.fa-home:before { + content: "\f015"; +} +.fa-file-o:before { + content: "\f016"; +} +.fa-clock-o:before { + content: "\f017"; +} +.fa-road:before { + content: "\f018"; +} +.fa-download:before { + content: "\f019"; +} +.fa-arrow-circle-o-down:before { + content: "\f01a"; +} +.fa-arrow-circle-o-up:before { + content: "\f01b"; +} +.fa-inbox:before { + content: "\f01c"; +} +.fa-play-circle-o:before { + content: "\f01d"; +} +.fa-rotate-right:before, +.fa-repeat:before { + content: "\f01e"; +} +.fa-refresh:before { + content: "\f021"; +} +.fa-list-alt:before { + content: "\f022"; +} +.fa-lock:before { + content: "\f023"; +} +.fa-flag:before { + content: "\f024"; +} +.fa-headphones:before { + content: "\f025"; +} +.fa-volume-off:before { + content: "\f026"; +} +.fa-volume-down:before { + content: "\f027"; +} +.fa-volume-up:before { + content: "\f028"; +} +.fa-qrcode:before { + content: "\f029"; +} +.fa-barcode:before { + content: "\f02a"; +} +.fa-tag:before { + content: "\f02b"; +} +.fa-tags:before { + content: "\f02c"; +} +.fa-book:before { + content: "\f02d"; +} +.fa-bookmark:before { + content: "\f02e"; +} +.fa-print:before { + content: "\f02f"; +} +.fa-camera:before { + content: "\f030"; +} +.fa-font:before { + content: "\f031"; +} +.fa-bold:before { + content: "\f032"; +} +.fa-italic:before { + content: "\f033"; +} +.fa-text-height:before { + content: "\f034"; +} +.fa-text-width:before { + content: "\f035"; +} +.fa-align-left:before { + content: "\f036"; +} +.fa-align-center:before { + content: "\f037"; +} +.fa-align-right:before { + content: "\f038"; +} +.fa-align-justify:before { + content: "\f039"; +} +.fa-list:before { + content: "\f03a"; +} +.fa-dedent:before, +.fa-outdent:before { + content: "\f03b"; +} +.fa-indent:before { + content: "\f03c"; +} +.fa-video-camera:before { + content: "\f03d"; +} +.fa-photo:before, +.fa-image:before, +.fa-picture-o:before { + content: "\f03e"; +} +.fa-pencil:before { + content: "\f040"; +} +.fa-map-marker:before { + content: "\f041"; +} +.fa-adjust:before { + content: "\f042"; +} +.fa-tint:before { + content: "\f043"; +} +.fa-edit:before, +.fa-pencil-square-o:before { + content: "\f044"; +} +.fa-share-square-o:before { + content: "\f045"; +} +.fa-check-square-o:before { + content: "\f046"; +} +.fa-arrows:before { + content: "\f047"; +} +.fa-step-backward:before { + content: "\f048"; +} +.fa-fast-backward:before { + content: "\f049"; +} +.fa-backward:before { + content: "\f04a"; +} +.fa-play:before { + content: "\f04b"; +} +.fa-pause:before { + content: "\f04c"; +} +.fa-stop:before { + content: "\f04d"; +} +.fa-forward:before { + content: "\f04e"; +} +.fa-fast-forward:before { + content: "\f050"; +} +.fa-step-forward:before { + content: "\f051"; +} +.fa-eject:before { + content: "\f052"; +} +.fa-chevron-left:before { + content: "\f053"; +} +.fa-chevron-right:before { + content: "\f054"; +} +.fa-plus-circle:before { + content: "\f055"; +} +.fa-minus-circle:before { + content: "\f056"; +} +.fa-times-circle:before { + content: "\f057"; +} +.fa-check-circle:before { + content: "\f058"; +} +.fa-question-circle:before { + content: "\f059"; +} +.fa-info-circle:before { + content: "\f05a"; +} +.fa-crosshairs:before { + content: "\f05b"; +} +.fa-times-circle-o:before { + content: "\f05c"; +} +.fa-check-circle-o:before { + content: "\f05d"; +} +.fa-ban:before { + content: "\f05e"; +} +.fa-arrow-left:before { + content: "\f060"; +} +.fa-arrow-right:before { + content: "\f061"; +} +.fa-arrow-up:before { + content: "\f062"; +} +.fa-arrow-down:before { + content: "\f063"; +} +.fa-mail-forward:before, +.fa-share:before { + content: "\f064"; +} +.fa-expand:before { + content: "\f065"; +} +.fa-compress:before { + content: "\f066"; +} +.fa-plus:before { + content: "\f067"; +} +.fa-minus:before { + content: "\f068"; +} +.fa-asterisk:before { + content: "\f069"; +} +.fa-exclamation-circle:before { + content: "\f06a"; +} +.fa-gift:before { + content: "\f06b"; +} +.fa-leaf:before { + content: "\f06c"; +} +.fa-fire:before { + content: "\f06d"; +} +.fa-eye:before { + content: "\f06e"; +} +.fa-eye-slash:before { + content: "\f070"; +} +.fa-warning:before, +.fa-exclamation-triangle:before { + content: "\f071"; +} +.fa-plane:before { + content: "\f072"; +} +.fa-calendar:before { + content: "\f073"; +} +.fa-random:before { + content: "\f074"; +} +.fa-comment:before { + content: "\f075"; +} +.fa-magnet:before { + content: "\f076"; +} +.fa-chevron-up:before { + content: "\f077"; +} +.fa-chevron-down:before { + content: "\f078"; +} +.fa-retweet:before { + content: "\f079"; +} +.fa-shopping-cart:before { + content: "\f07a"; +} +.fa-folder:before { + content: "\f07b"; +} +.fa-folder-open:before { + content: "\f07c"; +} +.fa-arrows-v:before { + content: "\f07d"; +} +.fa-arrows-h:before { + content: "\f07e"; +} +.fa-bar-chart-o:before, +.fa-bar-chart:before { + content: "\f080"; +} +.fa-twitter-square:before { + content: "\f081"; +} +.fa-facebook-square:before { + content: "\f082"; +} +.fa-camera-retro:before { + content: "\f083"; +} +.fa-key:before { + content: "\f084"; +} +.fa-gears:before, +.fa-cogs:before { + content: "\f085"; +} +.fa-comments:before { + content: "\f086"; +} +.fa-thumbs-o-up:before { + content: "\f087"; +} +.fa-thumbs-o-down:before { + content: "\f088"; +} +.fa-star-half:before { + content: "\f089"; +} +.fa-heart-o:before { + content: "\f08a"; +} +.fa-sign-out:before { + content: "\f08b"; +} +.fa-linkedin-square:before { + content: "\f08c"; +} +.fa-thumb-tack:before { + content: "\f08d"; +} +.fa-external-link:before { + content: "\f08e"; +} +.fa-sign-in:before { + content: "\f090"; +} +.fa-trophy:before { + content: "\f091"; +} +.fa-github-square:before { + content: "\f092"; +} +.fa-upload:before { + content: "\f093"; +} +.fa-lemon-o:before { + content: "\f094"; +} +.fa-phone:before { + content: "\f095"; +} +.fa-square-o:before { + content: "\f096"; +} +.fa-bookmark-o:before { + content: "\f097"; +} +.fa-phone-square:before { + content: "\f098"; +} +.fa-twitter:before { + content: "\f099"; +} +.fa-facebook-f:before, +.fa-facebook:before { + content: "\f09a"; +} +.fa-github:before { + content: "\f09b"; +} +.fa-unlock:before { + content: "\f09c"; +} +.fa-credit-card:before { + content: "\f09d"; +} +.fa-feed:before, +.fa-rss:before { + content: "\f09e"; +} +.fa-hdd-o:before { + content: "\f0a0"; +} +.fa-bullhorn:before { + content: "\f0a1"; +} +.fa-bell:before { + content: "\f0f3"; +} +.fa-certificate:before { + content: "\f0a3"; +} +.fa-hand-o-right:before { + content: "\f0a4"; +} +.fa-hand-o-left:before { + content: "\f0a5"; +} +.fa-hand-o-up:before { + content: "\f0a6"; +} +.fa-hand-o-down:before { + content: "\f0a7"; +} +.fa-arrow-circle-left:before { + content: "\f0a8"; +} +.fa-arrow-circle-right:before { + content: "\f0a9"; +} +.fa-arrow-circle-up:before { + content: "\f0aa"; +} +.fa-arrow-circle-down:before { + content: "\f0ab"; +} +.fa-globe:before { + content: "\f0ac"; +} +.fa-wrench:before { + content: "\f0ad"; +} +.fa-tasks:before { + content: "\f0ae"; +} +.fa-filter:before { + content: "\f0b0"; +} +.fa-briefcase:before { + content: "\f0b1"; +} +.fa-arrows-alt:before { + content: "\f0b2"; +} +.fa-group:before, +.fa-users:before { + content: "\f0c0"; +} +.fa-chain:before, +.fa-link:before { + content: "\f0c1"; +} +.fa-cloud:before { + content: "\f0c2"; +} +.fa-flask:before { + content: "\f0c3"; +} +.fa-cut:before, +.fa-scissors:before { + content: "\f0c4"; +} +.fa-copy:before, +.fa-files-o:before { + content: "\f0c5"; +} +.fa-paperclip:before { + content: "\f0c6"; +} +.fa-save:before, +.fa-floppy-o:before { + content: "\f0c7"; +} +.fa-square:before { + content: "\f0c8"; +} +.fa-navicon:before, +.fa-reorder:before, +.fa-bars:before { + content: "\f0c9"; +} +.fa-list-ul:before { + content: "\f0ca"; +} +.fa-list-ol:before { + content: "\f0cb"; +} +.fa-strikethrough:before { + content: "\f0cc"; +} +.fa-underline:before { + content: "\f0cd"; +} +.fa-table:before { + content: "\f0ce"; +} +.fa-magic:before { + content: "\f0d0"; +} +.fa-truck:before { + content: "\f0d1"; +} +.fa-pinterest:before { + content: "\f0d2"; +} +.fa-pinterest-square:before { + content: "\f0d3"; +} +.fa-google-plus-square:before { + content: "\f0d4"; +} +.fa-google-plus:before { + content: "\f0d5"; +} +.fa-money:before { + content: "\f0d6"; +} +.fa-caret-down:before { + content: "\f0d7"; +} +.fa-caret-up:before { + content: "\f0d8"; +} +.fa-caret-left:before { + content: "\f0d9"; +} +.fa-caret-right:before { + content: "\f0da"; +} +.fa-columns:before { + content: "\f0db"; +} +.fa-unsorted:before, +.fa-sort:before { + content: "\f0dc"; +} +.fa-sort-down:before, +.fa-sort-desc:before { + content: "\f0dd"; +} +.fa-sort-up:before, +.fa-sort-asc:before { + content: "\f0de"; +} +.fa-envelope:before { + content: "\f0e0"; +} +.fa-linkedin:before { + content: "\f0e1"; +} +.fa-rotate-left:before, +.fa-undo:before { + content: "\f0e2"; +} +.fa-legal:before, +.fa-gavel:before { + content: "\f0e3"; +} +.fa-dashboard:before, +.fa-tachometer:before { + content: "\f0e4"; +} +.fa-comment-o:before { + content: "\f0e5"; +} +.fa-comments-o:before { + content: "\f0e6"; +} +.fa-flash:before, +.fa-bolt:before { + content: "\f0e7"; +} +.fa-sitemap:before { + content: "\f0e8"; +} +.fa-umbrella:before { + content: "\f0e9"; +} +.fa-paste:before, +.fa-clipboard:before { + content: "\f0ea"; +} +.fa-lightbulb-o:before { + content: "\f0eb"; +} +.fa-exchange:before { + content: "\f0ec"; +} +.fa-cloud-download:before { + content: "\f0ed"; +} +.fa-cloud-upload:before { + content: "\f0ee"; +} +.fa-user-md:before { + content: "\f0f0"; +} +.fa-stethoscope:before { + content: "\f0f1"; +} +.fa-suitcase:before { + content: "\f0f2"; +} +.fa-bell-o:before { + content: "\f0a2"; +} +.fa-coffee:before { + content: "\f0f4"; +} +.fa-cutlery:before { + content: "\f0f5"; +} +.fa-file-text-o:before { + content: "\f0f6"; +} +.fa-building-o:before { + content: "\f0f7"; +} +.fa-hospital-o:before { + content: "\f0f8"; +} +.fa-ambulance:before { + content: "\f0f9"; +} +.fa-medkit:before { + content: "\f0fa"; +} +.fa-fighter-jet:before { + content: "\f0fb"; +} +.fa-beer:before { + content: "\f0fc"; +} +.fa-h-square:before { + content: "\f0fd"; +} +.fa-plus-square:before { + content: "\f0fe"; +} +.fa-angle-double-left:before { + content: "\f100"; +} +.fa-angle-double-right:before { + content: "\f101"; +} +.fa-angle-double-up:before { + content: "\f102"; +} +.fa-angle-double-down:before { + content: "\f103"; +} +.fa-angle-left:before { + content: "\f104"; +} +.fa-angle-right:before { + content: "\f105"; +} +.fa-angle-up:before { + content: "\f106"; +} +.fa-angle-down:before { + content: "\f107"; +} +.fa-desktop:before { + content: "\f108"; +} +.fa-laptop:before { + content: "\f109"; +} +.fa-tablet:before { + content: "\f10a"; +} +.fa-mobile-phone:before, +.fa-mobile:before { + content: "\f10b"; +} +.fa-circle-o:before { + content: "\f10c"; +} +.fa-quote-left:before { + content: "\f10d"; +} +.fa-quote-right:before { + content: "\f10e"; +} +.fa-spinner:before { + content: "\f110"; +} +.fa-circle:before { + content: "\f111"; +} +.fa-mail-reply:before, +.fa-reply:before { + content: "\f112"; +} +.fa-github-alt:before { + content: "\f113"; +} +.fa-folder-o:before { + content: "\f114"; +} +.fa-folder-open-o:before { + content: "\f115"; +} +.fa-smile-o:before { + content: "\f118"; +} +.fa-frown-o:before { + content: "\f119"; +} +.fa-meh-o:before { + content: "\f11a"; +} +.fa-gamepad:before { + content: "\f11b"; +} +.fa-keyboard-o:before { + content: "\f11c"; +} +.fa-flag-o:before { + content: "\f11d"; +} +.fa-flag-checkered:before { + content: "\f11e"; +} +.fa-terminal:before { + content: "\f120"; +} +.fa-code:before { + content: "\f121"; +} +.fa-mail-reply-all:before, +.fa-reply-all:before { + content: "\f122"; +} +.fa-star-half-empty:before, +.fa-star-half-full:before, +.fa-star-half-o:before { + content: "\f123"; +} +.fa-location-arrow:before { + content: "\f124"; +} +.fa-crop:before { + content: "\f125"; +} +.fa-code-fork:before { + content: "\f126"; +} +.fa-unlink:before, +.fa-chain-broken:before { + content: "\f127"; +} +.fa-question:before { + content: "\f128"; +} +.fa-info:before { + content: "\f129"; +} +.fa-exclamation:before { + content: "\f12a"; +} +.fa-superscript:before { + content: "\f12b"; +} +.fa-subscript:before { + content: "\f12c"; +} +.fa-eraser:before { + content: "\f12d"; +} +.fa-puzzle-piece:before { + content: "\f12e"; +} +.fa-microphone:before { + content: "\f130"; +} +.fa-microphone-slash:before { + content: "\f131"; +} +.fa-shield:before { + content: "\f132"; +} +.fa-calendar-o:before { + content: "\f133"; +} +.fa-fire-extinguisher:before { + content: "\f134"; +} +.fa-rocket:before { + content: "\f135"; +} +.fa-maxcdn:before { + content: "\f136"; +} +.fa-chevron-circle-left:before { + content: "\f137"; +} +.fa-chevron-circle-right:before { + content: "\f138"; +} +.fa-chevron-circle-up:before { + content: "\f139"; +} +.fa-chevron-circle-down:before { + content: "\f13a"; +} +.fa-html5:before { + content: "\f13b"; +} +.fa-css3:before { + content: "\f13c"; +} +.fa-anchor:before { + content: "\f13d"; +} +.fa-unlock-alt:before { + content: "\f13e"; +} +.fa-bullseye:before { + content: "\f140"; +} +.fa-ellipsis-h:before { + content: "\f141"; +} +.fa-ellipsis-v:before { + content: "\f142"; +} +.fa-rss-square:before { + content: "\f143"; +} +.fa-play-circle:before { + content: "\f144"; +} +.fa-ticket:before { + content: "\f145"; +} +.fa-minus-square:before { + content: "\f146"; +} +.fa-minus-square-o:before { + content: "\f147"; +} +.fa-level-up:before { + content: "\f148"; +} +.fa-level-down:before { + content: "\f149"; +} +.fa-check-square:before { + content: "\f14a"; +} +.fa-pencil-square:before { + content: "\f14b"; +} +.fa-external-link-square:before { + content: "\f14c"; +} +.fa-share-square:before { + content: "\f14d"; +} +.fa-compass:before { + content: "\f14e"; +} +.fa-toggle-down:before, +.fa-caret-square-o-down:before { + content: "\f150"; +} +.fa-toggle-up:before, +.fa-caret-square-o-up:before { + content: "\f151"; +} +.fa-toggle-right:before, +.fa-caret-square-o-right:before { + content: "\f152"; +} +.fa-euro:before, +.fa-eur:before { + content: "\f153"; +} +.fa-gbp:before { + content: "\f154"; +} +.fa-dollar:before, +.fa-usd:before { + content: "\f155"; +} +.fa-rupee:before, +.fa-inr:before { + content: "\f156"; +} +.fa-cny:before, +.fa-rmb:before, +.fa-yen:before, +.fa-jpy:before { + content: "\f157"; +} +.fa-ruble:before, +.fa-rouble:before, +.fa-rub:before { + content: "\f158"; +} +.fa-won:before, +.fa-krw:before { + content: "\f159"; +} +.fa-bitcoin:before, +.fa-btc:before { + content: "\f15a"; +} +.fa-file:before { + content: "\f15b"; +} +.fa-file-text:before { + content: "\f15c"; +} +.fa-sort-alpha-asc:before { + content: "\f15d"; +} +.fa-sort-alpha-desc:before { + content: "\f15e"; +} +.fa-sort-amount-asc:before { + content: "\f160"; +} +.fa-sort-amount-desc:before { + content: "\f161"; +} +.fa-sort-numeric-asc:before { + content: "\f162"; +} +.fa-sort-numeric-desc:before { + content: "\f163"; +} +.fa-thumbs-up:before { + content: "\f164"; +} +.fa-thumbs-down:before { + content: "\f165"; +} +.fa-youtube-square:before { + content: "\f166"; +} +.fa-youtube:before { + content: "\f167"; +} +.fa-xing:before { + content: "\f168"; +} +.fa-xing-square:before { + content: "\f169"; +} +.fa-youtube-play:before { + content: "\f16a"; +} +.fa-dropbox:before { + content: "\f16b"; +} +.fa-stack-overflow:before { + content: "\f16c"; +} +.fa-instagram:before { + content: "\f16d"; +} +.fa-flickr:before { + content: "\f16e"; +} +.fa-adn:before { + content: "\f170"; +} +.fa-bitbucket:before { + content: "\f171"; +} +.fa-bitbucket-square:before { + content: "\f172"; +} +.fa-tumblr:before { + content: "\f173"; +} +.fa-tumblr-square:before { + content: "\f174"; +} +.fa-long-arrow-down:before { + content: "\f175"; +} +.fa-long-arrow-up:before { + content: "\f176"; +} +.fa-long-arrow-left:before { + content: "\f177"; +} +.fa-long-arrow-right:before { + content: "\f178"; +} +.fa-apple:before { + content: "\f179"; +} +.fa-windows:before { + content: "\f17a"; +} +.fa-android:before { + content: "\f17b"; +} +.fa-linux:before { + content: "\f17c"; +} +.fa-dribbble:before { + content: "\f17d"; +} +.fa-skype:before { + content: "\f17e"; +} +.fa-foursquare:before { + content: "\f180"; +} +.fa-trello:before { + content: "\f181"; +} +.fa-female:before { + content: "\f182"; +} +.fa-male:before { + content: "\f183"; +} +.fa-gittip:before, +.fa-gratipay:before { + content: "\f184"; +} +.fa-sun-o:before { + content: "\f185"; +} +.fa-moon-o:before { + content: "\f186"; +} +.fa-archive:before { + content: "\f187"; +} +.fa-bug:before { + content: "\f188"; +} +.fa-vk:before { + content: "\f189"; +} +.fa-weibo:before { + content: "\f18a"; +} +.fa-renren:before { + content: "\f18b"; +} +.fa-pagelines:before { + content: "\f18c"; +} +.fa-stack-exchange:before { + content: "\f18d"; +} +.fa-arrow-circle-o-right:before { + content: "\f18e"; +} +.fa-arrow-circle-o-left:before { + content: "\f190"; +} +.fa-toggle-left:before, +.fa-caret-square-o-left:before { + content: "\f191"; +} +.fa-dot-circle-o:before { + content: "\f192"; +} +.fa-wheelchair:before { + content: "\f193"; +} +.fa-vimeo-square:before { + content: "\f194"; +} +.fa-turkish-lira:before, +.fa-try:before { + content: "\f195"; +} +.fa-plus-square-o:before { + content: "\f196"; +} +.fa-space-shuttle:before { + content: "\f197"; +} +.fa-slack:before { + content: "\f198"; +} +.fa-envelope-square:before { + content: "\f199"; +} +.fa-wordpress:before { + content: "\f19a"; +} +.fa-openid:before { + content: "\f19b"; +} +.fa-institution:before, +.fa-bank:before, +.fa-university:before { + content: "\f19c"; +} +.fa-mortar-board:before, +.fa-graduation-cap:before { + content: "\f19d"; +} +.fa-yahoo:before { + content: "\f19e"; +} +.fa-google:before { + content: "\f1a0"; +} +.fa-reddit:before { + content: "\f1a1"; +} +.fa-reddit-square:before { + content: "\f1a2"; +} +.fa-stumbleupon-circle:before { + content: "\f1a3"; +} +.fa-stumbleupon:before { + content: "\f1a4"; +} +.fa-delicious:before { + content: "\f1a5"; +} +.fa-digg:before { + content: "\f1a6"; +} +.fa-pied-piper-pp:before { + content: "\f1a7"; +} +.fa-pied-piper-alt:before { + content: "\f1a8"; +} +.fa-drupal:before { + content: "\f1a9"; +} +.fa-joomla:before { + content: "\f1aa"; +} +.fa-language:before { + content: "\f1ab"; +} +.fa-fax:before { + content: "\f1ac"; +} +.fa-building:before { + content: "\f1ad"; +} +.fa-child:before { + content: "\f1ae"; +} +.fa-paw:before { + content: "\f1b0"; +} +.fa-spoon:before { + content: "\f1b1"; +} +.fa-cube:before { + content: "\f1b2"; +} +.fa-cubes:before { + content: "\f1b3"; +} +.fa-behance:before { + content: "\f1b4"; +} +.fa-behance-square:before { + content: "\f1b5"; +} +.fa-steam:before { + content: "\f1b6"; +} +.fa-steam-square:before { + content: "\f1b7"; +} +.fa-recycle:before { + content: "\f1b8"; +} +.fa-automobile:before, +.fa-car:before { + content: "\f1b9"; +} +.fa-cab:before, +.fa-taxi:before { + content: "\f1ba"; +} +.fa-tree:before { + content: "\f1bb"; +} +.fa-spotify:before { + content: "\f1bc"; +} +.fa-deviantart:before { + content: "\f1bd"; +} +.fa-soundcloud:before { + content: "\f1be"; +} +.fa-database:before { + content: "\f1c0"; +} +.fa-file-pdf-o:before { + content: "\f1c1"; +} +.fa-file-word-o:before { + content: "\f1c2"; +} +.fa-file-excel-o:before { + content: "\f1c3"; +} +.fa-file-powerpoint-o:before { + content: "\f1c4"; +} +.fa-file-photo-o:before, +.fa-file-picture-o:before, +.fa-file-image-o:before { + content: "\f1c5"; +} +.fa-file-zip-o:before, +.fa-file-archive-o:before { + content: "\f1c6"; +} +.fa-file-sound-o:before, +.fa-file-audio-o:before { + content: "\f1c7"; +} +.fa-file-movie-o:before, +.fa-file-video-o:before { + content: "\f1c8"; +} +.fa-file-code-o:before { + content: "\f1c9"; +} +.fa-vine:before { + content: "\f1ca"; +} +.fa-codepen:before { + content: "\f1cb"; +} +.fa-jsfiddle:before { + content: "\f1cc"; +} +.fa-life-bouy:before, +.fa-life-buoy:before, +.fa-life-saver:before, +.fa-support:before, +.fa-life-ring:before { + content: "\f1cd"; +} +.fa-circle-o-notch:before { + content: "\f1ce"; +} +.fa-ra:before, +.fa-resistance:before, +.fa-rebel:before { + content: "\f1d0"; +} +.fa-ge:before, +.fa-empire:before { + content: "\f1d1"; +} +.fa-git-square:before { + content: "\f1d2"; +} +.fa-git:before { + content: "\f1d3"; +} +.fa-y-combinator-square:before, +.fa-yc-square:before, +.fa-hacker-news:before { + content: "\f1d4"; +} +.fa-tencent-weibo:before { + content: "\f1d5"; +} +.fa-qq:before { + content: "\f1d6"; +} +.fa-wechat:before, +.fa-weixin:before { + content: "\f1d7"; +} +.fa-send:before, +.fa-paper-plane:before { + content: "\f1d8"; +} +.fa-send-o:before, +.fa-paper-plane-o:before { + content: "\f1d9"; +} +.fa-history:before { + content: "\f1da"; +} +.fa-circle-thin:before { + content: "\f1db"; +} +.fa-header:before { + content: "\f1dc"; +} +.fa-paragraph:before { + content: "\f1dd"; +} +.fa-sliders:before { + content: "\f1de"; +} +.fa-share-alt:before { + content: "\f1e0"; +} +.fa-share-alt-square:before { + content: "\f1e1"; +} +.fa-bomb:before { + content: "\f1e2"; +} +.fa-soccer-ball-o:before, +.fa-futbol-o:before { + content: "\f1e3"; +} +.fa-tty:before { + content: "\f1e4"; +} +.fa-binoculars:before { + content: "\f1e5"; +} +.fa-plug:before { + content: "\f1e6"; +} +.fa-slideshare:before { + content: "\f1e7"; +} +.fa-twitch:before { + content: "\f1e8"; +} +.fa-yelp:before { + content: "\f1e9"; +} +.fa-newspaper-o:before { + content: "\f1ea"; +} +.fa-wifi:before { + content: "\f1eb"; +} +.fa-calculator:before { + content: "\f1ec"; +} +.fa-paypal:before { + content: "\f1ed"; +} +.fa-google-wallet:before { + content: "\f1ee"; +} +.fa-cc-visa:before { + content: "\f1f0"; +} +.fa-cc-mastercard:before { + content: "\f1f1"; +} +.fa-cc-discover:before { + content: "\f1f2"; +} +.fa-cc-amex:before { + content: "\f1f3"; +} +.fa-cc-paypal:before { + content: "\f1f4"; +} +.fa-cc-stripe:before { + content: "\f1f5"; +} +.fa-bell-slash:before { + content: "\f1f6"; +} +.fa-bell-slash-o:before { + content: "\f1f7"; +} +.fa-trash:before { + content: "\f1f8"; +} +.fa-copyright:before { + content: "\f1f9"; +} +.fa-at:before { + content: "\f1fa"; +} +.fa-eyedropper:before { + content: "\f1fb"; +} +.fa-paint-brush:before { + content: "\f1fc"; +} +.fa-birthday-cake:before { + content: "\f1fd"; +} +.fa-area-chart:before { + content: "\f1fe"; +} +.fa-pie-chart:before { + content: "\f200"; +} +.fa-line-chart:before { + content: "\f201"; +} +.fa-lastfm:before { + content: "\f202"; +} +.fa-lastfm-square:before { + content: "\f203"; +} +.fa-toggle-off:before { + content: "\f204"; +} +.fa-toggle-on:before { + content: "\f205"; +} +.fa-bicycle:before { + content: "\f206"; +} +.fa-bus:before { + content: "\f207"; +} +.fa-ioxhost:before { + content: "\f208"; +} +.fa-angellist:before { + content: "\f209"; +} +.fa-cc:before { + content: "\f20a"; +} +.fa-shekel:before, +.fa-sheqel:before, +.fa-ils:before { + content: "\f20b"; +} +.fa-meanpath:before { + content: "\f20c"; +} +.fa-buysellads:before { + content: "\f20d"; +} +.fa-connectdevelop:before { + content: "\f20e"; +} +.fa-dashcube:before { + content: "\f210"; +} +.fa-forumbee:before { + content: "\f211"; +} +.fa-leanpub:before { + content: "\f212"; +} +.fa-sellsy:before { + content: "\f213"; +} +.fa-shirtsinbulk:before { + content: "\f214"; +} +.fa-simplybuilt:before { + content: "\f215"; +} +.fa-skyatlas:before { + content: "\f216"; +} +.fa-cart-plus:before { + content: "\f217"; +} +.fa-cart-arrow-down:before { + content: "\f218"; +} +.fa-diamond:before { + content: "\f219"; +} +.fa-ship:before { + content: "\f21a"; +} +.fa-user-secret:before { + content: "\f21b"; +} +.fa-motorcycle:before { + content: "\f21c"; +} +.fa-street-view:before { + content: "\f21d"; +} +.fa-heartbeat:before { + content: "\f21e"; +} +.fa-venus:before { + content: "\f221"; +} +.fa-mars:before { + content: "\f222"; +} +.fa-mercury:before { + content: "\f223"; +} +.fa-intersex:before, +.fa-transgender:before { + content: "\f224"; +} +.fa-transgender-alt:before { + content: "\f225"; +} +.fa-venus-double:before { + content: "\f226"; +} +.fa-mars-double:before { + content: "\f227"; +} +.fa-venus-mars:before { + content: "\f228"; +} +.fa-mars-stroke:before { + content: "\f229"; +} +.fa-mars-stroke-v:before { + content: "\f22a"; +} +.fa-mars-stroke-h:before { + content: "\f22b"; +} +.fa-neuter:before { + content: "\f22c"; +} +.fa-genderless:before { + content: "\f22d"; +} +.fa-facebook-official:before { + content: "\f230"; +} +.fa-pinterest-p:before { + content: "\f231"; +} +.fa-whatsapp:before { + content: "\f232"; +} +.fa-server:before { + content: "\f233"; +} +.fa-user-plus:before { + content: "\f234"; +} +.fa-user-times:before { + content: "\f235"; +} +.fa-hotel:before, +.fa-bed:before { + content: "\f236"; +} +.fa-viacoin:before { + content: "\f237"; +} +.fa-train:before { + content: "\f238"; +} +.fa-subway:before { + content: "\f239"; +} +.fa-medium:before { + content: "\f23a"; +} +.fa-yc:before, +.fa-y-combinator:before { + content: "\f23b"; +} +.fa-optin-monster:before { + content: "\f23c"; +} +.fa-opencart:before { + content: "\f23d"; +} +.fa-expeditedssl:before { + content: "\f23e"; +} +.fa-battery-4:before, +.fa-battery:before, +.fa-battery-full:before { + content: "\f240"; +} +.fa-battery-3:before, +.fa-battery-three-quarters:before { + content: "\f241"; +} +.fa-battery-2:before, +.fa-battery-half:before { + content: "\f242"; +} +.fa-battery-1:before, +.fa-battery-quarter:before { + content: "\f243"; +} +.fa-battery-0:before, +.fa-battery-empty:before { + content: "\f244"; +} +.fa-mouse-pointer:before { + content: "\f245"; +} +.fa-i-cursor:before { + content: "\f246"; +} +.fa-object-group:before { + content: "\f247"; +} +.fa-object-ungroup:before { + content: "\f248"; +} +.fa-sticky-note:before { + content: "\f249"; +} +.fa-sticky-note-o:before { + content: "\f24a"; +} +.fa-cc-jcb:before { + content: "\f24b"; +} +.fa-cc-diners-club:before { + content: "\f24c"; +} +.fa-clone:before { + content: "\f24d"; +} +.fa-balance-scale:before { + content: "\f24e"; +} +.fa-hourglass-o:before { + content: "\f250"; +} +.fa-hourglass-1:before, +.fa-hourglass-start:before { + content: "\f251"; +} +.fa-hourglass-2:before, +.fa-hourglass-half:before { + content: "\f252"; +} +.fa-hourglass-3:before, +.fa-hourglass-end:before { + content: "\f253"; +} +.fa-hourglass:before { + content: "\f254"; +} +.fa-hand-grab-o:before, +.fa-hand-rock-o:before { + content: "\f255"; +} +.fa-hand-stop-o:before, +.fa-hand-paper-o:before { + content: "\f256"; +} +.fa-hand-scissors-o:before { + content: "\f257"; +} +.fa-hand-lizard-o:before { + content: "\f258"; +} +.fa-hand-spock-o:before { + content: "\f259"; +} +.fa-hand-pointer-o:before { + content: "\f25a"; +} +.fa-hand-peace-o:before { + content: "\f25b"; +} +.fa-trademark:before { + content: "\f25c"; +} +.fa-registered:before { + content: "\f25d"; +} +.fa-creative-commons:before { + content: "\f25e"; +} +.fa-gg:before { + content: "\f260"; +} +.fa-gg-circle:before { + content: "\f261"; +} +.fa-tripadvisor:before { + content: "\f262"; +} +.fa-odnoklassniki:before { + content: "\f263"; +} +.fa-odnoklassniki-square:before { + content: "\f264"; +} +.fa-get-pocket:before { + content: "\f265"; +} +.fa-wikipedia-w:before { + content: "\f266"; +} +.fa-safari:before { + content: "\f267"; +} +.fa-chrome:before { + content: "\f268"; +} +.fa-firefox:before { + content: "\f269"; +} +.fa-opera:before { + content: "\f26a"; +} +.fa-internet-explorer:before { + content: "\f26b"; +} +.fa-tv:before, +.fa-television:before { + content: "\f26c"; +} +.fa-contao:before { + content: "\f26d"; +} +.fa-500px:before { + content: "\f26e"; +} +.fa-amazon:before { + content: "\f270"; +} +.fa-calendar-plus-o:before { + content: "\f271"; +} +.fa-calendar-minus-o:before { + content: "\f272"; +} +.fa-calendar-times-o:before { + content: "\f273"; +} +.fa-calendar-check-o:before { + content: "\f274"; +} +.fa-industry:before { + content: "\f275"; +} +.fa-map-pin:before { + content: "\f276"; +} +.fa-map-signs:before { + content: "\f277"; +} +.fa-map-o:before { + content: "\f278"; +} +.fa-map:before { + content: "\f279"; +} +.fa-commenting:before { + content: "\f27a"; +} +.fa-commenting-o:before { + content: "\f27b"; +} +.fa-houzz:before { + content: "\f27c"; +} +.fa-vimeo:before { + content: "\f27d"; +} +.fa-black-tie:before { + content: "\f27e"; +} +.fa-fonticons:before { + content: "\f280"; +} +.fa-reddit-alien:before { + content: "\f281"; +} +.fa-edge:before { + content: "\f282"; +} +.fa-credit-card-alt:before { + content: "\f283"; +} +.fa-codiepie:before { + content: "\f284"; +} +.fa-modx:before { + content: "\f285"; +} +.fa-fort-awesome:before { + content: "\f286"; +} +.fa-usb:before { + content: "\f287"; +} +.fa-product-hunt:before { + content: "\f288"; +} +.fa-mixcloud:before { + content: "\f289"; +} +.fa-scribd:before { + content: "\f28a"; +} +.fa-pause-circle:before { + content: "\f28b"; +} +.fa-pause-circle-o:before { + content: "\f28c"; +} +.fa-stop-circle:before { + content: "\f28d"; +} +.fa-stop-circle-o:before { + content: "\f28e"; +} +.fa-shopping-bag:before { + content: "\f290"; +} +.fa-shopping-basket:before { + content: "\f291"; +} +.fa-hashtag:before { + content: "\f292"; +} +.fa-bluetooth:before { + content: "\f293"; +} +.fa-bluetooth-b:before { + content: "\f294"; +} +.fa-percent:before { + content: "\f295"; +} +.fa-gitlab:before { + content: "\f296"; +} +.fa-wpbeginner:before { + content: "\f297"; +} +.fa-wpforms:before { + content: "\f298"; +} +.fa-envira:before { + content: "\f299"; +} +.fa-universal-access:before { + content: "\f29a"; +} +.fa-wheelchair-alt:before { + content: "\f29b"; +} +.fa-question-circle-o:before { + content: "\f29c"; +} +.fa-blind:before { + content: "\f29d"; +} +.fa-audio-description:before { + content: "\f29e"; +} +.fa-volume-control-phone:before { + content: "\f2a0"; +} +.fa-braille:before { + content: "\f2a1"; +} +.fa-assistive-listening-systems:before { + content: "\f2a2"; +} +.fa-asl-interpreting:before, +.fa-american-sign-language-interpreting:before { + content: "\f2a3"; +} +.fa-deafness:before, +.fa-hard-of-hearing:before, +.fa-deaf:before { + content: "\f2a4"; +} +.fa-glide:before { + content: "\f2a5"; +} +.fa-glide-g:before { + content: "\f2a6"; +} +.fa-signing:before, +.fa-sign-language:before { + content: "\f2a7"; +} +.fa-low-vision:before { + content: "\f2a8"; +} +.fa-viadeo:before { + content: "\f2a9"; +} +.fa-viadeo-square:before { + content: "\f2aa"; +} +.fa-snapchat:before { + content: "\f2ab"; +} +.fa-snapchat-ghost:before { + content: "\f2ac"; +} +.fa-snapchat-square:before { + content: "\f2ad"; +} +.fa-pied-piper:before { + content: "\f2ae"; +} +.fa-first-order:before { + content: "\f2b0"; +} +.fa-yoast:before { + content: "\f2b1"; +} +.fa-themeisle:before { + content: "\f2b2"; +} +.fa-google-plus-circle:before, +.fa-google-plus-official:before { + content: "\f2b3"; +} +.fa-fa:before, +.fa-font-awesome:before { + content: "\f2b4"; +} +.fa-handshake-o:before { + content: "\f2b5"; +} +.fa-envelope-open:before { + content: "\f2b6"; +} +.fa-envelope-open-o:before { + content: "\f2b7"; +} +.fa-linode:before { + content: "\f2b8"; +} +.fa-address-book:before { + content: "\f2b9"; +} +.fa-address-book-o:before { + content: "\f2ba"; +} +.fa-vcard:before, +.fa-address-card:before { + content: "\f2bb"; +} +.fa-vcard-o:before, +.fa-address-card-o:before { + content: "\f2bc"; +} +.fa-user-circle:before { + content: "\f2bd"; +} +.fa-user-circle-o:before { + content: "\f2be"; +} +.fa-user-o:before { + content: "\f2c0"; +} +.fa-id-badge:before { + content: "\f2c1"; +} +.fa-drivers-license:before, +.fa-id-card:before { + content: "\f2c2"; +} +.fa-drivers-license-o:before, +.fa-id-card-o:before { + content: "\f2c3"; +} +.fa-quora:before { + content: "\f2c4"; +} +.fa-free-code-camp:before { + content: "\f2c5"; +} +.fa-telegram:before { + content: "\f2c6"; +} +.fa-thermometer-4:before, +.fa-thermometer:before, +.fa-thermometer-full:before { + content: "\f2c7"; +} +.fa-thermometer-3:before, +.fa-thermometer-three-quarters:before { + content: "\f2c8"; +} +.fa-thermometer-2:before, +.fa-thermometer-half:before { + content: "\f2c9"; +} +.fa-thermometer-1:before, +.fa-thermometer-quarter:before { + content: "\f2ca"; +} +.fa-thermometer-0:before, +.fa-thermometer-empty:before { + content: "\f2cb"; +} +.fa-shower:before { + content: "\f2cc"; +} +.fa-bathtub:before, +.fa-s15:before, +.fa-bath:before { + content: "\f2cd"; +} +.fa-podcast:before { + content: "\f2ce"; +} +.fa-window-maximize:before { + content: "\f2d0"; +} +.fa-window-minimize:before { + content: "\f2d1"; +} +.fa-window-restore:before { + content: "\f2d2"; +} +.fa-times-rectangle:before, +.fa-window-close:before { + content: "\f2d3"; +} +.fa-times-rectangle-o:before, +.fa-window-close-o:before { + content: "\f2d4"; +} +.fa-bandcamp:before { + content: "\f2d5"; +} +.fa-grav:before { + content: "\f2d6"; +} +.fa-etsy:before { + content: "\f2d7"; +} +.fa-imdb:before { + content: "\f2d8"; +} +.fa-ravelry:before { + content: "\f2d9"; +} +.fa-eercast:before { + content: "\f2da"; +} +.fa-microchip:before { + content: "\f2db"; +} +.fa-snowflake-o:before { + content: "\f2dc"; +} +.fa-superpowers:before { + content: "\f2dd"; +} +.fa-wpexplorer:before { + content: "\f2de"; +} +.fa-meetup:before { + content: "\f2e0"; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +.sr-only-focusable:active, +.sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; +} diff --git a/node_modules/font-awesome/css/font-awesome.css.map b/node_modules/font-awesome/css/font-awesome.css.map new file mode 100644 index 0000000000..60763a8640 --- /dev/null +++ b/node_modules/font-awesome/css/font-awesome.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;;;;;AAGA,UAUC;EATC,WAAW,EAAE,aAAa;EAC1B,GAAG,EAAE,+CAAgE;EACrE,GAAG,EAAE,ySAAmG;EAKxG,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,MAAM;ACTpB,GAAmB;EACjB,OAAO,EAAE,YAAY;EACrB,IAAI,EAAE,uCAAwD;EAC9D,SAAS,EAAE,OAAO;EAClB,cAAc,EAAE,IAAI;EACpB,sBAAsB,EAAE,WAAW;EACnC,uBAAuB,EAAE,SAAS;EAClC,SAAS,EAAE,eAAe;;;ACN5B,MAAsB;EACpB,SAAS,EAAE,SAAS;EACpB,WAAW,EAAE,MAAS;EACtB,cAAc,EAAE,IAAI;;AAEtB,MAAsB;EAAE,SAAS,EAAE,GAAG;;AACtC,MAAsB;EAAE,SAAS,EAAE,GAAG;;AACtC,MAAsB;EAAE,SAAS,EAAE,GAAG;;AACtC,MAAsB;EAAE,SAAS,EAAE,GAAG;;ACVtC,MAAsB;EACpB,KAAK,EAAE,SAAW;EAClB,UAAU,EAAE,MAAM;;ACDpB,MAAsB;EACpB,YAAY,EAAE,CAAC;EACf,WAAW,ECKU,SAAS;EDJ9B,eAAe,EAAE,IAAI;EACrB,WAAK;IAAE,QAAQ,EAAE,QAAQ;;AAE3B,MAAsB;EACpB,QAAQ,EAAE,QAAQ;EAClB,IAAI,EAAE,UAAa;EACnB,KAAK,ECFgB,SAAS;EDG9B,GAAG,EAAE,SAAU;EACf,UAAU,EAAE,MAAM;EAClB,YAAuB;IACrB,IAAI,EAAE,UAA0B;;AEbpC,UAA0B;EACxB,OAAO,EAAE,gBAAgB;EACzB,MAAM,EAAE,iBAA4B;EACpC,aAAa,EAAE,IAAI;;AAGrB,WAAY;EAAE,KAAK,EAAE,KAAK;;AAC1B,UAAW;EAAE,KAAK,EAAE,IAAI;;AAGtB,aAAY;EAAE,YAAY,EAAE,IAAI;AAChC,cAAa;EAAE,WAAW,EAAE,IAAI;;ACXlC,QAAwB;EACtB,iBAAiB,EAAE,0BAA0B;EACrC,SAAS,EAAE,0BAA0B;;AAG/C,SAAyB;EACvB,iBAAiB,EAAE,4BAA4B;EACvC,SAAS,EAAE,4BAA4B;;AAGjD,0BASC;EARC,EAAG;IACD,iBAAiB,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;EAEjC,IAAK;IACH,iBAAiB,EAAE,cAAc;IACzB,SAAS,EAAE,cAAc;AAIrC,kBASC;EARC,EAAG;IACD,iBAAiB,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;EAEjC,IAAK;IACH,iBAAiB,EAAE,cAAc;IACzB,SAAS,EAAE,cAAc;AC5BrC,aAA8B;ECY5B,MAAM,EAAE,wDAAmE;EAC3E,iBAAiB,EAAE,aAAgB;EAC/B,aAAa,EAAE,aAAgB;EAC3B,SAAS,EAAE,aAAgB;;ADdrC,cAA8B;ECW5B,MAAM,EAAE,wDAAmE;EAC3E,iBAAiB,EAAE,cAAgB;EAC/B,aAAa,EAAE,cAAgB;EAC3B,SAAS,EAAE,cAAgB;;ADbrC,cAA8B;ECU5B,MAAM,EAAE,wDAAmE;EAC3E,iBAAiB,EAAE,cAAgB;EAC/B,aAAa,EAAE,cAAgB;EAC3B,SAAS,EAAE,cAAgB;;ADXrC,mBAAmC;ECejC,MAAM,EAAE,wDAAmE;EAC3E,iBAAiB,EAAE,YAAoB;EACnC,aAAa,EAAE,YAAoB;EAC/B,SAAS,EAAE,YAAoB;;ADjBzC,iBAAmC;ECcjC,MAAM,EAAE,wDAAmE;EAC3E,iBAAiB,EAAE,YAAoB;EACnC,aAAa,EAAE,YAAoB;EAC/B,SAAS,EAAE,YAAoB;;ADZzC;;;;uBAIuC;EACrC,MAAM,EAAE,IAAI;;AEfd,SAAyB;EACvB,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,GAAG;EACV,MAAM,EAAE,GAAG;EACX,WAAW,EAAE,GAAG;EAChB,cAAc,EAAE,MAAM;;AAExB,0BAAyD;EACvD,QAAQ,EAAE,QAAQ;EAClB,IAAI,EAAE,CAAC;EACP,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,MAAM;;AAEpB,YAA4B;EAAE,WAAW,EAAE,OAAO;;AAClD,YAA4B;EAAE,SAAS,EAAE,GAAG;;AAC5C,WAA2B;EAAE,KAAK,ELVZ,IAAI;;;;AMN1B,gBAAgC;EAAE,OAAO,ENoQ1B,GAAO;;AMnQtB,gBAAgC;EAAE,OAAO,EN0W1B,GAAO;;AMzWtB,iBAAiC;EAAE,OAAO,ENmb1B,GAAO;;AMlbvB,qBAAqC;EAAE,OAAO,ENmL1B,GAAO;;AMlL3B,gBAAgC;EAAE,OAAO,ENkR1B,GAAO;;AMjRtB,eAA+B;EAAE,OAAO,ENke1B,GAAO;;AMjerB,iBAAiC;EAAE,OAAO,ENse1B,GAAO;;AMrevB,eAA+B;EAAE,OAAO,EN+iB1B,GAAO;;AM9iBrB,eAA+B;EAAE,OAAO,ENyN1B,GAAO;;AMxNrB,mBAAmC;EAAE,OAAO,ENggB1B,GAAO;;AM/fzB,aAA6B;EAAE,OAAO,EN8f1B,GAAO;;AM7fnB,kBAAkC;EAAE,OAAO,EN+f1B,GAAO;;AM9fxB,gBAAgC;EAAE,OAAO,ENoG1B,GAAO;;AMnGtB;;gBAEgC;EAAE,OAAO,ENkgB1B,GAAO;;AMjgBtB,sBAAsC;EAAE,OAAO,ENua1B,GAAO;;AMta5B,uBAAuC;EAAE,OAAO,ENqa1B,GAAO;;AMpa7B,oBAAoC;EAAE,OAAO,EN+X1B,GAAO;;AM9X1B,iBAAiC;EAAE,OAAO,ENsb1B,GAAO;;AMrbvB;cAC8B;EAAE,OAAO,ENwH1B,GAAO;;AMvHpB,kBAAkC;EAAE,OAAO,ENygB1B,GAAO;;AMxgBxB,eAA+B;EAAE,OAAO,ENmQ1B,GAAO;;AMlQrB,iBAAiC;EAAE,OAAO,EN6L1B,GAAO;;AM5LvB,kBAAkC;EAAE,OAAO,EN0G1B,GAAO;;AMzGxB,eAA+B;EAAE,OAAO,EN+Y1B,GAAO;;AM9YrB,mBAAmC;EAAE,OAAO,ENiJ1B,GAAO;;AMhJzB,8BAA8C;EAAE,OAAO,ENI1B,GAAO;;AMHpC,4BAA4C;EAAE,OAAO,ENM1B,GAAO;;AMLlC,gBAAgC;EAAE,OAAO,ENkQ1B,GAAO;;AMjQtB,wBAAwC;EAAE,OAAO,EN4W1B,GAAO;;AM3W9B;iBACiC;EAAE,OAAO,ENmY1B,GAAO;;AMlYvB,kBAAkC;EAAE,OAAO,EN8X1B,GAAO;;AM7XxB,mBAAmC;EAAE,OAAO,ENiS1B,GAAO;;AMhSzB,eAA+B;EAAE,OAAO,ENoS1B,GAAO;;AMnSrB,eAA+B;EAAE,OAAO,ENgM1B,GAAO;;AM/LrB,qBAAqC;EAAE,OAAO,EN+O1B,GAAO;;AM9O3B,qBAAqC;EAAE,OAAO,EN8hB1B,GAAO;;AM7hB3B,sBAAsC;EAAE,OAAO,EN4hB1B,GAAO;;AM3hB5B,oBAAoC;EAAE,OAAO,EN6hB1B,GAAO;;AM5hB1B,iBAAiC;EAAE,OAAO,EN2W1B,GAAO;;AM1WvB,kBAAkC;EAAE,OAAO,ENW1B,GAAO;;AMVxB,cAA8B;EAAE,OAAO,ENod1B,GAAO;;AMndpB,eAA+B;EAAE,OAAO,ENod1B,GAAO;;AMndrB,eAA+B;EAAE,OAAO,EN2B1B,GAAO;;AM1BrB,mBAAmC;EAAE,OAAO,EN2B1B,GAAO;;AM1BzB,gBAAgC;EAAE,OAAO,ENkW1B,GAAO;;AMjWtB,iBAAiC;EAAE,OAAO,ENwC1B,GAAO;;AMvCvB,eAA+B;EAAE,OAAO,EN8L1B,GAAO;;AM7LrB,eAA+B;EAAE,OAAO,ENmB1B,GAAO;;AMlBrB,iBAAiC;EAAE,OAAO,ENoP1B,GAAO;;AMnPvB,sBAAsC;EAAE,OAAO,ENid1B,GAAO;;AMhd5B,qBAAqC;EAAE,OAAO,ENid1B,GAAO;;AMhd3B,qBAAqC;EAAE,OAAO,EN1C1B,GAAO;;AM2C3B,uBAAuC;EAAE,OAAO,EN7C1B,GAAO;;AM8C7B,sBAAsC;EAAE,OAAO,EN3C1B,GAAO;;AM4C5B,wBAAwC;EAAE,OAAO,EN9C1B,GAAO;;AM+C9B,eAA+B;EAAE,OAAO,ENwQ1B,GAAO;;AMvQrB;kBACkC;EAAE,OAAO,ENmT1B,GAAO;;AMlTxB,iBAAiC;EAAE,OAAO,ENmO1B,GAAO;;AMlOvB,uBAAuC;EAAE,OAAO,ENigB1B,GAAO;;AMhgB7B;;oBAEoC;EAAE,OAAO,EN+T1B,GAAO;;AM9T1B,iBAAiC;EAAE,OAAO,ENwT1B,GAAO;;AMvTvB,qBAAqC;EAAE,OAAO,EN+Q1B,GAAO;;AM9Q3B,iBAAiC;EAAE,OAAO,EN5D1B,GAAO;;AM6DvB,eAA+B;EAAE,OAAO,EN8c1B,GAAO;;AM7crB;0BAC0C;EAAE,OAAO,ENqT1B,GAAO;;AMpThC,yBAAyC;EAAE,OAAO,ENuX1B,GAAO;;AMtX/B,yBAAyC;EAAE,OAAO,EN0C1B,GAAO;;AMzC/B,iBAAiC;EAAE,OAAO,ENjC1B,GAAO;;AMkCvB,wBAAwC;EAAE,OAAO,ENma1B,GAAO;;AMla9B,wBAAwC;EAAE,OAAO,EN4H1B,GAAO;;AM3H9B,mBAAmC;EAAE,OAAO,EN7B1B,GAAO;;AM8BzB,eAA+B;EAAE,OAAO,EN0T1B,GAAO;;AMzTrB,gBAAgC;EAAE,OAAO,ENwS1B,GAAO;;AMvStB,eAA+B;EAAE,OAAO,ENia1B,GAAO;;AMharB,kBAAkC;EAAE,OAAO,ENgK1B,GAAO;;AM/JxB,uBAAuC;EAAE,OAAO,ENuH1B,GAAO;;AMtH7B,uBAAuC;EAAE,OAAO,EN4Z1B,GAAO;;AM3Z7B,gBAAgC;EAAE,OAAO,EN4F1B,GAAO;;AM3FtB,uBAAuC;EAAE,OAAO,ENoC1B,GAAO;;AMnC7B,wBAAwC;EAAE,OAAO,ENoC1B,GAAO;;AMnC9B,sBAAsC;EAAE,OAAO,ENsT1B,GAAO;;AMrT5B,uBAAuC;EAAE,OAAO,ENyQ1B,GAAO;;AMxQ7B,uBAAuC;EAAE,OAAO,ENwb1B,GAAO;;AMvb7B,uBAAuC;EAAE,OAAO,ENsB1B,GAAO;;AMrB7B,0BAA0C;EAAE,OAAO,EN2T1B,GAAO;;AM1ThC,sBAAsC;EAAE,OAAO,ENsM1B,GAAO;;AMrM5B,qBAAqC;EAAE,OAAO,EN6D1B,GAAO;;AM5D3B,yBAAyC;EAAE,OAAO,ENob1B,GAAO;;AMnb/B,yBAAyC;EAAE,OAAO,ENkB1B,GAAO;;AMjB/B,cAA8B;EAAE,OAAO,EN/C1B,GAAO;;AMgDpB,qBAAqC;EAAE,OAAO,EN3D1B,GAAO;;AM4D3B,sBAAsC;EAAE,OAAO,EN3D1B,GAAO;;AM4D5B,mBAAmC;EAAE,OAAO,EN3D1B,GAAO;;AM4DzB,qBAAqC;EAAE,OAAO,EN/D1B,GAAO;;AMgE3B;gBACgC;EAAE,OAAO,ENqV1B,GAAO;;AMpVtB,iBAAiC;EAAE,OAAO,ENuF1B,GAAO;;AMtFvB,mBAAmC;EAAE,OAAO,EN4C1B,GAAO;;AM3CzB,eAA+B;EAAE,OAAO,ENmS1B,GAAO;;AMlSrB,gBAAgC;EAAE,OAAO,ENsP1B,GAAO;;AMrPtB,mBAAmC;EAAE,OAAO,EN9D1B,GAAO;;AM+DzB,6BAA6C;EAAE,OAAO,ENgF1B,GAAO;;AM/EnC,eAA+B;EAAE,OAAO,EN+I1B,GAAO;;AM9IrB,eAA+B;EAAE,OAAO,ENoM1B,GAAO;;AMnMrB,eAA+B;EAAE,OAAO,ENmH1B,GAAO;;AMlHrB,cAA8B;EAAE,OAAO,ENiF1B,GAAO;;AMhFpB,oBAAoC;EAAE,OAAO,ENiF1B,GAAO;;AMhF1B;+BAC+C;EAAE,OAAO,EN0E1B,GAAO;;AMzErC,gBAAgC;EAAE,OAAO,ENmR1B,GAAO;;AMlRtB,mBAAmC;EAAE,OAAO,EN/B1B,GAAO;;AMgCzB,iBAAiC;EAAE,OAAO,ENoS1B,GAAO;;AMnSvB,kBAAkC;EAAE,OAAO,ENwB1B,GAAO;;AMvBxB,iBAAiC;EAAE,OAAO,ENqN1B,GAAO;;AMpNvB,qBAAqC;EAAE,OAAO,ENE1B,GAAO;;AMD3B,uBAAuC;EAAE,OAAO,ENF1B,GAAO;;AMG7B,kBAAkC;EAAE,OAAO,EN2S1B,GAAO;;AM1SxB,wBAAwC;EAAE,OAAO,ENyU1B,GAAO;;AMxU9B,iBAAiC;EAAE,OAAO,EN8G1B,GAAO;;AM7GvB,sBAAsC;EAAE,OAAO,EN+G1B,GAAO;;AM9G5B,mBAAmC;EAAE,OAAO,ENnF1B,GAAO;;AMoFzB,mBAAmC;EAAE,OAAO,ENrF1B,GAAO;;AMsFzB;oBACoC;EAAE,OAAO,EN/E1B,GAAO;;AMgF1B,yBAAyC;EAAE,OAAO,ENua1B,GAAO;;AMta/B,0BAA0C;EAAE,OAAO,ENmE1B,GAAO;;AMlEhC,uBAAuC;EAAE,OAAO,EN5C1B,GAAO;;AM6C7B,cAA8B;EAAE,OAAO,ENqK1B,GAAO;;AMpKpB;eAC+B;EAAE,OAAO,ENK1B,GAAO;;AMJrB,mBAAmC;EAAE,OAAO,ENQ1B,GAAO;;AMPzB,sBAAsC;EAAE,OAAO,ENmY1B,GAAO;;AMlY5B,wBAAwC;EAAE,OAAO,ENiY1B,GAAO;;AMhY9B,oBAAoC;EAAE,OAAO,EN2V1B,GAAO;;AM1V1B,kBAAkC;EAAE,OAAO,ENyI1B,GAAO;;AMxIxB,mBAAmC;EAAE,OAAO,ENyT1B,GAAO;;AMxTzB,0BAA0C;EAAE,OAAO,ENiL1B,GAAO;;AMhLhC,qBAAqC;EAAE,OAAO,EN0X1B,GAAO;;AMzX3B,wBAAwC;EAAE,OAAO,EN8C1B,GAAO;;AM7C9B,kBAAkC;EAAE,OAAO,ENoT1B,GAAO;;AMnTxB,iBAAiC;EAAE,OAAO,EN8Y1B,GAAO;;AM7YvB,wBAAwC;EAAE,OAAO,EN6G1B,GAAO;;AM5G9B,iBAAiC;EAAE,OAAO,EN8Z1B,GAAO;;AM7ZvB,kBAAkC;EAAE,OAAO,EN+J1B,GAAO;;AM9JxB,gBAAgC;EAAE,OAAO,ENsO1B,GAAO;;AMrOtB,mBAAmC;EAAE,OAAO,EN2U1B,GAAO;;AM1UzB,qBAAqC;EAAE,OAAO,EN/E1B,GAAO;;AMgF3B,uBAAuC;EAAE,OAAO,ENoO1B,GAAO;;AMnO7B,kBAAkC;EAAE,OAAO,EN8Y1B,GAAO;;AM7YxB;mBACmC;EAAE,OAAO,ENuC1B,GAAO;;AMtCzB,iBAAiC;EAAE,OAAO,ENiG1B,GAAO;;AMhGvB,iBAAiC;EAAE,OAAO,ENiZ1B,GAAO;;AMhZvB,sBAAsC;EAAE,OAAO,ENR1B,GAAO;;AMS5B,cAA8B;EAAE,OAAO,EN4Q1B,GAAO;;AM3QpB,gBAAgC;EAAE,OAAO,ENgH1B,GAAO;;AM/GtB,mBAAmC;EAAE,OAAO,ENnF1B,GAAO;;AMoFzB,eAA+B;EAAE,OAAO,ENzG1B,GAAO;;AM0GrB,sBAAsC;EAAE,OAAO,ENzD1B,GAAO;;AM0D5B,uBAAuC;EAAE,OAAO,EN0G1B,GAAO;;AMzG7B,sBAAsC;EAAE,OAAO,ENwG1B,GAAO;;AMvG5B,oBAAoC;EAAE,OAAO,ENyG1B,GAAO;;AMxG1B,sBAAsC;EAAE,OAAO,ENqG1B,GAAO;;AMpG5B,4BAA4C;EAAE,OAAO,EN5I1B,GAAO;;AM6IlC,6BAA6C;EAAE,OAAO,ENxI1B,GAAO;;AMyInC,0BAA0C;EAAE,OAAO,ENxI1B,GAAO;;AMyIhC,4BAA4C;EAAE,OAAO,ENhJ1B,GAAO;;AMiJlC,gBAAgC;EAAE,OAAO,ENsF1B,GAAO;;AMrFtB,iBAAiC;EAAE,OAAO,ENia1B,GAAO;;AMhavB,gBAAgC;EAAE,OAAO,ENiV1B,GAAO;;AMhVtB,iBAAiC;EAAE,OAAO,ENgD1B,GAAO;;AM/CvB,oBAAoC;EAAE,OAAO,ENvG1B,GAAO;;AMwG1B,qBAAqC;EAAE,OAAO,ENzI1B,GAAO;;AM0I3B;gBACgC;EAAE,OAAO,ENqY1B,GAAO;;AMpYtB;eAC+B;EAAE,OAAO,ENuI1B,GAAO;;AMtIrB,gBAAgC;EAAE,OAAO,ENpD1B,GAAO;;AMqDtB,gBAAgC;EAAE,OAAO,EN+C1B,GAAO;;AM9CtB;mBACmC;EAAE,OAAO,ENwP1B,GAAO;;AMvPzB;kBACkC;EAAE,OAAO,ENkC1B,GAAO;;AMjCxB,oBAAoC;EAAE,OAAO,ENsL1B,GAAO;;AMrL1B;mBACmC;EAAE,OAAO,EN0C1B,GAAO;;AMzCzB,iBAAiC;EAAE,OAAO,ENiS1B,GAAO;;AMhSvB;;eAE+B;EAAE,OAAO,EN9I1B,GAAO;;AM+IrB,kBAAkC;EAAE,OAAO,ENgI1B,GAAO;;AM/HxB,kBAAkC;EAAE,OAAO,EN8H1B,GAAO;;AM7HxB,wBAAwC;EAAE,OAAO,EN4S1B,GAAO;;AM3S9B,oBAAoC;EAAE,OAAO,ENoW1B,GAAO;;AMnW1B,gBAAgC;EAAE,OAAO,ENmT1B,GAAO;;AMlTtB,gBAAgC;EAAE,OAAO,ENkI1B,GAAO;;AMjItB,gBAAgC;EAAE,OAAO,ENuV1B,GAAO;;AMtVtB,oBAAoC;EAAE,OAAO,ENwL1B,GAAO;;AMvL1B,2BAA2C;EAAE,OAAO,ENyL1B,GAAO;;AMxLjC,6BAA6C;EAAE,OAAO,ENyD1B,GAAO;;AMxDnC,sBAAsC;EAAE,OAAO,ENuD1B,GAAO;;AMtD5B,gBAAgC;EAAE,OAAO,ENsJ1B,GAAO;;AMrJtB,qBAAqC;EAAE,OAAO,ENtH1B,GAAO;;AMuH3B,mBAAmC;EAAE,OAAO,ENhH1B,GAAO;;AMiHzB,qBAAqC;EAAE,OAAO,ENvH1B,GAAO;;AMwH3B,sBAAsC;EAAE,OAAO,ENvH1B,GAAO;;AMwH5B,kBAAkC;EAAE,OAAO,ENvE1B,GAAO;;AMwExB;eAC+B;EAAE,OAAO,EN2P1B,GAAO;;AM1PrB;oBACoC;EAAE,OAAO,EN+P1B,GAAO;;AM9P1B;mBACmC;EAAE,OAAO,EN4P1B,GAAO;;AM3PzB,mBAAmC;EAAE,OAAO,ENxC1B,GAAO;;AMyCzB,mBAAmC;EAAE,OAAO,ENkG1B,GAAO;;AMjGzB;eAC+B;EAAE,OAAO,EN8U1B,GAAO;;AM7UrB;gBACgC;EAAE,OAAO,ENqB1B,GAAO;;AMpBtB;qBACqC;EAAE,OAAO,EN2R1B,GAAO;;AM1R3B,oBAAoC;EAAE,OAAO,ENpF1B,GAAO;;AMqF1B,qBAAqC;EAAE,OAAO,ENnF1B,GAAO;;AMoF3B;eAC+B;EAAE,OAAO,ENjK1B,GAAO;;AMkKrB,kBAAkC;EAAE,OAAO,ENkO1B,GAAO;;AMjOxB,mBAAmC;EAAE,OAAO,ENkU1B,GAAO;;AMjUzB;oBACoC;EAAE,OAAO,EN1G1B,GAAO;;AM2G1B,sBAAsC;EAAE,OAAO,ENgF1B,GAAO;;AM/E5B,mBAAmC;EAAE,OAAO,ENnD1B,GAAO;;AMoDzB,yBAAyC;EAAE,OAAO,ENzG1B,GAAO;;AM0G/B,uBAAuC;EAAE,OAAO,ENzG1B,GAAO;;AM0G7B,kBAAkC;EAAE,OAAO,ENsU1B,GAAO;;AMrUxB,sBAAsC;EAAE,OAAO,EN+P1B,GAAO;;AM9P5B,mBAAmC;EAAE,OAAO,ENsQ1B,GAAO;;AMrQzB,iBAAiC;EAAE,OAAO,ENvL1B,GAAO;;AMwLvB,iBAAiC;EAAE,OAAO,ENzG1B,GAAO;;AM0GvB,kBAAkC;EAAE,OAAO,ENtF1B,GAAO;;AMuFxB,sBAAsC;EAAE,OAAO,EN3B1B,GAAO;;AM4B5B,qBAAqC;EAAE,OAAO,ENxK1B,GAAO;;AMyK3B,qBAAqC;EAAE,OAAO,ENkC1B,GAAO;;AMjC3B,oBAAoC;EAAE,OAAO,EN3O1B,GAAO;;AM4O1B,iBAAiC;EAAE,OAAO,ENiG1B,GAAO;;AMhGvB,sBAAsC;EAAE,OAAO,EN/C1B,GAAO;;AMgD5B,eAA+B;EAAE,OAAO,ENpM1B,GAAO;;AMqMrB,mBAAmC;EAAE,OAAO,ENe1B,GAAO;;AMdzB,sBAAsC;EAAE,OAAO,ENgJ1B,GAAO;;AM/I5B,4BAA4C;EAAE,OAAO,EN5O1B,GAAO;;AM6OlC,6BAA6C;EAAE,OAAO,EN5O1B,GAAO;;AM6OnC,0BAA0C;EAAE,OAAO,EN5O1B,GAAO;;AM6OhC,4BAA4C;EAAE,OAAO,ENhP1B,GAAO;;AMiPlC,qBAAqC;EAAE,OAAO,EN5O1B,GAAO;;AM6O3B,sBAAsC;EAAE,OAAO,EN5O1B,GAAO;;AM6O5B,mBAAmC;EAAE,OAAO,EN5O1B,GAAO;;AM6OzB,qBAAqC;EAAE,OAAO,ENhP1B,GAAO;;AMiP3B,kBAAkC;EAAE,OAAO,ENlG1B,GAAO;;AMmGxB,iBAAiC;EAAE,OAAO,ENuC1B,GAAO;;AMtCvB,iBAAiC;EAAE,OAAO,ENoP1B,GAAO;;AMnPvB;iBACiC;EAAE,OAAO,ENyF1B,GAAO;;AMxFvB,mBAAmC;EAAE,OAAO,EN9I1B,GAAO;;AM+IzB,qBAAqC;EAAE,OAAO,EN0I1B,GAAO;;AMzI3B,sBAAsC;EAAE,OAAO,EN0I1B,GAAO;;AMzI5B,kBAAkC;EAAE,OAAO,ENgN1B,GAAO;;AM/MxB,iBAAiC;EAAE,OAAO,ENnJ1B,GAAO;;AMoJvB;gBACgC;EAAE,OAAO,ENkJ1B,GAAO;;AMjJtB,qBAAqC;EAAE,OAAO,ENnB1B,GAAO;;AMoB3B,mBAAmC;EAAE,OAAO,ENxC1B,GAAO;;AMyCzB,wBAAwC;EAAE,OAAO,ENvC1B,GAAO;;AMwC9B,kBAAkC;EAAE,OAAO,EN0L1B,GAAO;;AMzLxB,kBAAkC;EAAE,OAAO,ENpC1B,GAAO;;AMqCxB,gBAAgC;EAAE,OAAO,ENoE1B,GAAO;;AMnEtB,kBAAkC;EAAE,OAAO,ENpC1B,GAAO;;AMqCxB,qBAAqC;EAAE,OAAO,ENkB1B,GAAO;;AMjB3B,iBAAiC;EAAE,OAAO,ENrD1B,GAAO;;AMsDvB,yBAAyC;EAAE,OAAO,ENvD1B,GAAO;;AMwD/B,mBAAmC;EAAE,OAAO,ENuO1B,GAAO;;AMtOzB,eAA+B;EAAE,OAAO,ENtJ1B,GAAO;;AMuJrB;oBACoC;EAAE,OAAO,ENqI1B,GAAO;;AMpI1B;;sBAEsC;EAAE,OAAO,ENuM1B,GAAO;;AMtM5B,yBAAyC;EAAE,OAAO,ENkC1B,GAAO;;AMjC/B,eAA+B;EAAE,OAAO,EN5I1B,GAAO;;AM6IrB,oBAAoC;EAAE,OAAO,EN7J1B,GAAO;;AM8J1B;uBACuC;EAAE,OAAO,EN1L1B,GAAO;;AM2L7B,mBAAmC;EAAE,OAAO,EN4G1B,GAAO;;AM3GzB,eAA+B;EAAE,OAAO,ENT1B,GAAO;;AMUrB,sBAAsC;EAAE,OAAO,ENhH1B,GAAO;;AMiH5B,sBAAsC;EAAE,OAAO,EN8M1B,GAAO;;AM7M5B,oBAAoC;EAAE,OAAO,ENyM1B,GAAO;;AMxM1B,iBAAiC;EAAE,OAAO,ENvH1B,GAAO;;AMwHvB,uBAAuC;EAAE,OAAO,ENmG1B,GAAO;;AMlG7B,qBAAqC;EAAE,OAAO,EN8C1B,GAAO;;AM7C3B,2BAA2C;EAAE,OAAO,EN8C1B,GAAO;;AM7CjC,iBAAiC;EAAE,OAAO,ENgJ1B,GAAO;;AM/IvB,qBAAqC;EAAE,OAAO,EN5N1B,GAAO;;AM6N3B,4BAA4C;EAAE,OAAO,ENjF1B,GAAO;;AMkFlC,iBAAiC;EAAE,OAAO,ENoH1B,GAAO;;AMnHvB,iBAAiC;EAAE,OAAO,ENkC1B,GAAO;;AMjCvB,8BAA8C;EAAE,OAAO,ENlM1B,GAAO;;AMmMpC,+BAA+C;EAAE,OAAO,ENlM1B,GAAO;;AMmMrC,4BAA4C;EAAE,OAAO,ENlM1B,GAAO;;AMmMlC,8BAA8C;EAAE,OAAO,ENtM1B,GAAO;;AMuMpC,gBAAgC;EAAE,OAAO,EN/B1B,GAAO;;AMgCtB,eAA+B;EAAE,OAAO,ENjK1B,GAAO;;AMkKrB,iBAAiC;EAAE,OAAO,EN9S1B,GAAO;;AM+SvB,qBAAqC;EAAE,OAAO,ENmP1B,GAAO;;AMlP3B,mBAAmC;EAAE,OAAO,EN9O1B,GAAO;;AM+OzB,qBAAqC;EAAE,OAAO,EN/I1B,GAAO;;AMgJ3B,qBAAqC;EAAE,OAAO,EN/I1B,GAAO;;AMgJ3B,qBAAqC;EAAE,OAAO,EN4G1B,GAAO;;AM3G3B,sBAAsC;EAAE,OAAO,ENsE1B,GAAO;;AMrE5B,iBAAiC;EAAE,OAAO,EN2M1B,GAAO;;AM1MvB,uBAAuC;EAAE,OAAO,EN6B1B,GAAO;;AM5B7B,yBAAyC;EAAE,OAAO,EN6B1B,GAAO;;AM5B/B,mBAAmC;EAAE,OAAO,ENhB1B,GAAO;;AMiBzB,qBAAqC;EAAE,OAAO,ENlB1B,GAAO;;AMmB3B,uBAAuC;EAAE,OAAO,ENvN1B,GAAO;;AMwN7B,wBAAwC;EAAE,OAAO,ENiD1B,GAAO;;AMhD9B,+BAA+C;EAAE,OAAO,EN3I1B,GAAO;;AM4IrC,uBAAuC;EAAE,OAAO,ENkH1B,GAAO;;AMjH7B,kBAAkC;EAAE,OAAO,EN1L1B,GAAO;;AM2LxB;8BAC8C;EAAE,OAAO,ENjP1B,GAAO;;AMkPpC;4BAC4C;EAAE,OAAO,ENhP1B,GAAO;;AMiPlC;+BAC+C;EAAE,OAAO,ENnP1B,GAAO;;AMoPrC;cAC8B;EAAE,OAAO,EN7J1B,GAAO;;AM8JpB,cAA8B;EAAE,OAAO,EN/F1B,GAAO;;AMgGpB;cAC8B;EAAE,OAAO,EN4N1B,GAAO;;AM3NpB;cAC8B;EAAE,OAAO,ENvD1B,GAAO;;AMwDpB;;;cAG8B;EAAE,OAAO,ENrD1B,GAAO;;AMsDpB;;cAE8B;EAAE,OAAO,EN8E1B,GAAO;;AM7EpB;cAC8B;EAAE,OAAO,ENtD1B,GAAO;;AMuDpB;cAC8B;EAAE,OAAO,ENzR1B,GAAO;;AM0RpB,eAA+B;EAAE,OAAO,ENzJ1B,GAAO;;AM0JrB,oBAAoC;EAAE,OAAO,EN7I1B,GAAO;;AM8I1B,yBAAyC;EAAE,OAAO,EN2G1B,GAAO;;AM1G/B,0BAA0C;EAAE,OAAO,EN2G1B,GAAO;;AM1GhC,0BAA0C;EAAE,OAAO,EN2G1B,GAAO;;AM1GhC,2BAA2C;EAAE,OAAO,EN2G1B,GAAO;;AM1GjC,2BAA2C;EAAE,OAAO,EN8G1B,GAAO;;AM7GjC,4BAA4C;EAAE,OAAO,EN8G1B,GAAO;;AM7GlC,oBAAoC;EAAE,OAAO,ENgK1B,GAAO;;AM/J1B,sBAAsC;EAAE,OAAO,EN4J1B,GAAO;;AM3J5B,yBAAyC;EAAE,OAAO,ENwO1B,GAAO;;AMvO/B,kBAAkC;EAAE,OAAO,ENqO1B,GAAO;;AMpOxB,eAA+B;EAAE,OAAO,EN+N1B,GAAO;;AM9NrB,sBAAsC;EAAE,OAAO,EN+N1B,GAAO;;AM9N5B,uBAAuC;EAAE,OAAO,ENmO1B,GAAO;;AMlO7B,kBAAkC;EAAE,OAAO,ENxM1B,GAAO;;AMyMxB,yBAAyC;EAAE,OAAO,EN+G1B,GAAO;;AM9G/B,oBAAoC;EAAE,OAAO,ENnF1B,GAAO;;AMoF1B,iBAAiC;EAAE,OAAO,EN/I1B,GAAO;;AMgJvB,cAA8B;EAAE,OAAO,ENhX1B,GAAO;;AMiXpB,oBAAoC;EAAE,OAAO,ENxT1B,GAAO;;AMyT1B,2BAA2C;EAAE,OAAO,ENxT1B,GAAO;;AMyTjC,iBAAiC;EAAE,OAAO,ENyK1B,GAAO;;AMxKvB,wBAAwC;EAAE,OAAO,ENyK1B,GAAO;;AMxK9B,0BAA0C;EAAE,OAAO,ENtD1B,GAAO;;AMuDhC,wBAAwC;EAAE,OAAO,ENpD1B,GAAO;;AMqD9B,0BAA0C;EAAE,OAAO,ENvD1B,GAAO;;AMwDhC,2BAA2C;EAAE,OAAO,ENvD1B,GAAO;;AMwDjC,gBAAgC;EAAE,OAAO,ENxW1B,GAAO;;AMyWtB,kBAAkC;EAAE,OAAO,EN0M1B,GAAO;;AMzMxB,kBAAkC;EAAE,OAAO,ENpX1B,GAAO;;AMqXxB,gBAAgC;EAAE,OAAO,ENpE1B,GAAO;;AMqEtB,mBAAmC;EAAE,OAAO,EN1N1B,GAAO;;AM2NzB,gBAAgC;EAAE,OAAO,ENqE1B,GAAO;;AMpEtB,qBAAqC;EAAE,OAAO,ENtJ1B,GAAO;;AMuJ3B,iBAAiC;EAAE,OAAO,ENuJ1B,GAAO;;AMtJvB,iBAAiC;EAAE,OAAO,EN/L1B,GAAO;;AMgMvB,eAA+B;EAAE,OAAO,EN1D1B,GAAO;;AM2DrB;mBACmC;EAAE,OAAO,ENnI1B,GAAO;;AMoIzB,gBAAgC;EAAE,OAAO,EN2G1B,GAAO;;AM1GtB,iBAAiC;EAAE,OAAO,ENxC1B,GAAO;;AMyCvB,kBAAkC;EAAE,OAAO,ENrX1B,GAAO;;AMsXxB,cAA8B;EAAE,OAAO,ENpU1B,GAAO;;AMqUpB,aAA6B;EAAE,OAAO,ENgL1B,GAAO;;AM/KnB,gBAAgC;EAAE,OAAO,ENqL1B,GAAO;;AMpLtB,iBAAiC;EAAE,OAAO,ENa1B,GAAO;;AMZvB,oBAAoC;EAAE,OAAO,ENrC1B,GAAO;;AMsC1B,yBAAyC;EAAE,OAAO,EN8E1B,GAAO;;AM7E/B,+BAA+C;EAAE,OAAO,ENtX1B,GAAO;;AMuXrC,8BAA8C;EAAE,OAAO,ENxX1B,GAAO;;AMyXpC;8BAC8C;EAAE,OAAO,EN3T1B,GAAO;;AM4TpC,uBAAuC;EAAE,OAAO,ENjP1B,GAAO;;AMkP7B,qBAAqC;EAAE,OAAO,EN+K1B,GAAO;;AM9K3B,uBAAuC;EAAE,OAAO,ENmK1B,GAAO;;AMlK7B;cAC8B;EAAE,OAAO,ENoI1B,GAAO;;AMnIpB,wBAAwC;EAAE,OAAO,ENjB1B,GAAO;;AMkB9B,wBAAwC;EAAE,OAAO,EN6D1B,GAAO;;AM5D9B,gBAAgC;EAAE,OAAO,EN2C1B,GAAO;;AM1CtB,0BAA0C;EAAE,OAAO,EN7O1B,GAAO;;AM8OhC,oBAAoC;EAAE,OAAO,EN2K1B,GAAO;;AM1K1B,iBAAiC;EAAE,OAAO,ENvD1B,GAAO;;AMwDvB;;qBAEqC;EAAE,OAAO,ENsI1B,GAAO;;AMrI3B;yBACyC;EAAE,OAAO,ENjK1B,GAAO;;AMkK/B,gBAAgC;EAAE,OAAO,ENwK1B,GAAO;;AMvKtB,iBAAiC;EAAE,OAAO,ENvK1B,GAAO;;AMwKvB,iBAAiC;EAAE,OAAO,ENhB1B,GAAO;;AMiBvB,wBAAwC;EAAE,OAAO,ENhB1B,GAAO;;AMiB9B,6BAA6C;EAAE,OAAO,ENsE1B,GAAO;;AMrEnC,sBAAsC;EAAE,OAAO,ENoE1B,GAAO;;AMnE5B,oBAAoC;EAAE,OAAO,EN7Q1B,GAAO;;AM8Q1B,eAA+B;EAAE,OAAO,EN1Q1B,GAAO;;AM2QrB,qBAAqC;EAAE,OAAO,ENjD1B,GAAO;;AMkD3B,yBAAyC;EAAE,OAAO,ENjD1B,GAAO;;AMkD/B,iBAAiC;EAAE,OAAO,ENvQ1B,GAAO;;AMwQvB,iBAAiC;EAAE,OAAO,EN9I1B,GAAO;;AM+IvB,mBAAmC;EAAE,OAAO,ENzI1B,GAAO;;AM0IzB,cAA8B;EAAE,OAAO,EN9O1B,GAAO;;AM+OpB,mBAAmC;EAAE,OAAO,EN3W1B,GAAO;;AM4WzB,gBAAgC;EAAE,OAAO,EN9T1B,GAAO;;AM+TtB,cAA8B;EAAE,OAAO,ENnE1B,GAAO;;AMoEpB,gBAAgC;EAAE,OAAO,ENoC1B,GAAO;;AMnCtB,eAA+B;EAAE,OAAO,ENjS1B,GAAO;;AMkSrB,gBAAgC;EAAE,OAAO,ENjS1B,GAAO;;AMkStB,kBAAkC;EAAE,OAAO,ENtY1B,GAAO;;AMuYxB,yBAAyC;EAAE,OAAO,ENtY1B,GAAO;;AMuY/B,gBAAgC;EAAE,OAAO,EN2C1B,GAAO;;AM1CtB,uBAAuC;EAAE,OAAO,EN2C1B,GAAO;;AM1C7B,kBAAkC;EAAE,OAAO,ENvC1B,GAAO;;AMwCxB;cAC8B;EAAE,OAAO,EN3W1B,GAAO;;AM4WpB;eAC+B;EAAE,OAAO,EN2D1B,GAAO;;AM1DrB,eAA+B;EAAE,OAAO,ENuF1B,GAAO;;AMtFrB,kBAAkC;EAAE,OAAO,ENwB1B,GAAO;;AMvBxB,qBAAqC;EAAE,OAAO,ENpS1B,GAAO;;AMqS3B,qBAAqC;EAAE,OAAO,ENkB1B,GAAO;;AMjB3B,mBAAmC;EAAE,OAAO,EN1S1B,GAAO;;AM2SzB,qBAAqC;EAAE,OAAO,ENxP1B,GAAO;;AMyP3B,sBAAsC;EAAE,OAAO,ENjP1B,GAAO;;AMkP5B,uBAAuC;EAAE,OAAO,EN9P1B,GAAO;;AM+P7B,4BAA4C;EAAE,OAAO,ENxP1B,GAAO;;AMyPlC;;uBAEuC;EAAE,OAAO,ENjQ1B,GAAO;;AMkQ7B;yBACyC;EAAE,OAAO,ENvQ1B,GAAO;;AMwQ/B;uBACuC;EAAE,OAAO,ENxQ1B,GAAO;;AMyQ7B;uBACuC;EAAE,OAAO,EN7P1B,GAAO;;AM8P7B,sBAAsC;EAAE,OAAO,EN1Q1B,GAAO;;AM2Q5B,eAA+B;EAAE,OAAO,ENsG1B,GAAO;;AMrGrB,kBAAkC;EAAE,OAAO,ENlV1B,GAAO;;AMmVxB,mBAAmC;EAAE,OAAO,ENnL1B,GAAO;;AMoLzB;;;;oBAIoC;EAAE,OAAO,ENxK1B,GAAO;;AMyK1B,yBAAyC;EAAE,OAAO,ENpW1B,GAAO;;AMqW/B;gBACgC;EAAE,OAAO,EN1E1B,GAAO;;AM2EtB;iBACiC;EAAE,OAAO,ENpT1B,GAAO;;AMqTvB,qBAAqC;EAAE,OAAO,EN1O1B,GAAO;;AM2O3B,cAA8B;EAAE,OAAO,EN5O1B,GAAO;;AM6OpB,sBAAsC;EAAE,OAAO,EN7N1B,GAAO;;AM8N5B,wBAAwC;EAAE,OAAO,ENwB1B,GAAO;;AMvB9B,aAA6B;EAAE,OAAO,ENzF1B,GAAO;;AM0FnB;iBACiC;EAAE,OAAO,EN2F1B,GAAO;;AM1FvB;sBACsC;EAAE,OAAO,EN9H1B,GAAO;;AM+H5B;wBACwC;EAAE,OAAO,EN/H1B,GAAO;;AMgI9B,kBAAkC;EAAE,OAAO,EN3N1B,GAAO;;AM4NxB;sBACsC;EAAE,OAAO,ENrX1B,GAAO;;AMsX5B,iBAAiC;EAAE,OAAO,ENnO1B,GAAO;;AMoOvB,oBAAoC;EAAE,OAAO,ENlI1B,GAAO;;AMmI1B,kBAAkC;EAAE,OAAO,EN1C1B,GAAO;;AM2CxB,oBAAoC;EAAE,OAAO,EN7D1B,GAAO;;AM8D1B,2BAA2C;EAAE,OAAO,EN7D1B,GAAO;;AM8DjC,eAA+B;EAAE,OAAO,ENpb1B,GAAO;;AMqbrB;mBACmC;EAAE,OAAO,ENzQ1B,GAAO;;AM0QzB,cAA8B;EAAE,OAAO,ENsC1B,GAAO;;AMrCpB,qBAAqC;EAAE,OAAO,EN/b1B,GAAO;;AMgc3B,eAA+B;EAAE,OAAO,ENrH1B,GAAO;;AMsHrB,qBAAqC;EAAE,OAAO,ENlD1B,GAAO;;AMmD3B,iBAAiC;EAAE,OAAO,ENsC1B,GAAO;;AMrCvB,eAA+B;EAAE,OAAO,ENiF1B,GAAO;;AMhFrB,sBAAsC;EAAE,OAAO,ENvJ1B,GAAO;;AMwJ5B,eAA+B;EAAE,OAAO,ENuE1B,GAAO;;AMtErB,qBAAqC;EAAE,OAAO,ENjb1B,GAAO;;AMkb3B,iBAAiC;EAAE,OAAO,EN9I1B,GAAO;;AM+IvB,wBAAwC;EAAE,OAAO,ENhQ1B,GAAO;;AMiQ9B,kBAAkC;EAAE,OAAO,EN9Z1B,GAAO;;AM+ZxB,wBAAwC;EAAE,OAAO,ENla1B,GAAO;;AMma9B,sBAAsC;EAAE,OAAO,ENpa1B,GAAO;;AMqa5B,kBAAkC;EAAE,OAAO,ENta1B,GAAO;;AMuaxB,oBAAoC;EAAE,OAAO,ENpa1B,GAAO;;AMqa1B,oBAAoC;EAAE,OAAO,ENpa1B,GAAO;;AMqa1B,qBAAqC;EAAE,OAAO,ENld1B,GAAO;;AMmd3B,uBAAuC;EAAE,OAAO,ENld1B,GAAO;;AMmd7B,gBAAgC;EAAE,OAAO,ENY1B,GAAO;;AMXtB,oBAAoC;EAAE,OAAO,EN3X1B,GAAO;;AM4X1B,aAA6B;EAAE,OAAO,ENre1B,GAAO;;AMsenB,qBAAqC;EAAE,OAAO,ENjV1B,GAAO;;AMkV3B,sBAAsC;EAAE,OAAO,ENpK1B,GAAO;;AMqK5B,wBAAwC;EAAE,OAAO,ENrd1B,GAAO;;AMsd9B,qBAAqC;EAAE,OAAO,EN3f1B,GAAO;;AM4f3B,oBAAoC;EAAE,OAAO,ENvJ1B,GAAO;;AMwJ1B,qBAAqC;EAAE,OAAO,EN5N1B,GAAO;;AM6N3B,iBAAiC;EAAE,OAAO,EN1O1B,GAAO;;AM2OvB,wBAAwC;EAAE,OAAO,EN1O1B,GAAO;;AM2O9B,qBAAqC;EAAE,OAAO,ENN1B,GAAO;;AMO3B,oBAAoC;EAAE,OAAO,ENN1B,GAAO;;AMO1B,kBAAkC;EAAE,OAAO,EN/d1B,GAAO;;AMgexB,cAA8B;EAAE,OAAO,EN7c1B,GAAO;;AM8cpB,kBAAkC;EAAE,OAAO,EN1P1B,GAAO;;AM2PxB,oBAAoC;EAAE,OAAO,ENhhB1B,GAAO;;AMihB1B,aAA6B;EAAE,OAAO,EN7b1B,GAAO;;AM8bnB;;cAE8B;EAAE,OAAO,ENxQ1B,GAAO;;AMyQpB,mBAAmC;EAAE,OAAO,EN7M1B,GAAO;;AM8MzB,qBAAqC;EAAE,OAAO,ENpd1B,GAAO;;AMqd3B,yBAAyC;EAAE,OAAO,ENnZ1B,GAAO;;AMoZ/B,mBAAmC;EAAE,OAAO,ENxY1B,GAAO;;AMyYzB,mBAAmC;EAAE,OAAO,EN1T1B,GAAO;;AM2TzB,kBAAkC;EAAE,OAAO,ENxP1B,GAAO;;AMyPxB,iBAAiC;EAAE,OAAO,ENrH1B,GAAO;;AMsHvB,uBAAuC;EAAE,OAAO,ENzG1B,GAAO;;AM0G7B,sBAAsC;EAAE,OAAO,ENrG1B,GAAO;;AMsG5B,mBAAmC;EAAE,OAAO,ENpG1B,GAAO;;AMqGzB,oBAAoC;EAAE,OAAO,EN5c1B,GAAO;;AM6c1B,0BAA0C;EAAE,OAAO,EN9c1B,GAAO;;AM+chC,kBAAkC;EAAE,OAAO,EN3Y1B,GAAO;;AM4YxB,eAA+B;EAAE,OAAO,ENhH1B,GAAO;;AMiHrB,sBAAsC;EAAE,OAAO,ENI1B,GAAO;;AMH5B,qBAAqC;EAAE,OAAO,EN5M1B,GAAO;;AM6M3B,sBAAsC;EAAE,OAAO,ENpE1B,GAAO;;AMqE5B,oBAAoC;EAAE,OAAO,ENhS1B,GAAO;;AMiS1B,gBAAgC;EAAE,OAAO,ENG1B,GAAO;;AMFtB,eAA+B;EAAE,OAAO,ENtO1B,GAAO;;AMuOrB,kBAAkC;EAAE,OAAO,EN7N1B,GAAO;;AM8NxB,sBAAsC;EAAE,OAAO,ENhC1B,GAAO;;AMiC5B,0BAA0C;EAAE,OAAO,ENhC1B,GAAO;;AMiChC,uBAAuC;EAAE,OAAO,END1B,GAAO;;AME7B,sBAAsC;EAAE,OAAO,EN1O1B,GAAO;;AM2O5B,qBAAqC;EAAE,OAAO,ENF1B,GAAO;;AMG3B,sBAAsC;EAAE,OAAO,EN3O1B,GAAO;;AM4O5B,wBAAwC;EAAE,OAAO,EN1O1B,GAAO;;AM2O9B,wBAAwC;EAAE,OAAO,EN5O1B,GAAO;;AM6O9B,iBAAiC;EAAE,OAAO,ENvN1B,GAAO;;AMwNvB,4BAA4C;EAAE,OAAO,EN9X1B,GAAO;;AM+XlC,sBAAsC;EAAE,OAAO,ENhM1B,GAAO;;AMiM5B,mBAAmC;EAAE,OAAO,ENI1B,GAAO;;AMHzB,iBAAiC;EAAE,OAAO,EN7I1B,GAAO;;AM8IvB,oBAAoC;EAAE,OAAO,ENjB1B,GAAO;;AMkB1B,qBAAqC;EAAE,OAAO,ENhB1B,GAAO;;AMiB3B;cAC8B;EAAE,OAAO,ENphB1B,GAAO;;AMqhBpB,kBAAkC;EAAE,OAAO,ENd1B,GAAO;;AMexB,gBAAgC;EAAE,OAAO,ENnD1B,GAAO;;AMoDtB,iBAAiC;EAAE,OAAO,ENvF1B,GAAO;;AMwFvB,iBAAiC;EAAE,OAAO,ENrP1B,GAAO", +"sources": ["../scss/_path.scss","../scss/_core.scss","../scss/_larger.scss","../scss/_fixed-width.scss","../scss/_list.scss","../scss/_variables.scss","../scss/_bordered-pulled.scss","../scss/_animated.scss","../scss/_rotated-flipped.scss","../scss/_mixins.scss","../scss/_stacked.scss","../scss/_icons.scss"], +"names": [], +"file": "font-awesome.css" +} diff --git a/node_modules/font-awesome/css/font-awesome.min.css b/node_modules/font-awesome/css/font-awesome.min.css new file mode 100644 index 0000000000..540440ce89 --- /dev/null +++ b/node_modules/font-awesome/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/node_modules/font-awesome/fonts/FontAwesome.otf b/node_modules/font-awesome/fonts/FontAwesome.otf new file mode 100644 index 0000000000..401ec0f36e Binary files /dev/null and b/node_modules/font-awesome/fonts/FontAwesome.otf differ diff --git a/node_modules/font-awesome/fonts/fontawesome-webfont.eot b/node_modules/font-awesome/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000000..e9f60ca953 Binary files /dev/null and b/node_modules/font-awesome/fonts/fontawesome-webfont.eot differ diff --git a/node_modules/font-awesome/fonts/fontawesome-webfont.svg b/node_modules/font-awesome/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000000..855c845e53 --- /dev/null +++ b/node_modules/font-awesome/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/node_modules/font-awesome/fonts/fontawesome-webfont.ttf b/node_modules/font-awesome/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000000..35acda2fa1 Binary files /dev/null and b/node_modules/font-awesome/fonts/fontawesome-webfont.ttf differ diff --git a/node_modules/font-awesome/fonts/fontawesome-webfont.woff b/node_modules/font-awesome/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000000..400014a4b0 Binary files /dev/null and b/node_modules/font-awesome/fonts/fontawesome-webfont.woff differ diff --git a/node_modules/font-awesome/fonts/fontawesome-webfont.woff2 b/node_modules/font-awesome/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000000..4d13fc6040 Binary files /dev/null and b/node_modules/font-awesome/fonts/fontawesome-webfont.woff2 differ diff --git a/node_modules/font-awesome/less/animated.less b/node_modules/font-awesome/less/animated.less new file mode 100644 index 0000000000..66ad52a5ba --- /dev/null +++ b/node_modules/font-awesome/less/animated.less @@ -0,0 +1,34 @@ +// Animated Icons +// -------------------------- + +.@{fa-css-prefix}-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.@{fa-css-prefix}-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} diff --git a/node_modules/font-awesome/less/bordered-pulled.less b/node_modules/font-awesome/less/bordered-pulled.less new file mode 100644 index 0000000000..f1c8ad75f5 --- /dev/null +++ b/node_modules/font-awesome/less/bordered-pulled.less @@ -0,0 +1,25 @@ +// Bordered & Pulled +// ------------------------- + +.@{fa-css-prefix}-border { + padding: .2em .25em .15em; + border: solid .08em @fa-border-color; + border-radius: .1em; +} + +.@{fa-css-prefix}-pull-left { float: left; } +.@{fa-css-prefix}-pull-right { float: right; } + +.@{fa-css-prefix} { + &.@{fa-css-prefix}-pull-left { margin-right: .3em; } + &.@{fa-css-prefix}-pull-right { margin-left: .3em; } +} + +/* Deprecated as of 4.4.0 */ +.pull-right { float: right; } +.pull-left { float: left; } + +.@{fa-css-prefix} { + &.pull-left { margin-right: .3em; } + &.pull-right { margin-left: .3em; } +} diff --git a/node_modules/font-awesome/less/core.less b/node_modules/font-awesome/less/core.less new file mode 100644 index 0000000000..c577ac84a6 --- /dev/null +++ b/node_modules/font-awesome/less/core.less @@ -0,0 +1,12 @@ +// Base Class Definition +// ------------------------- + +.@{fa-css-prefix} { + display: inline-block; + font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration + font-size: inherit; // can't have font-size inherit on line above, so need to override + text-rendering: auto; // optimizelegibility throws things off #1094 + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + +} diff --git a/node_modules/font-awesome/less/fixed-width.less b/node_modules/font-awesome/less/fixed-width.less new file mode 100644 index 0000000000..110289f2f4 --- /dev/null +++ b/node_modules/font-awesome/less/fixed-width.less @@ -0,0 +1,6 @@ +// Fixed Width Icons +// ------------------------- +.@{fa-css-prefix}-fw { + width: (18em / 14); + text-align: center; +} diff --git a/node_modules/font-awesome/less/font-awesome.less b/node_modules/font-awesome/less/font-awesome.less new file mode 100644 index 0000000000..c3677def31 --- /dev/null +++ b/node_modules/font-awesome/less/font-awesome.less @@ -0,0 +1,18 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ + +@import "variables.less"; +@import "mixins.less"; +@import "path.less"; +@import "core.less"; +@import "larger.less"; +@import "fixed-width.less"; +@import "list.less"; +@import "bordered-pulled.less"; +@import "animated.less"; +@import "rotated-flipped.less"; +@import "stacked.less"; +@import "icons.less"; +@import "screen-reader.less"; diff --git a/node_modules/font-awesome/less/icons.less b/node_modules/font-awesome/less/icons.less new file mode 100644 index 0000000000..159d600425 --- /dev/null +++ b/node_modules/font-awesome/less/icons.less @@ -0,0 +1,789 @@ +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ + +.@{fa-css-prefix}-glass:before { content: @fa-var-glass; } +.@{fa-css-prefix}-music:before { content: @fa-var-music; } +.@{fa-css-prefix}-search:before { content: @fa-var-search; } +.@{fa-css-prefix}-envelope-o:before { content: @fa-var-envelope-o; } +.@{fa-css-prefix}-heart:before { content: @fa-var-heart; } +.@{fa-css-prefix}-star:before { content: @fa-var-star; } +.@{fa-css-prefix}-star-o:before { content: @fa-var-star-o; } +.@{fa-css-prefix}-user:before { content: @fa-var-user; } +.@{fa-css-prefix}-film:before { content: @fa-var-film; } +.@{fa-css-prefix}-th-large:before { content: @fa-var-th-large; } +.@{fa-css-prefix}-th:before { content: @fa-var-th; } +.@{fa-css-prefix}-th-list:before { content: @fa-var-th-list; } +.@{fa-css-prefix}-check:before { content: @fa-var-check; } +.@{fa-css-prefix}-remove:before, +.@{fa-css-prefix}-close:before, +.@{fa-css-prefix}-times:before { content: @fa-var-times; } +.@{fa-css-prefix}-search-plus:before { content: @fa-var-search-plus; } +.@{fa-css-prefix}-search-minus:before { content: @fa-var-search-minus; } +.@{fa-css-prefix}-power-off:before { content: @fa-var-power-off; } +.@{fa-css-prefix}-signal:before { content: @fa-var-signal; } +.@{fa-css-prefix}-gear:before, +.@{fa-css-prefix}-cog:before { content: @fa-var-cog; } +.@{fa-css-prefix}-trash-o:before { content: @fa-var-trash-o; } +.@{fa-css-prefix}-home:before { content: @fa-var-home; } +.@{fa-css-prefix}-file-o:before { content: @fa-var-file-o; } +.@{fa-css-prefix}-clock-o:before { content: @fa-var-clock-o; } +.@{fa-css-prefix}-road:before { content: @fa-var-road; } +.@{fa-css-prefix}-download:before { content: @fa-var-download; } +.@{fa-css-prefix}-arrow-circle-o-down:before { content: @fa-var-arrow-circle-o-down; } +.@{fa-css-prefix}-arrow-circle-o-up:before { content: @fa-var-arrow-circle-o-up; } +.@{fa-css-prefix}-inbox:before { content: @fa-var-inbox; } +.@{fa-css-prefix}-play-circle-o:before { content: @fa-var-play-circle-o; } +.@{fa-css-prefix}-rotate-right:before, +.@{fa-css-prefix}-repeat:before { content: @fa-var-repeat; } +.@{fa-css-prefix}-refresh:before { content: @fa-var-refresh; } +.@{fa-css-prefix}-list-alt:before { content: @fa-var-list-alt; } +.@{fa-css-prefix}-lock:before { content: @fa-var-lock; } +.@{fa-css-prefix}-flag:before { content: @fa-var-flag; } +.@{fa-css-prefix}-headphones:before { content: @fa-var-headphones; } +.@{fa-css-prefix}-volume-off:before { content: @fa-var-volume-off; } +.@{fa-css-prefix}-volume-down:before { content: @fa-var-volume-down; } +.@{fa-css-prefix}-volume-up:before { content: @fa-var-volume-up; } +.@{fa-css-prefix}-qrcode:before { content: @fa-var-qrcode; } +.@{fa-css-prefix}-barcode:before { content: @fa-var-barcode; } +.@{fa-css-prefix}-tag:before { content: @fa-var-tag; } +.@{fa-css-prefix}-tags:before { content: @fa-var-tags; } +.@{fa-css-prefix}-book:before { content: @fa-var-book; } +.@{fa-css-prefix}-bookmark:before { content: @fa-var-bookmark; } +.@{fa-css-prefix}-print:before { content: @fa-var-print; } +.@{fa-css-prefix}-camera:before { content: @fa-var-camera; } +.@{fa-css-prefix}-font:before { content: @fa-var-font; } +.@{fa-css-prefix}-bold:before { content: @fa-var-bold; } +.@{fa-css-prefix}-italic:before { content: @fa-var-italic; } +.@{fa-css-prefix}-text-height:before { content: @fa-var-text-height; } +.@{fa-css-prefix}-text-width:before { content: @fa-var-text-width; } +.@{fa-css-prefix}-align-left:before { content: @fa-var-align-left; } +.@{fa-css-prefix}-align-center:before { content: @fa-var-align-center; } +.@{fa-css-prefix}-align-right:before { content: @fa-var-align-right; } +.@{fa-css-prefix}-align-justify:before { content: @fa-var-align-justify; } +.@{fa-css-prefix}-list:before { content: @fa-var-list; } +.@{fa-css-prefix}-dedent:before, +.@{fa-css-prefix}-outdent:before { content: @fa-var-outdent; } +.@{fa-css-prefix}-indent:before { content: @fa-var-indent; } +.@{fa-css-prefix}-video-camera:before { content: @fa-var-video-camera; } +.@{fa-css-prefix}-photo:before, +.@{fa-css-prefix}-image:before, +.@{fa-css-prefix}-picture-o:before { content: @fa-var-picture-o; } +.@{fa-css-prefix}-pencil:before { content: @fa-var-pencil; } +.@{fa-css-prefix}-map-marker:before { content: @fa-var-map-marker; } +.@{fa-css-prefix}-adjust:before { content: @fa-var-adjust; } +.@{fa-css-prefix}-tint:before { content: @fa-var-tint; } +.@{fa-css-prefix}-edit:before, +.@{fa-css-prefix}-pencil-square-o:before { content: @fa-var-pencil-square-o; } +.@{fa-css-prefix}-share-square-o:before { content: @fa-var-share-square-o; } +.@{fa-css-prefix}-check-square-o:before { content: @fa-var-check-square-o; } +.@{fa-css-prefix}-arrows:before { content: @fa-var-arrows; } +.@{fa-css-prefix}-step-backward:before { content: @fa-var-step-backward; } +.@{fa-css-prefix}-fast-backward:before { content: @fa-var-fast-backward; } +.@{fa-css-prefix}-backward:before { content: @fa-var-backward; } +.@{fa-css-prefix}-play:before { content: @fa-var-play; } +.@{fa-css-prefix}-pause:before { content: @fa-var-pause; } +.@{fa-css-prefix}-stop:before { content: @fa-var-stop; } +.@{fa-css-prefix}-forward:before { content: @fa-var-forward; } +.@{fa-css-prefix}-fast-forward:before { content: @fa-var-fast-forward; } +.@{fa-css-prefix}-step-forward:before { content: @fa-var-step-forward; } +.@{fa-css-prefix}-eject:before { content: @fa-var-eject; } +.@{fa-css-prefix}-chevron-left:before { content: @fa-var-chevron-left; } +.@{fa-css-prefix}-chevron-right:before { content: @fa-var-chevron-right; } +.@{fa-css-prefix}-plus-circle:before { content: @fa-var-plus-circle; } +.@{fa-css-prefix}-minus-circle:before { content: @fa-var-minus-circle; } +.@{fa-css-prefix}-times-circle:before { content: @fa-var-times-circle; } +.@{fa-css-prefix}-check-circle:before { content: @fa-var-check-circle; } +.@{fa-css-prefix}-question-circle:before { content: @fa-var-question-circle; } +.@{fa-css-prefix}-info-circle:before { content: @fa-var-info-circle; } +.@{fa-css-prefix}-crosshairs:before { content: @fa-var-crosshairs; } +.@{fa-css-prefix}-times-circle-o:before { content: @fa-var-times-circle-o; } +.@{fa-css-prefix}-check-circle-o:before { content: @fa-var-check-circle-o; } +.@{fa-css-prefix}-ban:before { content: @fa-var-ban; } +.@{fa-css-prefix}-arrow-left:before { content: @fa-var-arrow-left; } +.@{fa-css-prefix}-arrow-right:before { content: @fa-var-arrow-right; } +.@{fa-css-prefix}-arrow-up:before { content: @fa-var-arrow-up; } +.@{fa-css-prefix}-arrow-down:before { content: @fa-var-arrow-down; } +.@{fa-css-prefix}-mail-forward:before, +.@{fa-css-prefix}-share:before { content: @fa-var-share; } +.@{fa-css-prefix}-expand:before { content: @fa-var-expand; } +.@{fa-css-prefix}-compress:before { content: @fa-var-compress; } +.@{fa-css-prefix}-plus:before { content: @fa-var-plus; } +.@{fa-css-prefix}-minus:before { content: @fa-var-minus; } +.@{fa-css-prefix}-asterisk:before { content: @fa-var-asterisk; } +.@{fa-css-prefix}-exclamation-circle:before { content: @fa-var-exclamation-circle; } +.@{fa-css-prefix}-gift:before { content: @fa-var-gift; } +.@{fa-css-prefix}-leaf:before { content: @fa-var-leaf; } +.@{fa-css-prefix}-fire:before { content: @fa-var-fire; } +.@{fa-css-prefix}-eye:before { content: @fa-var-eye; } +.@{fa-css-prefix}-eye-slash:before { content: @fa-var-eye-slash; } +.@{fa-css-prefix}-warning:before, +.@{fa-css-prefix}-exclamation-triangle:before { content: @fa-var-exclamation-triangle; } +.@{fa-css-prefix}-plane:before { content: @fa-var-plane; } +.@{fa-css-prefix}-calendar:before { content: @fa-var-calendar; } +.@{fa-css-prefix}-random:before { content: @fa-var-random; } +.@{fa-css-prefix}-comment:before { content: @fa-var-comment; } +.@{fa-css-prefix}-magnet:before { content: @fa-var-magnet; } +.@{fa-css-prefix}-chevron-up:before { content: @fa-var-chevron-up; } +.@{fa-css-prefix}-chevron-down:before { content: @fa-var-chevron-down; } +.@{fa-css-prefix}-retweet:before { content: @fa-var-retweet; } +.@{fa-css-prefix}-shopping-cart:before { content: @fa-var-shopping-cart; } +.@{fa-css-prefix}-folder:before { content: @fa-var-folder; } +.@{fa-css-prefix}-folder-open:before { content: @fa-var-folder-open; } +.@{fa-css-prefix}-arrows-v:before { content: @fa-var-arrows-v; } +.@{fa-css-prefix}-arrows-h:before { content: @fa-var-arrows-h; } +.@{fa-css-prefix}-bar-chart-o:before, +.@{fa-css-prefix}-bar-chart:before { content: @fa-var-bar-chart; } +.@{fa-css-prefix}-twitter-square:before { content: @fa-var-twitter-square; } +.@{fa-css-prefix}-facebook-square:before { content: @fa-var-facebook-square; } +.@{fa-css-prefix}-camera-retro:before { content: @fa-var-camera-retro; } +.@{fa-css-prefix}-key:before { content: @fa-var-key; } +.@{fa-css-prefix}-gears:before, +.@{fa-css-prefix}-cogs:before { content: @fa-var-cogs; } +.@{fa-css-prefix}-comments:before { content: @fa-var-comments; } +.@{fa-css-prefix}-thumbs-o-up:before { content: @fa-var-thumbs-o-up; } +.@{fa-css-prefix}-thumbs-o-down:before { content: @fa-var-thumbs-o-down; } +.@{fa-css-prefix}-star-half:before { content: @fa-var-star-half; } +.@{fa-css-prefix}-heart-o:before { content: @fa-var-heart-o; } +.@{fa-css-prefix}-sign-out:before { content: @fa-var-sign-out; } +.@{fa-css-prefix}-linkedin-square:before { content: @fa-var-linkedin-square; } +.@{fa-css-prefix}-thumb-tack:before { content: @fa-var-thumb-tack; } +.@{fa-css-prefix}-external-link:before { content: @fa-var-external-link; } +.@{fa-css-prefix}-sign-in:before { content: @fa-var-sign-in; } +.@{fa-css-prefix}-trophy:before { content: @fa-var-trophy; } +.@{fa-css-prefix}-github-square:before { content: @fa-var-github-square; } +.@{fa-css-prefix}-upload:before { content: @fa-var-upload; } +.@{fa-css-prefix}-lemon-o:before { content: @fa-var-lemon-o; } +.@{fa-css-prefix}-phone:before { content: @fa-var-phone; } +.@{fa-css-prefix}-square-o:before { content: @fa-var-square-o; } +.@{fa-css-prefix}-bookmark-o:before { content: @fa-var-bookmark-o; } +.@{fa-css-prefix}-phone-square:before { content: @fa-var-phone-square; } +.@{fa-css-prefix}-twitter:before { content: @fa-var-twitter; } +.@{fa-css-prefix}-facebook-f:before, +.@{fa-css-prefix}-facebook:before { content: @fa-var-facebook; } +.@{fa-css-prefix}-github:before { content: @fa-var-github; } +.@{fa-css-prefix}-unlock:before { content: @fa-var-unlock; } +.@{fa-css-prefix}-credit-card:before { content: @fa-var-credit-card; } +.@{fa-css-prefix}-feed:before, +.@{fa-css-prefix}-rss:before { content: @fa-var-rss; } +.@{fa-css-prefix}-hdd-o:before { content: @fa-var-hdd-o; } +.@{fa-css-prefix}-bullhorn:before { content: @fa-var-bullhorn; } +.@{fa-css-prefix}-bell:before { content: @fa-var-bell; } +.@{fa-css-prefix}-certificate:before { content: @fa-var-certificate; } +.@{fa-css-prefix}-hand-o-right:before { content: @fa-var-hand-o-right; } +.@{fa-css-prefix}-hand-o-left:before { content: @fa-var-hand-o-left; } +.@{fa-css-prefix}-hand-o-up:before { content: @fa-var-hand-o-up; } +.@{fa-css-prefix}-hand-o-down:before { content: @fa-var-hand-o-down; } +.@{fa-css-prefix}-arrow-circle-left:before { content: @fa-var-arrow-circle-left; } +.@{fa-css-prefix}-arrow-circle-right:before { content: @fa-var-arrow-circle-right; } +.@{fa-css-prefix}-arrow-circle-up:before { content: @fa-var-arrow-circle-up; } +.@{fa-css-prefix}-arrow-circle-down:before { content: @fa-var-arrow-circle-down; } +.@{fa-css-prefix}-globe:before { content: @fa-var-globe; } +.@{fa-css-prefix}-wrench:before { content: @fa-var-wrench; } +.@{fa-css-prefix}-tasks:before { content: @fa-var-tasks; } +.@{fa-css-prefix}-filter:before { content: @fa-var-filter; } +.@{fa-css-prefix}-briefcase:before { content: @fa-var-briefcase; } +.@{fa-css-prefix}-arrows-alt:before { content: @fa-var-arrows-alt; } +.@{fa-css-prefix}-group:before, +.@{fa-css-prefix}-users:before { content: @fa-var-users; } +.@{fa-css-prefix}-chain:before, +.@{fa-css-prefix}-link:before { content: @fa-var-link; } +.@{fa-css-prefix}-cloud:before { content: @fa-var-cloud; } +.@{fa-css-prefix}-flask:before { content: @fa-var-flask; } +.@{fa-css-prefix}-cut:before, +.@{fa-css-prefix}-scissors:before { content: @fa-var-scissors; } +.@{fa-css-prefix}-copy:before, +.@{fa-css-prefix}-files-o:before { content: @fa-var-files-o; } +.@{fa-css-prefix}-paperclip:before { content: @fa-var-paperclip; } +.@{fa-css-prefix}-save:before, +.@{fa-css-prefix}-floppy-o:before { content: @fa-var-floppy-o; } +.@{fa-css-prefix}-square:before { content: @fa-var-square; } +.@{fa-css-prefix}-navicon:before, +.@{fa-css-prefix}-reorder:before, +.@{fa-css-prefix}-bars:before { content: @fa-var-bars; } +.@{fa-css-prefix}-list-ul:before { content: @fa-var-list-ul; } +.@{fa-css-prefix}-list-ol:before { content: @fa-var-list-ol; } +.@{fa-css-prefix}-strikethrough:before { content: @fa-var-strikethrough; } +.@{fa-css-prefix}-underline:before { content: @fa-var-underline; } +.@{fa-css-prefix}-table:before { content: @fa-var-table; } +.@{fa-css-prefix}-magic:before { content: @fa-var-magic; } +.@{fa-css-prefix}-truck:before { content: @fa-var-truck; } +.@{fa-css-prefix}-pinterest:before { content: @fa-var-pinterest; } +.@{fa-css-prefix}-pinterest-square:before { content: @fa-var-pinterest-square; } +.@{fa-css-prefix}-google-plus-square:before { content: @fa-var-google-plus-square; } +.@{fa-css-prefix}-google-plus:before { content: @fa-var-google-plus; } +.@{fa-css-prefix}-money:before { content: @fa-var-money; } +.@{fa-css-prefix}-caret-down:before { content: @fa-var-caret-down; } +.@{fa-css-prefix}-caret-up:before { content: @fa-var-caret-up; } +.@{fa-css-prefix}-caret-left:before { content: @fa-var-caret-left; } +.@{fa-css-prefix}-caret-right:before { content: @fa-var-caret-right; } +.@{fa-css-prefix}-columns:before { content: @fa-var-columns; } +.@{fa-css-prefix}-unsorted:before, +.@{fa-css-prefix}-sort:before { content: @fa-var-sort; } +.@{fa-css-prefix}-sort-down:before, +.@{fa-css-prefix}-sort-desc:before { content: @fa-var-sort-desc; } +.@{fa-css-prefix}-sort-up:before, +.@{fa-css-prefix}-sort-asc:before { content: @fa-var-sort-asc; } +.@{fa-css-prefix}-envelope:before { content: @fa-var-envelope; } +.@{fa-css-prefix}-linkedin:before { content: @fa-var-linkedin; } +.@{fa-css-prefix}-rotate-left:before, +.@{fa-css-prefix}-undo:before { content: @fa-var-undo; } +.@{fa-css-prefix}-legal:before, +.@{fa-css-prefix}-gavel:before { content: @fa-var-gavel; } +.@{fa-css-prefix}-dashboard:before, +.@{fa-css-prefix}-tachometer:before { content: @fa-var-tachometer; } +.@{fa-css-prefix}-comment-o:before { content: @fa-var-comment-o; } +.@{fa-css-prefix}-comments-o:before { content: @fa-var-comments-o; } +.@{fa-css-prefix}-flash:before, +.@{fa-css-prefix}-bolt:before { content: @fa-var-bolt; } +.@{fa-css-prefix}-sitemap:before { content: @fa-var-sitemap; } +.@{fa-css-prefix}-umbrella:before { content: @fa-var-umbrella; } +.@{fa-css-prefix}-paste:before, +.@{fa-css-prefix}-clipboard:before { content: @fa-var-clipboard; } +.@{fa-css-prefix}-lightbulb-o:before { content: @fa-var-lightbulb-o; } +.@{fa-css-prefix}-exchange:before { content: @fa-var-exchange; } +.@{fa-css-prefix}-cloud-download:before { content: @fa-var-cloud-download; } +.@{fa-css-prefix}-cloud-upload:before { content: @fa-var-cloud-upload; } +.@{fa-css-prefix}-user-md:before { content: @fa-var-user-md; } +.@{fa-css-prefix}-stethoscope:before { content: @fa-var-stethoscope; } +.@{fa-css-prefix}-suitcase:before { content: @fa-var-suitcase; } +.@{fa-css-prefix}-bell-o:before { content: @fa-var-bell-o; } +.@{fa-css-prefix}-coffee:before { content: @fa-var-coffee; } +.@{fa-css-prefix}-cutlery:before { content: @fa-var-cutlery; } +.@{fa-css-prefix}-file-text-o:before { content: @fa-var-file-text-o; } +.@{fa-css-prefix}-building-o:before { content: @fa-var-building-o; } +.@{fa-css-prefix}-hospital-o:before { content: @fa-var-hospital-o; } +.@{fa-css-prefix}-ambulance:before { content: @fa-var-ambulance; } +.@{fa-css-prefix}-medkit:before { content: @fa-var-medkit; } +.@{fa-css-prefix}-fighter-jet:before { content: @fa-var-fighter-jet; } +.@{fa-css-prefix}-beer:before { content: @fa-var-beer; } +.@{fa-css-prefix}-h-square:before { content: @fa-var-h-square; } +.@{fa-css-prefix}-plus-square:before { content: @fa-var-plus-square; } +.@{fa-css-prefix}-angle-double-left:before { content: @fa-var-angle-double-left; } +.@{fa-css-prefix}-angle-double-right:before { content: @fa-var-angle-double-right; } +.@{fa-css-prefix}-angle-double-up:before { content: @fa-var-angle-double-up; } +.@{fa-css-prefix}-angle-double-down:before { content: @fa-var-angle-double-down; } +.@{fa-css-prefix}-angle-left:before { content: @fa-var-angle-left; } +.@{fa-css-prefix}-angle-right:before { content: @fa-var-angle-right; } +.@{fa-css-prefix}-angle-up:before { content: @fa-var-angle-up; } +.@{fa-css-prefix}-angle-down:before { content: @fa-var-angle-down; } +.@{fa-css-prefix}-desktop:before { content: @fa-var-desktop; } +.@{fa-css-prefix}-laptop:before { content: @fa-var-laptop; } +.@{fa-css-prefix}-tablet:before { content: @fa-var-tablet; } +.@{fa-css-prefix}-mobile-phone:before, +.@{fa-css-prefix}-mobile:before { content: @fa-var-mobile; } +.@{fa-css-prefix}-circle-o:before { content: @fa-var-circle-o; } +.@{fa-css-prefix}-quote-left:before { content: @fa-var-quote-left; } +.@{fa-css-prefix}-quote-right:before { content: @fa-var-quote-right; } +.@{fa-css-prefix}-spinner:before { content: @fa-var-spinner; } +.@{fa-css-prefix}-circle:before { content: @fa-var-circle; } +.@{fa-css-prefix}-mail-reply:before, +.@{fa-css-prefix}-reply:before { content: @fa-var-reply; } +.@{fa-css-prefix}-github-alt:before { content: @fa-var-github-alt; } +.@{fa-css-prefix}-folder-o:before { content: @fa-var-folder-o; } +.@{fa-css-prefix}-folder-open-o:before { content: @fa-var-folder-open-o; } +.@{fa-css-prefix}-smile-o:before { content: @fa-var-smile-o; } +.@{fa-css-prefix}-frown-o:before { content: @fa-var-frown-o; } +.@{fa-css-prefix}-meh-o:before { content: @fa-var-meh-o; } +.@{fa-css-prefix}-gamepad:before { content: @fa-var-gamepad; } +.@{fa-css-prefix}-keyboard-o:before { content: @fa-var-keyboard-o; } +.@{fa-css-prefix}-flag-o:before { content: @fa-var-flag-o; } +.@{fa-css-prefix}-flag-checkered:before { content: @fa-var-flag-checkered; } +.@{fa-css-prefix}-terminal:before { content: @fa-var-terminal; } +.@{fa-css-prefix}-code:before { content: @fa-var-code; } +.@{fa-css-prefix}-mail-reply-all:before, +.@{fa-css-prefix}-reply-all:before { content: @fa-var-reply-all; } +.@{fa-css-prefix}-star-half-empty:before, +.@{fa-css-prefix}-star-half-full:before, +.@{fa-css-prefix}-star-half-o:before { content: @fa-var-star-half-o; } +.@{fa-css-prefix}-location-arrow:before { content: @fa-var-location-arrow; } +.@{fa-css-prefix}-crop:before { content: @fa-var-crop; } +.@{fa-css-prefix}-code-fork:before { content: @fa-var-code-fork; } +.@{fa-css-prefix}-unlink:before, +.@{fa-css-prefix}-chain-broken:before { content: @fa-var-chain-broken; } +.@{fa-css-prefix}-question:before { content: @fa-var-question; } +.@{fa-css-prefix}-info:before { content: @fa-var-info; } +.@{fa-css-prefix}-exclamation:before { content: @fa-var-exclamation; } +.@{fa-css-prefix}-superscript:before { content: @fa-var-superscript; } +.@{fa-css-prefix}-subscript:before { content: @fa-var-subscript; } +.@{fa-css-prefix}-eraser:before { content: @fa-var-eraser; } +.@{fa-css-prefix}-puzzle-piece:before { content: @fa-var-puzzle-piece; } +.@{fa-css-prefix}-microphone:before { content: @fa-var-microphone; } +.@{fa-css-prefix}-microphone-slash:before { content: @fa-var-microphone-slash; } +.@{fa-css-prefix}-shield:before { content: @fa-var-shield; } +.@{fa-css-prefix}-calendar-o:before { content: @fa-var-calendar-o; } +.@{fa-css-prefix}-fire-extinguisher:before { content: @fa-var-fire-extinguisher; } +.@{fa-css-prefix}-rocket:before { content: @fa-var-rocket; } +.@{fa-css-prefix}-maxcdn:before { content: @fa-var-maxcdn; } +.@{fa-css-prefix}-chevron-circle-left:before { content: @fa-var-chevron-circle-left; } +.@{fa-css-prefix}-chevron-circle-right:before { content: @fa-var-chevron-circle-right; } +.@{fa-css-prefix}-chevron-circle-up:before { content: @fa-var-chevron-circle-up; } +.@{fa-css-prefix}-chevron-circle-down:before { content: @fa-var-chevron-circle-down; } +.@{fa-css-prefix}-html5:before { content: @fa-var-html5; } +.@{fa-css-prefix}-css3:before { content: @fa-var-css3; } +.@{fa-css-prefix}-anchor:before { content: @fa-var-anchor; } +.@{fa-css-prefix}-unlock-alt:before { content: @fa-var-unlock-alt; } +.@{fa-css-prefix}-bullseye:before { content: @fa-var-bullseye; } +.@{fa-css-prefix}-ellipsis-h:before { content: @fa-var-ellipsis-h; } +.@{fa-css-prefix}-ellipsis-v:before { content: @fa-var-ellipsis-v; } +.@{fa-css-prefix}-rss-square:before { content: @fa-var-rss-square; } +.@{fa-css-prefix}-play-circle:before { content: @fa-var-play-circle; } +.@{fa-css-prefix}-ticket:before { content: @fa-var-ticket; } +.@{fa-css-prefix}-minus-square:before { content: @fa-var-minus-square; } +.@{fa-css-prefix}-minus-square-o:before { content: @fa-var-minus-square-o; } +.@{fa-css-prefix}-level-up:before { content: @fa-var-level-up; } +.@{fa-css-prefix}-level-down:before { content: @fa-var-level-down; } +.@{fa-css-prefix}-check-square:before { content: @fa-var-check-square; } +.@{fa-css-prefix}-pencil-square:before { content: @fa-var-pencil-square; } +.@{fa-css-prefix}-external-link-square:before { content: @fa-var-external-link-square; } +.@{fa-css-prefix}-share-square:before { content: @fa-var-share-square; } +.@{fa-css-prefix}-compass:before { content: @fa-var-compass; } +.@{fa-css-prefix}-toggle-down:before, +.@{fa-css-prefix}-caret-square-o-down:before { content: @fa-var-caret-square-o-down; } +.@{fa-css-prefix}-toggle-up:before, +.@{fa-css-prefix}-caret-square-o-up:before { content: @fa-var-caret-square-o-up; } +.@{fa-css-prefix}-toggle-right:before, +.@{fa-css-prefix}-caret-square-o-right:before { content: @fa-var-caret-square-o-right; } +.@{fa-css-prefix}-euro:before, +.@{fa-css-prefix}-eur:before { content: @fa-var-eur; } +.@{fa-css-prefix}-gbp:before { content: @fa-var-gbp; } +.@{fa-css-prefix}-dollar:before, +.@{fa-css-prefix}-usd:before { content: @fa-var-usd; } +.@{fa-css-prefix}-rupee:before, +.@{fa-css-prefix}-inr:before { content: @fa-var-inr; } +.@{fa-css-prefix}-cny:before, +.@{fa-css-prefix}-rmb:before, +.@{fa-css-prefix}-yen:before, +.@{fa-css-prefix}-jpy:before { content: @fa-var-jpy; } +.@{fa-css-prefix}-ruble:before, +.@{fa-css-prefix}-rouble:before, +.@{fa-css-prefix}-rub:before { content: @fa-var-rub; } +.@{fa-css-prefix}-won:before, +.@{fa-css-prefix}-krw:before { content: @fa-var-krw; } +.@{fa-css-prefix}-bitcoin:before, +.@{fa-css-prefix}-btc:before { content: @fa-var-btc; } +.@{fa-css-prefix}-file:before { content: @fa-var-file; } +.@{fa-css-prefix}-file-text:before { content: @fa-var-file-text; } +.@{fa-css-prefix}-sort-alpha-asc:before { content: @fa-var-sort-alpha-asc; } +.@{fa-css-prefix}-sort-alpha-desc:before { content: @fa-var-sort-alpha-desc; } +.@{fa-css-prefix}-sort-amount-asc:before { content: @fa-var-sort-amount-asc; } +.@{fa-css-prefix}-sort-amount-desc:before { content: @fa-var-sort-amount-desc; } +.@{fa-css-prefix}-sort-numeric-asc:before { content: @fa-var-sort-numeric-asc; } +.@{fa-css-prefix}-sort-numeric-desc:before { content: @fa-var-sort-numeric-desc; } +.@{fa-css-prefix}-thumbs-up:before { content: @fa-var-thumbs-up; } +.@{fa-css-prefix}-thumbs-down:before { content: @fa-var-thumbs-down; } +.@{fa-css-prefix}-youtube-square:before { content: @fa-var-youtube-square; } +.@{fa-css-prefix}-youtube:before { content: @fa-var-youtube; } +.@{fa-css-prefix}-xing:before { content: @fa-var-xing; } +.@{fa-css-prefix}-xing-square:before { content: @fa-var-xing-square; } +.@{fa-css-prefix}-youtube-play:before { content: @fa-var-youtube-play; } +.@{fa-css-prefix}-dropbox:before { content: @fa-var-dropbox; } +.@{fa-css-prefix}-stack-overflow:before { content: @fa-var-stack-overflow; } +.@{fa-css-prefix}-instagram:before { content: @fa-var-instagram; } +.@{fa-css-prefix}-flickr:before { content: @fa-var-flickr; } +.@{fa-css-prefix}-adn:before { content: @fa-var-adn; } +.@{fa-css-prefix}-bitbucket:before { content: @fa-var-bitbucket; } +.@{fa-css-prefix}-bitbucket-square:before { content: @fa-var-bitbucket-square; } +.@{fa-css-prefix}-tumblr:before { content: @fa-var-tumblr; } +.@{fa-css-prefix}-tumblr-square:before { content: @fa-var-tumblr-square; } +.@{fa-css-prefix}-long-arrow-down:before { content: @fa-var-long-arrow-down; } +.@{fa-css-prefix}-long-arrow-up:before { content: @fa-var-long-arrow-up; } +.@{fa-css-prefix}-long-arrow-left:before { content: @fa-var-long-arrow-left; } +.@{fa-css-prefix}-long-arrow-right:before { content: @fa-var-long-arrow-right; } +.@{fa-css-prefix}-apple:before { content: @fa-var-apple; } +.@{fa-css-prefix}-windows:before { content: @fa-var-windows; } +.@{fa-css-prefix}-android:before { content: @fa-var-android; } +.@{fa-css-prefix}-linux:before { content: @fa-var-linux; } +.@{fa-css-prefix}-dribbble:before { content: @fa-var-dribbble; } +.@{fa-css-prefix}-skype:before { content: @fa-var-skype; } +.@{fa-css-prefix}-foursquare:before { content: @fa-var-foursquare; } +.@{fa-css-prefix}-trello:before { content: @fa-var-trello; } +.@{fa-css-prefix}-female:before { content: @fa-var-female; } +.@{fa-css-prefix}-male:before { content: @fa-var-male; } +.@{fa-css-prefix}-gittip:before, +.@{fa-css-prefix}-gratipay:before { content: @fa-var-gratipay; } +.@{fa-css-prefix}-sun-o:before { content: @fa-var-sun-o; } +.@{fa-css-prefix}-moon-o:before { content: @fa-var-moon-o; } +.@{fa-css-prefix}-archive:before { content: @fa-var-archive; } +.@{fa-css-prefix}-bug:before { content: @fa-var-bug; } +.@{fa-css-prefix}-vk:before { content: @fa-var-vk; } +.@{fa-css-prefix}-weibo:before { content: @fa-var-weibo; } +.@{fa-css-prefix}-renren:before { content: @fa-var-renren; } +.@{fa-css-prefix}-pagelines:before { content: @fa-var-pagelines; } +.@{fa-css-prefix}-stack-exchange:before { content: @fa-var-stack-exchange; } +.@{fa-css-prefix}-arrow-circle-o-right:before { content: @fa-var-arrow-circle-o-right; } +.@{fa-css-prefix}-arrow-circle-o-left:before { content: @fa-var-arrow-circle-o-left; } +.@{fa-css-prefix}-toggle-left:before, +.@{fa-css-prefix}-caret-square-o-left:before { content: @fa-var-caret-square-o-left; } +.@{fa-css-prefix}-dot-circle-o:before { content: @fa-var-dot-circle-o; } +.@{fa-css-prefix}-wheelchair:before { content: @fa-var-wheelchair; } +.@{fa-css-prefix}-vimeo-square:before { content: @fa-var-vimeo-square; } +.@{fa-css-prefix}-turkish-lira:before, +.@{fa-css-prefix}-try:before { content: @fa-var-try; } +.@{fa-css-prefix}-plus-square-o:before { content: @fa-var-plus-square-o; } +.@{fa-css-prefix}-space-shuttle:before { content: @fa-var-space-shuttle; } +.@{fa-css-prefix}-slack:before { content: @fa-var-slack; } +.@{fa-css-prefix}-envelope-square:before { content: @fa-var-envelope-square; } +.@{fa-css-prefix}-wordpress:before { content: @fa-var-wordpress; } +.@{fa-css-prefix}-openid:before { content: @fa-var-openid; } +.@{fa-css-prefix}-institution:before, +.@{fa-css-prefix}-bank:before, +.@{fa-css-prefix}-university:before { content: @fa-var-university; } +.@{fa-css-prefix}-mortar-board:before, +.@{fa-css-prefix}-graduation-cap:before { content: @fa-var-graduation-cap; } +.@{fa-css-prefix}-yahoo:before { content: @fa-var-yahoo; } +.@{fa-css-prefix}-google:before { content: @fa-var-google; } +.@{fa-css-prefix}-reddit:before { content: @fa-var-reddit; } +.@{fa-css-prefix}-reddit-square:before { content: @fa-var-reddit-square; } +.@{fa-css-prefix}-stumbleupon-circle:before { content: @fa-var-stumbleupon-circle; } +.@{fa-css-prefix}-stumbleupon:before { content: @fa-var-stumbleupon; } +.@{fa-css-prefix}-delicious:before { content: @fa-var-delicious; } +.@{fa-css-prefix}-digg:before { content: @fa-var-digg; } +.@{fa-css-prefix}-pied-piper-pp:before { content: @fa-var-pied-piper-pp; } +.@{fa-css-prefix}-pied-piper-alt:before { content: @fa-var-pied-piper-alt; } +.@{fa-css-prefix}-drupal:before { content: @fa-var-drupal; } +.@{fa-css-prefix}-joomla:before { content: @fa-var-joomla; } +.@{fa-css-prefix}-language:before { content: @fa-var-language; } +.@{fa-css-prefix}-fax:before { content: @fa-var-fax; } +.@{fa-css-prefix}-building:before { content: @fa-var-building; } +.@{fa-css-prefix}-child:before { content: @fa-var-child; } +.@{fa-css-prefix}-paw:before { content: @fa-var-paw; } +.@{fa-css-prefix}-spoon:before { content: @fa-var-spoon; } +.@{fa-css-prefix}-cube:before { content: @fa-var-cube; } +.@{fa-css-prefix}-cubes:before { content: @fa-var-cubes; } +.@{fa-css-prefix}-behance:before { content: @fa-var-behance; } +.@{fa-css-prefix}-behance-square:before { content: @fa-var-behance-square; } +.@{fa-css-prefix}-steam:before { content: @fa-var-steam; } +.@{fa-css-prefix}-steam-square:before { content: @fa-var-steam-square; } +.@{fa-css-prefix}-recycle:before { content: @fa-var-recycle; } +.@{fa-css-prefix}-automobile:before, +.@{fa-css-prefix}-car:before { content: @fa-var-car; } +.@{fa-css-prefix}-cab:before, +.@{fa-css-prefix}-taxi:before { content: @fa-var-taxi; } +.@{fa-css-prefix}-tree:before { content: @fa-var-tree; } +.@{fa-css-prefix}-spotify:before { content: @fa-var-spotify; } +.@{fa-css-prefix}-deviantart:before { content: @fa-var-deviantart; } +.@{fa-css-prefix}-soundcloud:before { content: @fa-var-soundcloud; } +.@{fa-css-prefix}-database:before { content: @fa-var-database; } +.@{fa-css-prefix}-file-pdf-o:before { content: @fa-var-file-pdf-o; } +.@{fa-css-prefix}-file-word-o:before { content: @fa-var-file-word-o; } +.@{fa-css-prefix}-file-excel-o:before { content: @fa-var-file-excel-o; } +.@{fa-css-prefix}-file-powerpoint-o:before { content: @fa-var-file-powerpoint-o; } +.@{fa-css-prefix}-file-photo-o:before, +.@{fa-css-prefix}-file-picture-o:before, +.@{fa-css-prefix}-file-image-o:before { content: @fa-var-file-image-o; } +.@{fa-css-prefix}-file-zip-o:before, +.@{fa-css-prefix}-file-archive-o:before { content: @fa-var-file-archive-o; } +.@{fa-css-prefix}-file-sound-o:before, +.@{fa-css-prefix}-file-audio-o:before { content: @fa-var-file-audio-o; } +.@{fa-css-prefix}-file-movie-o:before, +.@{fa-css-prefix}-file-video-o:before { content: @fa-var-file-video-o; } +.@{fa-css-prefix}-file-code-o:before { content: @fa-var-file-code-o; } +.@{fa-css-prefix}-vine:before { content: @fa-var-vine; } +.@{fa-css-prefix}-codepen:before { content: @fa-var-codepen; } +.@{fa-css-prefix}-jsfiddle:before { content: @fa-var-jsfiddle; } +.@{fa-css-prefix}-life-bouy:before, +.@{fa-css-prefix}-life-buoy:before, +.@{fa-css-prefix}-life-saver:before, +.@{fa-css-prefix}-support:before, +.@{fa-css-prefix}-life-ring:before { content: @fa-var-life-ring; } +.@{fa-css-prefix}-circle-o-notch:before { content: @fa-var-circle-o-notch; } +.@{fa-css-prefix}-ra:before, +.@{fa-css-prefix}-resistance:before, +.@{fa-css-prefix}-rebel:before { content: @fa-var-rebel; } +.@{fa-css-prefix}-ge:before, +.@{fa-css-prefix}-empire:before { content: @fa-var-empire; } +.@{fa-css-prefix}-git-square:before { content: @fa-var-git-square; } +.@{fa-css-prefix}-git:before { content: @fa-var-git; } +.@{fa-css-prefix}-y-combinator-square:before, +.@{fa-css-prefix}-yc-square:before, +.@{fa-css-prefix}-hacker-news:before { content: @fa-var-hacker-news; } +.@{fa-css-prefix}-tencent-weibo:before { content: @fa-var-tencent-weibo; } +.@{fa-css-prefix}-qq:before { content: @fa-var-qq; } +.@{fa-css-prefix}-wechat:before, +.@{fa-css-prefix}-weixin:before { content: @fa-var-weixin; } +.@{fa-css-prefix}-send:before, +.@{fa-css-prefix}-paper-plane:before { content: @fa-var-paper-plane; } +.@{fa-css-prefix}-send-o:before, +.@{fa-css-prefix}-paper-plane-o:before { content: @fa-var-paper-plane-o; } +.@{fa-css-prefix}-history:before { content: @fa-var-history; } +.@{fa-css-prefix}-circle-thin:before { content: @fa-var-circle-thin; } +.@{fa-css-prefix}-header:before { content: @fa-var-header; } +.@{fa-css-prefix}-paragraph:before { content: @fa-var-paragraph; } +.@{fa-css-prefix}-sliders:before { content: @fa-var-sliders; } +.@{fa-css-prefix}-share-alt:before { content: @fa-var-share-alt; } +.@{fa-css-prefix}-share-alt-square:before { content: @fa-var-share-alt-square; } +.@{fa-css-prefix}-bomb:before { content: @fa-var-bomb; } +.@{fa-css-prefix}-soccer-ball-o:before, +.@{fa-css-prefix}-futbol-o:before { content: @fa-var-futbol-o; } +.@{fa-css-prefix}-tty:before { content: @fa-var-tty; } +.@{fa-css-prefix}-binoculars:before { content: @fa-var-binoculars; } +.@{fa-css-prefix}-plug:before { content: @fa-var-plug; } +.@{fa-css-prefix}-slideshare:before { content: @fa-var-slideshare; } +.@{fa-css-prefix}-twitch:before { content: @fa-var-twitch; } +.@{fa-css-prefix}-yelp:before { content: @fa-var-yelp; } +.@{fa-css-prefix}-newspaper-o:before { content: @fa-var-newspaper-o; } +.@{fa-css-prefix}-wifi:before { content: @fa-var-wifi; } +.@{fa-css-prefix}-calculator:before { content: @fa-var-calculator; } +.@{fa-css-prefix}-paypal:before { content: @fa-var-paypal; } +.@{fa-css-prefix}-google-wallet:before { content: @fa-var-google-wallet; } +.@{fa-css-prefix}-cc-visa:before { content: @fa-var-cc-visa; } +.@{fa-css-prefix}-cc-mastercard:before { content: @fa-var-cc-mastercard; } +.@{fa-css-prefix}-cc-discover:before { content: @fa-var-cc-discover; } +.@{fa-css-prefix}-cc-amex:before { content: @fa-var-cc-amex; } +.@{fa-css-prefix}-cc-paypal:before { content: @fa-var-cc-paypal; } +.@{fa-css-prefix}-cc-stripe:before { content: @fa-var-cc-stripe; } +.@{fa-css-prefix}-bell-slash:before { content: @fa-var-bell-slash; } +.@{fa-css-prefix}-bell-slash-o:before { content: @fa-var-bell-slash-o; } +.@{fa-css-prefix}-trash:before { content: @fa-var-trash; } +.@{fa-css-prefix}-copyright:before { content: @fa-var-copyright; } +.@{fa-css-prefix}-at:before { content: @fa-var-at; } +.@{fa-css-prefix}-eyedropper:before { content: @fa-var-eyedropper; } +.@{fa-css-prefix}-paint-brush:before { content: @fa-var-paint-brush; } +.@{fa-css-prefix}-birthday-cake:before { content: @fa-var-birthday-cake; } +.@{fa-css-prefix}-area-chart:before { content: @fa-var-area-chart; } +.@{fa-css-prefix}-pie-chart:before { content: @fa-var-pie-chart; } +.@{fa-css-prefix}-line-chart:before { content: @fa-var-line-chart; } +.@{fa-css-prefix}-lastfm:before { content: @fa-var-lastfm; } +.@{fa-css-prefix}-lastfm-square:before { content: @fa-var-lastfm-square; } +.@{fa-css-prefix}-toggle-off:before { content: @fa-var-toggle-off; } +.@{fa-css-prefix}-toggle-on:before { content: @fa-var-toggle-on; } +.@{fa-css-prefix}-bicycle:before { content: @fa-var-bicycle; } +.@{fa-css-prefix}-bus:before { content: @fa-var-bus; } +.@{fa-css-prefix}-ioxhost:before { content: @fa-var-ioxhost; } +.@{fa-css-prefix}-angellist:before { content: @fa-var-angellist; } +.@{fa-css-prefix}-cc:before { content: @fa-var-cc; } +.@{fa-css-prefix}-shekel:before, +.@{fa-css-prefix}-sheqel:before, +.@{fa-css-prefix}-ils:before { content: @fa-var-ils; } +.@{fa-css-prefix}-meanpath:before { content: @fa-var-meanpath; } +.@{fa-css-prefix}-buysellads:before { content: @fa-var-buysellads; } +.@{fa-css-prefix}-connectdevelop:before { content: @fa-var-connectdevelop; } +.@{fa-css-prefix}-dashcube:before { content: @fa-var-dashcube; } +.@{fa-css-prefix}-forumbee:before { content: @fa-var-forumbee; } +.@{fa-css-prefix}-leanpub:before { content: @fa-var-leanpub; } +.@{fa-css-prefix}-sellsy:before { content: @fa-var-sellsy; } +.@{fa-css-prefix}-shirtsinbulk:before { content: @fa-var-shirtsinbulk; } +.@{fa-css-prefix}-simplybuilt:before { content: @fa-var-simplybuilt; } +.@{fa-css-prefix}-skyatlas:before { content: @fa-var-skyatlas; } +.@{fa-css-prefix}-cart-plus:before { content: @fa-var-cart-plus; } +.@{fa-css-prefix}-cart-arrow-down:before { content: @fa-var-cart-arrow-down; } +.@{fa-css-prefix}-diamond:before { content: @fa-var-diamond; } +.@{fa-css-prefix}-ship:before { content: @fa-var-ship; } +.@{fa-css-prefix}-user-secret:before { content: @fa-var-user-secret; } +.@{fa-css-prefix}-motorcycle:before { content: @fa-var-motorcycle; } +.@{fa-css-prefix}-street-view:before { content: @fa-var-street-view; } +.@{fa-css-prefix}-heartbeat:before { content: @fa-var-heartbeat; } +.@{fa-css-prefix}-venus:before { content: @fa-var-venus; } +.@{fa-css-prefix}-mars:before { content: @fa-var-mars; } +.@{fa-css-prefix}-mercury:before { content: @fa-var-mercury; } +.@{fa-css-prefix}-intersex:before, +.@{fa-css-prefix}-transgender:before { content: @fa-var-transgender; } +.@{fa-css-prefix}-transgender-alt:before { content: @fa-var-transgender-alt; } +.@{fa-css-prefix}-venus-double:before { content: @fa-var-venus-double; } +.@{fa-css-prefix}-mars-double:before { content: @fa-var-mars-double; } +.@{fa-css-prefix}-venus-mars:before { content: @fa-var-venus-mars; } +.@{fa-css-prefix}-mars-stroke:before { content: @fa-var-mars-stroke; } +.@{fa-css-prefix}-mars-stroke-v:before { content: @fa-var-mars-stroke-v; } +.@{fa-css-prefix}-mars-stroke-h:before { content: @fa-var-mars-stroke-h; } +.@{fa-css-prefix}-neuter:before { content: @fa-var-neuter; } +.@{fa-css-prefix}-genderless:before { content: @fa-var-genderless; } +.@{fa-css-prefix}-facebook-official:before { content: @fa-var-facebook-official; } +.@{fa-css-prefix}-pinterest-p:before { content: @fa-var-pinterest-p; } +.@{fa-css-prefix}-whatsapp:before { content: @fa-var-whatsapp; } +.@{fa-css-prefix}-server:before { content: @fa-var-server; } +.@{fa-css-prefix}-user-plus:before { content: @fa-var-user-plus; } +.@{fa-css-prefix}-user-times:before { content: @fa-var-user-times; } +.@{fa-css-prefix}-hotel:before, +.@{fa-css-prefix}-bed:before { content: @fa-var-bed; } +.@{fa-css-prefix}-viacoin:before { content: @fa-var-viacoin; } +.@{fa-css-prefix}-train:before { content: @fa-var-train; } +.@{fa-css-prefix}-subway:before { content: @fa-var-subway; } +.@{fa-css-prefix}-medium:before { content: @fa-var-medium; } +.@{fa-css-prefix}-yc:before, +.@{fa-css-prefix}-y-combinator:before { content: @fa-var-y-combinator; } +.@{fa-css-prefix}-optin-monster:before { content: @fa-var-optin-monster; } +.@{fa-css-prefix}-opencart:before { content: @fa-var-opencart; } +.@{fa-css-prefix}-expeditedssl:before { content: @fa-var-expeditedssl; } +.@{fa-css-prefix}-battery-4:before, +.@{fa-css-prefix}-battery:before, +.@{fa-css-prefix}-battery-full:before { content: @fa-var-battery-full; } +.@{fa-css-prefix}-battery-3:before, +.@{fa-css-prefix}-battery-three-quarters:before { content: @fa-var-battery-three-quarters; } +.@{fa-css-prefix}-battery-2:before, +.@{fa-css-prefix}-battery-half:before { content: @fa-var-battery-half; } +.@{fa-css-prefix}-battery-1:before, +.@{fa-css-prefix}-battery-quarter:before { content: @fa-var-battery-quarter; } +.@{fa-css-prefix}-battery-0:before, +.@{fa-css-prefix}-battery-empty:before { content: @fa-var-battery-empty; } +.@{fa-css-prefix}-mouse-pointer:before { content: @fa-var-mouse-pointer; } +.@{fa-css-prefix}-i-cursor:before { content: @fa-var-i-cursor; } +.@{fa-css-prefix}-object-group:before { content: @fa-var-object-group; } +.@{fa-css-prefix}-object-ungroup:before { content: @fa-var-object-ungroup; } +.@{fa-css-prefix}-sticky-note:before { content: @fa-var-sticky-note; } +.@{fa-css-prefix}-sticky-note-o:before { content: @fa-var-sticky-note-o; } +.@{fa-css-prefix}-cc-jcb:before { content: @fa-var-cc-jcb; } +.@{fa-css-prefix}-cc-diners-club:before { content: @fa-var-cc-diners-club; } +.@{fa-css-prefix}-clone:before { content: @fa-var-clone; } +.@{fa-css-prefix}-balance-scale:before { content: @fa-var-balance-scale; } +.@{fa-css-prefix}-hourglass-o:before { content: @fa-var-hourglass-o; } +.@{fa-css-prefix}-hourglass-1:before, +.@{fa-css-prefix}-hourglass-start:before { content: @fa-var-hourglass-start; } +.@{fa-css-prefix}-hourglass-2:before, +.@{fa-css-prefix}-hourglass-half:before { content: @fa-var-hourglass-half; } +.@{fa-css-prefix}-hourglass-3:before, +.@{fa-css-prefix}-hourglass-end:before { content: @fa-var-hourglass-end; } +.@{fa-css-prefix}-hourglass:before { content: @fa-var-hourglass; } +.@{fa-css-prefix}-hand-grab-o:before, +.@{fa-css-prefix}-hand-rock-o:before { content: @fa-var-hand-rock-o; } +.@{fa-css-prefix}-hand-stop-o:before, +.@{fa-css-prefix}-hand-paper-o:before { content: @fa-var-hand-paper-o; } +.@{fa-css-prefix}-hand-scissors-o:before { content: @fa-var-hand-scissors-o; } +.@{fa-css-prefix}-hand-lizard-o:before { content: @fa-var-hand-lizard-o; } +.@{fa-css-prefix}-hand-spock-o:before { content: @fa-var-hand-spock-o; } +.@{fa-css-prefix}-hand-pointer-o:before { content: @fa-var-hand-pointer-o; } +.@{fa-css-prefix}-hand-peace-o:before { content: @fa-var-hand-peace-o; } +.@{fa-css-prefix}-trademark:before { content: @fa-var-trademark; } +.@{fa-css-prefix}-registered:before { content: @fa-var-registered; } +.@{fa-css-prefix}-creative-commons:before { content: @fa-var-creative-commons; } +.@{fa-css-prefix}-gg:before { content: @fa-var-gg; } +.@{fa-css-prefix}-gg-circle:before { content: @fa-var-gg-circle; } +.@{fa-css-prefix}-tripadvisor:before { content: @fa-var-tripadvisor; } +.@{fa-css-prefix}-odnoklassniki:before { content: @fa-var-odnoklassniki; } +.@{fa-css-prefix}-odnoklassniki-square:before { content: @fa-var-odnoklassniki-square; } +.@{fa-css-prefix}-get-pocket:before { content: @fa-var-get-pocket; } +.@{fa-css-prefix}-wikipedia-w:before { content: @fa-var-wikipedia-w; } +.@{fa-css-prefix}-safari:before { content: @fa-var-safari; } +.@{fa-css-prefix}-chrome:before { content: @fa-var-chrome; } +.@{fa-css-prefix}-firefox:before { content: @fa-var-firefox; } +.@{fa-css-prefix}-opera:before { content: @fa-var-opera; } +.@{fa-css-prefix}-internet-explorer:before { content: @fa-var-internet-explorer; } +.@{fa-css-prefix}-tv:before, +.@{fa-css-prefix}-television:before { content: @fa-var-television; } +.@{fa-css-prefix}-contao:before { content: @fa-var-contao; } +.@{fa-css-prefix}-500px:before { content: @fa-var-500px; } +.@{fa-css-prefix}-amazon:before { content: @fa-var-amazon; } +.@{fa-css-prefix}-calendar-plus-o:before { content: @fa-var-calendar-plus-o; } +.@{fa-css-prefix}-calendar-minus-o:before { content: @fa-var-calendar-minus-o; } +.@{fa-css-prefix}-calendar-times-o:before { content: @fa-var-calendar-times-o; } +.@{fa-css-prefix}-calendar-check-o:before { content: @fa-var-calendar-check-o; } +.@{fa-css-prefix}-industry:before { content: @fa-var-industry; } +.@{fa-css-prefix}-map-pin:before { content: @fa-var-map-pin; } +.@{fa-css-prefix}-map-signs:before { content: @fa-var-map-signs; } +.@{fa-css-prefix}-map-o:before { content: @fa-var-map-o; } +.@{fa-css-prefix}-map:before { content: @fa-var-map; } +.@{fa-css-prefix}-commenting:before { content: @fa-var-commenting; } +.@{fa-css-prefix}-commenting-o:before { content: @fa-var-commenting-o; } +.@{fa-css-prefix}-houzz:before { content: @fa-var-houzz; } +.@{fa-css-prefix}-vimeo:before { content: @fa-var-vimeo; } +.@{fa-css-prefix}-black-tie:before { content: @fa-var-black-tie; } +.@{fa-css-prefix}-fonticons:before { content: @fa-var-fonticons; } +.@{fa-css-prefix}-reddit-alien:before { content: @fa-var-reddit-alien; } +.@{fa-css-prefix}-edge:before { content: @fa-var-edge; } +.@{fa-css-prefix}-credit-card-alt:before { content: @fa-var-credit-card-alt; } +.@{fa-css-prefix}-codiepie:before { content: @fa-var-codiepie; } +.@{fa-css-prefix}-modx:before { content: @fa-var-modx; } +.@{fa-css-prefix}-fort-awesome:before { content: @fa-var-fort-awesome; } +.@{fa-css-prefix}-usb:before { content: @fa-var-usb; } +.@{fa-css-prefix}-product-hunt:before { content: @fa-var-product-hunt; } +.@{fa-css-prefix}-mixcloud:before { content: @fa-var-mixcloud; } +.@{fa-css-prefix}-scribd:before { content: @fa-var-scribd; } +.@{fa-css-prefix}-pause-circle:before { content: @fa-var-pause-circle; } +.@{fa-css-prefix}-pause-circle-o:before { content: @fa-var-pause-circle-o; } +.@{fa-css-prefix}-stop-circle:before { content: @fa-var-stop-circle; } +.@{fa-css-prefix}-stop-circle-o:before { content: @fa-var-stop-circle-o; } +.@{fa-css-prefix}-shopping-bag:before { content: @fa-var-shopping-bag; } +.@{fa-css-prefix}-shopping-basket:before { content: @fa-var-shopping-basket; } +.@{fa-css-prefix}-hashtag:before { content: @fa-var-hashtag; } +.@{fa-css-prefix}-bluetooth:before { content: @fa-var-bluetooth; } +.@{fa-css-prefix}-bluetooth-b:before { content: @fa-var-bluetooth-b; } +.@{fa-css-prefix}-percent:before { content: @fa-var-percent; } +.@{fa-css-prefix}-gitlab:before { content: @fa-var-gitlab; } +.@{fa-css-prefix}-wpbeginner:before { content: @fa-var-wpbeginner; } +.@{fa-css-prefix}-wpforms:before { content: @fa-var-wpforms; } +.@{fa-css-prefix}-envira:before { content: @fa-var-envira; } +.@{fa-css-prefix}-universal-access:before { content: @fa-var-universal-access; } +.@{fa-css-prefix}-wheelchair-alt:before { content: @fa-var-wheelchair-alt; } +.@{fa-css-prefix}-question-circle-o:before { content: @fa-var-question-circle-o; } +.@{fa-css-prefix}-blind:before { content: @fa-var-blind; } +.@{fa-css-prefix}-audio-description:before { content: @fa-var-audio-description; } +.@{fa-css-prefix}-volume-control-phone:before { content: @fa-var-volume-control-phone; } +.@{fa-css-prefix}-braille:before { content: @fa-var-braille; } +.@{fa-css-prefix}-assistive-listening-systems:before { content: @fa-var-assistive-listening-systems; } +.@{fa-css-prefix}-asl-interpreting:before, +.@{fa-css-prefix}-american-sign-language-interpreting:before { content: @fa-var-american-sign-language-interpreting; } +.@{fa-css-prefix}-deafness:before, +.@{fa-css-prefix}-hard-of-hearing:before, +.@{fa-css-prefix}-deaf:before { content: @fa-var-deaf; } +.@{fa-css-prefix}-glide:before { content: @fa-var-glide; } +.@{fa-css-prefix}-glide-g:before { content: @fa-var-glide-g; } +.@{fa-css-prefix}-signing:before, +.@{fa-css-prefix}-sign-language:before { content: @fa-var-sign-language; } +.@{fa-css-prefix}-low-vision:before { content: @fa-var-low-vision; } +.@{fa-css-prefix}-viadeo:before { content: @fa-var-viadeo; } +.@{fa-css-prefix}-viadeo-square:before { content: @fa-var-viadeo-square; } +.@{fa-css-prefix}-snapchat:before { content: @fa-var-snapchat; } +.@{fa-css-prefix}-snapchat-ghost:before { content: @fa-var-snapchat-ghost; } +.@{fa-css-prefix}-snapchat-square:before { content: @fa-var-snapchat-square; } +.@{fa-css-prefix}-pied-piper:before { content: @fa-var-pied-piper; } +.@{fa-css-prefix}-first-order:before { content: @fa-var-first-order; } +.@{fa-css-prefix}-yoast:before { content: @fa-var-yoast; } +.@{fa-css-prefix}-themeisle:before { content: @fa-var-themeisle; } +.@{fa-css-prefix}-google-plus-circle:before, +.@{fa-css-prefix}-google-plus-official:before { content: @fa-var-google-plus-official; } +.@{fa-css-prefix}-fa:before, +.@{fa-css-prefix}-font-awesome:before { content: @fa-var-font-awesome; } +.@{fa-css-prefix}-handshake-o:before { content: @fa-var-handshake-o; } +.@{fa-css-prefix}-envelope-open:before { content: @fa-var-envelope-open; } +.@{fa-css-prefix}-envelope-open-o:before { content: @fa-var-envelope-open-o; } +.@{fa-css-prefix}-linode:before { content: @fa-var-linode; } +.@{fa-css-prefix}-address-book:before { content: @fa-var-address-book; } +.@{fa-css-prefix}-address-book-o:before { content: @fa-var-address-book-o; } +.@{fa-css-prefix}-vcard:before, +.@{fa-css-prefix}-address-card:before { content: @fa-var-address-card; } +.@{fa-css-prefix}-vcard-o:before, +.@{fa-css-prefix}-address-card-o:before { content: @fa-var-address-card-o; } +.@{fa-css-prefix}-user-circle:before { content: @fa-var-user-circle; } +.@{fa-css-prefix}-user-circle-o:before { content: @fa-var-user-circle-o; } +.@{fa-css-prefix}-user-o:before { content: @fa-var-user-o; } +.@{fa-css-prefix}-id-badge:before { content: @fa-var-id-badge; } +.@{fa-css-prefix}-drivers-license:before, +.@{fa-css-prefix}-id-card:before { content: @fa-var-id-card; } +.@{fa-css-prefix}-drivers-license-o:before, +.@{fa-css-prefix}-id-card-o:before { content: @fa-var-id-card-o; } +.@{fa-css-prefix}-quora:before { content: @fa-var-quora; } +.@{fa-css-prefix}-free-code-camp:before { content: @fa-var-free-code-camp; } +.@{fa-css-prefix}-telegram:before { content: @fa-var-telegram; } +.@{fa-css-prefix}-thermometer-4:before, +.@{fa-css-prefix}-thermometer:before, +.@{fa-css-prefix}-thermometer-full:before { content: @fa-var-thermometer-full; } +.@{fa-css-prefix}-thermometer-3:before, +.@{fa-css-prefix}-thermometer-three-quarters:before { content: @fa-var-thermometer-three-quarters; } +.@{fa-css-prefix}-thermometer-2:before, +.@{fa-css-prefix}-thermometer-half:before { content: @fa-var-thermometer-half; } +.@{fa-css-prefix}-thermometer-1:before, +.@{fa-css-prefix}-thermometer-quarter:before { content: @fa-var-thermometer-quarter; } +.@{fa-css-prefix}-thermometer-0:before, +.@{fa-css-prefix}-thermometer-empty:before { content: @fa-var-thermometer-empty; } +.@{fa-css-prefix}-shower:before { content: @fa-var-shower; } +.@{fa-css-prefix}-bathtub:before, +.@{fa-css-prefix}-s15:before, +.@{fa-css-prefix}-bath:before { content: @fa-var-bath; } +.@{fa-css-prefix}-podcast:before { content: @fa-var-podcast; } +.@{fa-css-prefix}-window-maximize:before { content: @fa-var-window-maximize; } +.@{fa-css-prefix}-window-minimize:before { content: @fa-var-window-minimize; } +.@{fa-css-prefix}-window-restore:before { content: @fa-var-window-restore; } +.@{fa-css-prefix}-times-rectangle:before, +.@{fa-css-prefix}-window-close:before { content: @fa-var-window-close; } +.@{fa-css-prefix}-times-rectangle-o:before, +.@{fa-css-prefix}-window-close-o:before { content: @fa-var-window-close-o; } +.@{fa-css-prefix}-bandcamp:before { content: @fa-var-bandcamp; } +.@{fa-css-prefix}-grav:before { content: @fa-var-grav; } +.@{fa-css-prefix}-etsy:before { content: @fa-var-etsy; } +.@{fa-css-prefix}-imdb:before { content: @fa-var-imdb; } +.@{fa-css-prefix}-ravelry:before { content: @fa-var-ravelry; } +.@{fa-css-prefix}-eercast:before { content: @fa-var-eercast; } +.@{fa-css-prefix}-microchip:before { content: @fa-var-microchip; } +.@{fa-css-prefix}-snowflake-o:before { content: @fa-var-snowflake-o; } +.@{fa-css-prefix}-superpowers:before { content: @fa-var-superpowers; } +.@{fa-css-prefix}-wpexplorer:before { content: @fa-var-wpexplorer; } +.@{fa-css-prefix}-meetup:before { content: @fa-var-meetup; } diff --git a/node_modules/font-awesome/less/larger.less b/node_modules/font-awesome/less/larger.less new file mode 100644 index 0000000000..c9d646770e --- /dev/null +++ b/node_modules/font-awesome/less/larger.less @@ -0,0 +1,13 @@ +// Icon Sizes +// ------------------------- + +/* makes the font 33% larger relative to the icon container */ +.@{fa-css-prefix}-lg { + font-size: (4em / 3); + line-height: (3em / 4); + vertical-align: -15%; +} +.@{fa-css-prefix}-2x { font-size: 2em; } +.@{fa-css-prefix}-3x { font-size: 3em; } +.@{fa-css-prefix}-4x { font-size: 4em; } +.@{fa-css-prefix}-5x { font-size: 5em; } diff --git a/node_modules/font-awesome/less/list.less b/node_modules/font-awesome/less/list.less new file mode 100644 index 0000000000..0b440382f6 --- /dev/null +++ b/node_modules/font-awesome/less/list.less @@ -0,0 +1,19 @@ +// List Icons +// ------------------------- + +.@{fa-css-prefix}-ul { + padding-left: 0; + margin-left: @fa-li-width; + list-style-type: none; + > li { position: relative; } +} +.@{fa-css-prefix}-li { + position: absolute; + left: -@fa-li-width; + width: @fa-li-width; + top: (2em / 14); + text-align: center; + &.@{fa-css-prefix}-lg { + left: (-@fa-li-width + (4em / 14)); + } +} diff --git a/node_modules/font-awesome/less/mixins.less b/node_modules/font-awesome/less/mixins.less new file mode 100644 index 0000000000..beef231d0e --- /dev/null +++ b/node_modules/font-awesome/less/mixins.less @@ -0,0 +1,60 @@ +// Mixins +// -------------------------- + +.fa-icon() { + display: inline-block; + font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration + font-size: inherit; // can't have font-size inherit on line above, so need to override + text-rendering: auto; // optimizelegibility throws things off #1094 + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + +} + +.fa-icon-rotate(@degrees, @rotation) { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation})"; + -webkit-transform: rotate(@degrees); + -ms-transform: rotate(@degrees); + transform: rotate(@degrees); +} + +.fa-icon-flip(@horiz, @vert, @rotation) { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation}, mirror=1)"; + -webkit-transform: scale(@horiz, @vert); + -ms-transform: scale(@horiz, @vert); + transform: scale(@horiz, @vert); +} + + +// Only display content to screen readers. A la Bootstrap 4. +// +// See: http://a11yproject.com/posts/how-to-hide-content/ + +.sr-only() { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0,0,0,0); + border: 0; +} + +// Use in conjunction with .sr-only to only display content when it's focused. +// +// Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 +// +// Credit: HTML5 Boilerplate + +.sr-only-focusable() { + &:active, + &:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; + } +} diff --git a/node_modules/font-awesome/less/path.less b/node_modules/font-awesome/less/path.less new file mode 100644 index 0000000000..835be41f81 --- /dev/null +++ b/node_modules/font-awesome/less/path.less @@ -0,0 +1,15 @@ +/* FONT PATH + * -------------------------- */ + +@font-face { + font-family: 'FontAwesome'; + src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); + src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), + url('@{fa-font-path}/fontawesome-webfont.woff2?v=@{fa-version}') format('woff2'), + url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), + url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), + url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); + // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts + font-weight: normal; + font-style: normal; +} diff --git a/node_modules/font-awesome/less/rotated-flipped.less b/node_modules/font-awesome/less/rotated-flipped.less new file mode 100644 index 0000000000..f6ba81475b --- /dev/null +++ b/node_modules/font-awesome/less/rotated-flipped.less @@ -0,0 +1,20 @@ +// Rotated & Flipped Icons +// ------------------------- + +.@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } +.@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } +.@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } + +.@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } +.@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } + +// Hook for IE8-9 +// ------------------------- + +:root .@{fa-css-prefix}-rotate-90, +:root .@{fa-css-prefix}-rotate-180, +:root .@{fa-css-prefix}-rotate-270, +:root .@{fa-css-prefix}-flip-horizontal, +:root .@{fa-css-prefix}-flip-vertical { + filter: none; +} diff --git a/node_modules/font-awesome/less/screen-reader.less b/node_modules/font-awesome/less/screen-reader.less new file mode 100644 index 0000000000..11c188196d --- /dev/null +++ b/node_modules/font-awesome/less/screen-reader.less @@ -0,0 +1,5 @@ +// Screen Readers +// ------------------------- + +.sr-only { .sr-only(); } +.sr-only-focusable { .sr-only-focusable(); } diff --git a/node_modules/font-awesome/less/stacked.less b/node_modules/font-awesome/less/stacked.less new file mode 100644 index 0000000000..fc53fb0e7a --- /dev/null +++ b/node_modules/font-awesome/less/stacked.less @@ -0,0 +1,20 @@ +// Stacked Icons +// ------------------------- + +.@{fa-css-prefix}-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} +.@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} +.@{fa-css-prefix}-stack-1x { line-height: inherit; } +.@{fa-css-prefix}-stack-2x { font-size: 2em; } +.@{fa-css-prefix}-inverse { color: @fa-inverse; } diff --git a/node_modules/font-awesome/less/variables.less b/node_modules/font-awesome/less/variables.less new file mode 100644 index 0000000000..7ddbbc0115 --- /dev/null +++ b/node_modules/font-awesome/less/variables.less @@ -0,0 +1,800 @@ +// Variables +// -------------------------- + +@fa-font-path: "../fonts"; +@fa-font-size-base: 14px; +@fa-line-height-base: 1; +//@fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.7.0/fonts"; // for referencing Bootstrap CDN font files directly +@fa-css-prefix: fa; +@fa-version: "4.7.0"; +@fa-border-color: #eee; +@fa-inverse: #fff; +@fa-li-width: (30em / 14); + +@fa-var-500px: "\f26e"; +@fa-var-address-book: "\f2b9"; +@fa-var-address-book-o: "\f2ba"; +@fa-var-address-card: "\f2bb"; +@fa-var-address-card-o: "\f2bc"; +@fa-var-adjust: "\f042"; +@fa-var-adn: "\f170"; +@fa-var-align-center: "\f037"; +@fa-var-align-justify: "\f039"; +@fa-var-align-left: "\f036"; +@fa-var-align-right: "\f038"; +@fa-var-amazon: "\f270"; +@fa-var-ambulance: "\f0f9"; +@fa-var-american-sign-language-interpreting: "\f2a3"; +@fa-var-anchor: "\f13d"; +@fa-var-android: "\f17b"; +@fa-var-angellist: "\f209"; +@fa-var-angle-double-down: "\f103"; +@fa-var-angle-double-left: "\f100"; +@fa-var-angle-double-right: "\f101"; +@fa-var-angle-double-up: "\f102"; +@fa-var-angle-down: "\f107"; +@fa-var-angle-left: "\f104"; +@fa-var-angle-right: "\f105"; +@fa-var-angle-up: "\f106"; +@fa-var-apple: "\f179"; +@fa-var-archive: "\f187"; +@fa-var-area-chart: "\f1fe"; +@fa-var-arrow-circle-down: "\f0ab"; +@fa-var-arrow-circle-left: "\f0a8"; +@fa-var-arrow-circle-o-down: "\f01a"; +@fa-var-arrow-circle-o-left: "\f190"; +@fa-var-arrow-circle-o-right: "\f18e"; +@fa-var-arrow-circle-o-up: "\f01b"; +@fa-var-arrow-circle-right: "\f0a9"; +@fa-var-arrow-circle-up: "\f0aa"; +@fa-var-arrow-down: "\f063"; +@fa-var-arrow-left: "\f060"; +@fa-var-arrow-right: "\f061"; +@fa-var-arrow-up: "\f062"; +@fa-var-arrows: "\f047"; +@fa-var-arrows-alt: "\f0b2"; +@fa-var-arrows-h: "\f07e"; +@fa-var-arrows-v: "\f07d"; +@fa-var-asl-interpreting: "\f2a3"; +@fa-var-assistive-listening-systems: "\f2a2"; +@fa-var-asterisk: "\f069"; +@fa-var-at: "\f1fa"; +@fa-var-audio-description: "\f29e"; +@fa-var-automobile: "\f1b9"; +@fa-var-backward: "\f04a"; +@fa-var-balance-scale: "\f24e"; +@fa-var-ban: "\f05e"; +@fa-var-bandcamp: "\f2d5"; +@fa-var-bank: "\f19c"; +@fa-var-bar-chart: "\f080"; +@fa-var-bar-chart-o: "\f080"; +@fa-var-barcode: "\f02a"; +@fa-var-bars: "\f0c9"; +@fa-var-bath: "\f2cd"; +@fa-var-bathtub: "\f2cd"; +@fa-var-battery: "\f240"; +@fa-var-battery-0: "\f244"; +@fa-var-battery-1: "\f243"; +@fa-var-battery-2: "\f242"; +@fa-var-battery-3: "\f241"; +@fa-var-battery-4: "\f240"; +@fa-var-battery-empty: "\f244"; +@fa-var-battery-full: "\f240"; +@fa-var-battery-half: "\f242"; +@fa-var-battery-quarter: "\f243"; +@fa-var-battery-three-quarters: "\f241"; +@fa-var-bed: "\f236"; +@fa-var-beer: "\f0fc"; +@fa-var-behance: "\f1b4"; +@fa-var-behance-square: "\f1b5"; +@fa-var-bell: "\f0f3"; +@fa-var-bell-o: "\f0a2"; +@fa-var-bell-slash: "\f1f6"; +@fa-var-bell-slash-o: "\f1f7"; +@fa-var-bicycle: "\f206"; +@fa-var-binoculars: "\f1e5"; +@fa-var-birthday-cake: "\f1fd"; +@fa-var-bitbucket: "\f171"; +@fa-var-bitbucket-square: "\f172"; +@fa-var-bitcoin: "\f15a"; +@fa-var-black-tie: "\f27e"; +@fa-var-blind: "\f29d"; +@fa-var-bluetooth: "\f293"; +@fa-var-bluetooth-b: "\f294"; +@fa-var-bold: "\f032"; +@fa-var-bolt: "\f0e7"; +@fa-var-bomb: "\f1e2"; +@fa-var-book: "\f02d"; +@fa-var-bookmark: "\f02e"; +@fa-var-bookmark-o: "\f097"; +@fa-var-braille: "\f2a1"; +@fa-var-briefcase: "\f0b1"; +@fa-var-btc: "\f15a"; +@fa-var-bug: "\f188"; +@fa-var-building: "\f1ad"; +@fa-var-building-o: "\f0f7"; +@fa-var-bullhorn: "\f0a1"; +@fa-var-bullseye: "\f140"; +@fa-var-bus: "\f207"; +@fa-var-buysellads: "\f20d"; +@fa-var-cab: "\f1ba"; +@fa-var-calculator: "\f1ec"; +@fa-var-calendar: "\f073"; +@fa-var-calendar-check-o: "\f274"; +@fa-var-calendar-minus-o: "\f272"; +@fa-var-calendar-o: "\f133"; +@fa-var-calendar-plus-o: "\f271"; +@fa-var-calendar-times-o: "\f273"; +@fa-var-camera: "\f030"; +@fa-var-camera-retro: "\f083"; +@fa-var-car: "\f1b9"; +@fa-var-caret-down: "\f0d7"; +@fa-var-caret-left: "\f0d9"; +@fa-var-caret-right: "\f0da"; +@fa-var-caret-square-o-down: "\f150"; +@fa-var-caret-square-o-left: "\f191"; +@fa-var-caret-square-o-right: "\f152"; +@fa-var-caret-square-o-up: "\f151"; +@fa-var-caret-up: "\f0d8"; +@fa-var-cart-arrow-down: "\f218"; +@fa-var-cart-plus: "\f217"; +@fa-var-cc: "\f20a"; +@fa-var-cc-amex: "\f1f3"; +@fa-var-cc-diners-club: "\f24c"; +@fa-var-cc-discover: "\f1f2"; +@fa-var-cc-jcb: "\f24b"; +@fa-var-cc-mastercard: "\f1f1"; +@fa-var-cc-paypal: "\f1f4"; +@fa-var-cc-stripe: "\f1f5"; +@fa-var-cc-visa: "\f1f0"; +@fa-var-certificate: "\f0a3"; +@fa-var-chain: "\f0c1"; +@fa-var-chain-broken: "\f127"; +@fa-var-check: "\f00c"; +@fa-var-check-circle: "\f058"; +@fa-var-check-circle-o: "\f05d"; +@fa-var-check-square: "\f14a"; +@fa-var-check-square-o: "\f046"; +@fa-var-chevron-circle-down: "\f13a"; +@fa-var-chevron-circle-left: "\f137"; +@fa-var-chevron-circle-right: "\f138"; +@fa-var-chevron-circle-up: "\f139"; +@fa-var-chevron-down: "\f078"; +@fa-var-chevron-left: "\f053"; +@fa-var-chevron-right: "\f054"; +@fa-var-chevron-up: "\f077"; +@fa-var-child: "\f1ae"; +@fa-var-chrome: "\f268"; +@fa-var-circle: "\f111"; +@fa-var-circle-o: "\f10c"; +@fa-var-circle-o-notch: "\f1ce"; +@fa-var-circle-thin: "\f1db"; +@fa-var-clipboard: "\f0ea"; +@fa-var-clock-o: "\f017"; +@fa-var-clone: "\f24d"; +@fa-var-close: "\f00d"; +@fa-var-cloud: "\f0c2"; +@fa-var-cloud-download: "\f0ed"; +@fa-var-cloud-upload: "\f0ee"; +@fa-var-cny: "\f157"; +@fa-var-code: "\f121"; +@fa-var-code-fork: "\f126"; +@fa-var-codepen: "\f1cb"; +@fa-var-codiepie: "\f284"; +@fa-var-coffee: "\f0f4"; +@fa-var-cog: "\f013"; +@fa-var-cogs: "\f085"; +@fa-var-columns: "\f0db"; +@fa-var-comment: "\f075"; +@fa-var-comment-o: "\f0e5"; +@fa-var-commenting: "\f27a"; +@fa-var-commenting-o: "\f27b"; +@fa-var-comments: "\f086"; +@fa-var-comments-o: "\f0e6"; +@fa-var-compass: "\f14e"; +@fa-var-compress: "\f066"; +@fa-var-connectdevelop: "\f20e"; +@fa-var-contao: "\f26d"; +@fa-var-copy: "\f0c5"; +@fa-var-copyright: "\f1f9"; +@fa-var-creative-commons: "\f25e"; +@fa-var-credit-card: "\f09d"; +@fa-var-credit-card-alt: "\f283"; +@fa-var-crop: "\f125"; +@fa-var-crosshairs: "\f05b"; +@fa-var-css3: "\f13c"; +@fa-var-cube: "\f1b2"; +@fa-var-cubes: "\f1b3"; +@fa-var-cut: "\f0c4"; +@fa-var-cutlery: "\f0f5"; +@fa-var-dashboard: "\f0e4"; +@fa-var-dashcube: "\f210"; +@fa-var-database: "\f1c0"; +@fa-var-deaf: "\f2a4"; +@fa-var-deafness: "\f2a4"; +@fa-var-dedent: "\f03b"; +@fa-var-delicious: "\f1a5"; +@fa-var-desktop: "\f108"; +@fa-var-deviantart: "\f1bd"; +@fa-var-diamond: "\f219"; +@fa-var-digg: "\f1a6"; +@fa-var-dollar: "\f155"; +@fa-var-dot-circle-o: "\f192"; +@fa-var-download: "\f019"; +@fa-var-dribbble: "\f17d"; +@fa-var-drivers-license: "\f2c2"; +@fa-var-drivers-license-o: "\f2c3"; +@fa-var-dropbox: "\f16b"; +@fa-var-drupal: "\f1a9"; +@fa-var-edge: "\f282"; +@fa-var-edit: "\f044"; +@fa-var-eercast: "\f2da"; +@fa-var-eject: "\f052"; +@fa-var-ellipsis-h: "\f141"; +@fa-var-ellipsis-v: "\f142"; +@fa-var-empire: "\f1d1"; +@fa-var-envelope: "\f0e0"; +@fa-var-envelope-o: "\f003"; +@fa-var-envelope-open: "\f2b6"; +@fa-var-envelope-open-o: "\f2b7"; +@fa-var-envelope-square: "\f199"; +@fa-var-envira: "\f299"; +@fa-var-eraser: "\f12d"; +@fa-var-etsy: "\f2d7"; +@fa-var-eur: "\f153"; +@fa-var-euro: "\f153"; +@fa-var-exchange: "\f0ec"; +@fa-var-exclamation: "\f12a"; +@fa-var-exclamation-circle: "\f06a"; +@fa-var-exclamation-triangle: "\f071"; +@fa-var-expand: "\f065"; +@fa-var-expeditedssl: "\f23e"; +@fa-var-external-link: "\f08e"; +@fa-var-external-link-square: "\f14c"; +@fa-var-eye: "\f06e"; +@fa-var-eye-slash: "\f070"; +@fa-var-eyedropper: "\f1fb"; +@fa-var-fa: "\f2b4"; +@fa-var-facebook: "\f09a"; +@fa-var-facebook-f: "\f09a"; +@fa-var-facebook-official: "\f230"; +@fa-var-facebook-square: "\f082"; +@fa-var-fast-backward: "\f049"; +@fa-var-fast-forward: "\f050"; +@fa-var-fax: "\f1ac"; +@fa-var-feed: "\f09e"; +@fa-var-female: "\f182"; +@fa-var-fighter-jet: "\f0fb"; +@fa-var-file: "\f15b"; +@fa-var-file-archive-o: "\f1c6"; +@fa-var-file-audio-o: "\f1c7"; +@fa-var-file-code-o: "\f1c9"; +@fa-var-file-excel-o: "\f1c3"; +@fa-var-file-image-o: "\f1c5"; +@fa-var-file-movie-o: "\f1c8"; +@fa-var-file-o: "\f016"; +@fa-var-file-pdf-o: "\f1c1"; +@fa-var-file-photo-o: "\f1c5"; +@fa-var-file-picture-o: "\f1c5"; +@fa-var-file-powerpoint-o: "\f1c4"; +@fa-var-file-sound-o: "\f1c7"; +@fa-var-file-text: "\f15c"; +@fa-var-file-text-o: "\f0f6"; +@fa-var-file-video-o: "\f1c8"; +@fa-var-file-word-o: "\f1c2"; +@fa-var-file-zip-o: "\f1c6"; +@fa-var-files-o: "\f0c5"; +@fa-var-film: "\f008"; +@fa-var-filter: "\f0b0"; +@fa-var-fire: "\f06d"; +@fa-var-fire-extinguisher: "\f134"; +@fa-var-firefox: "\f269"; +@fa-var-first-order: "\f2b0"; +@fa-var-flag: "\f024"; +@fa-var-flag-checkered: "\f11e"; +@fa-var-flag-o: "\f11d"; +@fa-var-flash: "\f0e7"; +@fa-var-flask: "\f0c3"; +@fa-var-flickr: "\f16e"; +@fa-var-floppy-o: "\f0c7"; +@fa-var-folder: "\f07b"; +@fa-var-folder-o: "\f114"; +@fa-var-folder-open: "\f07c"; +@fa-var-folder-open-o: "\f115"; +@fa-var-font: "\f031"; +@fa-var-font-awesome: "\f2b4"; +@fa-var-fonticons: "\f280"; +@fa-var-fort-awesome: "\f286"; +@fa-var-forumbee: "\f211"; +@fa-var-forward: "\f04e"; +@fa-var-foursquare: "\f180"; +@fa-var-free-code-camp: "\f2c5"; +@fa-var-frown-o: "\f119"; +@fa-var-futbol-o: "\f1e3"; +@fa-var-gamepad: "\f11b"; +@fa-var-gavel: "\f0e3"; +@fa-var-gbp: "\f154"; +@fa-var-ge: "\f1d1"; +@fa-var-gear: "\f013"; +@fa-var-gears: "\f085"; +@fa-var-genderless: "\f22d"; +@fa-var-get-pocket: "\f265"; +@fa-var-gg: "\f260"; +@fa-var-gg-circle: "\f261"; +@fa-var-gift: "\f06b"; +@fa-var-git: "\f1d3"; +@fa-var-git-square: "\f1d2"; +@fa-var-github: "\f09b"; +@fa-var-github-alt: "\f113"; +@fa-var-github-square: "\f092"; +@fa-var-gitlab: "\f296"; +@fa-var-gittip: "\f184"; +@fa-var-glass: "\f000"; +@fa-var-glide: "\f2a5"; +@fa-var-glide-g: "\f2a6"; +@fa-var-globe: "\f0ac"; +@fa-var-google: "\f1a0"; +@fa-var-google-plus: "\f0d5"; +@fa-var-google-plus-circle: "\f2b3"; +@fa-var-google-plus-official: "\f2b3"; +@fa-var-google-plus-square: "\f0d4"; +@fa-var-google-wallet: "\f1ee"; +@fa-var-graduation-cap: "\f19d"; +@fa-var-gratipay: "\f184"; +@fa-var-grav: "\f2d6"; +@fa-var-group: "\f0c0"; +@fa-var-h-square: "\f0fd"; +@fa-var-hacker-news: "\f1d4"; +@fa-var-hand-grab-o: "\f255"; +@fa-var-hand-lizard-o: "\f258"; +@fa-var-hand-o-down: "\f0a7"; +@fa-var-hand-o-left: "\f0a5"; +@fa-var-hand-o-right: "\f0a4"; +@fa-var-hand-o-up: "\f0a6"; +@fa-var-hand-paper-o: "\f256"; +@fa-var-hand-peace-o: "\f25b"; +@fa-var-hand-pointer-o: "\f25a"; +@fa-var-hand-rock-o: "\f255"; +@fa-var-hand-scissors-o: "\f257"; +@fa-var-hand-spock-o: "\f259"; +@fa-var-hand-stop-o: "\f256"; +@fa-var-handshake-o: "\f2b5"; +@fa-var-hard-of-hearing: "\f2a4"; +@fa-var-hashtag: "\f292"; +@fa-var-hdd-o: "\f0a0"; +@fa-var-header: "\f1dc"; +@fa-var-headphones: "\f025"; +@fa-var-heart: "\f004"; +@fa-var-heart-o: "\f08a"; +@fa-var-heartbeat: "\f21e"; +@fa-var-history: "\f1da"; +@fa-var-home: "\f015"; +@fa-var-hospital-o: "\f0f8"; +@fa-var-hotel: "\f236"; +@fa-var-hourglass: "\f254"; +@fa-var-hourglass-1: "\f251"; +@fa-var-hourglass-2: "\f252"; +@fa-var-hourglass-3: "\f253"; +@fa-var-hourglass-end: "\f253"; +@fa-var-hourglass-half: "\f252"; +@fa-var-hourglass-o: "\f250"; +@fa-var-hourglass-start: "\f251"; +@fa-var-houzz: "\f27c"; +@fa-var-html5: "\f13b"; +@fa-var-i-cursor: "\f246"; +@fa-var-id-badge: "\f2c1"; +@fa-var-id-card: "\f2c2"; +@fa-var-id-card-o: "\f2c3"; +@fa-var-ils: "\f20b"; +@fa-var-image: "\f03e"; +@fa-var-imdb: "\f2d8"; +@fa-var-inbox: "\f01c"; +@fa-var-indent: "\f03c"; +@fa-var-industry: "\f275"; +@fa-var-info: "\f129"; +@fa-var-info-circle: "\f05a"; +@fa-var-inr: "\f156"; +@fa-var-instagram: "\f16d"; +@fa-var-institution: "\f19c"; +@fa-var-internet-explorer: "\f26b"; +@fa-var-intersex: "\f224"; +@fa-var-ioxhost: "\f208"; +@fa-var-italic: "\f033"; +@fa-var-joomla: "\f1aa"; +@fa-var-jpy: "\f157"; +@fa-var-jsfiddle: "\f1cc"; +@fa-var-key: "\f084"; +@fa-var-keyboard-o: "\f11c"; +@fa-var-krw: "\f159"; +@fa-var-language: "\f1ab"; +@fa-var-laptop: "\f109"; +@fa-var-lastfm: "\f202"; +@fa-var-lastfm-square: "\f203"; +@fa-var-leaf: "\f06c"; +@fa-var-leanpub: "\f212"; +@fa-var-legal: "\f0e3"; +@fa-var-lemon-o: "\f094"; +@fa-var-level-down: "\f149"; +@fa-var-level-up: "\f148"; +@fa-var-life-bouy: "\f1cd"; +@fa-var-life-buoy: "\f1cd"; +@fa-var-life-ring: "\f1cd"; +@fa-var-life-saver: "\f1cd"; +@fa-var-lightbulb-o: "\f0eb"; +@fa-var-line-chart: "\f201"; +@fa-var-link: "\f0c1"; +@fa-var-linkedin: "\f0e1"; +@fa-var-linkedin-square: "\f08c"; +@fa-var-linode: "\f2b8"; +@fa-var-linux: "\f17c"; +@fa-var-list: "\f03a"; +@fa-var-list-alt: "\f022"; +@fa-var-list-ol: "\f0cb"; +@fa-var-list-ul: "\f0ca"; +@fa-var-location-arrow: "\f124"; +@fa-var-lock: "\f023"; +@fa-var-long-arrow-down: "\f175"; +@fa-var-long-arrow-left: "\f177"; +@fa-var-long-arrow-right: "\f178"; +@fa-var-long-arrow-up: "\f176"; +@fa-var-low-vision: "\f2a8"; +@fa-var-magic: "\f0d0"; +@fa-var-magnet: "\f076"; +@fa-var-mail-forward: "\f064"; +@fa-var-mail-reply: "\f112"; +@fa-var-mail-reply-all: "\f122"; +@fa-var-male: "\f183"; +@fa-var-map: "\f279"; +@fa-var-map-marker: "\f041"; +@fa-var-map-o: "\f278"; +@fa-var-map-pin: "\f276"; +@fa-var-map-signs: "\f277"; +@fa-var-mars: "\f222"; +@fa-var-mars-double: "\f227"; +@fa-var-mars-stroke: "\f229"; +@fa-var-mars-stroke-h: "\f22b"; +@fa-var-mars-stroke-v: "\f22a"; +@fa-var-maxcdn: "\f136"; +@fa-var-meanpath: "\f20c"; +@fa-var-medium: "\f23a"; +@fa-var-medkit: "\f0fa"; +@fa-var-meetup: "\f2e0"; +@fa-var-meh-o: "\f11a"; +@fa-var-mercury: "\f223"; +@fa-var-microchip: "\f2db"; +@fa-var-microphone: "\f130"; +@fa-var-microphone-slash: "\f131"; +@fa-var-minus: "\f068"; +@fa-var-minus-circle: "\f056"; +@fa-var-minus-square: "\f146"; +@fa-var-minus-square-o: "\f147"; +@fa-var-mixcloud: "\f289"; +@fa-var-mobile: "\f10b"; +@fa-var-mobile-phone: "\f10b"; +@fa-var-modx: "\f285"; +@fa-var-money: "\f0d6"; +@fa-var-moon-o: "\f186"; +@fa-var-mortar-board: "\f19d"; +@fa-var-motorcycle: "\f21c"; +@fa-var-mouse-pointer: "\f245"; +@fa-var-music: "\f001"; +@fa-var-navicon: "\f0c9"; +@fa-var-neuter: "\f22c"; +@fa-var-newspaper-o: "\f1ea"; +@fa-var-object-group: "\f247"; +@fa-var-object-ungroup: "\f248"; +@fa-var-odnoklassniki: "\f263"; +@fa-var-odnoklassniki-square: "\f264"; +@fa-var-opencart: "\f23d"; +@fa-var-openid: "\f19b"; +@fa-var-opera: "\f26a"; +@fa-var-optin-monster: "\f23c"; +@fa-var-outdent: "\f03b"; +@fa-var-pagelines: "\f18c"; +@fa-var-paint-brush: "\f1fc"; +@fa-var-paper-plane: "\f1d8"; +@fa-var-paper-plane-o: "\f1d9"; +@fa-var-paperclip: "\f0c6"; +@fa-var-paragraph: "\f1dd"; +@fa-var-paste: "\f0ea"; +@fa-var-pause: "\f04c"; +@fa-var-pause-circle: "\f28b"; +@fa-var-pause-circle-o: "\f28c"; +@fa-var-paw: "\f1b0"; +@fa-var-paypal: "\f1ed"; +@fa-var-pencil: "\f040"; +@fa-var-pencil-square: "\f14b"; +@fa-var-pencil-square-o: "\f044"; +@fa-var-percent: "\f295"; +@fa-var-phone: "\f095"; +@fa-var-phone-square: "\f098"; +@fa-var-photo: "\f03e"; +@fa-var-picture-o: "\f03e"; +@fa-var-pie-chart: "\f200"; +@fa-var-pied-piper: "\f2ae"; +@fa-var-pied-piper-alt: "\f1a8"; +@fa-var-pied-piper-pp: "\f1a7"; +@fa-var-pinterest: "\f0d2"; +@fa-var-pinterest-p: "\f231"; +@fa-var-pinterest-square: "\f0d3"; +@fa-var-plane: "\f072"; +@fa-var-play: "\f04b"; +@fa-var-play-circle: "\f144"; +@fa-var-play-circle-o: "\f01d"; +@fa-var-plug: "\f1e6"; +@fa-var-plus: "\f067"; +@fa-var-plus-circle: "\f055"; +@fa-var-plus-square: "\f0fe"; +@fa-var-plus-square-o: "\f196"; +@fa-var-podcast: "\f2ce"; +@fa-var-power-off: "\f011"; +@fa-var-print: "\f02f"; +@fa-var-product-hunt: "\f288"; +@fa-var-puzzle-piece: "\f12e"; +@fa-var-qq: "\f1d6"; +@fa-var-qrcode: "\f029"; +@fa-var-question: "\f128"; +@fa-var-question-circle: "\f059"; +@fa-var-question-circle-o: "\f29c"; +@fa-var-quora: "\f2c4"; +@fa-var-quote-left: "\f10d"; +@fa-var-quote-right: "\f10e"; +@fa-var-ra: "\f1d0"; +@fa-var-random: "\f074"; +@fa-var-ravelry: "\f2d9"; +@fa-var-rebel: "\f1d0"; +@fa-var-recycle: "\f1b8"; +@fa-var-reddit: "\f1a1"; +@fa-var-reddit-alien: "\f281"; +@fa-var-reddit-square: "\f1a2"; +@fa-var-refresh: "\f021"; +@fa-var-registered: "\f25d"; +@fa-var-remove: "\f00d"; +@fa-var-renren: "\f18b"; +@fa-var-reorder: "\f0c9"; +@fa-var-repeat: "\f01e"; +@fa-var-reply: "\f112"; +@fa-var-reply-all: "\f122"; +@fa-var-resistance: "\f1d0"; +@fa-var-retweet: "\f079"; +@fa-var-rmb: "\f157"; +@fa-var-road: "\f018"; +@fa-var-rocket: "\f135"; +@fa-var-rotate-left: "\f0e2"; +@fa-var-rotate-right: "\f01e"; +@fa-var-rouble: "\f158"; +@fa-var-rss: "\f09e"; +@fa-var-rss-square: "\f143"; +@fa-var-rub: "\f158"; +@fa-var-ruble: "\f158"; +@fa-var-rupee: "\f156"; +@fa-var-s15: "\f2cd"; +@fa-var-safari: "\f267"; +@fa-var-save: "\f0c7"; +@fa-var-scissors: "\f0c4"; +@fa-var-scribd: "\f28a"; +@fa-var-search: "\f002"; +@fa-var-search-minus: "\f010"; +@fa-var-search-plus: "\f00e"; +@fa-var-sellsy: "\f213"; +@fa-var-send: "\f1d8"; +@fa-var-send-o: "\f1d9"; +@fa-var-server: "\f233"; +@fa-var-share: "\f064"; +@fa-var-share-alt: "\f1e0"; +@fa-var-share-alt-square: "\f1e1"; +@fa-var-share-square: "\f14d"; +@fa-var-share-square-o: "\f045"; +@fa-var-shekel: "\f20b"; +@fa-var-sheqel: "\f20b"; +@fa-var-shield: "\f132"; +@fa-var-ship: "\f21a"; +@fa-var-shirtsinbulk: "\f214"; +@fa-var-shopping-bag: "\f290"; +@fa-var-shopping-basket: "\f291"; +@fa-var-shopping-cart: "\f07a"; +@fa-var-shower: "\f2cc"; +@fa-var-sign-in: "\f090"; +@fa-var-sign-language: "\f2a7"; +@fa-var-sign-out: "\f08b"; +@fa-var-signal: "\f012"; +@fa-var-signing: "\f2a7"; +@fa-var-simplybuilt: "\f215"; +@fa-var-sitemap: "\f0e8"; +@fa-var-skyatlas: "\f216"; +@fa-var-skype: "\f17e"; +@fa-var-slack: "\f198"; +@fa-var-sliders: "\f1de"; +@fa-var-slideshare: "\f1e7"; +@fa-var-smile-o: "\f118"; +@fa-var-snapchat: "\f2ab"; +@fa-var-snapchat-ghost: "\f2ac"; +@fa-var-snapchat-square: "\f2ad"; +@fa-var-snowflake-o: "\f2dc"; +@fa-var-soccer-ball-o: "\f1e3"; +@fa-var-sort: "\f0dc"; +@fa-var-sort-alpha-asc: "\f15d"; +@fa-var-sort-alpha-desc: "\f15e"; +@fa-var-sort-amount-asc: "\f160"; +@fa-var-sort-amount-desc: "\f161"; +@fa-var-sort-asc: "\f0de"; +@fa-var-sort-desc: "\f0dd"; +@fa-var-sort-down: "\f0dd"; +@fa-var-sort-numeric-asc: "\f162"; +@fa-var-sort-numeric-desc: "\f163"; +@fa-var-sort-up: "\f0de"; +@fa-var-soundcloud: "\f1be"; +@fa-var-space-shuttle: "\f197"; +@fa-var-spinner: "\f110"; +@fa-var-spoon: "\f1b1"; +@fa-var-spotify: "\f1bc"; +@fa-var-square: "\f0c8"; +@fa-var-square-o: "\f096"; +@fa-var-stack-exchange: "\f18d"; +@fa-var-stack-overflow: "\f16c"; +@fa-var-star: "\f005"; +@fa-var-star-half: "\f089"; +@fa-var-star-half-empty: "\f123"; +@fa-var-star-half-full: "\f123"; +@fa-var-star-half-o: "\f123"; +@fa-var-star-o: "\f006"; +@fa-var-steam: "\f1b6"; +@fa-var-steam-square: "\f1b7"; +@fa-var-step-backward: "\f048"; +@fa-var-step-forward: "\f051"; +@fa-var-stethoscope: "\f0f1"; +@fa-var-sticky-note: "\f249"; +@fa-var-sticky-note-o: "\f24a"; +@fa-var-stop: "\f04d"; +@fa-var-stop-circle: "\f28d"; +@fa-var-stop-circle-o: "\f28e"; +@fa-var-street-view: "\f21d"; +@fa-var-strikethrough: "\f0cc"; +@fa-var-stumbleupon: "\f1a4"; +@fa-var-stumbleupon-circle: "\f1a3"; +@fa-var-subscript: "\f12c"; +@fa-var-subway: "\f239"; +@fa-var-suitcase: "\f0f2"; +@fa-var-sun-o: "\f185"; +@fa-var-superpowers: "\f2dd"; +@fa-var-superscript: "\f12b"; +@fa-var-support: "\f1cd"; +@fa-var-table: "\f0ce"; +@fa-var-tablet: "\f10a"; +@fa-var-tachometer: "\f0e4"; +@fa-var-tag: "\f02b"; +@fa-var-tags: "\f02c"; +@fa-var-tasks: "\f0ae"; +@fa-var-taxi: "\f1ba"; +@fa-var-telegram: "\f2c6"; +@fa-var-television: "\f26c"; +@fa-var-tencent-weibo: "\f1d5"; +@fa-var-terminal: "\f120"; +@fa-var-text-height: "\f034"; +@fa-var-text-width: "\f035"; +@fa-var-th: "\f00a"; +@fa-var-th-large: "\f009"; +@fa-var-th-list: "\f00b"; +@fa-var-themeisle: "\f2b2"; +@fa-var-thermometer: "\f2c7"; +@fa-var-thermometer-0: "\f2cb"; +@fa-var-thermometer-1: "\f2ca"; +@fa-var-thermometer-2: "\f2c9"; +@fa-var-thermometer-3: "\f2c8"; +@fa-var-thermometer-4: "\f2c7"; +@fa-var-thermometer-empty: "\f2cb"; +@fa-var-thermometer-full: "\f2c7"; +@fa-var-thermometer-half: "\f2c9"; +@fa-var-thermometer-quarter: "\f2ca"; +@fa-var-thermometer-three-quarters: "\f2c8"; +@fa-var-thumb-tack: "\f08d"; +@fa-var-thumbs-down: "\f165"; +@fa-var-thumbs-o-down: "\f088"; +@fa-var-thumbs-o-up: "\f087"; +@fa-var-thumbs-up: "\f164"; +@fa-var-ticket: "\f145"; +@fa-var-times: "\f00d"; +@fa-var-times-circle: "\f057"; +@fa-var-times-circle-o: "\f05c"; +@fa-var-times-rectangle: "\f2d3"; +@fa-var-times-rectangle-o: "\f2d4"; +@fa-var-tint: "\f043"; +@fa-var-toggle-down: "\f150"; +@fa-var-toggle-left: "\f191"; +@fa-var-toggle-off: "\f204"; +@fa-var-toggle-on: "\f205"; +@fa-var-toggle-right: "\f152"; +@fa-var-toggle-up: "\f151"; +@fa-var-trademark: "\f25c"; +@fa-var-train: "\f238"; +@fa-var-transgender: "\f224"; +@fa-var-transgender-alt: "\f225"; +@fa-var-trash: "\f1f8"; +@fa-var-trash-o: "\f014"; +@fa-var-tree: "\f1bb"; +@fa-var-trello: "\f181"; +@fa-var-tripadvisor: "\f262"; +@fa-var-trophy: "\f091"; +@fa-var-truck: "\f0d1"; +@fa-var-try: "\f195"; +@fa-var-tty: "\f1e4"; +@fa-var-tumblr: "\f173"; +@fa-var-tumblr-square: "\f174"; +@fa-var-turkish-lira: "\f195"; +@fa-var-tv: "\f26c"; +@fa-var-twitch: "\f1e8"; +@fa-var-twitter: "\f099"; +@fa-var-twitter-square: "\f081"; +@fa-var-umbrella: "\f0e9"; +@fa-var-underline: "\f0cd"; +@fa-var-undo: "\f0e2"; +@fa-var-universal-access: "\f29a"; +@fa-var-university: "\f19c"; +@fa-var-unlink: "\f127"; +@fa-var-unlock: "\f09c"; +@fa-var-unlock-alt: "\f13e"; +@fa-var-unsorted: "\f0dc"; +@fa-var-upload: "\f093"; +@fa-var-usb: "\f287"; +@fa-var-usd: "\f155"; +@fa-var-user: "\f007"; +@fa-var-user-circle: "\f2bd"; +@fa-var-user-circle-o: "\f2be"; +@fa-var-user-md: "\f0f0"; +@fa-var-user-o: "\f2c0"; +@fa-var-user-plus: "\f234"; +@fa-var-user-secret: "\f21b"; +@fa-var-user-times: "\f235"; +@fa-var-users: "\f0c0"; +@fa-var-vcard: "\f2bb"; +@fa-var-vcard-o: "\f2bc"; +@fa-var-venus: "\f221"; +@fa-var-venus-double: "\f226"; +@fa-var-venus-mars: "\f228"; +@fa-var-viacoin: "\f237"; +@fa-var-viadeo: "\f2a9"; +@fa-var-viadeo-square: "\f2aa"; +@fa-var-video-camera: "\f03d"; +@fa-var-vimeo: "\f27d"; +@fa-var-vimeo-square: "\f194"; +@fa-var-vine: "\f1ca"; +@fa-var-vk: "\f189"; +@fa-var-volume-control-phone: "\f2a0"; +@fa-var-volume-down: "\f027"; +@fa-var-volume-off: "\f026"; +@fa-var-volume-up: "\f028"; +@fa-var-warning: "\f071"; +@fa-var-wechat: "\f1d7"; +@fa-var-weibo: "\f18a"; +@fa-var-weixin: "\f1d7"; +@fa-var-whatsapp: "\f232"; +@fa-var-wheelchair: "\f193"; +@fa-var-wheelchair-alt: "\f29b"; +@fa-var-wifi: "\f1eb"; +@fa-var-wikipedia-w: "\f266"; +@fa-var-window-close: "\f2d3"; +@fa-var-window-close-o: "\f2d4"; +@fa-var-window-maximize: "\f2d0"; +@fa-var-window-minimize: "\f2d1"; +@fa-var-window-restore: "\f2d2"; +@fa-var-windows: "\f17a"; +@fa-var-won: "\f159"; +@fa-var-wordpress: "\f19a"; +@fa-var-wpbeginner: "\f297"; +@fa-var-wpexplorer: "\f2de"; +@fa-var-wpforms: "\f298"; +@fa-var-wrench: "\f0ad"; +@fa-var-xing: "\f168"; +@fa-var-xing-square: "\f169"; +@fa-var-y-combinator: "\f23b"; +@fa-var-y-combinator-square: "\f1d4"; +@fa-var-yahoo: "\f19e"; +@fa-var-yc: "\f23b"; +@fa-var-yc-square: "\f1d4"; +@fa-var-yelp: "\f1e9"; +@fa-var-yen: "\f157"; +@fa-var-yoast: "\f2b1"; +@fa-var-youtube: "\f167"; +@fa-var-youtube-play: "\f16a"; +@fa-var-youtube-square: "\f166"; + diff --git a/node_modules/font-awesome/package.json b/node_modules/font-awesome/package.json new file mode 100644 index 0000000000..86f58db06b --- /dev/null +++ b/node_modules/font-awesome/package.json @@ -0,0 +1,44 @@ +{ + "name": "font-awesome", + "description": "The iconic font and CSS framework", + "version": "4.7.0", + "style": "css/font-awesome.css", + "keywords": ["font", "awesome", "fontawesome", "icon", "font", "bootstrap"], + "homepage": "http://fontawesome.io/", + "bugs": { + "url" : "http://github.com/FortAwesome/Font-Awesome/issues" + }, + "author": { + "name": "Dave Gandy", + "email": "dave@fontawesome.io", + "web": "http://twitter.com/davegandy" + }, + "repository": { + "type": "git", + "url": "https://github.com/FortAwesome/Font-Awesome.git" + }, + "contributors": [ + { + "name": "Brian Talbot", + "web": "http://twitter.com/talbs" + }, + { + "name": "Travis Chase", + "web": "http://twitter.com/supercodepoet" + }, + { + "name": "Rob Madole", + "web": "http://twitter.com/robmadole" + }, + { + "name": "Geremia Taglialatela", + "web": "http://twitter.com/gtagliala" + } + ], + "license": "(OFL-1.1 AND MIT)", + "dependencies": { + }, + "engines" : { + "node" : ">=0.10.3" + } +} diff --git a/node_modules/font-awesome/scss/_animated.scss b/node_modules/font-awesome/scss/_animated.scss new file mode 100644 index 0000000000..8a020dbfff --- /dev/null +++ b/node_modules/font-awesome/scss/_animated.scss @@ -0,0 +1,34 @@ +// Spinning Icons +// -------------------------- + +.#{$fa-css-prefix}-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.#{$fa-css-prefix}-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} diff --git a/node_modules/font-awesome/scss/_bordered-pulled.scss b/node_modules/font-awesome/scss/_bordered-pulled.scss new file mode 100644 index 0000000000..d4b85a02f2 --- /dev/null +++ b/node_modules/font-awesome/scss/_bordered-pulled.scss @@ -0,0 +1,25 @@ +// Bordered & Pulled +// ------------------------- + +.#{$fa-css-prefix}-border { + padding: .2em .25em .15em; + border: solid .08em $fa-border-color; + border-radius: .1em; +} + +.#{$fa-css-prefix}-pull-left { float: left; } +.#{$fa-css-prefix}-pull-right { float: right; } + +.#{$fa-css-prefix} { + &.#{$fa-css-prefix}-pull-left { margin-right: .3em; } + &.#{$fa-css-prefix}-pull-right { margin-left: .3em; } +} + +/* Deprecated as of 4.4.0 */ +.pull-right { float: right; } +.pull-left { float: left; } + +.#{$fa-css-prefix} { + &.pull-left { margin-right: .3em; } + &.pull-right { margin-left: .3em; } +} diff --git a/node_modules/font-awesome/scss/_core.scss b/node_modules/font-awesome/scss/_core.scss new file mode 100644 index 0000000000..7425ef85fc --- /dev/null +++ b/node_modules/font-awesome/scss/_core.scss @@ -0,0 +1,12 @@ +// Base Class Definition +// ------------------------- + +.#{$fa-css-prefix} { + display: inline-block; + font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration + font-size: inherit; // can't have font-size inherit on line above, so need to override + text-rendering: auto; // optimizelegibility throws things off #1094 + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + +} diff --git a/node_modules/font-awesome/scss/_fixed-width.scss b/node_modules/font-awesome/scss/_fixed-width.scss new file mode 100644 index 0000000000..b221c98133 --- /dev/null +++ b/node_modules/font-awesome/scss/_fixed-width.scss @@ -0,0 +1,6 @@ +// Fixed Width Icons +// ------------------------- +.#{$fa-css-prefix}-fw { + width: (18em / 14); + text-align: center; +} diff --git a/node_modules/font-awesome/scss/_icons.scss b/node_modules/font-awesome/scss/_icons.scss new file mode 100644 index 0000000000..e63e702c4d --- /dev/null +++ b/node_modules/font-awesome/scss/_icons.scss @@ -0,0 +1,789 @@ +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ + +.#{$fa-css-prefix}-glass:before { content: $fa-var-glass; } +.#{$fa-css-prefix}-music:before { content: $fa-var-music; } +.#{$fa-css-prefix}-search:before { content: $fa-var-search; } +.#{$fa-css-prefix}-envelope-o:before { content: $fa-var-envelope-o; } +.#{$fa-css-prefix}-heart:before { content: $fa-var-heart; } +.#{$fa-css-prefix}-star:before { content: $fa-var-star; } +.#{$fa-css-prefix}-star-o:before { content: $fa-var-star-o; } +.#{$fa-css-prefix}-user:before { content: $fa-var-user; } +.#{$fa-css-prefix}-film:before { content: $fa-var-film; } +.#{$fa-css-prefix}-th-large:before { content: $fa-var-th-large; } +.#{$fa-css-prefix}-th:before { content: $fa-var-th; } +.#{$fa-css-prefix}-th-list:before { content: $fa-var-th-list; } +.#{$fa-css-prefix}-check:before { content: $fa-var-check; } +.#{$fa-css-prefix}-remove:before, +.#{$fa-css-prefix}-close:before, +.#{$fa-css-prefix}-times:before { content: $fa-var-times; } +.#{$fa-css-prefix}-search-plus:before { content: $fa-var-search-plus; } +.#{$fa-css-prefix}-search-minus:before { content: $fa-var-search-minus; } +.#{$fa-css-prefix}-power-off:before { content: $fa-var-power-off; } +.#{$fa-css-prefix}-signal:before { content: $fa-var-signal; } +.#{$fa-css-prefix}-gear:before, +.#{$fa-css-prefix}-cog:before { content: $fa-var-cog; } +.#{$fa-css-prefix}-trash-o:before { content: $fa-var-trash-o; } +.#{$fa-css-prefix}-home:before { content: $fa-var-home; } +.#{$fa-css-prefix}-file-o:before { content: $fa-var-file-o; } +.#{$fa-css-prefix}-clock-o:before { content: $fa-var-clock-o; } +.#{$fa-css-prefix}-road:before { content: $fa-var-road; } +.#{$fa-css-prefix}-download:before { content: $fa-var-download; } +.#{$fa-css-prefix}-arrow-circle-o-down:before { content: $fa-var-arrow-circle-o-down; } +.#{$fa-css-prefix}-arrow-circle-o-up:before { content: $fa-var-arrow-circle-o-up; } +.#{$fa-css-prefix}-inbox:before { content: $fa-var-inbox; } +.#{$fa-css-prefix}-play-circle-o:before { content: $fa-var-play-circle-o; } +.#{$fa-css-prefix}-rotate-right:before, +.#{$fa-css-prefix}-repeat:before { content: $fa-var-repeat; } +.#{$fa-css-prefix}-refresh:before { content: $fa-var-refresh; } +.#{$fa-css-prefix}-list-alt:before { content: $fa-var-list-alt; } +.#{$fa-css-prefix}-lock:before { content: $fa-var-lock; } +.#{$fa-css-prefix}-flag:before { content: $fa-var-flag; } +.#{$fa-css-prefix}-headphones:before { content: $fa-var-headphones; } +.#{$fa-css-prefix}-volume-off:before { content: $fa-var-volume-off; } +.#{$fa-css-prefix}-volume-down:before { content: $fa-var-volume-down; } +.#{$fa-css-prefix}-volume-up:before { content: $fa-var-volume-up; } +.#{$fa-css-prefix}-qrcode:before { content: $fa-var-qrcode; } +.#{$fa-css-prefix}-barcode:before { content: $fa-var-barcode; } +.#{$fa-css-prefix}-tag:before { content: $fa-var-tag; } +.#{$fa-css-prefix}-tags:before { content: $fa-var-tags; } +.#{$fa-css-prefix}-book:before { content: $fa-var-book; } +.#{$fa-css-prefix}-bookmark:before { content: $fa-var-bookmark; } +.#{$fa-css-prefix}-print:before { content: $fa-var-print; } +.#{$fa-css-prefix}-camera:before { content: $fa-var-camera; } +.#{$fa-css-prefix}-font:before { content: $fa-var-font; } +.#{$fa-css-prefix}-bold:before { content: $fa-var-bold; } +.#{$fa-css-prefix}-italic:before { content: $fa-var-italic; } +.#{$fa-css-prefix}-text-height:before { content: $fa-var-text-height; } +.#{$fa-css-prefix}-text-width:before { content: $fa-var-text-width; } +.#{$fa-css-prefix}-align-left:before { content: $fa-var-align-left; } +.#{$fa-css-prefix}-align-center:before { content: $fa-var-align-center; } +.#{$fa-css-prefix}-align-right:before { content: $fa-var-align-right; } +.#{$fa-css-prefix}-align-justify:before { content: $fa-var-align-justify; } +.#{$fa-css-prefix}-list:before { content: $fa-var-list; } +.#{$fa-css-prefix}-dedent:before, +.#{$fa-css-prefix}-outdent:before { content: $fa-var-outdent; } +.#{$fa-css-prefix}-indent:before { content: $fa-var-indent; } +.#{$fa-css-prefix}-video-camera:before { content: $fa-var-video-camera; } +.#{$fa-css-prefix}-photo:before, +.#{$fa-css-prefix}-image:before, +.#{$fa-css-prefix}-picture-o:before { content: $fa-var-picture-o; } +.#{$fa-css-prefix}-pencil:before { content: $fa-var-pencil; } +.#{$fa-css-prefix}-map-marker:before { content: $fa-var-map-marker; } +.#{$fa-css-prefix}-adjust:before { content: $fa-var-adjust; } +.#{$fa-css-prefix}-tint:before { content: $fa-var-tint; } +.#{$fa-css-prefix}-edit:before, +.#{$fa-css-prefix}-pencil-square-o:before { content: $fa-var-pencil-square-o; } +.#{$fa-css-prefix}-share-square-o:before { content: $fa-var-share-square-o; } +.#{$fa-css-prefix}-check-square-o:before { content: $fa-var-check-square-o; } +.#{$fa-css-prefix}-arrows:before { content: $fa-var-arrows; } +.#{$fa-css-prefix}-step-backward:before { content: $fa-var-step-backward; } +.#{$fa-css-prefix}-fast-backward:before { content: $fa-var-fast-backward; } +.#{$fa-css-prefix}-backward:before { content: $fa-var-backward; } +.#{$fa-css-prefix}-play:before { content: $fa-var-play; } +.#{$fa-css-prefix}-pause:before { content: $fa-var-pause; } +.#{$fa-css-prefix}-stop:before { content: $fa-var-stop; } +.#{$fa-css-prefix}-forward:before { content: $fa-var-forward; } +.#{$fa-css-prefix}-fast-forward:before { content: $fa-var-fast-forward; } +.#{$fa-css-prefix}-step-forward:before { content: $fa-var-step-forward; } +.#{$fa-css-prefix}-eject:before { content: $fa-var-eject; } +.#{$fa-css-prefix}-chevron-left:before { content: $fa-var-chevron-left; } +.#{$fa-css-prefix}-chevron-right:before { content: $fa-var-chevron-right; } +.#{$fa-css-prefix}-plus-circle:before { content: $fa-var-plus-circle; } +.#{$fa-css-prefix}-minus-circle:before { content: $fa-var-minus-circle; } +.#{$fa-css-prefix}-times-circle:before { content: $fa-var-times-circle; } +.#{$fa-css-prefix}-check-circle:before { content: $fa-var-check-circle; } +.#{$fa-css-prefix}-question-circle:before { content: $fa-var-question-circle; } +.#{$fa-css-prefix}-info-circle:before { content: $fa-var-info-circle; } +.#{$fa-css-prefix}-crosshairs:before { content: $fa-var-crosshairs; } +.#{$fa-css-prefix}-times-circle-o:before { content: $fa-var-times-circle-o; } +.#{$fa-css-prefix}-check-circle-o:before { content: $fa-var-check-circle-o; } +.#{$fa-css-prefix}-ban:before { content: $fa-var-ban; } +.#{$fa-css-prefix}-arrow-left:before { content: $fa-var-arrow-left; } +.#{$fa-css-prefix}-arrow-right:before { content: $fa-var-arrow-right; } +.#{$fa-css-prefix}-arrow-up:before { content: $fa-var-arrow-up; } +.#{$fa-css-prefix}-arrow-down:before { content: $fa-var-arrow-down; } +.#{$fa-css-prefix}-mail-forward:before, +.#{$fa-css-prefix}-share:before { content: $fa-var-share; } +.#{$fa-css-prefix}-expand:before { content: $fa-var-expand; } +.#{$fa-css-prefix}-compress:before { content: $fa-var-compress; } +.#{$fa-css-prefix}-plus:before { content: $fa-var-plus; } +.#{$fa-css-prefix}-minus:before { content: $fa-var-minus; } +.#{$fa-css-prefix}-asterisk:before { content: $fa-var-asterisk; } +.#{$fa-css-prefix}-exclamation-circle:before { content: $fa-var-exclamation-circle; } +.#{$fa-css-prefix}-gift:before { content: $fa-var-gift; } +.#{$fa-css-prefix}-leaf:before { content: $fa-var-leaf; } +.#{$fa-css-prefix}-fire:before { content: $fa-var-fire; } +.#{$fa-css-prefix}-eye:before { content: $fa-var-eye; } +.#{$fa-css-prefix}-eye-slash:before { content: $fa-var-eye-slash; } +.#{$fa-css-prefix}-warning:before, +.#{$fa-css-prefix}-exclamation-triangle:before { content: $fa-var-exclamation-triangle; } +.#{$fa-css-prefix}-plane:before { content: $fa-var-plane; } +.#{$fa-css-prefix}-calendar:before { content: $fa-var-calendar; } +.#{$fa-css-prefix}-random:before { content: $fa-var-random; } +.#{$fa-css-prefix}-comment:before { content: $fa-var-comment; } +.#{$fa-css-prefix}-magnet:before { content: $fa-var-magnet; } +.#{$fa-css-prefix}-chevron-up:before { content: $fa-var-chevron-up; } +.#{$fa-css-prefix}-chevron-down:before { content: $fa-var-chevron-down; } +.#{$fa-css-prefix}-retweet:before { content: $fa-var-retweet; } +.#{$fa-css-prefix}-shopping-cart:before { content: $fa-var-shopping-cart; } +.#{$fa-css-prefix}-folder:before { content: $fa-var-folder; } +.#{$fa-css-prefix}-folder-open:before { content: $fa-var-folder-open; } +.#{$fa-css-prefix}-arrows-v:before { content: $fa-var-arrows-v; } +.#{$fa-css-prefix}-arrows-h:before { content: $fa-var-arrows-h; } +.#{$fa-css-prefix}-bar-chart-o:before, +.#{$fa-css-prefix}-bar-chart:before { content: $fa-var-bar-chart; } +.#{$fa-css-prefix}-twitter-square:before { content: $fa-var-twitter-square; } +.#{$fa-css-prefix}-facebook-square:before { content: $fa-var-facebook-square; } +.#{$fa-css-prefix}-camera-retro:before { content: $fa-var-camera-retro; } +.#{$fa-css-prefix}-key:before { content: $fa-var-key; } +.#{$fa-css-prefix}-gears:before, +.#{$fa-css-prefix}-cogs:before { content: $fa-var-cogs; } +.#{$fa-css-prefix}-comments:before { content: $fa-var-comments; } +.#{$fa-css-prefix}-thumbs-o-up:before { content: $fa-var-thumbs-o-up; } +.#{$fa-css-prefix}-thumbs-o-down:before { content: $fa-var-thumbs-o-down; } +.#{$fa-css-prefix}-star-half:before { content: $fa-var-star-half; } +.#{$fa-css-prefix}-heart-o:before { content: $fa-var-heart-o; } +.#{$fa-css-prefix}-sign-out:before { content: $fa-var-sign-out; } +.#{$fa-css-prefix}-linkedin-square:before { content: $fa-var-linkedin-square; } +.#{$fa-css-prefix}-thumb-tack:before { content: $fa-var-thumb-tack; } +.#{$fa-css-prefix}-external-link:before { content: $fa-var-external-link; } +.#{$fa-css-prefix}-sign-in:before { content: $fa-var-sign-in; } +.#{$fa-css-prefix}-trophy:before { content: $fa-var-trophy; } +.#{$fa-css-prefix}-github-square:before { content: $fa-var-github-square; } +.#{$fa-css-prefix}-upload:before { content: $fa-var-upload; } +.#{$fa-css-prefix}-lemon-o:before { content: $fa-var-lemon-o; } +.#{$fa-css-prefix}-phone:before { content: $fa-var-phone; } +.#{$fa-css-prefix}-square-o:before { content: $fa-var-square-o; } +.#{$fa-css-prefix}-bookmark-o:before { content: $fa-var-bookmark-o; } +.#{$fa-css-prefix}-phone-square:before { content: $fa-var-phone-square; } +.#{$fa-css-prefix}-twitter:before { content: $fa-var-twitter; } +.#{$fa-css-prefix}-facebook-f:before, +.#{$fa-css-prefix}-facebook:before { content: $fa-var-facebook; } +.#{$fa-css-prefix}-github:before { content: $fa-var-github; } +.#{$fa-css-prefix}-unlock:before { content: $fa-var-unlock; } +.#{$fa-css-prefix}-credit-card:before { content: $fa-var-credit-card; } +.#{$fa-css-prefix}-feed:before, +.#{$fa-css-prefix}-rss:before { content: $fa-var-rss; } +.#{$fa-css-prefix}-hdd-o:before { content: $fa-var-hdd-o; } +.#{$fa-css-prefix}-bullhorn:before { content: $fa-var-bullhorn; } +.#{$fa-css-prefix}-bell:before { content: $fa-var-bell; } +.#{$fa-css-prefix}-certificate:before { content: $fa-var-certificate; } +.#{$fa-css-prefix}-hand-o-right:before { content: $fa-var-hand-o-right; } +.#{$fa-css-prefix}-hand-o-left:before { content: $fa-var-hand-o-left; } +.#{$fa-css-prefix}-hand-o-up:before { content: $fa-var-hand-o-up; } +.#{$fa-css-prefix}-hand-o-down:before { content: $fa-var-hand-o-down; } +.#{$fa-css-prefix}-arrow-circle-left:before { content: $fa-var-arrow-circle-left; } +.#{$fa-css-prefix}-arrow-circle-right:before { content: $fa-var-arrow-circle-right; } +.#{$fa-css-prefix}-arrow-circle-up:before { content: $fa-var-arrow-circle-up; } +.#{$fa-css-prefix}-arrow-circle-down:before { content: $fa-var-arrow-circle-down; } +.#{$fa-css-prefix}-globe:before { content: $fa-var-globe; } +.#{$fa-css-prefix}-wrench:before { content: $fa-var-wrench; } +.#{$fa-css-prefix}-tasks:before { content: $fa-var-tasks; } +.#{$fa-css-prefix}-filter:before { content: $fa-var-filter; } +.#{$fa-css-prefix}-briefcase:before { content: $fa-var-briefcase; } +.#{$fa-css-prefix}-arrows-alt:before { content: $fa-var-arrows-alt; } +.#{$fa-css-prefix}-group:before, +.#{$fa-css-prefix}-users:before { content: $fa-var-users; } +.#{$fa-css-prefix}-chain:before, +.#{$fa-css-prefix}-link:before { content: $fa-var-link; } +.#{$fa-css-prefix}-cloud:before { content: $fa-var-cloud; } +.#{$fa-css-prefix}-flask:before { content: $fa-var-flask; } +.#{$fa-css-prefix}-cut:before, +.#{$fa-css-prefix}-scissors:before { content: $fa-var-scissors; } +.#{$fa-css-prefix}-copy:before, +.#{$fa-css-prefix}-files-o:before { content: $fa-var-files-o; } +.#{$fa-css-prefix}-paperclip:before { content: $fa-var-paperclip; } +.#{$fa-css-prefix}-save:before, +.#{$fa-css-prefix}-floppy-o:before { content: $fa-var-floppy-o; } +.#{$fa-css-prefix}-square:before { content: $fa-var-square; } +.#{$fa-css-prefix}-navicon:before, +.#{$fa-css-prefix}-reorder:before, +.#{$fa-css-prefix}-bars:before { content: $fa-var-bars; } +.#{$fa-css-prefix}-list-ul:before { content: $fa-var-list-ul; } +.#{$fa-css-prefix}-list-ol:before { content: $fa-var-list-ol; } +.#{$fa-css-prefix}-strikethrough:before { content: $fa-var-strikethrough; } +.#{$fa-css-prefix}-underline:before { content: $fa-var-underline; } +.#{$fa-css-prefix}-table:before { content: $fa-var-table; } +.#{$fa-css-prefix}-magic:before { content: $fa-var-magic; } +.#{$fa-css-prefix}-truck:before { content: $fa-var-truck; } +.#{$fa-css-prefix}-pinterest:before { content: $fa-var-pinterest; } +.#{$fa-css-prefix}-pinterest-square:before { content: $fa-var-pinterest-square; } +.#{$fa-css-prefix}-google-plus-square:before { content: $fa-var-google-plus-square; } +.#{$fa-css-prefix}-google-plus:before { content: $fa-var-google-plus; } +.#{$fa-css-prefix}-money:before { content: $fa-var-money; } +.#{$fa-css-prefix}-caret-down:before { content: $fa-var-caret-down; } +.#{$fa-css-prefix}-caret-up:before { content: $fa-var-caret-up; } +.#{$fa-css-prefix}-caret-left:before { content: $fa-var-caret-left; } +.#{$fa-css-prefix}-caret-right:before { content: $fa-var-caret-right; } +.#{$fa-css-prefix}-columns:before { content: $fa-var-columns; } +.#{$fa-css-prefix}-unsorted:before, +.#{$fa-css-prefix}-sort:before { content: $fa-var-sort; } +.#{$fa-css-prefix}-sort-down:before, +.#{$fa-css-prefix}-sort-desc:before { content: $fa-var-sort-desc; } +.#{$fa-css-prefix}-sort-up:before, +.#{$fa-css-prefix}-sort-asc:before { content: $fa-var-sort-asc; } +.#{$fa-css-prefix}-envelope:before { content: $fa-var-envelope; } +.#{$fa-css-prefix}-linkedin:before { content: $fa-var-linkedin; } +.#{$fa-css-prefix}-rotate-left:before, +.#{$fa-css-prefix}-undo:before { content: $fa-var-undo; } +.#{$fa-css-prefix}-legal:before, +.#{$fa-css-prefix}-gavel:before { content: $fa-var-gavel; } +.#{$fa-css-prefix}-dashboard:before, +.#{$fa-css-prefix}-tachometer:before { content: $fa-var-tachometer; } +.#{$fa-css-prefix}-comment-o:before { content: $fa-var-comment-o; } +.#{$fa-css-prefix}-comments-o:before { content: $fa-var-comments-o; } +.#{$fa-css-prefix}-flash:before, +.#{$fa-css-prefix}-bolt:before { content: $fa-var-bolt; } +.#{$fa-css-prefix}-sitemap:before { content: $fa-var-sitemap; } +.#{$fa-css-prefix}-umbrella:before { content: $fa-var-umbrella; } +.#{$fa-css-prefix}-paste:before, +.#{$fa-css-prefix}-clipboard:before { content: $fa-var-clipboard; } +.#{$fa-css-prefix}-lightbulb-o:before { content: $fa-var-lightbulb-o; } +.#{$fa-css-prefix}-exchange:before { content: $fa-var-exchange; } +.#{$fa-css-prefix}-cloud-download:before { content: $fa-var-cloud-download; } +.#{$fa-css-prefix}-cloud-upload:before { content: $fa-var-cloud-upload; } +.#{$fa-css-prefix}-user-md:before { content: $fa-var-user-md; } +.#{$fa-css-prefix}-stethoscope:before { content: $fa-var-stethoscope; } +.#{$fa-css-prefix}-suitcase:before { content: $fa-var-suitcase; } +.#{$fa-css-prefix}-bell-o:before { content: $fa-var-bell-o; } +.#{$fa-css-prefix}-coffee:before { content: $fa-var-coffee; } +.#{$fa-css-prefix}-cutlery:before { content: $fa-var-cutlery; } +.#{$fa-css-prefix}-file-text-o:before { content: $fa-var-file-text-o; } +.#{$fa-css-prefix}-building-o:before { content: $fa-var-building-o; } +.#{$fa-css-prefix}-hospital-o:before { content: $fa-var-hospital-o; } +.#{$fa-css-prefix}-ambulance:before { content: $fa-var-ambulance; } +.#{$fa-css-prefix}-medkit:before { content: $fa-var-medkit; } +.#{$fa-css-prefix}-fighter-jet:before { content: $fa-var-fighter-jet; } +.#{$fa-css-prefix}-beer:before { content: $fa-var-beer; } +.#{$fa-css-prefix}-h-square:before { content: $fa-var-h-square; } +.#{$fa-css-prefix}-plus-square:before { content: $fa-var-plus-square; } +.#{$fa-css-prefix}-angle-double-left:before { content: $fa-var-angle-double-left; } +.#{$fa-css-prefix}-angle-double-right:before { content: $fa-var-angle-double-right; } +.#{$fa-css-prefix}-angle-double-up:before { content: $fa-var-angle-double-up; } +.#{$fa-css-prefix}-angle-double-down:before { content: $fa-var-angle-double-down; } +.#{$fa-css-prefix}-angle-left:before { content: $fa-var-angle-left; } +.#{$fa-css-prefix}-angle-right:before { content: $fa-var-angle-right; } +.#{$fa-css-prefix}-angle-up:before { content: $fa-var-angle-up; } +.#{$fa-css-prefix}-angle-down:before { content: $fa-var-angle-down; } +.#{$fa-css-prefix}-desktop:before { content: $fa-var-desktop; } +.#{$fa-css-prefix}-laptop:before { content: $fa-var-laptop; } +.#{$fa-css-prefix}-tablet:before { content: $fa-var-tablet; } +.#{$fa-css-prefix}-mobile-phone:before, +.#{$fa-css-prefix}-mobile:before { content: $fa-var-mobile; } +.#{$fa-css-prefix}-circle-o:before { content: $fa-var-circle-o; } +.#{$fa-css-prefix}-quote-left:before { content: $fa-var-quote-left; } +.#{$fa-css-prefix}-quote-right:before { content: $fa-var-quote-right; } +.#{$fa-css-prefix}-spinner:before { content: $fa-var-spinner; } +.#{$fa-css-prefix}-circle:before { content: $fa-var-circle; } +.#{$fa-css-prefix}-mail-reply:before, +.#{$fa-css-prefix}-reply:before { content: $fa-var-reply; } +.#{$fa-css-prefix}-github-alt:before { content: $fa-var-github-alt; } +.#{$fa-css-prefix}-folder-o:before { content: $fa-var-folder-o; } +.#{$fa-css-prefix}-folder-open-o:before { content: $fa-var-folder-open-o; } +.#{$fa-css-prefix}-smile-o:before { content: $fa-var-smile-o; } +.#{$fa-css-prefix}-frown-o:before { content: $fa-var-frown-o; } +.#{$fa-css-prefix}-meh-o:before { content: $fa-var-meh-o; } +.#{$fa-css-prefix}-gamepad:before { content: $fa-var-gamepad; } +.#{$fa-css-prefix}-keyboard-o:before { content: $fa-var-keyboard-o; } +.#{$fa-css-prefix}-flag-o:before { content: $fa-var-flag-o; } +.#{$fa-css-prefix}-flag-checkered:before { content: $fa-var-flag-checkered; } +.#{$fa-css-prefix}-terminal:before { content: $fa-var-terminal; } +.#{$fa-css-prefix}-code:before { content: $fa-var-code; } +.#{$fa-css-prefix}-mail-reply-all:before, +.#{$fa-css-prefix}-reply-all:before { content: $fa-var-reply-all; } +.#{$fa-css-prefix}-star-half-empty:before, +.#{$fa-css-prefix}-star-half-full:before, +.#{$fa-css-prefix}-star-half-o:before { content: $fa-var-star-half-o; } +.#{$fa-css-prefix}-location-arrow:before { content: $fa-var-location-arrow; } +.#{$fa-css-prefix}-crop:before { content: $fa-var-crop; } +.#{$fa-css-prefix}-code-fork:before { content: $fa-var-code-fork; } +.#{$fa-css-prefix}-unlink:before, +.#{$fa-css-prefix}-chain-broken:before { content: $fa-var-chain-broken; } +.#{$fa-css-prefix}-question:before { content: $fa-var-question; } +.#{$fa-css-prefix}-info:before { content: $fa-var-info; } +.#{$fa-css-prefix}-exclamation:before { content: $fa-var-exclamation; } +.#{$fa-css-prefix}-superscript:before { content: $fa-var-superscript; } +.#{$fa-css-prefix}-subscript:before { content: $fa-var-subscript; } +.#{$fa-css-prefix}-eraser:before { content: $fa-var-eraser; } +.#{$fa-css-prefix}-puzzle-piece:before { content: $fa-var-puzzle-piece; } +.#{$fa-css-prefix}-microphone:before { content: $fa-var-microphone; } +.#{$fa-css-prefix}-microphone-slash:before { content: $fa-var-microphone-slash; } +.#{$fa-css-prefix}-shield:before { content: $fa-var-shield; } +.#{$fa-css-prefix}-calendar-o:before { content: $fa-var-calendar-o; } +.#{$fa-css-prefix}-fire-extinguisher:before { content: $fa-var-fire-extinguisher; } +.#{$fa-css-prefix}-rocket:before { content: $fa-var-rocket; } +.#{$fa-css-prefix}-maxcdn:before { content: $fa-var-maxcdn; } +.#{$fa-css-prefix}-chevron-circle-left:before { content: $fa-var-chevron-circle-left; } +.#{$fa-css-prefix}-chevron-circle-right:before { content: $fa-var-chevron-circle-right; } +.#{$fa-css-prefix}-chevron-circle-up:before { content: $fa-var-chevron-circle-up; } +.#{$fa-css-prefix}-chevron-circle-down:before { content: $fa-var-chevron-circle-down; } +.#{$fa-css-prefix}-html5:before { content: $fa-var-html5; } +.#{$fa-css-prefix}-css3:before { content: $fa-var-css3; } +.#{$fa-css-prefix}-anchor:before { content: $fa-var-anchor; } +.#{$fa-css-prefix}-unlock-alt:before { content: $fa-var-unlock-alt; } +.#{$fa-css-prefix}-bullseye:before { content: $fa-var-bullseye; } +.#{$fa-css-prefix}-ellipsis-h:before { content: $fa-var-ellipsis-h; } +.#{$fa-css-prefix}-ellipsis-v:before { content: $fa-var-ellipsis-v; } +.#{$fa-css-prefix}-rss-square:before { content: $fa-var-rss-square; } +.#{$fa-css-prefix}-play-circle:before { content: $fa-var-play-circle; } +.#{$fa-css-prefix}-ticket:before { content: $fa-var-ticket; } +.#{$fa-css-prefix}-minus-square:before { content: $fa-var-minus-square; } +.#{$fa-css-prefix}-minus-square-o:before { content: $fa-var-minus-square-o; } +.#{$fa-css-prefix}-level-up:before { content: $fa-var-level-up; } +.#{$fa-css-prefix}-level-down:before { content: $fa-var-level-down; } +.#{$fa-css-prefix}-check-square:before { content: $fa-var-check-square; } +.#{$fa-css-prefix}-pencil-square:before { content: $fa-var-pencil-square; } +.#{$fa-css-prefix}-external-link-square:before { content: $fa-var-external-link-square; } +.#{$fa-css-prefix}-share-square:before { content: $fa-var-share-square; } +.#{$fa-css-prefix}-compass:before { content: $fa-var-compass; } +.#{$fa-css-prefix}-toggle-down:before, +.#{$fa-css-prefix}-caret-square-o-down:before { content: $fa-var-caret-square-o-down; } +.#{$fa-css-prefix}-toggle-up:before, +.#{$fa-css-prefix}-caret-square-o-up:before { content: $fa-var-caret-square-o-up; } +.#{$fa-css-prefix}-toggle-right:before, +.#{$fa-css-prefix}-caret-square-o-right:before { content: $fa-var-caret-square-o-right; } +.#{$fa-css-prefix}-euro:before, +.#{$fa-css-prefix}-eur:before { content: $fa-var-eur; } +.#{$fa-css-prefix}-gbp:before { content: $fa-var-gbp; } +.#{$fa-css-prefix}-dollar:before, +.#{$fa-css-prefix}-usd:before { content: $fa-var-usd; } +.#{$fa-css-prefix}-rupee:before, +.#{$fa-css-prefix}-inr:before { content: $fa-var-inr; } +.#{$fa-css-prefix}-cny:before, +.#{$fa-css-prefix}-rmb:before, +.#{$fa-css-prefix}-yen:before, +.#{$fa-css-prefix}-jpy:before { content: $fa-var-jpy; } +.#{$fa-css-prefix}-ruble:before, +.#{$fa-css-prefix}-rouble:before, +.#{$fa-css-prefix}-rub:before { content: $fa-var-rub; } +.#{$fa-css-prefix}-won:before, +.#{$fa-css-prefix}-krw:before { content: $fa-var-krw; } +.#{$fa-css-prefix}-bitcoin:before, +.#{$fa-css-prefix}-btc:before { content: $fa-var-btc; } +.#{$fa-css-prefix}-file:before { content: $fa-var-file; } +.#{$fa-css-prefix}-file-text:before { content: $fa-var-file-text; } +.#{$fa-css-prefix}-sort-alpha-asc:before { content: $fa-var-sort-alpha-asc; } +.#{$fa-css-prefix}-sort-alpha-desc:before { content: $fa-var-sort-alpha-desc; } +.#{$fa-css-prefix}-sort-amount-asc:before { content: $fa-var-sort-amount-asc; } +.#{$fa-css-prefix}-sort-amount-desc:before { content: $fa-var-sort-amount-desc; } +.#{$fa-css-prefix}-sort-numeric-asc:before { content: $fa-var-sort-numeric-asc; } +.#{$fa-css-prefix}-sort-numeric-desc:before { content: $fa-var-sort-numeric-desc; } +.#{$fa-css-prefix}-thumbs-up:before { content: $fa-var-thumbs-up; } +.#{$fa-css-prefix}-thumbs-down:before { content: $fa-var-thumbs-down; } +.#{$fa-css-prefix}-youtube-square:before { content: $fa-var-youtube-square; } +.#{$fa-css-prefix}-youtube:before { content: $fa-var-youtube; } +.#{$fa-css-prefix}-xing:before { content: $fa-var-xing; } +.#{$fa-css-prefix}-xing-square:before { content: $fa-var-xing-square; } +.#{$fa-css-prefix}-youtube-play:before { content: $fa-var-youtube-play; } +.#{$fa-css-prefix}-dropbox:before { content: $fa-var-dropbox; } +.#{$fa-css-prefix}-stack-overflow:before { content: $fa-var-stack-overflow; } +.#{$fa-css-prefix}-instagram:before { content: $fa-var-instagram; } +.#{$fa-css-prefix}-flickr:before { content: $fa-var-flickr; } +.#{$fa-css-prefix}-adn:before { content: $fa-var-adn; } +.#{$fa-css-prefix}-bitbucket:before { content: $fa-var-bitbucket; } +.#{$fa-css-prefix}-bitbucket-square:before { content: $fa-var-bitbucket-square; } +.#{$fa-css-prefix}-tumblr:before { content: $fa-var-tumblr; } +.#{$fa-css-prefix}-tumblr-square:before { content: $fa-var-tumblr-square; } +.#{$fa-css-prefix}-long-arrow-down:before { content: $fa-var-long-arrow-down; } +.#{$fa-css-prefix}-long-arrow-up:before { content: $fa-var-long-arrow-up; } +.#{$fa-css-prefix}-long-arrow-left:before { content: $fa-var-long-arrow-left; } +.#{$fa-css-prefix}-long-arrow-right:before { content: $fa-var-long-arrow-right; } +.#{$fa-css-prefix}-apple:before { content: $fa-var-apple; } +.#{$fa-css-prefix}-windows:before { content: $fa-var-windows; } +.#{$fa-css-prefix}-android:before { content: $fa-var-android; } +.#{$fa-css-prefix}-linux:before { content: $fa-var-linux; } +.#{$fa-css-prefix}-dribbble:before { content: $fa-var-dribbble; } +.#{$fa-css-prefix}-skype:before { content: $fa-var-skype; } +.#{$fa-css-prefix}-foursquare:before { content: $fa-var-foursquare; } +.#{$fa-css-prefix}-trello:before { content: $fa-var-trello; } +.#{$fa-css-prefix}-female:before { content: $fa-var-female; } +.#{$fa-css-prefix}-male:before { content: $fa-var-male; } +.#{$fa-css-prefix}-gittip:before, +.#{$fa-css-prefix}-gratipay:before { content: $fa-var-gratipay; } +.#{$fa-css-prefix}-sun-o:before { content: $fa-var-sun-o; } +.#{$fa-css-prefix}-moon-o:before { content: $fa-var-moon-o; } +.#{$fa-css-prefix}-archive:before { content: $fa-var-archive; } +.#{$fa-css-prefix}-bug:before { content: $fa-var-bug; } +.#{$fa-css-prefix}-vk:before { content: $fa-var-vk; } +.#{$fa-css-prefix}-weibo:before { content: $fa-var-weibo; } +.#{$fa-css-prefix}-renren:before { content: $fa-var-renren; } +.#{$fa-css-prefix}-pagelines:before { content: $fa-var-pagelines; } +.#{$fa-css-prefix}-stack-exchange:before { content: $fa-var-stack-exchange; } +.#{$fa-css-prefix}-arrow-circle-o-right:before { content: $fa-var-arrow-circle-o-right; } +.#{$fa-css-prefix}-arrow-circle-o-left:before { content: $fa-var-arrow-circle-o-left; } +.#{$fa-css-prefix}-toggle-left:before, +.#{$fa-css-prefix}-caret-square-o-left:before { content: $fa-var-caret-square-o-left; } +.#{$fa-css-prefix}-dot-circle-o:before { content: $fa-var-dot-circle-o; } +.#{$fa-css-prefix}-wheelchair:before { content: $fa-var-wheelchair; } +.#{$fa-css-prefix}-vimeo-square:before { content: $fa-var-vimeo-square; } +.#{$fa-css-prefix}-turkish-lira:before, +.#{$fa-css-prefix}-try:before { content: $fa-var-try; } +.#{$fa-css-prefix}-plus-square-o:before { content: $fa-var-plus-square-o; } +.#{$fa-css-prefix}-space-shuttle:before { content: $fa-var-space-shuttle; } +.#{$fa-css-prefix}-slack:before { content: $fa-var-slack; } +.#{$fa-css-prefix}-envelope-square:before { content: $fa-var-envelope-square; } +.#{$fa-css-prefix}-wordpress:before { content: $fa-var-wordpress; } +.#{$fa-css-prefix}-openid:before { content: $fa-var-openid; } +.#{$fa-css-prefix}-institution:before, +.#{$fa-css-prefix}-bank:before, +.#{$fa-css-prefix}-university:before { content: $fa-var-university; } +.#{$fa-css-prefix}-mortar-board:before, +.#{$fa-css-prefix}-graduation-cap:before { content: $fa-var-graduation-cap; } +.#{$fa-css-prefix}-yahoo:before { content: $fa-var-yahoo; } +.#{$fa-css-prefix}-google:before { content: $fa-var-google; } +.#{$fa-css-prefix}-reddit:before { content: $fa-var-reddit; } +.#{$fa-css-prefix}-reddit-square:before { content: $fa-var-reddit-square; } +.#{$fa-css-prefix}-stumbleupon-circle:before { content: $fa-var-stumbleupon-circle; } +.#{$fa-css-prefix}-stumbleupon:before { content: $fa-var-stumbleupon; } +.#{$fa-css-prefix}-delicious:before { content: $fa-var-delicious; } +.#{$fa-css-prefix}-digg:before { content: $fa-var-digg; } +.#{$fa-css-prefix}-pied-piper-pp:before { content: $fa-var-pied-piper-pp; } +.#{$fa-css-prefix}-pied-piper-alt:before { content: $fa-var-pied-piper-alt; } +.#{$fa-css-prefix}-drupal:before { content: $fa-var-drupal; } +.#{$fa-css-prefix}-joomla:before { content: $fa-var-joomla; } +.#{$fa-css-prefix}-language:before { content: $fa-var-language; } +.#{$fa-css-prefix}-fax:before { content: $fa-var-fax; } +.#{$fa-css-prefix}-building:before { content: $fa-var-building; } +.#{$fa-css-prefix}-child:before { content: $fa-var-child; } +.#{$fa-css-prefix}-paw:before { content: $fa-var-paw; } +.#{$fa-css-prefix}-spoon:before { content: $fa-var-spoon; } +.#{$fa-css-prefix}-cube:before { content: $fa-var-cube; } +.#{$fa-css-prefix}-cubes:before { content: $fa-var-cubes; } +.#{$fa-css-prefix}-behance:before { content: $fa-var-behance; } +.#{$fa-css-prefix}-behance-square:before { content: $fa-var-behance-square; } +.#{$fa-css-prefix}-steam:before { content: $fa-var-steam; } +.#{$fa-css-prefix}-steam-square:before { content: $fa-var-steam-square; } +.#{$fa-css-prefix}-recycle:before { content: $fa-var-recycle; } +.#{$fa-css-prefix}-automobile:before, +.#{$fa-css-prefix}-car:before { content: $fa-var-car; } +.#{$fa-css-prefix}-cab:before, +.#{$fa-css-prefix}-taxi:before { content: $fa-var-taxi; } +.#{$fa-css-prefix}-tree:before { content: $fa-var-tree; } +.#{$fa-css-prefix}-spotify:before { content: $fa-var-spotify; } +.#{$fa-css-prefix}-deviantart:before { content: $fa-var-deviantart; } +.#{$fa-css-prefix}-soundcloud:before { content: $fa-var-soundcloud; } +.#{$fa-css-prefix}-database:before { content: $fa-var-database; } +.#{$fa-css-prefix}-file-pdf-o:before { content: $fa-var-file-pdf-o; } +.#{$fa-css-prefix}-file-word-o:before { content: $fa-var-file-word-o; } +.#{$fa-css-prefix}-file-excel-o:before { content: $fa-var-file-excel-o; } +.#{$fa-css-prefix}-file-powerpoint-o:before { content: $fa-var-file-powerpoint-o; } +.#{$fa-css-prefix}-file-photo-o:before, +.#{$fa-css-prefix}-file-picture-o:before, +.#{$fa-css-prefix}-file-image-o:before { content: $fa-var-file-image-o; } +.#{$fa-css-prefix}-file-zip-o:before, +.#{$fa-css-prefix}-file-archive-o:before { content: $fa-var-file-archive-o; } +.#{$fa-css-prefix}-file-sound-o:before, +.#{$fa-css-prefix}-file-audio-o:before { content: $fa-var-file-audio-o; } +.#{$fa-css-prefix}-file-movie-o:before, +.#{$fa-css-prefix}-file-video-o:before { content: $fa-var-file-video-o; } +.#{$fa-css-prefix}-file-code-o:before { content: $fa-var-file-code-o; } +.#{$fa-css-prefix}-vine:before { content: $fa-var-vine; } +.#{$fa-css-prefix}-codepen:before { content: $fa-var-codepen; } +.#{$fa-css-prefix}-jsfiddle:before { content: $fa-var-jsfiddle; } +.#{$fa-css-prefix}-life-bouy:before, +.#{$fa-css-prefix}-life-buoy:before, +.#{$fa-css-prefix}-life-saver:before, +.#{$fa-css-prefix}-support:before, +.#{$fa-css-prefix}-life-ring:before { content: $fa-var-life-ring; } +.#{$fa-css-prefix}-circle-o-notch:before { content: $fa-var-circle-o-notch; } +.#{$fa-css-prefix}-ra:before, +.#{$fa-css-prefix}-resistance:before, +.#{$fa-css-prefix}-rebel:before { content: $fa-var-rebel; } +.#{$fa-css-prefix}-ge:before, +.#{$fa-css-prefix}-empire:before { content: $fa-var-empire; } +.#{$fa-css-prefix}-git-square:before { content: $fa-var-git-square; } +.#{$fa-css-prefix}-git:before { content: $fa-var-git; } +.#{$fa-css-prefix}-y-combinator-square:before, +.#{$fa-css-prefix}-yc-square:before, +.#{$fa-css-prefix}-hacker-news:before { content: $fa-var-hacker-news; } +.#{$fa-css-prefix}-tencent-weibo:before { content: $fa-var-tencent-weibo; } +.#{$fa-css-prefix}-qq:before { content: $fa-var-qq; } +.#{$fa-css-prefix}-wechat:before, +.#{$fa-css-prefix}-weixin:before { content: $fa-var-weixin; } +.#{$fa-css-prefix}-send:before, +.#{$fa-css-prefix}-paper-plane:before { content: $fa-var-paper-plane; } +.#{$fa-css-prefix}-send-o:before, +.#{$fa-css-prefix}-paper-plane-o:before { content: $fa-var-paper-plane-o; } +.#{$fa-css-prefix}-history:before { content: $fa-var-history; } +.#{$fa-css-prefix}-circle-thin:before { content: $fa-var-circle-thin; } +.#{$fa-css-prefix}-header:before { content: $fa-var-header; } +.#{$fa-css-prefix}-paragraph:before { content: $fa-var-paragraph; } +.#{$fa-css-prefix}-sliders:before { content: $fa-var-sliders; } +.#{$fa-css-prefix}-share-alt:before { content: $fa-var-share-alt; } +.#{$fa-css-prefix}-share-alt-square:before { content: $fa-var-share-alt-square; } +.#{$fa-css-prefix}-bomb:before { content: $fa-var-bomb; } +.#{$fa-css-prefix}-soccer-ball-o:before, +.#{$fa-css-prefix}-futbol-o:before { content: $fa-var-futbol-o; } +.#{$fa-css-prefix}-tty:before { content: $fa-var-tty; } +.#{$fa-css-prefix}-binoculars:before { content: $fa-var-binoculars; } +.#{$fa-css-prefix}-plug:before { content: $fa-var-plug; } +.#{$fa-css-prefix}-slideshare:before { content: $fa-var-slideshare; } +.#{$fa-css-prefix}-twitch:before { content: $fa-var-twitch; } +.#{$fa-css-prefix}-yelp:before { content: $fa-var-yelp; } +.#{$fa-css-prefix}-newspaper-o:before { content: $fa-var-newspaper-o; } +.#{$fa-css-prefix}-wifi:before { content: $fa-var-wifi; } +.#{$fa-css-prefix}-calculator:before { content: $fa-var-calculator; } +.#{$fa-css-prefix}-paypal:before { content: $fa-var-paypal; } +.#{$fa-css-prefix}-google-wallet:before { content: $fa-var-google-wallet; } +.#{$fa-css-prefix}-cc-visa:before { content: $fa-var-cc-visa; } +.#{$fa-css-prefix}-cc-mastercard:before { content: $fa-var-cc-mastercard; } +.#{$fa-css-prefix}-cc-discover:before { content: $fa-var-cc-discover; } +.#{$fa-css-prefix}-cc-amex:before { content: $fa-var-cc-amex; } +.#{$fa-css-prefix}-cc-paypal:before { content: $fa-var-cc-paypal; } +.#{$fa-css-prefix}-cc-stripe:before { content: $fa-var-cc-stripe; } +.#{$fa-css-prefix}-bell-slash:before { content: $fa-var-bell-slash; } +.#{$fa-css-prefix}-bell-slash-o:before { content: $fa-var-bell-slash-o; } +.#{$fa-css-prefix}-trash:before { content: $fa-var-trash; } +.#{$fa-css-prefix}-copyright:before { content: $fa-var-copyright; } +.#{$fa-css-prefix}-at:before { content: $fa-var-at; } +.#{$fa-css-prefix}-eyedropper:before { content: $fa-var-eyedropper; } +.#{$fa-css-prefix}-paint-brush:before { content: $fa-var-paint-brush; } +.#{$fa-css-prefix}-birthday-cake:before { content: $fa-var-birthday-cake; } +.#{$fa-css-prefix}-area-chart:before { content: $fa-var-area-chart; } +.#{$fa-css-prefix}-pie-chart:before { content: $fa-var-pie-chart; } +.#{$fa-css-prefix}-line-chart:before { content: $fa-var-line-chart; } +.#{$fa-css-prefix}-lastfm:before { content: $fa-var-lastfm; } +.#{$fa-css-prefix}-lastfm-square:before { content: $fa-var-lastfm-square; } +.#{$fa-css-prefix}-toggle-off:before { content: $fa-var-toggle-off; } +.#{$fa-css-prefix}-toggle-on:before { content: $fa-var-toggle-on; } +.#{$fa-css-prefix}-bicycle:before { content: $fa-var-bicycle; } +.#{$fa-css-prefix}-bus:before { content: $fa-var-bus; } +.#{$fa-css-prefix}-ioxhost:before { content: $fa-var-ioxhost; } +.#{$fa-css-prefix}-angellist:before { content: $fa-var-angellist; } +.#{$fa-css-prefix}-cc:before { content: $fa-var-cc; } +.#{$fa-css-prefix}-shekel:before, +.#{$fa-css-prefix}-sheqel:before, +.#{$fa-css-prefix}-ils:before { content: $fa-var-ils; } +.#{$fa-css-prefix}-meanpath:before { content: $fa-var-meanpath; } +.#{$fa-css-prefix}-buysellads:before { content: $fa-var-buysellads; } +.#{$fa-css-prefix}-connectdevelop:before { content: $fa-var-connectdevelop; } +.#{$fa-css-prefix}-dashcube:before { content: $fa-var-dashcube; } +.#{$fa-css-prefix}-forumbee:before { content: $fa-var-forumbee; } +.#{$fa-css-prefix}-leanpub:before { content: $fa-var-leanpub; } +.#{$fa-css-prefix}-sellsy:before { content: $fa-var-sellsy; } +.#{$fa-css-prefix}-shirtsinbulk:before { content: $fa-var-shirtsinbulk; } +.#{$fa-css-prefix}-simplybuilt:before { content: $fa-var-simplybuilt; } +.#{$fa-css-prefix}-skyatlas:before { content: $fa-var-skyatlas; } +.#{$fa-css-prefix}-cart-plus:before { content: $fa-var-cart-plus; } +.#{$fa-css-prefix}-cart-arrow-down:before { content: $fa-var-cart-arrow-down; } +.#{$fa-css-prefix}-diamond:before { content: $fa-var-diamond; } +.#{$fa-css-prefix}-ship:before { content: $fa-var-ship; } +.#{$fa-css-prefix}-user-secret:before { content: $fa-var-user-secret; } +.#{$fa-css-prefix}-motorcycle:before { content: $fa-var-motorcycle; } +.#{$fa-css-prefix}-street-view:before { content: $fa-var-street-view; } +.#{$fa-css-prefix}-heartbeat:before { content: $fa-var-heartbeat; } +.#{$fa-css-prefix}-venus:before { content: $fa-var-venus; } +.#{$fa-css-prefix}-mars:before { content: $fa-var-mars; } +.#{$fa-css-prefix}-mercury:before { content: $fa-var-mercury; } +.#{$fa-css-prefix}-intersex:before, +.#{$fa-css-prefix}-transgender:before { content: $fa-var-transgender; } +.#{$fa-css-prefix}-transgender-alt:before { content: $fa-var-transgender-alt; } +.#{$fa-css-prefix}-venus-double:before { content: $fa-var-venus-double; } +.#{$fa-css-prefix}-mars-double:before { content: $fa-var-mars-double; } +.#{$fa-css-prefix}-venus-mars:before { content: $fa-var-venus-mars; } +.#{$fa-css-prefix}-mars-stroke:before { content: $fa-var-mars-stroke; } +.#{$fa-css-prefix}-mars-stroke-v:before { content: $fa-var-mars-stroke-v; } +.#{$fa-css-prefix}-mars-stroke-h:before { content: $fa-var-mars-stroke-h; } +.#{$fa-css-prefix}-neuter:before { content: $fa-var-neuter; } +.#{$fa-css-prefix}-genderless:before { content: $fa-var-genderless; } +.#{$fa-css-prefix}-facebook-official:before { content: $fa-var-facebook-official; } +.#{$fa-css-prefix}-pinterest-p:before { content: $fa-var-pinterest-p; } +.#{$fa-css-prefix}-whatsapp:before { content: $fa-var-whatsapp; } +.#{$fa-css-prefix}-server:before { content: $fa-var-server; } +.#{$fa-css-prefix}-user-plus:before { content: $fa-var-user-plus; } +.#{$fa-css-prefix}-user-times:before { content: $fa-var-user-times; } +.#{$fa-css-prefix}-hotel:before, +.#{$fa-css-prefix}-bed:before { content: $fa-var-bed; } +.#{$fa-css-prefix}-viacoin:before { content: $fa-var-viacoin; } +.#{$fa-css-prefix}-train:before { content: $fa-var-train; } +.#{$fa-css-prefix}-subway:before { content: $fa-var-subway; } +.#{$fa-css-prefix}-medium:before { content: $fa-var-medium; } +.#{$fa-css-prefix}-yc:before, +.#{$fa-css-prefix}-y-combinator:before { content: $fa-var-y-combinator; } +.#{$fa-css-prefix}-optin-monster:before { content: $fa-var-optin-monster; } +.#{$fa-css-prefix}-opencart:before { content: $fa-var-opencart; } +.#{$fa-css-prefix}-expeditedssl:before { content: $fa-var-expeditedssl; } +.#{$fa-css-prefix}-battery-4:before, +.#{$fa-css-prefix}-battery:before, +.#{$fa-css-prefix}-battery-full:before { content: $fa-var-battery-full; } +.#{$fa-css-prefix}-battery-3:before, +.#{$fa-css-prefix}-battery-three-quarters:before { content: $fa-var-battery-three-quarters; } +.#{$fa-css-prefix}-battery-2:before, +.#{$fa-css-prefix}-battery-half:before { content: $fa-var-battery-half; } +.#{$fa-css-prefix}-battery-1:before, +.#{$fa-css-prefix}-battery-quarter:before { content: $fa-var-battery-quarter; } +.#{$fa-css-prefix}-battery-0:before, +.#{$fa-css-prefix}-battery-empty:before { content: $fa-var-battery-empty; } +.#{$fa-css-prefix}-mouse-pointer:before { content: $fa-var-mouse-pointer; } +.#{$fa-css-prefix}-i-cursor:before { content: $fa-var-i-cursor; } +.#{$fa-css-prefix}-object-group:before { content: $fa-var-object-group; } +.#{$fa-css-prefix}-object-ungroup:before { content: $fa-var-object-ungroup; } +.#{$fa-css-prefix}-sticky-note:before { content: $fa-var-sticky-note; } +.#{$fa-css-prefix}-sticky-note-o:before { content: $fa-var-sticky-note-o; } +.#{$fa-css-prefix}-cc-jcb:before { content: $fa-var-cc-jcb; } +.#{$fa-css-prefix}-cc-diners-club:before { content: $fa-var-cc-diners-club; } +.#{$fa-css-prefix}-clone:before { content: $fa-var-clone; } +.#{$fa-css-prefix}-balance-scale:before { content: $fa-var-balance-scale; } +.#{$fa-css-prefix}-hourglass-o:before { content: $fa-var-hourglass-o; } +.#{$fa-css-prefix}-hourglass-1:before, +.#{$fa-css-prefix}-hourglass-start:before { content: $fa-var-hourglass-start; } +.#{$fa-css-prefix}-hourglass-2:before, +.#{$fa-css-prefix}-hourglass-half:before { content: $fa-var-hourglass-half; } +.#{$fa-css-prefix}-hourglass-3:before, +.#{$fa-css-prefix}-hourglass-end:before { content: $fa-var-hourglass-end; } +.#{$fa-css-prefix}-hourglass:before { content: $fa-var-hourglass; } +.#{$fa-css-prefix}-hand-grab-o:before, +.#{$fa-css-prefix}-hand-rock-o:before { content: $fa-var-hand-rock-o; } +.#{$fa-css-prefix}-hand-stop-o:before, +.#{$fa-css-prefix}-hand-paper-o:before { content: $fa-var-hand-paper-o; } +.#{$fa-css-prefix}-hand-scissors-o:before { content: $fa-var-hand-scissors-o; } +.#{$fa-css-prefix}-hand-lizard-o:before { content: $fa-var-hand-lizard-o; } +.#{$fa-css-prefix}-hand-spock-o:before { content: $fa-var-hand-spock-o; } +.#{$fa-css-prefix}-hand-pointer-o:before { content: $fa-var-hand-pointer-o; } +.#{$fa-css-prefix}-hand-peace-o:before { content: $fa-var-hand-peace-o; } +.#{$fa-css-prefix}-trademark:before { content: $fa-var-trademark; } +.#{$fa-css-prefix}-registered:before { content: $fa-var-registered; } +.#{$fa-css-prefix}-creative-commons:before { content: $fa-var-creative-commons; } +.#{$fa-css-prefix}-gg:before { content: $fa-var-gg; } +.#{$fa-css-prefix}-gg-circle:before { content: $fa-var-gg-circle; } +.#{$fa-css-prefix}-tripadvisor:before { content: $fa-var-tripadvisor; } +.#{$fa-css-prefix}-odnoklassniki:before { content: $fa-var-odnoklassniki; } +.#{$fa-css-prefix}-odnoklassniki-square:before { content: $fa-var-odnoklassniki-square; } +.#{$fa-css-prefix}-get-pocket:before { content: $fa-var-get-pocket; } +.#{$fa-css-prefix}-wikipedia-w:before { content: $fa-var-wikipedia-w; } +.#{$fa-css-prefix}-safari:before { content: $fa-var-safari; } +.#{$fa-css-prefix}-chrome:before { content: $fa-var-chrome; } +.#{$fa-css-prefix}-firefox:before { content: $fa-var-firefox; } +.#{$fa-css-prefix}-opera:before { content: $fa-var-opera; } +.#{$fa-css-prefix}-internet-explorer:before { content: $fa-var-internet-explorer; } +.#{$fa-css-prefix}-tv:before, +.#{$fa-css-prefix}-television:before { content: $fa-var-television; } +.#{$fa-css-prefix}-contao:before { content: $fa-var-contao; } +.#{$fa-css-prefix}-500px:before { content: $fa-var-500px; } +.#{$fa-css-prefix}-amazon:before { content: $fa-var-amazon; } +.#{$fa-css-prefix}-calendar-plus-o:before { content: $fa-var-calendar-plus-o; } +.#{$fa-css-prefix}-calendar-minus-o:before { content: $fa-var-calendar-minus-o; } +.#{$fa-css-prefix}-calendar-times-o:before { content: $fa-var-calendar-times-o; } +.#{$fa-css-prefix}-calendar-check-o:before { content: $fa-var-calendar-check-o; } +.#{$fa-css-prefix}-industry:before { content: $fa-var-industry; } +.#{$fa-css-prefix}-map-pin:before { content: $fa-var-map-pin; } +.#{$fa-css-prefix}-map-signs:before { content: $fa-var-map-signs; } +.#{$fa-css-prefix}-map-o:before { content: $fa-var-map-o; } +.#{$fa-css-prefix}-map:before { content: $fa-var-map; } +.#{$fa-css-prefix}-commenting:before { content: $fa-var-commenting; } +.#{$fa-css-prefix}-commenting-o:before { content: $fa-var-commenting-o; } +.#{$fa-css-prefix}-houzz:before { content: $fa-var-houzz; } +.#{$fa-css-prefix}-vimeo:before { content: $fa-var-vimeo; } +.#{$fa-css-prefix}-black-tie:before { content: $fa-var-black-tie; } +.#{$fa-css-prefix}-fonticons:before { content: $fa-var-fonticons; } +.#{$fa-css-prefix}-reddit-alien:before { content: $fa-var-reddit-alien; } +.#{$fa-css-prefix}-edge:before { content: $fa-var-edge; } +.#{$fa-css-prefix}-credit-card-alt:before { content: $fa-var-credit-card-alt; } +.#{$fa-css-prefix}-codiepie:before { content: $fa-var-codiepie; } +.#{$fa-css-prefix}-modx:before { content: $fa-var-modx; } +.#{$fa-css-prefix}-fort-awesome:before { content: $fa-var-fort-awesome; } +.#{$fa-css-prefix}-usb:before { content: $fa-var-usb; } +.#{$fa-css-prefix}-product-hunt:before { content: $fa-var-product-hunt; } +.#{$fa-css-prefix}-mixcloud:before { content: $fa-var-mixcloud; } +.#{$fa-css-prefix}-scribd:before { content: $fa-var-scribd; } +.#{$fa-css-prefix}-pause-circle:before { content: $fa-var-pause-circle; } +.#{$fa-css-prefix}-pause-circle-o:before { content: $fa-var-pause-circle-o; } +.#{$fa-css-prefix}-stop-circle:before { content: $fa-var-stop-circle; } +.#{$fa-css-prefix}-stop-circle-o:before { content: $fa-var-stop-circle-o; } +.#{$fa-css-prefix}-shopping-bag:before { content: $fa-var-shopping-bag; } +.#{$fa-css-prefix}-shopping-basket:before { content: $fa-var-shopping-basket; } +.#{$fa-css-prefix}-hashtag:before { content: $fa-var-hashtag; } +.#{$fa-css-prefix}-bluetooth:before { content: $fa-var-bluetooth; } +.#{$fa-css-prefix}-bluetooth-b:before { content: $fa-var-bluetooth-b; } +.#{$fa-css-prefix}-percent:before { content: $fa-var-percent; } +.#{$fa-css-prefix}-gitlab:before { content: $fa-var-gitlab; } +.#{$fa-css-prefix}-wpbeginner:before { content: $fa-var-wpbeginner; } +.#{$fa-css-prefix}-wpforms:before { content: $fa-var-wpforms; } +.#{$fa-css-prefix}-envira:before { content: $fa-var-envira; } +.#{$fa-css-prefix}-universal-access:before { content: $fa-var-universal-access; } +.#{$fa-css-prefix}-wheelchair-alt:before { content: $fa-var-wheelchair-alt; } +.#{$fa-css-prefix}-question-circle-o:before { content: $fa-var-question-circle-o; } +.#{$fa-css-prefix}-blind:before { content: $fa-var-blind; } +.#{$fa-css-prefix}-audio-description:before { content: $fa-var-audio-description; } +.#{$fa-css-prefix}-volume-control-phone:before { content: $fa-var-volume-control-phone; } +.#{$fa-css-prefix}-braille:before { content: $fa-var-braille; } +.#{$fa-css-prefix}-assistive-listening-systems:before { content: $fa-var-assistive-listening-systems; } +.#{$fa-css-prefix}-asl-interpreting:before, +.#{$fa-css-prefix}-american-sign-language-interpreting:before { content: $fa-var-american-sign-language-interpreting; } +.#{$fa-css-prefix}-deafness:before, +.#{$fa-css-prefix}-hard-of-hearing:before, +.#{$fa-css-prefix}-deaf:before { content: $fa-var-deaf; } +.#{$fa-css-prefix}-glide:before { content: $fa-var-glide; } +.#{$fa-css-prefix}-glide-g:before { content: $fa-var-glide-g; } +.#{$fa-css-prefix}-signing:before, +.#{$fa-css-prefix}-sign-language:before { content: $fa-var-sign-language; } +.#{$fa-css-prefix}-low-vision:before { content: $fa-var-low-vision; } +.#{$fa-css-prefix}-viadeo:before { content: $fa-var-viadeo; } +.#{$fa-css-prefix}-viadeo-square:before { content: $fa-var-viadeo-square; } +.#{$fa-css-prefix}-snapchat:before { content: $fa-var-snapchat; } +.#{$fa-css-prefix}-snapchat-ghost:before { content: $fa-var-snapchat-ghost; } +.#{$fa-css-prefix}-snapchat-square:before { content: $fa-var-snapchat-square; } +.#{$fa-css-prefix}-pied-piper:before { content: $fa-var-pied-piper; } +.#{$fa-css-prefix}-first-order:before { content: $fa-var-first-order; } +.#{$fa-css-prefix}-yoast:before { content: $fa-var-yoast; } +.#{$fa-css-prefix}-themeisle:before { content: $fa-var-themeisle; } +.#{$fa-css-prefix}-google-plus-circle:before, +.#{$fa-css-prefix}-google-plus-official:before { content: $fa-var-google-plus-official; } +.#{$fa-css-prefix}-fa:before, +.#{$fa-css-prefix}-font-awesome:before { content: $fa-var-font-awesome; } +.#{$fa-css-prefix}-handshake-o:before { content: $fa-var-handshake-o; } +.#{$fa-css-prefix}-envelope-open:before { content: $fa-var-envelope-open; } +.#{$fa-css-prefix}-envelope-open-o:before { content: $fa-var-envelope-open-o; } +.#{$fa-css-prefix}-linode:before { content: $fa-var-linode; } +.#{$fa-css-prefix}-address-book:before { content: $fa-var-address-book; } +.#{$fa-css-prefix}-address-book-o:before { content: $fa-var-address-book-o; } +.#{$fa-css-prefix}-vcard:before, +.#{$fa-css-prefix}-address-card:before { content: $fa-var-address-card; } +.#{$fa-css-prefix}-vcard-o:before, +.#{$fa-css-prefix}-address-card-o:before { content: $fa-var-address-card-o; } +.#{$fa-css-prefix}-user-circle:before { content: $fa-var-user-circle; } +.#{$fa-css-prefix}-user-circle-o:before { content: $fa-var-user-circle-o; } +.#{$fa-css-prefix}-user-o:before { content: $fa-var-user-o; } +.#{$fa-css-prefix}-id-badge:before { content: $fa-var-id-badge; } +.#{$fa-css-prefix}-drivers-license:before, +.#{$fa-css-prefix}-id-card:before { content: $fa-var-id-card; } +.#{$fa-css-prefix}-drivers-license-o:before, +.#{$fa-css-prefix}-id-card-o:before { content: $fa-var-id-card-o; } +.#{$fa-css-prefix}-quora:before { content: $fa-var-quora; } +.#{$fa-css-prefix}-free-code-camp:before { content: $fa-var-free-code-camp; } +.#{$fa-css-prefix}-telegram:before { content: $fa-var-telegram; } +.#{$fa-css-prefix}-thermometer-4:before, +.#{$fa-css-prefix}-thermometer:before, +.#{$fa-css-prefix}-thermometer-full:before { content: $fa-var-thermometer-full; } +.#{$fa-css-prefix}-thermometer-3:before, +.#{$fa-css-prefix}-thermometer-three-quarters:before { content: $fa-var-thermometer-three-quarters; } +.#{$fa-css-prefix}-thermometer-2:before, +.#{$fa-css-prefix}-thermometer-half:before { content: $fa-var-thermometer-half; } +.#{$fa-css-prefix}-thermometer-1:before, +.#{$fa-css-prefix}-thermometer-quarter:before { content: $fa-var-thermometer-quarter; } +.#{$fa-css-prefix}-thermometer-0:before, +.#{$fa-css-prefix}-thermometer-empty:before { content: $fa-var-thermometer-empty; } +.#{$fa-css-prefix}-shower:before { content: $fa-var-shower; } +.#{$fa-css-prefix}-bathtub:before, +.#{$fa-css-prefix}-s15:before, +.#{$fa-css-prefix}-bath:before { content: $fa-var-bath; } +.#{$fa-css-prefix}-podcast:before { content: $fa-var-podcast; } +.#{$fa-css-prefix}-window-maximize:before { content: $fa-var-window-maximize; } +.#{$fa-css-prefix}-window-minimize:before { content: $fa-var-window-minimize; } +.#{$fa-css-prefix}-window-restore:before { content: $fa-var-window-restore; } +.#{$fa-css-prefix}-times-rectangle:before, +.#{$fa-css-prefix}-window-close:before { content: $fa-var-window-close; } +.#{$fa-css-prefix}-times-rectangle-o:before, +.#{$fa-css-prefix}-window-close-o:before { content: $fa-var-window-close-o; } +.#{$fa-css-prefix}-bandcamp:before { content: $fa-var-bandcamp; } +.#{$fa-css-prefix}-grav:before { content: $fa-var-grav; } +.#{$fa-css-prefix}-etsy:before { content: $fa-var-etsy; } +.#{$fa-css-prefix}-imdb:before { content: $fa-var-imdb; } +.#{$fa-css-prefix}-ravelry:before { content: $fa-var-ravelry; } +.#{$fa-css-prefix}-eercast:before { content: $fa-var-eercast; } +.#{$fa-css-prefix}-microchip:before { content: $fa-var-microchip; } +.#{$fa-css-prefix}-snowflake-o:before { content: $fa-var-snowflake-o; } +.#{$fa-css-prefix}-superpowers:before { content: $fa-var-superpowers; } +.#{$fa-css-prefix}-wpexplorer:before { content: $fa-var-wpexplorer; } +.#{$fa-css-prefix}-meetup:before { content: $fa-var-meetup; } diff --git a/node_modules/font-awesome/scss/_larger.scss b/node_modules/font-awesome/scss/_larger.scss new file mode 100644 index 0000000000..41e9a8184a --- /dev/null +++ b/node_modules/font-awesome/scss/_larger.scss @@ -0,0 +1,13 @@ +// Icon Sizes +// ------------------------- + +/* makes the font 33% larger relative to the icon container */ +.#{$fa-css-prefix}-lg { + font-size: (4em / 3); + line-height: (3em / 4); + vertical-align: -15%; +} +.#{$fa-css-prefix}-2x { font-size: 2em; } +.#{$fa-css-prefix}-3x { font-size: 3em; } +.#{$fa-css-prefix}-4x { font-size: 4em; } +.#{$fa-css-prefix}-5x { font-size: 5em; } diff --git a/node_modules/font-awesome/scss/_list.scss b/node_modules/font-awesome/scss/_list.scss new file mode 100644 index 0000000000..7d1e4d54d6 --- /dev/null +++ b/node_modules/font-awesome/scss/_list.scss @@ -0,0 +1,19 @@ +// List Icons +// ------------------------- + +.#{$fa-css-prefix}-ul { + padding-left: 0; + margin-left: $fa-li-width; + list-style-type: none; + > li { position: relative; } +} +.#{$fa-css-prefix}-li { + position: absolute; + left: -$fa-li-width; + width: $fa-li-width; + top: (2em / 14); + text-align: center; + &.#{$fa-css-prefix}-lg { + left: -$fa-li-width + (4em / 14); + } +} diff --git a/node_modules/font-awesome/scss/_mixins.scss b/node_modules/font-awesome/scss/_mixins.scss new file mode 100644 index 0000000000..c3bbd5745d --- /dev/null +++ b/node_modules/font-awesome/scss/_mixins.scss @@ -0,0 +1,60 @@ +// Mixins +// -------------------------- + +@mixin fa-icon() { + display: inline-block; + font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration + font-size: inherit; // can't have font-size inherit on line above, so need to override + text-rendering: auto; // optimizelegibility throws things off #1094 + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + +} + +@mixin fa-icon-rotate($degrees, $rotation) { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation})"; + -webkit-transform: rotate($degrees); + -ms-transform: rotate($degrees); + transform: rotate($degrees); +} + +@mixin fa-icon-flip($horiz, $vert, $rotation) { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}, mirror=1)"; + -webkit-transform: scale($horiz, $vert); + -ms-transform: scale($horiz, $vert); + transform: scale($horiz, $vert); +} + + +// Only display content to screen readers. A la Bootstrap 4. +// +// See: http://a11yproject.com/posts/how-to-hide-content/ + +@mixin sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0,0,0,0); + border: 0; +} + +// Use in conjunction with .sr-only to only display content when it's focused. +// +// Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 +// +// Credit: HTML5 Boilerplate + +@mixin sr-only-focusable { + &:active, + &:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; + } +} diff --git a/node_modules/font-awesome/scss/_path.scss b/node_modules/font-awesome/scss/_path.scss new file mode 100644 index 0000000000..bb457c23a8 --- /dev/null +++ b/node_modules/font-awesome/scss/_path.scss @@ -0,0 +1,15 @@ +/* FONT PATH + * -------------------------- */ + +@font-face { + font-family: 'FontAwesome'; + src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); + src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), + url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'), + url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), + url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), + url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg'); +// src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts + font-weight: normal; + font-style: normal; +} diff --git a/node_modules/font-awesome/scss/_rotated-flipped.scss b/node_modules/font-awesome/scss/_rotated-flipped.scss new file mode 100644 index 0000000000..a3558fd09c --- /dev/null +++ b/node_modules/font-awesome/scss/_rotated-flipped.scss @@ -0,0 +1,20 @@ +// Rotated & Flipped Icons +// ------------------------- + +.#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } +.#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } +.#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } + +.#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } +.#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } + +// Hook for IE8-9 +// ------------------------- + +:root .#{$fa-css-prefix}-rotate-90, +:root .#{$fa-css-prefix}-rotate-180, +:root .#{$fa-css-prefix}-rotate-270, +:root .#{$fa-css-prefix}-flip-horizontal, +:root .#{$fa-css-prefix}-flip-vertical { + filter: none; +} diff --git a/node_modules/font-awesome/scss/_screen-reader.scss b/node_modules/font-awesome/scss/_screen-reader.scss new file mode 100644 index 0000000000..637426f0da --- /dev/null +++ b/node_modules/font-awesome/scss/_screen-reader.scss @@ -0,0 +1,5 @@ +// Screen Readers +// ------------------------- + +.sr-only { @include sr-only(); } +.sr-only-focusable { @include sr-only-focusable(); } diff --git a/node_modules/font-awesome/scss/_stacked.scss b/node_modules/font-awesome/scss/_stacked.scss new file mode 100644 index 0000000000..aef7403660 --- /dev/null +++ b/node_modules/font-awesome/scss/_stacked.scss @@ -0,0 +1,20 @@ +// Stacked Icons +// ------------------------- + +.#{$fa-css-prefix}-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} +.#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} +.#{$fa-css-prefix}-stack-1x { line-height: inherit; } +.#{$fa-css-prefix}-stack-2x { font-size: 2em; } +.#{$fa-css-prefix}-inverse { color: $fa-inverse; } diff --git a/node_modules/font-awesome/scss/_variables.scss b/node_modules/font-awesome/scss/_variables.scss new file mode 100644 index 0000000000..498fc4a087 --- /dev/null +++ b/node_modules/font-awesome/scss/_variables.scss @@ -0,0 +1,800 @@ +// Variables +// -------------------------- + +$fa-font-path: "../fonts" !default; +$fa-font-size-base: 14px !default; +$fa-line-height-base: 1 !default; +//$fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.7.0/fonts" !default; // for referencing Bootstrap CDN font files directly +$fa-css-prefix: fa !default; +$fa-version: "4.7.0" !default; +$fa-border-color: #eee !default; +$fa-inverse: #fff !default; +$fa-li-width: (30em / 14) !default; + +$fa-var-500px: "\f26e"; +$fa-var-address-book: "\f2b9"; +$fa-var-address-book-o: "\f2ba"; +$fa-var-address-card: "\f2bb"; +$fa-var-address-card-o: "\f2bc"; +$fa-var-adjust: "\f042"; +$fa-var-adn: "\f170"; +$fa-var-align-center: "\f037"; +$fa-var-align-justify: "\f039"; +$fa-var-align-left: "\f036"; +$fa-var-align-right: "\f038"; +$fa-var-amazon: "\f270"; +$fa-var-ambulance: "\f0f9"; +$fa-var-american-sign-language-interpreting: "\f2a3"; +$fa-var-anchor: "\f13d"; +$fa-var-android: "\f17b"; +$fa-var-angellist: "\f209"; +$fa-var-angle-double-down: "\f103"; +$fa-var-angle-double-left: "\f100"; +$fa-var-angle-double-right: "\f101"; +$fa-var-angle-double-up: "\f102"; +$fa-var-angle-down: "\f107"; +$fa-var-angle-left: "\f104"; +$fa-var-angle-right: "\f105"; +$fa-var-angle-up: "\f106"; +$fa-var-apple: "\f179"; +$fa-var-archive: "\f187"; +$fa-var-area-chart: "\f1fe"; +$fa-var-arrow-circle-down: "\f0ab"; +$fa-var-arrow-circle-left: "\f0a8"; +$fa-var-arrow-circle-o-down: "\f01a"; +$fa-var-arrow-circle-o-left: "\f190"; +$fa-var-arrow-circle-o-right: "\f18e"; +$fa-var-arrow-circle-o-up: "\f01b"; +$fa-var-arrow-circle-right: "\f0a9"; +$fa-var-arrow-circle-up: "\f0aa"; +$fa-var-arrow-down: "\f063"; +$fa-var-arrow-left: "\f060"; +$fa-var-arrow-right: "\f061"; +$fa-var-arrow-up: "\f062"; +$fa-var-arrows: "\f047"; +$fa-var-arrows-alt: "\f0b2"; +$fa-var-arrows-h: "\f07e"; +$fa-var-arrows-v: "\f07d"; +$fa-var-asl-interpreting: "\f2a3"; +$fa-var-assistive-listening-systems: "\f2a2"; +$fa-var-asterisk: "\f069"; +$fa-var-at: "\f1fa"; +$fa-var-audio-description: "\f29e"; +$fa-var-automobile: "\f1b9"; +$fa-var-backward: "\f04a"; +$fa-var-balance-scale: "\f24e"; +$fa-var-ban: "\f05e"; +$fa-var-bandcamp: "\f2d5"; +$fa-var-bank: "\f19c"; +$fa-var-bar-chart: "\f080"; +$fa-var-bar-chart-o: "\f080"; +$fa-var-barcode: "\f02a"; +$fa-var-bars: "\f0c9"; +$fa-var-bath: "\f2cd"; +$fa-var-bathtub: "\f2cd"; +$fa-var-battery: "\f240"; +$fa-var-battery-0: "\f244"; +$fa-var-battery-1: "\f243"; +$fa-var-battery-2: "\f242"; +$fa-var-battery-3: "\f241"; +$fa-var-battery-4: "\f240"; +$fa-var-battery-empty: "\f244"; +$fa-var-battery-full: "\f240"; +$fa-var-battery-half: "\f242"; +$fa-var-battery-quarter: "\f243"; +$fa-var-battery-three-quarters: "\f241"; +$fa-var-bed: "\f236"; +$fa-var-beer: "\f0fc"; +$fa-var-behance: "\f1b4"; +$fa-var-behance-square: "\f1b5"; +$fa-var-bell: "\f0f3"; +$fa-var-bell-o: "\f0a2"; +$fa-var-bell-slash: "\f1f6"; +$fa-var-bell-slash-o: "\f1f7"; +$fa-var-bicycle: "\f206"; +$fa-var-binoculars: "\f1e5"; +$fa-var-birthday-cake: "\f1fd"; +$fa-var-bitbucket: "\f171"; +$fa-var-bitbucket-square: "\f172"; +$fa-var-bitcoin: "\f15a"; +$fa-var-black-tie: "\f27e"; +$fa-var-blind: "\f29d"; +$fa-var-bluetooth: "\f293"; +$fa-var-bluetooth-b: "\f294"; +$fa-var-bold: "\f032"; +$fa-var-bolt: "\f0e7"; +$fa-var-bomb: "\f1e2"; +$fa-var-book: "\f02d"; +$fa-var-bookmark: "\f02e"; +$fa-var-bookmark-o: "\f097"; +$fa-var-braille: "\f2a1"; +$fa-var-briefcase: "\f0b1"; +$fa-var-btc: "\f15a"; +$fa-var-bug: "\f188"; +$fa-var-building: "\f1ad"; +$fa-var-building-o: "\f0f7"; +$fa-var-bullhorn: "\f0a1"; +$fa-var-bullseye: "\f140"; +$fa-var-bus: "\f207"; +$fa-var-buysellads: "\f20d"; +$fa-var-cab: "\f1ba"; +$fa-var-calculator: "\f1ec"; +$fa-var-calendar: "\f073"; +$fa-var-calendar-check-o: "\f274"; +$fa-var-calendar-minus-o: "\f272"; +$fa-var-calendar-o: "\f133"; +$fa-var-calendar-plus-o: "\f271"; +$fa-var-calendar-times-o: "\f273"; +$fa-var-camera: "\f030"; +$fa-var-camera-retro: "\f083"; +$fa-var-car: "\f1b9"; +$fa-var-caret-down: "\f0d7"; +$fa-var-caret-left: "\f0d9"; +$fa-var-caret-right: "\f0da"; +$fa-var-caret-square-o-down: "\f150"; +$fa-var-caret-square-o-left: "\f191"; +$fa-var-caret-square-o-right: "\f152"; +$fa-var-caret-square-o-up: "\f151"; +$fa-var-caret-up: "\f0d8"; +$fa-var-cart-arrow-down: "\f218"; +$fa-var-cart-plus: "\f217"; +$fa-var-cc: "\f20a"; +$fa-var-cc-amex: "\f1f3"; +$fa-var-cc-diners-club: "\f24c"; +$fa-var-cc-discover: "\f1f2"; +$fa-var-cc-jcb: "\f24b"; +$fa-var-cc-mastercard: "\f1f1"; +$fa-var-cc-paypal: "\f1f4"; +$fa-var-cc-stripe: "\f1f5"; +$fa-var-cc-visa: "\f1f0"; +$fa-var-certificate: "\f0a3"; +$fa-var-chain: "\f0c1"; +$fa-var-chain-broken: "\f127"; +$fa-var-check: "\f00c"; +$fa-var-check-circle: "\f058"; +$fa-var-check-circle-o: "\f05d"; +$fa-var-check-square: "\f14a"; +$fa-var-check-square-o: "\f046"; +$fa-var-chevron-circle-down: "\f13a"; +$fa-var-chevron-circle-left: "\f137"; +$fa-var-chevron-circle-right: "\f138"; +$fa-var-chevron-circle-up: "\f139"; +$fa-var-chevron-down: "\f078"; +$fa-var-chevron-left: "\f053"; +$fa-var-chevron-right: "\f054"; +$fa-var-chevron-up: "\f077"; +$fa-var-child: "\f1ae"; +$fa-var-chrome: "\f268"; +$fa-var-circle: "\f111"; +$fa-var-circle-o: "\f10c"; +$fa-var-circle-o-notch: "\f1ce"; +$fa-var-circle-thin: "\f1db"; +$fa-var-clipboard: "\f0ea"; +$fa-var-clock-o: "\f017"; +$fa-var-clone: "\f24d"; +$fa-var-close: "\f00d"; +$fa-var-cloud: "\f0c2"; +$fa-var-cloud-download: "\f0ed"; +$fa-var-cloud-upload: "\f0ee"; +$fa-var-cny: "\f157"; +$fa-var-code: "\f121"; +$fa-var-code-fork: "\f126"; +$fa-var-codepen: "\f1cb"; +$fa-var-codiepie: "\f284"; +$fa-var-coffee: "\f0f4"; +$fa-var-cog: "\f013"; +$fa-var-cogs: "\f085"; +$fa-var-columns: "\f0db"; +$fa-var-comment: "\f075"; +$fa-var-comment-o: "\f0e5"; +$fa-var-commenting: "\f27a"; +$fa-var-commenting-o: "\f27b"; +$fa-var-comments: "\f086"; +$fa-var-comments-o: "\f0e6"; +$fa-var-compass: "\f14e"; +$fa-var-compress: "\f066"; +$fa-var-connectdevelop: "\f20e"; +$fa-var-contao: "\f26d"; +$fa-var-copy: "\f0c5"; +$fa-var-copyright: "\f1f9"; +$fa-var-creative-commons: "\f25e"; +$fa-var-credit-card: "\f09d"; +$fa-var-credit-card-alt: "\f283"; +$fa-var-crop: "\f125"; +$fa-var-crosshairs: "\f05b"; +$fa-var-css3: "\f13c"; +$fa-var-cube: "\f1b2"; +$fa-var-cubes: "\f1b3"; +$fa-var-cut: "\f0c4"; +$fa-var-cutlery: "\f0f5"; +$fa-var-dashboard: "\f0e4"; +$fa-var-dashcube: "\f210"; +$fa-var-database: "\f1c0"; +$fa-var-deaf: "\f2a4"; +$fa-var-deafness: "\f2a4"; +$fa-var-dedent: "\f03b"; +$fa-var-delicious: "\f1a5"; +$fa-var-desktop: "\f108"; +$fa-var-deviantart: "\f1bd"; +$fa-var-diamond: "\f219"; +$fa-var-digg: "\f1a6"; +$fa-var-dollar: "\f155"; +$fa-var-dot-circle-o: "\f192"; +$fa-var-download: "\f019"; +$fa-var-dribbble: "\f17d"; +$fa-var-drivers-license: "\f2c2"; +$fa-var-drivers-license-o: "\f2c3"; +$fa-var-dropbox: "\f16b"; +$fa-var-drupal: "\f1a9"; +$fa-var-edge: "\f282"; +$fa-var-edit: "\f044"; +$fa-var-eercast: "\f2da"; +$fa-var-eject: "\f052"; +$fa-var-ellipsis-h: "\f141"; +$fa-var-ellipsis-v: "\f142"; +$fa-var-empire: "\f1d1"; +$fa-var-envelope: "\f0e0"; +$fa-var-envelope-o: "\f003"; +$fa-var-envelope-open: "\f2b6"; +$fa-var-envelope-open-o: "\f2b7"; +$fa-var-envelope-square: "\f199"; +$fa-var-envira: "\f299"; +$fa-var-eraser: "\f12d"; +$fa-var-etsy: "\f2d7"; +$fa-var-eur: "\f153"; +$fa-var-euro: "\f153"; +$fa-var-exchange: "\f0ec"; +$fa-var-exclamation: "\f12a"; +$fa-var-exclamation-circle: "\f06a"; +$fa-var-exclamation-triangle: "\f071"; +$fa-var-expand: "\f065"; +$fa-var-expeditedssl: "\f23e"; +$fa-var-external-link: "\f08e"; +$fa-var-external-link-square: "\f14c"; +$fa-var-eye: "\f06e"; +$fa-var-eye-slash: "\f070"; +$fa-var-eyedropper: "\f1fb"; +$fa-var-fa: "\f2b4"; +$fa-var-facebook: "\f09a"; +$fa-var-facebook-f: "\f09a"; +$fa-var-facebook-official: "\f230"; +$fa-var-facebook-square: "\f082"; +$fa-var-fast-backward: "\f049"; +$fa-var-fast-forward: "\f050"; +$fa-var-fax: "\f1ac"; +$fa-var-feed: "\f09e"; +$fa-var-female: "\f182"; +$fa-var-fighter-jet: "\f0fb"; +$fa-var-file: "\f15b"; +$fa-var-file-archive-o: "\f1c6"; +$fa-var-file-audio-o: "\f1c7"; +$fa-var-file-code-o: "\f1c9"; +$fa-var-file-excel-o: "\f1c3"; +$fa-var-file-image-o: "\f1c5"; +$fa-var-file-movie-o: "\f1c8"; +$fa-var-file-o: "\f016"; +$fa-var-file-pdf-o: "\f1c1"; +$fa-var-file-photo-o: "\f1c5"; +$fa-var-file-picture-o: "\f1c5"; +$fa-var-file-powerpoint-o: "\f1c4"; +$fa-var-file-sound-o: "\f1c7"; +$fa-var-file-text: "\f15c"; +$fa-var-file-text-o: "\f0f6"; +$fa-var-file-video-o: "\f1c8"; +$fa-var-file-word-o: "\f1c2"; +$fa-var-file-zip-o: "\f1c6"; +$fa-var-files-o: "\f0c5"; +$fa-var-film: "\f008"; +$fa-var-filter: "\f0b0"; +$fa-var-fire: "\f06d"; +$fa-var-fire-extinguisher: "\f134"; +$fa-var-firefox: "\f269"; +$fa-var-first-order: "\f2b0"; +$fa-var-flag: "\f024"; +$fa-var-flag-checkered: "\f11e"; +$fa-var-flag-o: "\f11d"; +$fa-var-flash: "\f0e7"; +$fa-var-flask: "\f0c3"; +$fa-var-flickr: "\f16e"; +$fa-var-floppy-o: "\f0c7"; +$fa-var-folder: "\f07b"; +$fa-var-folder-o: "\f114"; +$fa-var-folder-open: "\f07c"; +$fa-var-folder-open-o: "\f115"; +$fa-var-font: "\f031"; +$fa-var-font-awesome: "\f2b4"; +$fa-var-fonticons: "\f280"; +$fa-var-fort-awesome: "\f286"; +$fa-var-forumbee: "\f211"; +$fa-var-forward: "\f04e"; +$fa-var-foursquare: "\f180"; +$fa-var-free-code-camp: "\f2c5"; +$fa-var-frown-o: "\f119"; +$fa-var-futbol-o: "\f1e3"; +$fa-var-gamepad: "\f11b"; +$fa-var-gavel: "\f0e3"; +$fa-var-gbp: "\f154"; +$fa-var-ge: "\f1d1"; +$fa-var-gear: "\f013"; +$fa-var-gears: "\f085"; +$fa-var-genderless: "\f22d"; +$fa-var-get-pocket: "\f265"; +$fa-var-gg: "\f260"; +$fa-var-gg-circle: "\f261"; +$fa-var-gift: "\f06b"; +$fa-var-git: "\f1d3"; +$fa-var-git-square: "\f1d2"; +$fa-var-github: "\f09b"; +$fa-var-github-alt: "\f113"; +$fa-var-github-square: "\f092"; +$fa-var-gitlab: "\f296"; +$fa-var-gittip: "\f184"; +$fa-var-glass: "\f000"; +$fa-var-glide: "\f2a5"; +$fa-var-glide-g: "\f2a6"; +$fa-var-globe: "\f0ac"; +$fa-var-google: "\f1a0"; +$fa-var-google-plus: "\f0d5"; +$fa-var-google-plus-circle: "\f2b3"; +$fa-var-google-plus-official: "\f2b3"; +$fa-var-google-plus-square: "\f0d4"; +$fa-var-google-wallet: "\f1ee"; +$fa-var-graduation-cap: "\f19d"; +$fa-var-gratipay: "\f184"; +$fa-var-grav: "\f2d6"; +$fa-var-group: "\f0c0"; +$fa-var-h-square: "\f0fd"; +$fa-var-hacker-news: "\f1d4"; +$fa-var-hand-grab-o: "\f255"; +$fa-var-hand-lizard-o: "\f258"; +$fa-var-hand-o-down: "\f0a7"; +$fa-var-hand-o-left: "\f0a5"; +$fa-var-hand-o-right: "\f0a4"; +$fa-var-hand-o-up: "\f0a6"; +$fa-var-hand-paper-o: "\f256"; +$fa-var-hand-peace-o: "\f25b"; +$fa-var-hand-pointer-o: "\f25a"; +$fa-var-hand-rock-o: "\f255"; +$fa-var-hand-scissors-o: "\f257"; +$fa-var-hand-spock-o: "\f259"; +$fa-var-hand-stop-o: "\f256"; +$fa-var-handshake-o: "\f2b5"; +$fa-var-hard-of-hearing: "\f2a4"; +$fa-var-hashtag: "\f292"; +$fa-var-hdd-o: "\f0a0"; +$fa-var-header: "\f1dc"; +$fa-var-headphones: "\f025"; +$fa-var-heart: "\f004"; +$fa-var-heart-o: "\f08a"; +$fa-var-heartbeat: "\f21e"; +$fa-var-history: "\f1da"; +$fa-var-home: "\f015"; +$fa-var-hospital-o: "\f0f8"; +$fa-var-hotel: "\f236"; +$fa-var-hourglass: "\f254"; +$fa-var-hourglass-1: "\f251"; +$fa-var-hourglass-2: "\f252"; +$fa-var-hourglass-3: "\f253"; +$fa-var-hourglass-end: "\f253"; +$fa-var-hourglass-half: "\f252"; +$fa-var-hourglass-o: "\f250"; +$fa-var-hourglass-start: "\f251"; +$fa-var-houzz: "\f27c"; +$fa-var-html5: "\f13b"; +$fa-var-i-cursor: "\f246"; +$fa-var-id-badge: "\f2c1"; +$fa-var-id-card: "\f2c2"; +$fa-var-id-card-o: "\f2c3"; +$fa-var-ils: "\f20b"; +$fa-var-image: "\f03e"; +$fa-var-imdb: "\f2d8"; +$fa-var-inbox: "\f01c"; +$fa-var-indent: "\f03c"; +$fa-var-industry: "\f275"; +$fa-var-info: "\f129"; +$fa-var-info-circle: "\f05a"; +$fa-var-inr: "\f156"; +$fa-var-instagram: "\f16d"; +$fa-var-institution: "\f19c"; +$fa-var-internet-explorer: "\f26b"; +$fa-var-intersex: "\f224"; +$fa-var-ioxhost: "\f208"; +$fa-var-italic: "\f033"; +$fa-var-joomla: "\f1aa"; +$fa-var-jpy: "\f157"; +$fa-var-jsfiddle: "\f1cc"; +$fa-var-key: "\f084"; +$fa-var-keyboard-o: "\f11c"; +$fa-var-krw: "\f159"; +$fa-var-language: "\f1ab"; +$fa-var-laptop: "\f109"; +$fa-var-lastfm: "\f202"; +$fa-var-lastfm-square: "\f203"; +$fa-var-leaf: "\f06c"; +$fa-var-leanpub: "\f212"; +$fa-var-legal: "\f0e3"; +$fa-var-lemon-o: "\f094"; +$fa-var-level-down: "\f149"; +$fa-var-level-up: "\f148"; +$fa-var-life-bouy: "\f1cd"; +$fa-var-life-buoy: "\f1cd"; +$fa-var-life-ring: "\f1cd"; +$fa-var-life-saver: "\f1cd"; +$fa-var-lightbulb-o: "\f0eb"; +$fa-var-line-chart: "\f201"; +$fa-var-link: "\f0c1"; +$fa-var-linkedin: "\f0e1"; +$fa-var-linkedin-square: "\f08c"; +$fa-var-linode: "\f2b8"; +$fa-var-linux: "\f17c"; +$fa-var-list: "\f03a"; +$fa-var-list-alt: "\f022"; +$fa-var-list-ol: "\f0cb"; +$fa-var-list-ul: "\f0ca"; +$fa-var-location-arrow: "\f124"; +$fa-var-lock: "\f023"; +$fa-var-long-arrow-down: "\f175"; +$fa-var-long-arrow-left: "\f177"; +$fa-var-long-arrow-right: "\f178"; +$fa-var-long-arrow-up: "\f176"; +$fa-var-low-vision: "\f2a8"; +$fa-var-magic: "\f0d0"; +$fa-var-magnet: "\f076"; +$fa-var-mail-forward: "\f064"; +$fa-var-mail-reply: "\f112"; +$fa-var-mail-reply-all: "\f122"; +$fa-var-male: "\f183"; +$fa-var-map: "\f279"; +$fa-var-map-marker: "\f041"; +$fa-var-map-o: "\f278"; +$fa-var-map-pin: "\f276"; +$fa-var-map-signs: "\f277"; +$fa-var-mars: "\f222"; +$fa-var-mars-double: "\f227"; +$fa-var-mars-stroke: "\f229"; +$fa-var-mars-stroke-h: "\f22b"; +$fa-var-mars-stroke-v: "\f22a"; +$fa-var-maxcdn: "\f136"; +$fa-var-meanpath: "\f20c"; +$fa-var-medium: "\f23a"; +$fa-var-medkit: "\f0fa"; +$fa-var-meetup: "\f2e0"; +$fa-var-meh-o: "\f11a"; +$fa-var-mercury: "\f223"; +$fa-var-microchip: "\f2db"; +$fa-var-microphone: "\f130"; +$fa-var-microphone-slash: "\f131"; +$fa-var-minus: "\f068"; +$fa-var-minus-circle: "\f056"; +$fa-var-minus-square: "\f146"; +$fa-var-minus-square-o: "\f147"; +$fa-var-mixcloud: "\f289"; +$fa-var-mobile: "\f10b"; +$fa-var-mobile-phone: "\f10b"; +$fa-var-modx: "\f285"; +$fa-var-money: "\f0d6"; +$fa-var-moon-o: "\f186"; +$fa-var-mortar-board: "\f19d"; +$fa-var-motorcycle: "\f21c"; +$fa-var-mouse-pointer: "\f245"; +$fa-var-music: "\f001"; +$fa-var-navicon: "\f0c9"; +$fa-var-neuter: "\f22c"; +$fa-var-newspaper-o: "\f1ea"; +$fa-var-object-group: "\f247"; +$fa-var-object-ungroup: "\f248"; +$fa-var-odnoklassniki: "\f263"; +$fa-var-odnoklassniki-square: "\f264"; +$fa-var-opencart: "\f23d"; +$fa-var-openid: "\f19b"; +$fa-var-opera: "\f26a"; +$fa-var-optin-monster: "\f23c"; +$fa-var-outdent: "\f03b"; +$fa-var-pagelines: "\f18c"; +$fa-var-paint-brush: "\f1fc"; +$fa-var-paper-plane: "\f1d8"; +$fa-var-paper-plane-o: "\f1d9"; +$fa-var-paperclip: "\f0c6"; +$fa-var-paragraph: "\f1dd"; +$fa-var-paste: "\f0ea"; +$fa-var-pause: "\f04c"; +$fa-var-pause-circle: "\f28b"; +$fa-var-pause-circle-o: "\f28c"; +$fa-var-paw: "\f1b0"; +$fa-var-paypal: "\f1ed"; +$fa-var-pencil: "\f040"; +$fa-var-pencil-square: "\f14b"; +$fa-var-pencil-square-o: "\f044"; +$fa-var-percent: "\f295"; +$fa-var-phone: "\f095"; +$fa-var-phone-square: "\f098"; +$fa-var-photo: "\f03e"; +$fa-var-picture-o: "\f03e"; +$fa-var-pie-chart: "\f200"; +$fa-var-pied-piper: "\f2ae"; +$fa-var-pied-piper-alt: "\f1a8"; +$fa-var-pied-piper-pp: "\f1a7"; +$fa-var-pinterest: "\f0d2"; +$fa-var-pinterest-p: "\f231"; +$fa-var-pinterest-square: "\f0d3"; +$fa-var-plane: "\f072"; +$fa-var-play: "\f04b"; +$fa-var-play-circle: "\f144"; +$fa-var-play-circle-o: "\f01d"; +$fa-var-plug: "\f1e6"; +$fa-var-plus: "\f067"; +$fa-var-plus-circle: "\f055"; +$fa-var-plus-square: "\f0fe"; +$fa-var-plus-square-o: "\f196"; +$fa-var-podcast: "\f2ce"; +$fa-var-power-off: "\f011"; +$fa-var-print: "\f02f"; +$fa-var-product-hunt: "\f288"; +$fa-var-puzzle-piece: "\f12e"; +$fa-var-qq: "\f1d6"; +$fa-var-qrcode: "\f029"; +$fa-var-question: "\f128"; +$fa-var-question-circle: "\f059"; +$fa-var-question-circle-o: "\f29c"; +$fa-var-quora: "\f2c4"; +$fa-var-quote-left: "\f10d"; +$fa-var-quote-right: "\f10e"; +$fa-var-ra: "\f1d0"; +$fa-var-random: "\f074"; +$fa-var-ravelry: "\f2d9"; +$fa-var-rebel: "\f1d0"; +$fa-var-recycle: "\f1b8"; +$fa-var-reddit: "\f1a1"; +$fa-var-reddit-alien: "\f281"; +$fa-var-reddit-square: "\f1a2"; +$fa-var-refresh: "\f021"; +$fa-var-registered: "\f25d"; +$fa-var-remove: "\f00d"; +$fa-var-renren: "\f18b"; +$fa-var-reorder: "\f0c9"; +$fa-var-repeat: "\f01e"; +$fa-var-reply: "\f112"; +$fa-var-reply-all: "\f122"; +$fa-var-resistance: "\f1d0"; +$fa-var-retweet: "\f079"; +$fa-var-rmb: "\f157"; +$fa-var-road: "\f018"; +$fa-var-rocket: "\f135"; +$fa-var-rotate-left: "\f0e2"; +$fa-var-rotate-right: "\f01e"; +$fa-var-rouble: "\f158"; +$fa-var-rss: "\f09e"; +$fa-var-rss-square: "\f143"; +$fa-var-rub: "\f158"; +$fa-var-ruble: "\f158"; +$fa-var-rupee: "\f156"; +$fa-var-s15: "\f2cd"; +$fa-var-safari: "\f267"; +$fa-var-save: "\f0c7"; +$fa-var-scissors: "\f0c4"; +$fa-var-scribd: "\f28a"; +$fa-var-search: "\f002"; +$fa-var-search-minus: "\f010"; +$fa-var-search-plus: "\f00e"; +$fa-var-sellsy: "\f213"; +$fa-var-send: "\f1d8"; +$fa-var-send-o: "\f1d9"; +$fa-var-server: "\f233"; +$fa-var-share: "\f064"; +$fa-var-share-alt: "\f1e0"; +$fa-var-share-alt-square: "\f1e1"; +$fa-var-share-square: "\f14d"; +$fa-var-share-square-o: "\f045"; +$fa-var-shekel: "\f20b"; +$fa-var-sheqel: "\f20b"; +$fa-var-shield: "\f132"; +$fa-var-ship: "\f21a"; +$fa-var-shirtsinbulk: "\f214"; +$fa-var-shopping-bag: "\f290"; +$fa-var-shopping-basket: "\f291"; +$fa-var-shopping-cart: "\f07a"; +$fa-var-shower: "\f2cc"; +$fa-var-sign-in: "\f090"; +$fa-var-sign-language: "\f2a7"; +$fa-var-sign-out: "\f08b"; +$fa-var-signal: "\f012"; +$fa-var-signing: "\f2a7"; +$fa-var-simplybuilt: "\f215"; +$fa-var-sitemap: "\f0e8"; +$fa-var-skyatlas: "\f216"; +$fa-var-skype: "\f17e"; +$fa-var-slack: "\f198"; +$fa-var-sliders: "\f1de"; +$fa-var-slideshare: "\f1e7"; +$fa-var-smile-o: "\f118"; +$fa-var-snapchat: "\f2ab"; +$fa-var-snapchat-ghost: "\f2ac"; +$fa-var-snapchat-square: "\f2ad"; +$fa-var-snowflake-o: "\f2dc"; +$fa-var-soccer-ball-o: "\f1e3"; +$fa-var-sort: "\f0dc"; +$fa-var-sort-alpha-asc: "\f15d"; +$fa-var-sort-alpha-desc: "\f15e"; +$fa-var-sort-amount-asc: "\f160"; +$fa-var-sort-amount-desc: "\f161"; +$fa-var-sort-asc: "\f0de"; +$fa-var-sort-desc: "\f0dd"; +$fa-var-sort-down: "\f0dd"; +$fa-var-sort-numeric-asc: "\f162"; +$fa-var-sort-numeric-desc: "\f163"; +$fa-var-sort-up: "\f0de"; +$fa-var-soundcloud: "\f1be"; +$fa-var-space-shuttle: "\f197"; +$fa-var-spinner: "\f110"; +$fa-var-spoon: "\f1b1"; +$fa-var-spotify: "\f1bc"; +$fa-var-square: "\f0c8"; +$fa-var-square-o: "\f096"; +$fa-var-stack-exchange: "\f18d"; +$fa-var-stack-overflow: "\f16c"; +$fa-var-star: "\f005"; +$fa-var-star-half: "\f089"; +$fa-var-star-half-empty: "\f123"; +$fa-var-star-half-full: "\f123"; +$fa-var-star-half-o: "\f123"; +$fa-var-star-o: "\f006"; +$fa-var-steam: "\f1b6"; +$fa-var-steam-square: "\f1b7"; +$fa-var-step-backward: "\f048"; +$fa-var-step-forward: "\f051"; +$fa-var-stethoscope: "\f0f1"; +$fa-var-sticky-note: "\f249"; +$fa-var-sticky-note-o: "\f24a"; +$fa-var-stop: "\f04d"; +$fa-var-stop-circle: "\f28d"; +$fa-var-stop-circle-o: "\f28e"; +$fa-var-street-view: "\f21d"; +$fa-var-strikethrough: "\f0cc"; +$fa-var-stumbleupon: "\f1a4"; +$fa-var-stumbleupon-circle: "\f1a3"; +$fa-var-subscript: "\f12c"; +$fa-var-subway: "\f239"; +$fa-var-suitcase: "\f0f2"; +$fa-var-sun-o: "\f185"; +$fa-var-superpowers: "\f2dd"; +$fa-var-superscript: "\f12b"; +$fa-var-support: "\f1cd"; +$fa-var-table: "\f0ce"; +$fa-var-tablet: "\f10a"; +$fa-var-tachometer: "\f0e4"; +$fa-var-tag: "\f02b"; +$fa-var-tags: "\f02c"; +$fa-var-tasks: "\f0ae"; +$fa-var-taxi: "\f1ba"; +$fa-var-telegram: "\f2c6"; +$fa-var-television: "\f26c"; +$fa-var-tencent-weibo: "\f1d5"; +$fa-var-terminal: "\f120"; +$fa-var-text-height: "\f034"; +$fa-var-text-width: "\f035"; +$fa-var-th: "\f00a"; +$fa-var-th-large: "\f009"; +$fa-var-th-list: "\f00b"; +$fa-var-themeisle: "\f2b2"; +$fa-var-thermometer: "\f2c7"; +$fa-var-thermometer-0: "\f2cb"; +$fa-var-thermometer-1: "\f2ca"; +$fa-var-thermometer-2: "\f2c9"; +$fa-var-thermometer-3: "\f2c8"; +$fa-var-thermometer-4: "\f2c7"; +$fa-var-thermometer-empty: "\f2cb"; +$fa-var-thermometer-full: "\f2c7"; +$fa-var-thermometer-half: "\f2c9"; +$fa-var-thermometer-quarter: "\f2ca"; +$fa-var-thermometer-three-quarters: "\f2c8"; +$fa-var-thumb-tack: "\f08d"; +$fa-var-thumbs-down: "\f165"; +$fa-var-thumbs-o-down: "\f088"; +$fa-var-thumbs-o-up: "\f087"; +$fa-var-thumbs-up: "\f164"; +$fa-var-ticket: "\f145"; +$fa-var-times: "\f00d"; +$fa-var-times-circle: "\f057"; +$fa-var-times-circle-o: "\f05c"; +$fa-var-times-rectangle: "\f2d3"; +$fa-var-times-rectangle-o: "\f2d4"; +$fa-var-tint: "\f043"; +$fa-var-toggle-down: "\f150"; +$fa-var-toggle-left: "\f191"; +$fa-var-toggle-off: "\f204"; +$fa-var-toggle-on: "\f205"; +$fa-var-toggle-right: "\f152"; +$fa-var-toggle-up: "\f151"; +$fa-var-trademark: "\f25c"; +$fa-var-train: "\f238"; +$fa-var-transgender: "\f224"; +$fa-var-transgender-alt: "\f225"; +$fa-var-trash: "\f1f8"; +$fa-var-trash-o: "\f014"; +$fa-var-tree: "\f1bb"; +$fa-var-trello: "\f181"; +$fa-var-tripadvisor: "\f262"; +$fa-var-trophy: "\f091"; +$fa-var-truck: "\f0d1"; +$fa-var-try: "\f195"; +$fa-var-tty: "\f1e4"; +$fa-var-tumblr: "\f173"; +$fa-var-tumblr-square: "\f174"; +$fa-var-turkish-lira: "\f195"; +$fa-var-tv: "\f26c"; +$fa-var-twitch: "\f1e8"; +$fa-var-twitter: "\f099"; +$fa-var-twitter-square: "\f081"; +$fa-var-umbrella: "\f0e9"; +$fa-var-underline: "\f0cd"; +$fa-var-undo: "\f0e2"; +$fa-var-universal-access: "\f29a"; +$fa-var-university: "\f19c"; +$fa-var-unlink: "\f127"; +$fa-var-unlock: "\f09c"; +$fa-var-unlock-alt: "\f13e"; +$fa-var-unsorted: "\f0dc"; +$fa-var-upload: "\f093"; +$fa-var-usb: "\f287"; +$fa-var-usd: "\f155"; +$fa-var-user: "\f007"; +$fa-var-user-circle: "\f2bd"; +$fa-var-user-circle-o: "\f2be"; +$fa-var-user-md: "\f0f0"; +$fa-var-user-o: "\f2c0"; +$fa-var-user-plus: "\f234"; +$fa-var-user-secret: "\f21b"; +$fa-var-user-times: "\f235"; +$fa-var-users: "\f0c0"; +$fa-var-vcard: "\f2bb"; +$fa-var-vcard-o: "\f2bc"; +$fa-var-venus: "\f221"; +$fa-var-venus-double: "\f226"; +$fa-var-venus-mars: "\f228"; +$fa-var-viacoin: "\f237"; +$fa-var-viadeo: "\f2a9"; +$fa-var-viadeo-square: "\f2aa"; +$fa-var-video-camera: "\f03d"; +$fa-var-vimeo: "\f27d"; +$fa-var-vimeo-square: "\f194"; +$fa-var-vine: "\f1ca"; +$fa-var-vk: "\f189"; +$fa-var-volume-control-phone: "\f2a0"; +$fa-var-volume-down: "\f027"; +$fa-var-volume-off: "\f026"; +$fa-var-volume-up: "\f028"; +$fa-var-warning: "\f071"; +$fa-var-wechat: "\f1d7"; +$fa-var-weibo: "\f18a"; +$fa-var-weixin: "\f1d7"; +$fa-var-whatsapp: "\f232"; +$fa-var-wheelchair: "\f193"; +$fa-var-wheelchair-alt: "\f29b"; +$fa-var-wifi: "\f1eb"; +$fa-var-wikipedia-w: "\f266"; +$fa-var-window-close: "\f2d3"; +$fa-var-window-close-o: "\f2d4"; +$fa-var-window-maximize: "\f2d0"; +$fa-var-window-minimize: "\f2d1"; +$fa-var-window-restore: "\f2d2"; +$fa-var-windows: "\f17a"; +$fa-var-won: "\f159"; +$fa-var-wordpress: "\f19a"; +$fa-var-wpbeginner: "\f297"; +$fa-var-wpexplorer: "\f2de"; +$fa-var-wpforms: "\f298"; +$fa-var-wrench: "\f0ad"; +$fa-var-xing: "\f168"; +$fa-var-xing-square: "\f169"; +$fa-var-y-combinator: "\f23b"; +$fa-var-y-combinator-square: "\f1d4"; +$fa-var-yahoo: "\f19e"; +$fa-var-yc: "\f23b"; +$fa-var-yc-square: "\f1d4"; +$fa-var-yelp: "\f1e9"; +$fa-var-yen: "\f157"; +$fa-var-yoast: "\f2b1"; +$fa-var-youtube: "\f167"; +$fa-var-youtube-play: "\f16a"; +$fa-var-youtube-square: "\f166"; + diff --git a/node_modules/font-awesome/scss/font-awesome.scss b/node_modules/font-awesome/scss/font-awesome.scss new file mode 100644 index 0000000000..f1c83aaa5d --- /dev/null +++ b/node_modules/font-awesome/scss/font-awesome.scss @@ -0,0 +1,18 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ + +@import "variables"; +@import "mixins"; +@import "path"; +@import "core"; +@import "larger"; +@import "fixed-width"; +@import "list"; +@import "bordered-pulled"; +@import "animated"; +@import "rotated-flipped"; +@import "stacked"; +@import "icons"; +@import "screen-reader"; diff --git a/node_modules/mux.js/CHANGELOG.md b/node_modules/mux.js/CHANGELOG.md index 3c37d3e93a..d7d319fc4e 100644 --- a/node_modules/mux.js/CHANGELOG.md +++ b/node_modules/mux.js/CHANGELOG.md @@ -1,3 +1,50 @@ + +## [7.0.1](https://github.com/videojs/mux.js/compare/v7.0.0...v7.0.1) (2023-10-12) + +### Bug Fixes + +* 708 captions multi-byte char fix ([#439](https://github.com/videojs/mux.js/issues/439)) ([ec31749](https://github.com/videojs/mux.js/commit/ec31749)) + +### Chores + +* update v7.0.0 documentation ([#435](https://github.com/videojs/mux.js/issues/435)) ([21e55aa](https://github.com/videojs/mux.js/commit/21e55aa)) + + +# [7.0.0](https://github.com/videojs/mux.js/compare/v6.3.0...v7.0.0) (2023-07-21) + +### Features + +* add position data to captions ([#434](https://github.com/videojs/mux.js/issues/434)) ([30f2132](https://github.com/videojs/mux.js/commit/30f2132)) + +### Chores + +* add npm publish step to the release workflow ([a8306cd](https://github.com/videojs/mux.js/commit/a8306cd)) +* rename workflow name from github-release to release and add discussion category name for github releases ([4ba1607](https://github.com/videojs/mux.js/commit/4ba1607)) +* Update CI and release workflows ([#431](https://github.com/videojs/mux.js/issues/431)) ([dc56f1b](https://github.com/videojs/mux.js/commit/dc56f1b)) +* update collaborator guide md ([51b3ed4](https://github.com/videojs/mux.js/commit/51b3ed4)) +* update git push suggestion in collaborator guide md ([73a5b60](https://github.com/videojs/mux.js/commit/73a5b60)) + +### BREAKING CHANGES + +* In the case of CEA-608 captions, mux.js will now be returning captions in the form of caption sets. +This means that rather then returning a single text of combined caption cues, an array of caption cues is returned in the `content` property. + +```js +transmuxer.on('data', function (segment) { + // create a VTTCue for all the parsed CEA-608 captions:> + segment.captions.forEach(function(captionSet) { + // Caption sets contains multiple captions with text and position data. + captionSet.content.forEach(function(cue) { + const newCue = new VTTCue(cue.startTime, cue.endTime, cue.text); + newCue.line = cue.line; + newCue.position = cue.position; + + captionTextTrack.addCue(newCue); + }); + }); +}); +``` + # [6.3.0](https://github.com/videojs/mux.js/compare/v6.2.0...v6.3.0) (2023-02-22) diff --git a/node_modules/mux.js/README.md b/node_modules/mux.js/README.md index 45a2a74b45..8bf35dac6e 100644 --- a/node_modules/mux.js/README.md +++ b/node_modules/mux.js/README.md @@ -333,8 +333,15 @@ transmuxer.on('data', function (segment) { metadataTextTrack.addCue(new VTTCue(time, time, frame.value)); }); // create a VTTCue for all the parsed CEA-608 captions:> - segment.captions.forEach(function(cue) { - captionTextTrack.addCue(new VTTCue(cue.startTime, cue.endTime, cue.text)); + segment.captions.forEach(function(captionSet) { + // Caption sets contains multiple caption cues with text and position data. + captionSet.content.forEach(function(cue) { + const newCue = new VTTCue(cue.startTime, cue.endTime, cue.text); + newCue.line = cue.line; + newCue.position = cue.position; + + captionTextTrack.addCue(newCue); + }); }); }); ``` diff --git a/node_modules/mux.js/cjs/flv/coalesce-stream.js b/node_modules/mux.js/cjs/flv/coalesce-stream.js index 4bf5ca92e6..ce63c5d462 100644 --- a/node_modules/mux.js/cjs/flv/coalesce-stream.js +++ b/node_modules/mux.js/cjs/flv/coalesce-stream.js @@ -33,7 +33,7 @@ var CoalesceStream = function CoalesceStream(options) { this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/cjs/m2ts/caption-stream.js b/node_modules/mux.js/cjs/m2ts/caption-stream.js index 47d140a6c2..aee29bb47d 100644 --- a/node_modules/mux.js/cjs/m2ts/caption-stream.js +++ b/node_modules/mux.js/cjs/m2ts/caption-stream.js @@ -707,19 +707,35 @@ Cea708Stream.prototype.handleText = function (i, service, options) { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(function (byte) { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + ; + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + var unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -1364,13 +1380,19 @@ var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since ther var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. +// We keep track of positioning information as we go by storing the +// number of indentations and the tab offset in this buffer. var createDisplayBuffer = function createDisplayBuffer() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ + text: '', + indent: 0, + offset: 0 + }); } return result; @@ -1439,9 +1461,9 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { this.startPts_ = packet.pts; } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -1474,9 +1496,9 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // backspace the "e" and insert "è". // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations // regardless of field and data channel. // Then byte-shift to the left and OR with char1 so we can pass the @@ -1508,7 +1530,11 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) + var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + + this.nonDisplayed_[this.row_].offset = offset; + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { // There's no logic for PAC -> row mapping, so we have to just // find the row code in an array and use its index :( @@ -1542,7 +1568,10 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + var indentations = (data & 0xe) >> 1; + this.column_ = indentations * 4; // add to the number of indentations for positioning + + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -1573,29 +1602,52 @@ Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the // display buffer Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row, index) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + var _this = this; + + var logWarning = function logWarning(index) { + _this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + + var content = []; + this.displayed_.forEach(function (row, i) { + if (row && row.text && row.text.length) { + try { + // remove spaces from the start and end of the string + row.text = row.text.trim(); + } catch (e) { + // Ordinarily, this shouldn't happen. However, caption + // parsing errors should not throw exceptions and + // break playback. + logWarning(i); + } // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + + + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 + }); + } + } else if (row === undefined || row === null) { + logWarning(i); } - }, this) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content: content, stream: this.name_ }); } @@ -1804,7 +1856,11 @@ Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { + text: '', + indent: 0, + offset: 0 + }; } } @@ -1841,27 +1897,35 @@ Cea608Stream.prototype.clearFormatting = function (pts) { Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.shiftRowsUp_ = function () { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } // shift displayed rows up @@ -1870,13 +1934,17 @@ Cea608Stream.prototype.shiftRowsUp_ = function () { } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { + text: '', + indent: 0, + offset: 0 + }; }; Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports diff --git a/node_modules/mux.js/cjs/mp4/caption-parser.js b/node_modules/mux.js/cjs/mp4/caption-parser.js index 77398d9b0f..1bd65a4df3 100644 --- a/node_modules/mux.js/cjs/mp4/caption-parser.js +++ b/node_modules/mux.js/cjs/mp4/caption-parser.js @@ -248,7 +248,10 @@ var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption + * @return {Object[]} parsedCaptions[].content - A list of individual caption segments + * @return {String} parsedCaptions[].content.text - The visible content of the caption segment + * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment + * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 **/ diff --git a/node_modules/mux.js/cjs/mp4/transmuxer.js b/node_modules/mux.js/cjs/mp4/transmuxer.js index aecff4de90..a7796c6de0 100644 --- a/node_modules/mux.js/cjs/mp4/transmuxer.js +++ b/node_modules/mux.js/cjs/mp4/transmuxer.js @@ -654,7 +654,7 @@ _CoalesceStream = function CoalesceStream(options, metadataStream) { this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/dist/mux-flv.js b/node_modules/mux.js/dist/mux-flv.js index 0f0e528bfb..9d4c8a0ab9 100644 --- a/node_modules/mux.js/dist/mux-flv.js +++ b/node_modules/mux.js/dist/mux-flv.js @@ -1,4 +1,4 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -1407,19 +1407,33 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(function (byte) { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + var unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -2063,13 +2077,19 @@ var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. + // We keep track of positioning information as we go by storing the + // number of indentations and the tab offset in this buffer. var createDisplayBuffer = function createDisplayBuffer() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ + text: '', + indent: 0, + offset: 0 + }); } return result; @@ -2138,9 +2158,9 @@ this.startPts_ = packet.pts; } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -2173,9 +2193,9 @@ // backspace the "e" and insert "è". // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations // regardless of field and data channel. // Then byte-shift to the left and OR with char1 so we can pass the @@ -2207,7 +2227,11 @@ // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) + var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + + this.nonDisplayed_[this.row_].offset = offset; + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { // There's no logic for PAC -> row mapping, so we have to just // find the row code in an array and use its index :( @@ -2241,7 +2265,10 @@ // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + var indentations = (data & 0xe) >> 1; + this.column_ = indentations * 4; // add to the number of indentations for positioning + + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -2272,29 +2299,52 @@ // display buffer Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row, index) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + var _this = this; + + var logWarning = function logWarning(index) { + _this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + + var content = []; + this.displayed_.forEach(function (row, i) { + if (row && row.text && row.text.length) { + try { + // remove spaces from the start and end of the string + row.text = row.text.trim(); + } catch (e) { + // Ordinarily, this shouldn't happen. However, caption + // parsing errors should not throw exceptions and + // break playback. + logWarning(i); + } // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + + + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 + }); + } + } else if (row === undefined || row === null) { + logWarning(i); } - }, this) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content: content, stream: this.name_ }); } @@ -2503,7 +2553,11 @@ // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { + text: '', + indent: 0, + offset: 0 + }; } } @@ -2540,27 +2594,35 @@ Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.shiftRowsUp_ = function () { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } // shift displayed rows up @@ -2569,13 +2631,17 @@ } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { + text: '', + indent: 0, + offset: 0 + }; }; Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports @@ -4591,7 +4657,7 @@ this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/dist/mux-flv.min.js b/node_modules/mux.js/dist/mux-flv.min.js index 3d061a59d2..7ad7cc6e22 100644 --- a/node_modules/mux.js/dist/mux-flv.min.js +++ b/node_modules/mux.js/dist/mux-flv.min.js @@ -1,2 +1,2 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e()}(this,(function(){"use strict";var t;(t=function(e,i){var s,a=0,n=16384,r=function(t,e){var i,s=t.position+e;s0)throw new Error("Attempted to create new NAL wihout closing the old one");a=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===a+4?this.length-=4:a>0&&(e=a+4,i=this.length-e,this.position=a,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),a=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(p,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&e)>>>8,this.bytes[15]=(255&e)>>>0;break;case t.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=i?0:1;break;case t.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,a),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return s=this.length-11,this.bytes[1]=(16711680&s)>>>16,this.bytes[2]=(65280&s)>>>8,this.bytes[3]=(255&s)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=t.frameTime(this.bytes),this}}).AUDIO_TAG=8,t.VIDEO_TAG=9,t.METADATA_TAG=18,t.isAudioFrame=function(e){return t.AUDIO_TAG===e[0]},t.isVideoFrame=function(e){return t.VIDEO_TAG===e[0]},t.isMetaData=function(e){return t.METADATA_TAG===e[0]},t.isKeyFrame=function(e){return t.isVideoFrame(e)?23===e[11]:!!t.isAudioFrame(e)||!!t.isMetaData(e)},t.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var e=t,i=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var s;return!!t[e]&&(s=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(s,1),s>-1)},this.trigger=function(e){var i,s,a,n;if(i=t[e])if(2===arguments.length)for(a=i.length,s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},l.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},l.prototype.addText=function(t){this.rows[this.rowIdx]+=t},l.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var c=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new l(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};c.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new l(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},c.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},c.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var u=function t(e){e=e||{},t.prototype.init.call(this);var i,s=this,a=e.captionServices||{},n={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(n[t]=i.encoding)})),this.serviceEncodings=n,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(s.new708Packet(),s.add708Bytes(t)):(null===s.current708Packet&&s.new708Packet(),s.add708Bytes(t))}};u.prototype=new s,u.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},u.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,s=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},u.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,s=null,a=0,n=e[a++];for(t.seq=n>>6,t.sizeCode=63&n;a>5)&&s>0&&(i=n=e[a++]),this.pushServiceBlock(i,a,s),s>0&&(a+=s-1)},u.prototype.pushServiceBlock=function(t,e,i){var s,a=e,n=this.current708Packet.data,r=this.services[t];for(r||(r=this.initService(t,a));a>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++t],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++t],n.anchorHorizontal=s,s=i[++t],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++t],n.columnCount=63&s,s=i[++t],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,t},u.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.winAttr;return s=i[++t],a.fillOpacity=(192&s)>>6,a.fillRed=(48&s)>>4,a.fillGreen=(12&s)>>2,a.fillBlue=3&s,s=i[++t],a.borderType=(192&s)>>6,a.borderRed=(48&s)>>4,a.borderGreen=(12&s)>>2,a.borderBlue=3&s,s=i[++t],a.borderType+=(128&s)>>5,a.wordWrap=(64&s)>>6,a.printDirection=(48&s)>>4,a.scrollDirection=(12&s)>>2,a.justify=3&s,s=i[++t],a.effectSpeed=(240&s)>>4,a.effectDirection=(12&s)>>2,a.displayEffect=3&s,t},u.prototype.flushDisplayed=function(t,e){for(var i=[],s=0;s<8;s++)e.windows[s].visible&&!e.windows[s].isEmpty()&&i.push(e.windows[s].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},u.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},u.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],s=this.getPts(t);this.flushDisplayed(s,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&s)>>2,a.penSize=3&s,s=i[++t],a.italics=(128&s)>>7,a.underline=(64&s)>>6,a.edgeType=(56&s)>>3,a.fontStyle=7&s,t},u.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penColor;return s=i[++t],a.fgOpacity=(192&s)>>6,a.fgRed=(48&s)>>4,a.fgGreen=(12&s)>>2,a.fgBlue=3&s,s=i[++t],a.bgOpacity=(192&s)>>6,a.bgRed=(48&s)>>4,a.bgGreen=(12&s)>>2,a.bgBlue=3&s,s=i[++t],a.edgeRed=(48&s)>>4,a.edgeGreen=(12&s)>>2,a.edgeBlue=3&s,t},u.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,s=i[++t],a.row=15&s,s=i[++t],a.column=63&s,t},u.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var f={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},g=function(t){return null===t?"":(t=f[t]||t,String.fromCharCode(t))},y=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],m=function(){for(var t=[],e=15;e--;)t.push("");return t},_=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,s,a,n;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),s=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=m();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=m();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=m()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,a))n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isExtCharacter(s,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isMidRowCode(s,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,a))this.column_+=3&a;else if(this.isPAC(s,a)){var r=y.indexOf(7968&e);"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(t.pts,r)),r!==this.row_&&(this.clearFormatting(t.pts),this.row_=r),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(0===a&&(a=null),n=g(s),n+=g(a),this[this.mode_](t.pts,n),this.column_+=n.length)}else this.lastControlCode_=null}};_.prototype=new s,_.prototype.flushDisplayed=function(t){var e=this.displayed_.map((function(t,e){try{return t.trim()}catch(t){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},_.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=m(),this.nonDisplayed_=m(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},_.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},_.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},_.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},_.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},_.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},_.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},_.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},_.prototype.isNormalChar=function(t){return t>=32&&t<=127},_.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=m(),this.displayed_=m()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},_.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},_.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},_.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},_.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},k=function t(e){var i,s;t.prototype.init.call(this),this.type_=e||v,this.push=function(t){this.type_!==v&&t.type!==this.type_||(void 0===s&&(s=t.dts),t.dts=T(t.dts,s),t.pts=T(t.pts,s),i=t.dts,this.trigger("data",t))},this.flush=function(){s=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){s=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};k.prototype=new s;var S,A=k,C=function(t,e,i){if(!t)return-1;for(var s=i;s>>2;d*=4,d+=3&p[7],o.timeStamp=d,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=r}while(i>>4>1&&(s+=e[s]+1),0===i.pid)i.type="pat",t(e.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,s,i]):this.processPes_(e,s,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=b.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=b.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new s,I.STREAM_TYPES={h264:27,adts:15},(L=function(){var t,e=this,i=!1,s={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r=function(t,i,s){var a,n,r=new Uint8Array(t.size),o={type:i},h=0,p=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h>>3,l.pts*=4,l.pts+=(6&d[13])>>>1,l.dts=l.pts,64&c&&(l.dts=(14&d[14])<<27|(255&d[15])<<20|(254&d[16])<<12|(255&d[17])<<5|(254&d[18])>>>3,l.dts*=4,l.dts+=(6&d[18])>>>1)),l.data=d.subarray(9+d[8])),a="video"===i||o.packetLength<=t.size,(s||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};L.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case b.H264_STREAM_TYPE:t=s,e="video";break;case b.ADTS_STREAM_TYPE:t=a,e="audio";break;case b.METADATA_STREAM_TYPE:t=n,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",s)}})[o.type]()},this.reset=function(){s.size=0,s.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(s,"video"),r(a,"audio"),r(n,"timed-metadata")},this.flush=function(){if(!i&&t){var s={type:"metadata",tracks:[]};null!==t.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new s;var W={PAT_PID:0,MP2T_PACKET_LENGTH:N,TransportPacketStream:O,TransportParseStream:I,ElementaryStream:L,TimestampRolloverStream:G,CaptionStream:w.CaptionStream,Cea608Stream:w.Cea608Stream,Cea708Stream:w.Cea708Stream,MetadataStream:B};for(var F in b)b.hasOwnProperty(F)&&(W[F]=b[F]);var z,V,Y,X,j=W,q=9e4;z=function(t){return t*q},V=function(t,e){return t*e},Y=function(t){return t/q},X=function(t,e){return t/e};var H,K=q,Z=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(H=function(t){var e,i=0;H.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(s){var a,n,r,o,h,p=0;if(t||(i=0),"audio"===s.type){var d;for(e&&e.length?(r=e,(e=new Uint8Array(r.byteLength+s.data.byteLength)).set(r),e.set(s.data,r.byteLength)):e=s.data;p+7>5,h=(o=1024*(1+(3&e[p+6])))*K/Z[(60&e[p+2])>>>2],e.byteLength-p>>6&3),channelcount:(1&e[p+2])<<2|(192&e[p+3])>>>6,samplerate:Z[(60&e[p+2])>>>2],samplingfrequencyindex:(60&e[p+2])>>>2,samplesize:16,data:e.subarray(p+7+n,p+a)}),i++,p+=a}else"number"!=typeof d&&(d=p),p++;"number"==typeof d&&(this.skipWarn_(d,p),d=null),e=e.subarray(p)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new s;var $,J,Q,tt=H,et=function(t){var e=t.byteLength,i=0,s=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+s},this.loadWord=function(){var a=t.byteLength-e,n=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");n.set(t.subarray(a,a+r)),i=new DataView(n.buffer).getUint32(0),s=8*r,e-=r},this.skipBits=function(t){var a;s>t?(i<<=t,s-=t):(t-=s,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,s-=t)},this.readBits=function(t){var a=Math.min(s,t),n=i>>>32-a;return(s-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?n<>>t))return i<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(J=function(){var t,e,i=0;J.prototype.init.call(this),this.push=function(s){var a;e?((a=new Uint8Array(e.byteLength+s.data.byteLength)).set(e),a.set(s.data,e.byteLength),e=a):e=s.data;for(var n=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new s,Q={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},($=function(){var t,e,i,s,a,n,r,o=new J;$.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,s=t.dts,o.push(t))},o.on("data",(function(r){var o={trackId:e,pts:i,dts:s,data:r,nalUnitTypeCode:31&r[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(r.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(t,e){var i,s=8,a=8;for(i=0;i=a[0]&&(o=a.shift(),this.writeMetaDataTags(h,o)),(t.extraData!==i||n.pts-o>=1e3)&&(this.writeMetaDataTags(h,n.pts),i=t.extraData,o=n.pts),(r=new e(e.AUDIO_TAG)).pts=n.pts,r.dts=n.dts,r.writeBytes(n.data),h.push(r.finalize());a.length=0,i=null,this.trigger("data",{track:t,tags:h.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(i,s){var a;(a=new e(e.METADATA_TAG)).pts=s,a.dts=s,a.writeMetaDataDouble("audiocodecid",10),a.writeMetaDataBoolean("stereo",2===t.channelcount),a.writeMetaDataDouble("audiosamplerate",t.samplerate),a.writeMetaDataDouble("audiosamplesize",16),i.push(a.finalize()),(a=new e(e.AUDIO_TAG,!0)).pts=s,a.dts=s,a.view.setUint16(a.position,t.extraData),a.position+=2,a.length=Math.max(a.length,a.position),i.push(a.finalize())},this.onVideoKeyFrame=function(t){a.push(t)}}).prototype=new s,(nt=function(t){var i,s,a=[];nt.prototype.init.call(this),this.finishFrame=function(e,a){if(a){if(i&&t&&t.newMetadata&&(a.keyFrame||0===e.length)){var n=ht(i,a.dts).finalize(),r=pt(t,a.dts).finalize();n.metaDataTag=r.metaDataTag=!0,e.push(n),e.push(r),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),e.push(a.finalize()),s=null}},this.push=function(e){ot(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),a.push(e)},this.flush=function(){for(var n,r=new lt;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0!==a.length){for(;a.length;)"seq_parameter_set_rbsp"===(n=a.shift()).nalUnitType?(t.newMetadata=!0,i=n.config,t.width=i.width,t.height=i.height,t.sps=[n.data],t.profileIdc=i.profileIdc,t.levelIdc=i.levelIdc,t.profileCompatibility=i.profileCompatibility,s.endNalUnit()):"pic_parameter_set_rbsp"===n.nalUnitType?(t.newMetadata=!0,t.pps=[n.data],s.endNalUnit()):"access_unit_delimiter_rbsp"===n.nalUnitType?(s&&this.finishFrame(r,s),(s=new e(e.VIDEO_TAG)).pts=n.pts,s.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(s.keyFrame=!0),s.endNalUnit()),s.startNalUnit(),s.writeBytes(n.data);s&&this.finishFrame(r,s),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new s,(at=function(t){var e,i,s,a,n,r,o,h,p,d,l,c,u=this;at.prototype.init.call(this),t=t||{},this.metadataStream=new j.MetadataStream,t.metadataStream=this.metadataStream,e=new j.TransportPacketStream,i=new j.TransportParseStream,s=new j.ElementaryStream,a=new j.TimestampRolloverStream("video"),n=new j.TimestampRolloverStream("audio"),r=new j.TimestampRolloverStream("timed-metadata"),o=new tt,h=new ct,c=new dt(t),e.pipe(i).pipe(s),s.pipe(a).pipe(h),s.pipe(n).pipe(o),s.pipe(r).pipe(this.metadataStream).pipe(c),l=new j.CaptionStream(t),h.pipe(l).pipe(c),s.on("data",(function(t){var e,i,s;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(s=t.tracks[e]);i&&!p&&(c.numberOfTracks++,p=new nt(i),h.pipe(p).pipe(c)),s&&!d&&(c.numberOfTracks++,d=new rt(s),o.pipe(d).pipe(c),p&&p.on("keyframe",d.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){l.reset()},c.on("data",(function(t){u.trigger("data",t)})),c.on("done",(function(){u.trigger("done")}))}).prototype=new s;var ut=function(t,i,s){var a,n,r,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,i=void 0===i||i,s=void 0===s||s,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(i?4:0)|(s?1:0)),h.setUint32(5,o.byteLength),t<=0?((n=new Uint8Array(o.byteLength+4)).set(o),n.set([0,0,0,0],o.byteLength),n):((a=new e(e.METADATA_TAG)).pts=a.dts=0,a.writeMetaDataDouble("duration",t),r=a.finalize().length,(n=new Uint8Array(o.byteLength+r)).set(o),n.set(h.byteLength,r),n)};return{tag:e,Transmuxer:at,getFlvHeader:ut}})); +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e()}(this,(function(){"use strict";var t;(t=function(e,i){var s,a=0,n=16384,r=function(t,e){var i,s=t.position+e;s0)throw new Error("Attempted to create new NAL wihout closing the old one");a=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===a+4?this.length-=4:a>0&&(e=a+4,i=this.length-e,this.position=a,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),a=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(p,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&e)>>>8,this.bytes[15]=(255&e)>>>0;break;case t.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=i?0:1;break;case t.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,a),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return s=this.length-11,this.bytes[1]=(16711680&s)>>>16,this.bytes[2]=(65280&s)>>>8,this.bytes[3]=(255&s)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=t.frameTime(this.bytes),this}}).AUDIO_TAG=8,t.VIDEO_TAG=9,t.METADATA_TAG=18,t.isAudioFrame=function(e){return t.AUDIO_TAG===e[0]},t.isVideoFrame=function(e){return t.VIDEO_TAG===e[0]},t.isMetaData=function(e){return t.METADATA_TAG===e[0]},t.isKeyFrame=function(e){return t.isVideoFrame(e)?23===e[11]:!!t.isAudioFrame(e)||!!t.isMetaData(e)},t.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var e=t,i=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var s;return!!t[e]&&(s=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(s,1),s>-1)},this.trigger=function(e){var i,s,a,n;if(i=t[e])if(2===arguments.length)for(a=i.length,s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},l.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},l.prototype.addText=function(t){this.rows[this.rowIdx]+=t},l.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var c=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new l(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};c.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new l(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},c.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},c.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var u=function t(e){e=e||{},t.prototype.init.call(this);var i,s=this,a=e.captionServices||{},n={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(n[t]=i.encoding)})),this.serviceEncodings=n,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(s.new708Packet(),s.add708Bytes(t)):(null===s.current708Packet&&s.new708Packet(),s.add708Bytes(t))}};u.prototype=new s,u.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},u.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,s=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},u.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,s=null,a=0,n=e[a++];for(t.seq=n>>6,t.sizeCode=63&n;a>5)&&s>0&&(i=n=e[a++]),this.pushServiceBlock(i,a,s),s>0&&(a+=s-1)},u.prototype.pushServiceBlock=function(t,e,i){var s,a=e,n=this.current708Packet.data,r=this.services[t];for(r||(r=this.initService(t,a));a>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++t],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++t],n.anchorHorizontal=s,s=i[++t],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++t],n.columnCount=63&s,s=i[++t],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,t},u.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.winAttr;return s=i[++t],a.fillOpacity=(192&s)>>6,a.fillRed=(48&s)>>4,a.fillGreen=(12&s)>>2,a.fillBlue=3&s,s=i[++t],a.borderType=(192&s)>>6,a.borderRed=(48&s)>>4,a.borderGreen=(12&s)>>2,a.borderBlue=3&s,s=i[++t],a.borderType+=(128&s)>>5,a.wordWrap=(64&s)>>6,a.printDirection=(48&s)>>4,a.scrollDirection=(12&s)>>2,a.justify=3&s,s=i[++t],a.effectSpeed=(240&s)>>4,a.effectDirection=(12&s)>>2,a.displayEffect=3&s,t},u.prototype.flushDisplayed=function(t,e){for(var i=[],s=0;s<8;s++)e.windows[s].visible&&!e.windows[s].isEmpty()&&i.push(e.windows[s].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},u.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},u.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],s=this.getPts(t);this.flushDisplayed(s,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&s)>>2,a.penSize=3&s,s=i[++t],a.italics=(128&s)>>7,a.underline=(64&s)>>6,a.edgeType=(56&s)>>3,a.fontStyle=7&s,t},u.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penColor;return s=i[++t],a.fgOpacity=(192&s)>>6,a.fgRed=(48&s)>>4,a.fgGreen=(12&s)>>2,a.fgBlue=3&s,s=i[++t],a.bgOpacity=(192&s)>>6,a.bgRed=(48&s)>>4,a.bgGreen=(12&s)>>2,a.bgBlue=3&s,s=i[++t],a.edgeRed=(48&s)>>4,a.edgeGreen=(12&s)>>2,a.edgeBlue=3&s,t},u.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,s=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,s=i[++t],a.row=15&s,s=i[++t],a.column=63&s,t},u.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var f={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},g=function(t){return null===t?"":(t=f[t]||t,String.fromCharCode(t))},y=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],m=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},_=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,s,a,n;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),s=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=m();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=m();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=m()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,a))n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isExtCharacter(s,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),n=g((s=(3&s)<<8)|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isMidRowCode(s,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,a)){var r=3&a;this.nonDisplayed_[this.row_].offset=r,this.column_+=r}else if(this.isPAC(s,a)){var o=y.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var h=(14&e)>>1;this.column_=4*h,this.nonDisplayed_[this.row_].indent+=h}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(0===a&&(a=null),n=g(s),n+=g(a),this[this.mode_](t.pts,n),this.column_+=n.length)}else this.lastControlCode_=null}};_.prototype=new s,_.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},s=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&s.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:s,stream:this.name_})},_.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=m(),this.nonDisplayed_=m(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},_.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},_.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},_.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},_.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},_.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},_.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},_.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},_.prototype.isNormalChar=function(t){return t>=32&&t<=127},_.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=m(),this.displayed_=m()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},_.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},_.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},_.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},_.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},k=function t(e){var i,s;t.prototype.init.call(this),this.type_=e||v,this.push=function(t){this.type_!==v&&t.type!==this.type_||(void 0===s&&(s=t.dts),t.dts=T(t.dts,s),t.pts=T(t.pts,s),i=t.dts,this.trigger("data",t))},this.flush=function(){s=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){s=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};k.prototype=new s;var S,A=k,C=function(t,e,i){if(!t)return-1;for(var s=i;s>>2;d*=4,d+=3&p[7],o.timeStamp=d,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=r}while(i>>4>1&&(s+=e[s]+1),0===i.pid)i.type="pat",t(e.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,s,i]):this.processPes_(e,s,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=b.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=b.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new s,I.STREAM_TYPES={h264:27,adts:15},(L=function(){var t,e=this,i=!1,s={data:[],size:0},a={data:[],size:0},n={data:[],size:0},r=function(t,i,s){var a,n,r=new Uint8Array(t.size),o={type:i},h=0,p=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h>>3,l.pts*=4,l.pts+=(6&d[13])>>>1,l.dts=l.pts,64&c&&(l.dts=(14&d[14])<<27|(255&d[15])<<20|(254&d[16])<<12|(255&d[17])<<5|(254&d[18])>>>3,l.dts*=4,l.dts+=(6&d[18])>>>1)),l.data=d.subarray(9+d[8])),a="video"===i||o.packetLength<=t.size,(s||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};L.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case b.H264_STREAM_TYPE:t=s,e="video";break;case b.ADTS_STREAM_TYPE:t=a,e="audio";break;case b.METADATA_STREAM_TYPE:t=n,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",s)}})[o.type]()},this.reset=function(){s.size=0,s.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){r(s,"video"),r(a,"audio"),r(n,"timed-metadata")},this.flush=function(){if(!i&&t){var s={type:"metadata",tracks:[]};null!==t.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new s;var W={PAT_PID:0,MP2T_PACKET_LENGTH:N,TransportPacketStream:O,TransportParseStream:I,ElementaryStream:L,TimestampRolloverStream:G,CaptionStream:w.CaptionStream,Cea608Stream:w.Cea608Stream,Cea708Stream:w.Cea708Stream,MetadataStream:B};for(var F in b)b.hasOwnProperty(F)&&(W[F]=b[F]);var z,V,Y,X,j=W,q=9e4;z=function(t){return t*q},V=function(t,e){return t*e},Y=function(t){return t/q},X=function(t,e){return t/e};var H,K=q,Z=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(H=function(t){var e,i=0;H.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(s){var a,n,r,o,h,p=0;if(t||(i=0),"audio"===s.type){var d;for(e&&e.length?(r=e,(e=new Uint8Array(r.byteLength+s.data.byteLength)).set(r),e.set(s.data,r.byteLength)):e=s.data;p+7>5,h=(o=1024*(1+(3&e[p+6])))*K/Z[(60&e[p+2])>>>2],e.byteLength-p>>6&3),channelcount:(1&e[p+2])<<2|(192&e[p+3])>>>6,samplerate:Z[(60&e[p+2])>>>2],samplingfrequencyindex:(60&e[p+2])>>>2,samplesize:16,data:e.subarray(p+7+n,p+a)}),i++,p+=a}else"number"!=typeof d&&(d=p),p++;"number"==typeof d&&(this.skipWarn_(d,p),d=null),e=e.subarray(p)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new s;var $,J,Q,tt=H,et=function(t){var e=t.byteLength,i=0,s=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+s},this.loadWord=function(){var a=t.byteLength-e,n=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");n.set(t.subarray(a,a+r)),i=new DataView(n.buffer).getUint32(0),s=8*r,e-=r},this.skipBits=function(t){var a;s>t?(i<<=t,s-=t):(t-=s,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,s-=t)},this.readBits=function(t){var a=Math.min(s,t),n=i>>>32-a;return(s-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?n<>>t))return i<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(J=function(){var t,e,i=0;J.prototype.init.call(this),this.push=function(s){var a;e?((a=new Uint8Array(e.byteLength+s.data.byteLength)).set(e),a.set(s.data,e.byteLength),e=a):e=s.data;for(var n=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new s,Q={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},($=function(){var t,e,i,s,a,n,r,o=new J;$.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,s=t.dts,o.push(t))},o.on("data",(function(r){var o={trackId:e,pts:i,dts:s,data:r,nalUnitTypeCode:31&r[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(r.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(r.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},r=function(t,e){var i,s=8,a=8;for(i=0;i=a[0]&&(o=a.shift(),this.writeMetaDataTags(h,o)),(t.extraData!==i||n.pts-o>=1e3)&&(this.writeMetaDataTags(h,n.pts),i=t.extraData,o=n.pts),(r=new e(e.AUDIO_TAG)).pts=n.pts,r.dts=n.dts,r.writeBytes(n.data),h.push(r.finalize());a.length=0,i=null,this.trigger("data",{track:t,tags:h.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(i,s){var a;(a=new e(e.METADATA_TAG)).pts=s,a.dts=s,a.writeMetaDataDouble("audiocodecid",10),a.writeMetaDataBoolean("stereo",2===t.channelcount),a.writeMetaDataDouble("audiosamplerate",t.samplerate),a.writeMetaDataDouble("audiosamplesize",16),i.push(a.finalize()),(a=new e(e.AUDIO_TAG,!0)).pts=s,a.dts=s,a.view.setUint16(a.position,t.extraData),a.position+=2,a.length=Math.max(a.length,a.position),i.push(a.finalize())},this.onVideoKeyFrame=function(t){a.push(t)}}).prototype=new s,(nt=function(t){var i,s,a=[];nt.prototype.init.call(this),this.finishFrame=function(e,a){if(a){if(i&&t&&t.newMetadata&&(a.keyFrame||0===e.length)){var n=ht(i,a.dts).finalize(),r=pt(t,a.dts).finalize();n.metaDataTag=r.metaDataTag=!0,e.push(n),e.push(r),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),e.push(a.finalize()),s=null}},this.push=function(e){ot(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),a.push(e)},this.flush=function(){for(var n,r=new lt;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0!==a.length){for(;a.length;)"seq_parameter_set_rbsp"===(n=a.shift()).nalUnitType?(t.newMetadata=!0,i=n.config,t.width=i.width,t.height=i.height,t.sps=[n.data],t.profileIdc=i.profileIdc,t.levelIdc=i.levelIdc,t.profileCompatibility=i.profileCompatibility,s.endNalUnit()):"pic_parameter_set_rbsp"===n.nalUnitType?(t.newMetadata=!0,t.pps=[n.data],s.endNalUnit()):"access_unit_delimiter_rbsp"===n.nalUnitType?(s&&this.finishFrame(r,s),(s=new e(e.VIDEO_TAG)).pts=n.pts,s.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(s.keyFrame=!0),s.endNalUnit()),s.startNalUnit(),s.writeBytes(n.data);s&&this.finishFrame(r,s),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new s,(at=function(t){var e,i,s,a,n,r,o,h,p,d,l,c,u=this;at.prototype.init.call(this),t=t||{},this.metadataStream=new j.MetadataStream,t.metadataStream=this.metadataStream,e=new j.TransportPacketStream,i=new j.TransportParseStream,s=new j.ElementaryStream,a=new j.TimestampRolloverStream("video"),n=new j.TimestampRolloverStream("audio"),r=new j.TimestampRolloverStream("timed-metadata"),o=new tt,h=new ct,c=new dt(t),e.pipe(i).pipe(s),s.pipe(a).pipe(h),s.pipe(n).pipe(o),s.pipe(r).pipe(this.metadataStream).pipe(c),l=new j.CaptionStream(t),h.pipe(l).pipe(c),s.on("data",(function(t){var e,i,s;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(s=t.tracks[e]);i&&!p&&(c.numberOfTracks++,p=new nt(i),h.pipe(p).pipe(c)),s&&!d&&(c.numberOfTracks++,d=new rt(s),o.pipe(d).pipe(c),p&&p.on("keyframe",d.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){l.reset()},c.on("data",(function(t){u.trigger("data",t)})),c.on("done",(function(){u.trigger("done")}))}).prototype=new s;var ut=function(t,i,s){var a,n,r,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,i=void 0===i||i,s=void 0===s||s,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(i?4:0)|(s?1:0)),h.setUint32(5,o.byteLength),t<=0?((n=new Uint8Array(o.byteLength+4)).set(o),n.set([0,0,0,0],o.byteLength),n):((a=new e(e.METADATA_TAG)).pts=a.dts=0,a.writeMetaDataDouble("duration",t),r=a.finalize().length,(n=new Uint8Array(o.byteLength+r)).set(o),n.set(h.byteLength,r),n)};return{tag:e,Transmuxer:at,getFlvHeader:ut}})); diff --git a/node_modules/mux.js/dist/mux-mp4.js b/node_modules/mux.js/dist/mux-mp4.js index 0ef0dfe337..f788449053 100644 --- a/node_modules/mux.js/dist/mux-mp4.js +++ b/node_modules/mux.js/dist/mux-mp4.js @@ -1,4 +1,4 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window')) : typeof define === 'function' && define.amd ? define(['global/window'], factory) : @@ -3339,19 +3339,33 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(function (byte) { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + var unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -3995,13 +4009,19 @@ var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. + // We keep track of positioning information as we go by storing the + // number of indentations and the tab offset in this buffer. var createDisplayBuffer = function createDisplayBuffer() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ + text: '', + indent: 0, + offset: 0 + }); } return result; @@ -4070,9 +4090,9 @@ this.startPts_ = packet.pts; } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -4105,9 +4125,9 @@ // backspace the "e" and insert "è". // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations // regardless of field and data channel. // Then byte-shift to the left and OR with char1 so we can pass the @@ -4139,7 +4159,11 @@ // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) + var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + + this.nonDisplayed_[this.row_].offset = offset; + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { // There's no logic for PAC -> row mapping, so we have to just // find the row code in an array and use its index :( @@ -4173,7 +4197,10 @@ // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + var indentations = (data & 0xe) >> 1; + this.column_ = indentations * 4; // add to the number of indentations for positioning + + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -4204,29 +4231,52 @@ // display buffer Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row, index) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + var _this = this; + + var logWarning = function logWarning(index) { + _this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + + var content = []; + this.displayed_.forEach(function (row, i) { + if (row && row.text && row.text.length) { + try { + // remove spaces from the start and end of the string + row.text = row.text.trim(); + } catch (e) { + // Ordinarily, this shouldn't happen. However, caption + // parsing errors should not throw exceptions and + // break playback. + logWarning(i); + } // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + + + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 + }); + } + } else if (row === undefined || row === null) { + logWarning(i); } - }, this) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content: content, stream: this.name_ }); } @@ -4435,7 +4485,11 @@ // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { + text: '', + indent: 0, + offset: 0 + }; } } @@ -4472,27 +4526,35 @@ Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.shiftRowsUp_ = function () { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } // shift displayed rows up @@ -4501,13 +4563,17 @@ } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { + text: '', + indent: 0, + offset: 0 + }; }; Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports @@ -7077,7 +7143,7 @@ this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush @@ -7758,7 +7824,10 @@ * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption + * @return {Object[]} parsedCaptions[].content - A list of individual caption segments + * @return {String} parsedCaptions[].content.text - The visible content of the caption segment + * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment + * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 **/ diff --git a/node_modules/mux.js/dist/mux-mp4.min.js b/node_modules/mux.js/dist/mux-mp4.min.js index b1ad8351e0..967150667e 100644 --- a/node_modules/mux.js/dist/mux-mp4.min.js +++ b/node_modules/mux.js/dist/mux-mp4.min.js @@ -1,2 +1,2 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i,n,a,r,s,o,d,h,p,u,l,c,f,g,m,y,S,v,b,_,w,T,C,k,P,A,U,D,E,L,x,O,I,R,M,N,B,W,G,z,F=e(t),V=Math.pow(2,32),Y={getUint64:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.getBigUint64?(e=i.getBigUint64(0))>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},m=function(t){return i(T.hdlr,D[t])},g=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),i(T.mdhd,e)},f=function(t){return i(T.mdia,g(t),m(t.type),o(t))},s=function(t){return i(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},o=function(t){return i(T.minf,"video"===t.type?i(T.vmhd,E):i(T.smhd,L),n(),S(t))},d=function(t,e){for(var n=[],a=e.length;a--;)n[a]=b(e[a]);return i.apply(null,[T.moof,s(t)].concat(n))},h=function(t){for(var e=t.length,n=[];e--;)n[e]=l(t[e]);return i.apply(null,[T.moov,u(4294967295)].concat(n).concat(p(t)))},p=function(t){for(var e=t.length,n=[];e--;)n[e]=_(t[e]);return i.apply(null,[T.mvex].concat(n))},u=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(T.mvhd,e)},y=function(t){var e,n,a=t.samples||[],r=new Uint8Array(4+a.length);for(n=0;n>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));for(e=0;e>>8),o.push(255&r[e].byteLength),o=o.concat(Array.prototype.slice.call(r[e]));if(n=[T.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(T.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([a.length],s,[r.length],o))),i(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var d=t.sarRatio[0],h=t.sarRatio[1];n.push(i(T.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h])))}return i.apply(null,n)},B=function(t){return i(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),a(t))},c=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return i(T.tkhd,e)},b=function(t){var e,n,a,r,s,o;return e=i(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(t.baseMediaDecodeTime/X),o=Math.floor(t.baseMediaDecodeTime%X),n=i(T.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===t.type?(a=w(t,92),i(T.traf,e,n,a)):(r=y(t),a=w(t,r.length+92),i(T.traf,e,n,a,r))},l=function(t){return t.duration=t.duration||4294967295,i(T.trak,c(t),f(t))},_=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),i(T.trex,e)},z=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},G=function(t,e){var n,a,r,s,o,d;for(e+=20+16*(s=t.samples||[]).length,r=z(s,e),(a=new Uint8Array(r.length+16*s.length)).set(r),n=r.length,d=0;d>>24,a[n++]=(16711680&o.duration)>>>16,a[n++]=(65280&o.duration)>>>8,a[n++]=255&o.duration,a[n++]=(4278190080&o.size)>>>24,a[n++]=(16711680&o.size)>>>16,a[n++]=(65280&o.size)>>>8,a[n++]=255&o.size,a[n++]=o.flags.isLeading<<2|o.flags.dependsOn,a[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,a[n++]=61440&o.flags.degradationPriority,a[n++]=15&o.flags.degradationPriority,a[n++]=(4278190080&o.compositionTimeOffset)>>>24,a[n++]=(16711680&o.compositionTimeOffset)>>>16,a[n++]=(65280&o.compositionTimeOffset)>>>8,a[n++]=255&o.compositionTimeOffset;return i(T.trun,a)},W=function(t,e){var n,a,r,s,o,d;for(e+=20+8*(s=t.samples||[]).length,r=z(s,e),(n=new Uint8Array(r.length+8*s.length)).set(r),a=r.length,d=0;d>>24,n[a++]=(16711680&o.duration)>>>16,n[a++]=(65280&o.duration)>>>8,n[a++]=255&o.duration,n[a++]=(4278190080&o.size)>>>24,n[a++]=(16711680&o.size)>>>16,n[a++]=(65280&o.size)>>>8,n[a++]=255&o.size;return i(T.trun,n)},w=function(t,e){return"audio"===t.type?W(t,e):G(t,e)};var j,q,H,$,Z,K,J,Q={ftyp:r=function(){return i(T.ftyp,C,k,C,P)},mdat:function(t){return i(T.mdat,t)},moof:d,moov:h,initSegment:function(t){var e,i=r(),n=h(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},tt=function(t){return t>>>0},et=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},it=tt,nt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},at=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},rt=Y.getUint64,st=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&ot(e.presentation_time_delta)&&i,a=1===t&&ot(e.presentation_time)&&i;return!(t>1)&&n||a},ot=function(t){return void 0!==t||null!==t},dt=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=rt(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return st(h,u)?u:void 0},ht=function(t,e,i,n){return t||0===t?t/e:n+i/e},pt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},ut=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},lt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:ut(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=ut(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},ct=tt,ft=Y.getUint64,gt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=ft(t.subarray(4)):e.baseMediaDecodeTime=ct(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},mt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=kt(p[9]),a.codec+=kt(p[10]),a.codec+=kt(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===et(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+kt(p[19]),a.codec+="."+kt(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=nt(t,["mdia","mdhd"])[0];l&&(a.timescale=K(l)),i.push(a)})),i},J=function(t,e){return void 0===e&&(e=0),nt(t,["emsg"]).map((function(t){var i=dt(new Uint8Array(t)),n=At(i.message_data);return{cueTime:ht(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:ht(i.event_duration,i.timescale),frames:n}}))};var Ut={findBox:nt,parseType:et,timescale:j,startTime:q,compositionStartTime:H,videoTrackIds:$,tracks:Z,getTimescaleFromMediaHeader:K=function(t){var e=0===t[0]?12:20;return Ct(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:J},Dt=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},Vt=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;iZt/2))){for((s=Ht()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ie=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},me.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},me.prototype.addText=function(t){this.rows[this.rowIdx]+=t},me.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var ye=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new me(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};ye.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new me(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},ye.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},ye.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Se=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Se.prototype=new Bt,Se.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Se.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Se.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Se.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Se.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Se.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Se.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Se.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Se.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Se.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var ve={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},be=function(t){return null===t?"":(t=ve[t]||t,String.fromCharCode(t))},_e=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],we=function(){for(var t=[],e=15;e--;)t.push("");return t},Te=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=we();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=we();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=we()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a))this.column_+=3&a;else if(this.isPAC(n,a)){var s=_e.indexOf(7968&e);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(t.pts,s)),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=be(n),r+=be(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Te.prototype=new Bt,Te.prototype.flushDisplayed=function(t){var e=this.displayed_.map((function(t,e){try{return t.trim()}catch(t){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},Te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=we(),this.nonDisplayed_=we(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Te.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Te.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Te.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Te.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Te.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Te.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Te.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Te.prototype.isNormalChar=function(t){return t>=32&&t<=127},Te.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=we(),this.displayed_=we()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Te.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Te.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},Te.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},Te.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},Ue=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Pe,this.push=function(t){this.type_!==Pe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=Ae(t.dts,n),t.pts=Ae(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ue.prototype=new Bt;var De,Ee=Ue;(De=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(De.prototype.init.call(this),this.dispatchType=ke.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=ke.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ke.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new Bt,xe.STREAM_TYPES={h264:27,adts:15},(Oe=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};Oe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case ke.H264_STREAM_TYPE:t=n,e="video";break;case ke.ADTS_STREAM_TYPE:t=a,e="audio";break;case ke.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new Bt;var Ne={PAT_PID:0,MP2T_PACKET_LENGTH:Me,TransportPacketStream:Le,TransportParseStream:xe,ElementaryStream:Oe,TimestampRolloverStream:Re,CaptionStream:Ce.CaptionStream,Cea608Stream:Ce.Cea608Stream,Cea708Stream:Ce.Cea708Stream,MetadataStream:Ie};for(var Be in ke)ke.hasOwnProperty(Be)&&(Ne[Be]=ke[Be]);var We,Ge=Ne,ze=Zt,Fe=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(We=function(t){var e,i=0;We.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(n){var a,r,s,o,d,h=0;if(t||(i=0),"audio"===n.type){var p;for(e&&e.length?(s=e,(e=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),e.set(n.data,s.byteLength)):e=n.data;h+7>5,d=(o=1024*(1+(3&e[h+6])))*ze/Fe[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:Fe[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new Bt;var Ve,Ye,Xe,je=We,qe=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Ye=function(){var t,e,i=0;Ye.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new Bt,Xe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ve=function(){var t,e,i,n,a,r,s,o=new Ye;Ve.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i=0?i:0,(16&t[e+5])>>4?i+20:i+10},Ke=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=Ze(e,i))},Je=function(t){var e=Ke(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},Qe=Ze,ti=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i};(He=function(){var t=new Uint8Array,e=0;He.prototype.init.call(this),this.setTimestamp=function(t){e=t},this.push=function(i){var n,a,r,s,o=0,d=0;for(t.length?(s=t.length,(t=new Uint8Array(i.byteLength+s)).set(t.subarray(0,s)),t.set(i,s)):t=i;t.length-d>=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ti(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=Qe(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new Bt;var ei,ii,ni,ai,ri=He,si=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],oi=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],di=$e.H264Stream,hi=Je,pi=Zt,ui=function(t,e){e.stream=t,this.trigger("log",e)},li=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new Bt,(ai=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ai.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new Bt,ai.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,oi.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,si.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Q.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ai.prototype.setRemux=function(t){this.remuxTracks=t},(ni=function(t){var e,i,n=this,a=!0;ni.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new Ge.MetadataStream,a.aacStream=new ri,a.audioTimestampRolloverStream=new Ge.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Ge.TimestampRolloverStream("timed-metadata"),a.adtsStream=new je,a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new Ge.MetadataStream,a.packetStream=new Ge.TransportPacketStream,a.parseStream=new Ge.TransportParseStream,a.elementaryStream=new Ge.ElementaryStream,a.timestampRolloverStream=new Ge.TimestampRolloverStream,a.adtsStream=new je,a.h264Stream=new di,a.captionStream=new Ge.CaptionStream(t),a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new ei(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,re(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,re(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=hi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Bt;var gi={Transmuxer:ni,VideoSegmentStream:ei,AudioSegmentStream:ii,AUDIO_PROPERTIES:si,VIDEO_PROPERTIES:oi,generateSegmentTimingInfo:fi},mi=ue,yi=Ce.CaptionStream,Si=function(t,e){for(var i=t,n=0;n0?gt(h[0]).baseMediaDecodeTime:0,u=nt(r,["trun"]);e===d&&u.length>0&&(i=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=vi(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}}})); +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i,n,a,r,s,o,d,h,p,u,l,c,f,g,m,y,S,v,b,_,w,T,C,k,P,A,D,x,U,E,L,O,I,R,M,N,B,W,G,z,F=e(t),V=Math.pow(2,32),Y={getUint64:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.getBigUint64?(e=i.getBigUint64(0))>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},m=function(t){return i(T.hdlr,x[t])},g=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),i(T.mdhd,e)},f=function(t){return i(T.mdia,g(t),m(t.type),o(t))},s=function(t){return i(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},o=function(t){return i(T.minf,"video"===t.type?i(T.vmhd,U):i(T.smhd,E),n(),S(t))},d=function(t,e){for(var n=[],a=e.length;a--;)n[a]=b(e[a]);return i.apply(null,[T.moof,s(t)].concat(n))},h=function(t){for(var e=t.length,n=[];e--;)n[e]=l(t[e]);return i.apply(null,[T.moov,u(4294967295)].concat(n).concat(p(t)))},p=function(t){for(var e=t.length,n=[];e--;)n[e]=_(t[e]);return i.apply(null,[T.mvex].concat(n))},u=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return i(T.mvhd,e)},y=function(t){var e,n,a=t.samples||[],r=new Uint8Array(4+a.length);for(n=0;n>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));for(e=0;e>>8),o.push(255&r[e].byteLength),o=o.concat(Array.prototype.slice.call(r[e]));if(n=[T.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),i(T.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([a.length],s,[r.length],o))),i(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var d=t.sarRatio[0],h=t.sarRatio[1];n.push(i(T.pasp,new Uint8Array([(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d,(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h])))}return i.apply(null,n)},B=function(t){return i(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),a(t))},c=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return i(T.tkhd,e)},b=function(t){var e,n,a,r,s,o;return e=i(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(t.baseMediaDecodeTime/X),o=Math.floor(t.baseMediaDecodeTime%X),n=i(T.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===t.type?(a=w(t,92),i(T.traf,e,n,a)):(r=y(t),a=w(t,r.length+92),i(T.traf,e,n,a,r))},l=function(t){return t.duration=t.duration||4294967295,i(T.trak,c(t),f(t))},_=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),i(T.trex,e)},z=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},G=function(t,e){var n,a,r,s,o,d;for(e+=20+16*(s=t.samples||[]).length,r=z(s,e),(a=new Uint8Array(r.length+16*s.length)).set(r),n=r.length,d=0;d>>24,a[n++]=(16711680&o.duration)>>>16,a[n++]=(65280&o.duration)>>>8,a[n++]=255&o.duration,a[n++]=(4278190080&o.size)>>>24,a[n++]=(16711680&o.size)>>>16,a[n++]=(65280&o.size)>>>8,a[n++]=255&o.size,a[n++]=o.flags.isLeading<<2|o.flags.dependsOn,a[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,a[n++]=61440&o.flags.degradationPriority,a[n++]=15&o.flags.degradationPriority,a[n++]=(4278190080&o.compositionTimeOffset)>>>24,a[n++]=(16711680&o.compositionTimeOffset)>>>16,a[n++]=(65280&o.compositionTimeOffset)>>>8,a[n++]=255&o.compositionTimeOffset;return i(T.trun,a)},W=function(t,e){var n,a,r,s,o,d;for(e+=20+8*(s=t.samples||[]).length,r=z(s,e),(n=new Uint8Array(r.length+8*s.length)).set(r),a=r.length,d=0;d>>24,n[a++]=(16711680&o.duration)>>>16,n[a++]=(65280&o.duration)>>>8,n[a++]=255&o.duration,n[a++]=(4278190080&o.size)>>>24,n[a++]=(16711680&o.size)>>>16,n[a++]=(65280&o.size)>>>8,n[a++]=255&o.size;return i(T.trun,n)},w=function(t,e){return"audio"===t.type?W(t,e):G(t,e)};var j,q,H,$,Z,K,J,Q={ftyp:r=function(){return i(T.ftyp,C,k,C,P)},mdat:function(t){return i(T.mdat,t)},moof:d,moov:h,initSegment:function(t){var e,i=r(),n=h(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},tt=function(t){return t>>>0},et=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},it=tt,nt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},at=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},rt=Y.getUint64,st=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&ot(e.presentation_time_delta)&&i,a=1===t&&ot(e.presentation_time)&&i;return!(t>1)&&n||a},ot=function(t){return void 0!==t||null!==t},dt=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=rt(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=at(t.subarray(d))).length,d+=(i=at(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return st(h,u)?u:void 0},ht=function(t,e,i,n){return t||0===t?t/e:n+i/e},pt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},ut=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},lt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:ut(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=ut(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},ct=tt,ft=Y.getUint64,gt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=ft(t.subarray(4)):e.baseMediaDecodeTime=ct(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},mt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=kt(p[9]),a.codec+=kt(p[10]),a.codec+=kt(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===et(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+kt(p[19]),a.codec+="."+kt(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=nt(t,["mdia","mdhd"])[0];l&&(a.timescale=K(l)),i.push(a)})),i},J=function(t,e){return void 0===e&&(e=0),nt(t,["emsg"]).map((function(t){var i=dt(new Uint8Array(t)),n=At(i.message_data);return{cueTime:ht(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:ht(i.event_duration,i.timescale),frames:n}}))};var Dt={findBox:nt,parseType:et,timescale:j,startTime:q,compositionStartTime:H,videoTrackIds:$,tracks:Z,getTimescaleFromMediaHeader:K=function(t){var e=0===t[0]?12:20;return Ct(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:J},xt=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},Vt=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;iZt/2))){for((s=Ht()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ie=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},me.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},me.prototype.addText=function(t){this.rows[this.rowIdx]+=t},me.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var ye=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new me(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};ye.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new me(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},ye.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},ye.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Se=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Se.prototype=new Bt,Se.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Se.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Se.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Se.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Se.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Se.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Se.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Se.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Se.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Se.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var ve={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},be=function(t){return null===t?"":(t=ve[t]||t,String.fromCharCode(t))},_e=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],we=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},Te=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=we();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=we();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=we()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),r=be((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a)){var s=3&a;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(n,a)){var o=_e.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var d=(14&e)>>1;this.column_=4*d,this.nonDisplayed_[this.row_].indent+=d}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=be(n),r+=be(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Te.prototype=new Bt,Te.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},n=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&n.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),n.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:n,stream:this.name_})},Te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=we(),this.nonDisplayed_=we(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Te.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Te.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Te.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Te.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Te.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Te.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Te.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Te.prototype.isNormalChar=function(t){return t>=32&&t<=127},Te.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=we(),this.displayed_=we()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Te.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Te.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},Te.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},Te.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},De=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Pe,this.push=function(t){this.type_!==Pe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=Ae(t.dts,n),t.pts=Ae(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};De.prototype=new Bt;var xe,Ue=De;(xe=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(xe.prototype.init.call(this),this.dispatchType=ke.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=ke.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=ke.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new Bt,Le.STREAM_TYPES={h264:27,adts:15},(Oe=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};Oe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case ke.H264_STREAM_TYPE:t=n,e="video";break;case ke.ADTS_STREAM_TYPE:t=a,e="audio";break;case ke.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new Bt;var Ne={PAT_PID:0,MP2T_PACKET_LENGTH:Me,TransportPacketStream:Ee,TransportParseStream:Le,ElementaryStream:Oe,TimestampRolloverStream:Re,CaptionStream:Ce.CaptionStream,Cea608Stream:Ce.Cea608Stream,Cea708Stream:Ce.Cea708Stream,MetadataStream:Ie};for(var Be in ke)ke.hasOwnProperty(Be)&&(Ne[Be]=ke[Be]);var We,Ge=Ne,ze=Zt,Fe=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(We=function(t){var e,i=0;We.prototype.init.call(this),this.skipWarn_=function(t,e){this.trigger("log",{level:"warn",message:"adts skiping bytes "+t+" to "+e+" in frame "+i+" outside syncword"})},this.push=function(n){var a,r,s,o,d,h=0;if(t||(i=0),"audio"===n.type){var p;for(e&&e.length?(s=e,(e=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),e.set(n.data,s.byteLength)):e=n.data;h+7>5,d=(o=1024*(1+(3&e[h+6])))*ze/Fe[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:Fe[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new Bt;var Ve,Ye,Xe,je=We,qe=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Ye=function(){var t,e,i=0;Ye.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new Bt,Xe={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Ve=function(){var t,e,i,n,a,r,s,o=new Ye;Ve.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i=0?i:0,(16&t[e+5])>>4?i+20:i+10},Ke=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=Ze(e,i))},Je=function(t){var e=Ke(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},Qe=Ze,ti=function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i};(He=function(){var t=new Uint8Array,e=0;He.prototype.init.call(this),this.setTimestamp=function(t){e=t},this.push=function(i){var n,a,r,s,o=0,d=0;for(t.length?(s=t.length,(t=new Uint8Array(i.byteLength+s)).set(t.subarray(0,s)),t.set(i,s)):t=i;t.length-d>=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ti(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=Qe(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new Bt;var ei,ii,ni,ai,ri=He,si=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],oi=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],di=$e.H264Stream,hi=Je,pi=Zt,ui=function(t,e){e.stream=t,this.trigger("log",e)},li=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new Bt,(ai=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ai.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new Bt,ai.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,oi.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,si.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Q.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ai.prototype.setRemux=function(t){this.remuxTracks=t},(ni=function(t){var e,i,n=this,a=!0;ni.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new Ge.MetadataStream,a.aacStream=new ri,a.audioTimestampRolloverStream=new Ge.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new Ge.TimestampRolloverStream("timed-metadata"),a.adtsStream=new je,a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new Ge.MetadataStream,a.packetStream=new Ge.TransportPacketStream,a.parseStream=new Ge.TransportParseStream,a.elementaryStream=new Ge.ElementaryStream,a.timestampRolloverStream=new Ge.TimestampRolloverStream,a.adtsStream=new je,a.h264Stream=new di,a.captionStream=new Ge.CaptionStream(t),a.coalesceStream=new ai(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new ei(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new ii(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),li(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,re(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,re(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=hi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Bt;var gi={Transmuxer:ni,VideoSegmentStream:ei,AudioSegmentStream:ii,AUDIO_PROPERTIES:si,VIDEO_PROPERTIES:oi,generateSegmentTimingInfo:fi},mi=ue,yi=Ce.CaptionStream,Si=function(t,e){for(var i=t,n=0;n0?gt(h[0]).baseMediaDecodeTime:0,u=nt(r,["trun"]);e===d&&u.length>0&&(i=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=vi(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}}})); diff --git a/node_modules/mux.js/dist/mux.js b/node_modules/mux.js/dist/mux.js index eb62ddb979..eb617e9ac3 100644 --- a/node_modules/mux.js/dist/mux.js +++ b/node_modules/mux.js/dist/mux.js @@ -1,4 +1,4 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('global/window')) : typeof define === 'function' && define.amd ? define(['global/window'], factory) : @@ -4200,19 +4200,33 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(function (byte) { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + var unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -4856,13 +4870,19 @@ var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. + // We keep track of positioning information as we go by storing the + // number of indentations and the tab offset in this buffer. var createDisplayBuffer = function createDisplayBuffer() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ + text: '', + indent: 0, + offset: 0 + }); } return result; @@ -4931,9 +4951,9 @@ this.startPts_ = packet.pts; } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -4966,9 +4986,9 @@ // backspace the "e" and insert "è". // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations // regardless of field and data channel. // Then byte-shift to the left and OR with char1 so we can pass the @@ -5000,7 +5020,11 @@ // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) + var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + + this.nonDisplayed_[this.row_].offset = offset; + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { // There's no logic for PAC -> row mapping, so we have to just // find the row code in an array and use its index :( @@ -5034,7 +5058,10 @@ // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + var indentations = (data & 0xe) >> 1; + this.column_ = indentations * 4; // add to the number of indentations for positioning + + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -5065,29 +5092,52 @@ // display buffer Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row, index) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + var _this = this; + + var logWarning = function logWarning(index) { + _this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + + var content = []; + this.displayed_.forEach(function (row, i) { + if (row && row.text && row.text.length) { + try { + // remove spaces from the start and end of the string + row.text = row.text.trim(); + } catch (e) { + // Ordinarily, this shouldn't happen. However, caption + // parsing errors should not throw exceptions and + // break playback. + logWarning(i); + } // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + + + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 + }); + } + } else if (row === undefined || row === null) { + logWarning(i); } - }, this) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content: content, stream: this.name_ }); } @@ -5296,7 +5346,11 @@ // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { + text: '', + indent: 0, + offset: 0 + }; } } @@ -5333,27 +5387,35 @@ Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.shiftRowsUp_ = function () { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } // shift displayed rows up @@ -5362,13 +5424,17 @@ } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { + text: '', + indent: 0, + offset: 0 + }; }; Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports @@ -7089,7 +7155,7 @@ this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush @@ -7770,7 +7836,10 @@ * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption + * @return {Object[]} parsedCaptions[].content - A list of individual caption segments + * @return {String} parsedCaptions[].content.text - The visible content of the caption segment + * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment + * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 **/ @@ -8422,7 +8491,7 @@ this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/dist/mux.min.js b/node_modules/mux.js/dist/mux.min.js index 6099d9f554..7d5ee7dd49 100644 --- a/node_modules/mux.js/dist/mux.min.js +++ b/node_modules/mux.js/dist/mux.min.js @@ -1,2 +1,2 @@ -/*! @name mux.js @version 6.3.0 @license Apache-2.0 */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(t),n=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n>5,d=(o=1024*(1+(3&e[h+6])))*v/S[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:S[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new u;var w,T,_,k=c,U=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(T=function(){var t,e,i=0;T.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new u,_={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(w=function(){var t,e,i,n,a,r,s,o=new T;w.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},z=function(t){return A(H.hdlr,Q[t])},F=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),A(H.mdhd,e)},N=function(t){return A(H.mdia,F(t),z(t.type),L(t))},I=function(t){return A(H.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},L=function(t){return A(H.minf,"video"===t.type?A(H.vmhd,tt):A(H.smhd,et),C(),G(t))},O=function(t,e){for(var i=[],n=e.length;n--;)i[n]=j(e[n]);return A.apply(null,[H.moof,I(t)].concat(i))},x=function(t){for(var e=t.length,i=[];e--;)i[e]=R(t[e]);return A.apply(null,[H.moov,M(4294967295)].concat(i).concat(E(t)))},E=function(t){for(var e=t.length,i=[];e--;)i[e]=q(t[e]);return A.apply(null,[H.mvex].concat(i))},M=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return A(H.mvhd,e)},V=function(t){var e,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(i=0;i>>8),r.push(255&n[e].byteLength),r=r.concat(Array.prototype.slice.call(n[e]));for(e=0;e>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));if(i=[H.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A(H.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length],r,[a.length],s))),A(H.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var o=t.sarRatio[0],d=t.sarRatio[1];i.push(A(H.pasp,new Uint8Array([(4278190080&o)>>24,(16711680&o)>>16,(65280&o)>>8,255&o,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return A.apply(null,i)},dt=function(t){return A(H.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),D(t))},B=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return A(H.tkhd,e)},j=function(t){var e,i,n,a,r,s;return e=A(H.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/mt),s=Math.floor(t.baseMediaDecodeTime%mt),i=A(H.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=Y(t,92),A(H.traf,e,i,n)):(a=V(t),n=Y(t,a.length+92),A(H.traf,e,i,n,a))},R=function(t){return t.duration=t.duration||4294967295,A(H.trak,B(t),N(t))},q=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),A(H.trex,e)},ut=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},pt=function(t,e){var i,n,a,r,s,o;for(e+=20+16*(r=t.samples||[]).length,a=ut(r,e),(n=new Uint8Array(a.length+16*r.length)).set(a),i=a.length,o=0;o>>24,n[i++]=(16711680&s.duration)>>>16,n[i++]=(65280&s.duration)>>>8,n[i++]=255&s.duration,n[i++]=(4278190080&s.size)>>>24,n[i++]=(16711680&s.size)>>>16,n[i++]=(65280&s.size)>>>8,n[i++]=255&s.size,n[i++]=s.flags.isLeading<<2|s.flags.dependsOn,n[i++]=s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,n[i++]=61440&s.flags.degradationPriority,n[i++]=15&s.flags.degradationPriority,n[i++]=(4278190080&s.compositionTimeOffset)>>>24,n[i++]=(16711680&s.compositionTimeOffset)>>>16,n[i++]=(65280&s.compositionTimeOffset)>>>8,n[i++]=255&s.compositionTimeOffset;return A(H.trun,n)},ht=function(t,e){var i,n,a,r,s,o;for(e+=20+8*(r=t.samples||[]).length,a=ut(r,e),(i=new Uint8Array(a.length+8*r.length)).set(a),n=a.length,o=0;o>>24,i[n++]=(16711680&s.duration)>>>16,i[n++]=(65280&s.duration)>>>8,i[n++]=255&s.duration,i[n++]=(4278190080&s.size)>>>24,i[n++]=(16711680&s.size)>>>16,i[n++]=(65280&s.size)>>>8,i[n++]=255&s.size;return A(H.trun,i)},Y=function(t,e){return"audio"===t.type?ht(t,e):pt(t,e)};var yt,bt,vt,St,wt,Tt,_t,kt={ftyp:P=function(){return A(H.ftyp,X,K,X,$)},mdat:function(t){return A(H.mdat,t)},moof:O,moov:x,initSegment:function(t){var e,i=P(),n=x(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},Ut=function(t){return t>>>0},At=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},Ct=Ut,Dt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},Pt=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},It=gt.getUint64,Lt=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&Ot(e.presentation_time_delta)&&i,a=1===t&&Ot(e.presentation_time)&&i;return!(t>1)&&n||a},Ot=function(t){return void 0!==t||null!==t},xt=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=It(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return Lt(h,u)?u:void 0},Et=function(t,e,i,n){return t||0===t?t/e:n+i/e},Mt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},Rt=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Bt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:Rt(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=Rt(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},Nt=Ut,Ft=gt.getUint64,zt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=Ft(t.subarray(4)):e.baseMediaDecodeTime=Nt(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},Vt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=$t(p[9]),a.codec+=$t(p[10]),a.codec+=$t(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===At(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+$t(p[19]),a.codec+="."+$t(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=Dt(t,["mdia","mdhd"])[0];l&&(a.timescale=Tt(l)),i.push(a)})),i},_t=function(t,e){return void 0===e&&(e=0),Dt(t,["emsg"]).map((function(t){var i=xt(new Uint8Array(t)),n=Jt(i.message_data);return{cueTime:Et(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:Et(i.event_duration,i.timescale),frames:n}}))};var Qt,te={findBox:Dt,parseType:At,timescale:yt,startTime:bt,compositionStartTime:vt,videoTrackIds:St,tracks:wt,getTimescaleFromMediaHeader:Tt=function(t){var e=0===t[0]?12:20;return Kt(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:_t},ee=function(t,e){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=e,i.compositionTimeOffset=t.pts-t.dts,i.duration=t.duration,i.size=4*t.length,i.size+=t.byteLength,t.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie=function(t){var e,i,n=[],a=[];for(a.byteLength=0,a.nalCount=0,a.duration=0,n.byteLength=0,e=0;e1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},re=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;if/2))){for((s=le()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ge=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Pe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Pe.prototype.addText=function(t){this.rows[this.rowIdx]+=t},Pe.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var Ie=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new Pe(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};Ie.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new Pe(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},Ie.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},Ie.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Le=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Le.prototype=new u,Le.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Le.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Le.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Le.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Le.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Le.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Le.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Le.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Le.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Le.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Le.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var Oe={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},xe=function(t){return null===t?"":(t=Oe[t]||t,String.fromCharCode(t))},Ee=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Me=function(){for(var t=[],e=15;e--;)t.push("");return t},Re=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=Me();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Me();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=Me()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=xe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=xe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a))this.column_+=3&a;else if(this.isPAC(n,a)){var s=Ee.indexOf(7968&e);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(t.pts,s)),s!==this.row_&&(this.clearFormatting(t.pts),this.row_=s),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)&&(this.column_=4*((14&e)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=xe(n),r+=xe(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Re.prototype=new u,Re.prototype.flushDisplayed=function(t){var e=this.displayed_.map((function(t,e){try{return t.trim()}catch(t){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");e.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:e,stream:this.name_})},Re.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Me(),this.nonDisplayed_=Me(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Re.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Re.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Re.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Re.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Re.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Re.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Re.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Re.prototype.isNormalChar=function(t){return t>=32&&t<=127},Re.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=Me(),this.displayed_=Me()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Re.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Re.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_];i+=e,this.nonDisplayed_[this.row_]=i},Re.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_];i+=e,this.displayed_[this.row_]=i},Re.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},Ve=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Fe,this.push=function(t){this.type_!==Fe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=ze(t.dts,n),t.pts=ze(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ve.prototype=new u;var Ge,We=Ve,je=ze;(Ge=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(Ge.prototype.init.call(this),this.dispatchType=Ne.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=Ne.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ne.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new u,Ye.STREAM_TYPES={h264:27,adts:15},(He=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case Ne.H264_STREAM_TYPE:t=n,e="video";break;case Ne.ADTS_STREAM_TYPE:t=a,e="audio";break;case Ne.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new u;var Ze={PAT_PID:0,MP2T_PACKET_LENGTH:$e,TransportPacketStream:qe,TransportParseStream:Ye,ElementaryStream:He,TimestampRolloverStream:Ke,CaptionStream:Be.CaptionStream,Cea608Stream:Be.Cea608Stream,Cea708Stream:Be.Cea708Stream,MetadataStream:Xe};for(var Je in Ne)Ne.hasOwnProperty(Je)&&(Ze[Je]=Ne[Je]);var Qe,ti=Ze,ei=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ii=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return i=i>=0?i:0,(16&t[e+5])>>4?i+20:i+10},ni=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=ii(e,i))},ai=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},ri={isLikelyAacData:function(t){var e=ni(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},parseId3TagSize:ii,parseAdtsSize:function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},parseType:function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},parseSampleRate:function(t){for(var e=0;e+5>>2];e++}return null},parseAacTimestamp:function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=ai(t.subarray(10,14)));do{if((i=ai(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var a=0;a>>2;return s*=4,s+=3&r[7]}break}}e+=10,e+=i}while(e=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ri.parseAdtsSize(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=ri.parseId3TagSize(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new u;var si,oi,di,hi,pi=Qe,ui=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],li=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ci=lt.H264Stream,fi=ri.isLikelyAacData,gi=f,mi=function(t,e){e.stream=t,this.trigger("log",e)},yi=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new u,(hi=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,hi.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new u,hi.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,li.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ui.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=kt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},hi.prototype.setRemux=function(t){this.remuxTracks=t},(di=function(t){var e,i,n=this,a=!0;di.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new ti.MetadataStream,a.aacStream=new pi,a.audioTimestampRolloverStream=new ti.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new ti.TimestampRolloverStream("timed-metadata"),a.adtsStream=new k,a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new ti.MetadataStream,a.packetStream=new ti.TransportPacketStream,a.parseStream=new ti.TransportParseStream,a.elementaryStream=new ti.ElementaryStream,a.timestampRolloverStream=new ti.TimestampRolloverStream,a.adtsStream=new k,a.h264Stream=new ci,a.captionStream=new ti.CaptionStream(t),a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new si(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,be(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,be(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=fi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new u;var Si,wi={Transmuxer:di,VideoSegmentStream:si,AudioSegmentStream:oi,AUDIO_PROPERTIES:ui,VIDEO_PROPERTIES:li,generateSegmentTimingInfo:vi},Ti=ke,_i=Be.CaptionStream,ki=function(t,e){for(var i=t,n=0;n0?zt(p[0]).baseMediaDecodeTime:0,l=Dt(s,["trun"]);e===h&&l.length>0&&(n=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=Ui(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}};(Si=function(t,e){var i,n=0,a=16384,r=function(t,e){var i,n=t.position+e;n0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===n+4?this.length-=4:n>0&&(e=n+4,i=this.length-e,this.position=n,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),n=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(s,this.position),this.position+=5;else if("height"===t)this.bytes.set(o,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case Si.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case Si.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=Si.frameTime(this.bytes),this}}).AUDIO_TAG=8,Si.VIDEO_TAG=9,Si.METADATA_TAG=18,Si.isAudioFrame=function(t){return Si.AUDIO_TAG===t[0]},Si.isVideoFrame=function(t){return Si.VIDEO_TAG===t[0]},Si.isMetaData=function(t){return Si.METADATA_TAG===t[0]},Si.isKeyFrame=function(t){return Si.isVideoFrame(t)?23===t[11]:!!Si.isAudioFrame(t)||!!Si.isMetaData(t)},Si.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var Ci=Si,Di=function t(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,t.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};(Di.prototype=new u).flush=function(t){var e,i,n,a,r={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks=n[0]&&(s=n.shift(),this.writeMetaDataTags(o,s)),(t.extraData!==e||a.pts-s>=1e3)&&(this.writeMetaDataTags(o,a.pts),e=t.extraData,s=a.pts),(r=new Ci(Ci.AUDIO_TAG)).pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),o.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,i){var n;(n=new Ci(Ci.METADATA_TAG)).pts=i,n.dts=i,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),(n=new Ci(Ci.AUDIO_TAG,!0)).pts=i,n.dts=i,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}}).prototype=new u,(Ii=function(t){var e,i,n=[];Ii.prototype.init.call(this),this.finishFrame=function(n,a){if(a){if(e&&t&&t.newMetadata&&(a.keyFrame||0===n.length)){var r=xi(e,a.dts).finalize(),s=Ei(t,a.dts).finalize();r.metaDataTag=s.metaDataTag=!0,n.push(r),n.push(s),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),n.push(a.finalize()),i=null}},this.push=function(e){Oi(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),n.push(e)},this.flush=function(){for(var a,r=new Ri;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0!==n.length){for(;n.length;)"seq_parameter_set_rbsp"===(a=n.shift()).nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(i&&this.finishFrame(r,i),(i=new Ci(Ci.VIDEO_TAG)).pts=a.pts,i.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(a.data);i&&this.finishFrame(r,i),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new u,(Pi=function(t){var e,i,n,a,r,s,o,d,h,p,u,l,c=this;Pi.prototype.init.call(this),t=t||{},this.metadataStream=new ti.MetadataStream,t.metadataStream=this.metadataStream,e=new ti.TransportPacketStream,i=new ti.TransportParseStream,n=new ti.ElementaryStream,a=new ti.TimestampRolloverStream("video"),r=new ti.TimestampRolloverStream("audio"),s=new ti.TimestampRolloverStream("timed-metadata"),o=new k,d=new Bi,l=new Mi(t),e.pipe(i).pipe(n),n.pipe(a).pipe(d),n.pipe(r).pipe(o),n.pipe(s).pipe(this.metadataStream).pipe(l),u=new ti.CaptionStream(t),d.pipe(u).pipe(l),n.on("data",(function(t){var e,i,n;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(n=t.tracks[e]);i&&!h&&(l.numberOfTracks++,h=new Ii(i),d.pipe(h).pipe(l)),n&&!p&&(l.numberOfTracks++,p=new Li(n),o.pipe(p).pipe(l),h&&h.on("keyframe",p.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){u.reset()},l.on("data",(function(t){c.trigger("data",t)})),l.on("done",(function(){c.trigger("done")}))}).prototype=new u;var Ni=function(t,e,i){var n,a,r,s=new Uint8Array(9),o=new DataView(s.buffer);return t=t||0,e=void 0===e||e,i=void 0===i||i,o.setUint8(0,70),o.setUint8(1,76),o.setUint8(2,86),o.setUint8(3,1),o.setUint8(4,(e?4:0)|(i?1:0)),o.setUint32(5,s.byteLength),t<=0?((a=new Uint8Array(s.byteLength+4)).set(s),a.set([0,0,0,0],s.byteLength),a):((n=new Ci(Ci.METADATA_TAG)).pts=n.dts=0,n.writeMetaDataDouble("duration",t),r=n.finalize().length,(a=new Uint8Array(s.byteLength+r)).set(s),a.set(o.byteLength,r),a)},Fi={tag:Ci,Transmuxer:Pi,getFlvHeader:Ni},zi=ti,Vi=f,Gi=function t(e,i){var n=[],a=0,r=0,s=0,o=1/0,d=null,h=null;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),e&&ui.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(t){r=t},this.setVideoBaseMediaDecodeTime=function(t){o=t},this.setAudioAppendStart=function(t){s=t},this.processFrames_=function(){var t,p,u,l,c;0!==n.length&&0!==(t=fe(n,e,r)).length&&(e.baseMediaDecodeTime=ve(e,i.keepOriginalTimestamps),ce(e,t,s,o),e.samples=ge(t),u=kt.mdat(me(t)),n=[],p=kt.moof(a,[e]),a++,e.initSegment=kt.initSegment([e]),(l=new Uint8Array(p.byteLength+u.byteLength)).set(p),l.set(u,p.byteLength),be(e),null===d&&(h=d=t[0].pts),h+=t.length*(1024*Vi/e.samplerate),c={start:d},this.trigger("timingInfo",c),this.trigger("data",{track:e,boxes:l}))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:d,end:h}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){be(e),d=null,h=null},this.reset=function(){this.resetTiming_(),n=[],this.trigger("reset")}};Gi.prototype=new u;var Wi=Gi,ji=function t(e,i){var n,a,r,s=0,o=[],d=[],h=null,p=null,u=!0;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],li.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||a||(a=t.data,e.pps=[t.data]),o.push(t)},this.processNals_=function(t){var n;for(o=d.concat(o);o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0!==o.length){var a=ie(o);if(a.length)if(d=a[a.length-1],t&&(a.pop(),a.duration-=d.duration,a.nalCount-=d.length,a.byteLength-=d.byteLength),a.length){if(this.trigger("timelineStartInfo",e.timelineStartInfo),u){if(!(r=ne(a))[0][0].keyFrame){if(!(r=ae(r))[0][0].keyFrame)return o=[].concat.apply([],a).concat(d),void(d=[]);(a=[].concat.apply([],r)).duration=r.duration}u=!1}for(null===h&&(h=a[0].pts,p=h),p+=a.duration,this.trigger("timingInfo",{start:h,end:p}),n=0;nMALFORMED DATA");else switch(31&t[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+t[e]&31)}return a},an={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:$i(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,a,r=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,a=0;a>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:At(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n>10)),a.language+=String.fromCharCode(96+((992&e)>>5)),a.language+=String.fromCharCode(96+(31&e)),a},mdia:function(t){return{boxes:$i(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:$i(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return t.byteLength>28&&(i.streamDescriptor=$i(t.subarray(28))[0]),i},moof:function(t){return{boxes:$i(t)}},moov:function(t){return{boxes:$i(t)}},mvex:function(t){return{boxes:$i(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=en(e.getUint32(i)),i+=8,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=en(e.getUint32(i)),i+=4,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=e.getUint32(n),i.firstOffset=e.getUint32(n+4),n+=8):(i.earliestPresentationTime=Qi(t.subarray(n)),i.firstOffset=Qi(t.subarray(n+8)),n+=16),n+=2;var a=e.getUint16(n);for(n+=2;a>0;n+=12,a--)i.references.push({referenceType:(128&t[n])>>>7,referencedSize:2147483647&e.getUint32(n),subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(128&t[n+8]),sapType:(112&t[n+8])>>>4,sapDeltaTime:268435455&e.getUint32(n+8)});return i},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:$i(t)}},ctts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),compositionOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=8,a--)n.compositionOffsets.push({sampleCount:i.getUint32(e),sampleOffset:i[0===n.version?"getUint32":"getInt32"](e+4)});return n},stss:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),syncSamples:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.syncSamples.push(i.getUint32(e));return n},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)a.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return a},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:$i(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:Bt,"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},rn={inspect:$i=function(t){for(var e,i,n,a,r,s=0,o=[],d=new ArrayBuffer(t.length),h=new Uint8Array(d),p=0;p1?s+i:t.byteLength,(r=(an[n]||function(t){return{data:t}})(t.subarray(s+8,a))).size=i,r.type=n,o.push(r),s=a;return o},textify:Zi=function(t,e){var i;return e=e||0,i=new Array(2*e+1).join(" "),t.map((function(t,n){return i+t.type+"\n"+Object.keys(t).filter((function(t){return"type"!==t&&"boxes"!==t})).map((function(e){var n=i+" "+e+": ",a=t[e];if(a instanceof Uint8Array||a instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)).map((function(t){return" "+("00"+t.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return r?1===r.length?n+"<"+r.join("").slice(1)+">":n+"<\n"+r.map((function(t){return i+" "+t})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(a,null,2).split("\n").map((function(t,e){return 0===e?t:i+" "+t})).join("\n")})).join("\n")+(t.boxes?"\n"+Zi(t.boxes,e+1):"")})).join("\n")},parseType:At,findBox:Dt,parseTraf:an.traf,parseTfdt:an.tfdt,parseHdlr:an.hdlr,parseTfhd:an.tfhd,parseTrun:an.trun,parseSidx:an.sidx},sn={8:"audio",9:"video",18:"metadata"},on=function(t){for(var e,i=[];t.byteLength>0;)e=0,i.push("0x"+("00"+t[e++].toString(16)).slice(-2).toUpperCase()),t=t.subarray(1);return i.join(" ")},dn=function(t,e){var i=t[0]&parseInt("00001111",2);return(e=e||{}).frameType=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"][(t[0]&parseInt("11110000",2))>>>4],e.codecID=i,7===i?function(t,e){var i=t[1]&parseInt("01111111",2)<<16|t[2]<<8|t[3];return(e=e||{}).avcPacketType=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"][t[0]],e.CompositionTime=t[1]&parseInt("10000000",2)?-i:i,1===t[0]?e.nalUnitTypeRaw=on(t.subarray(4,100)):e.data=on(t.subarray(4)),e}(t.subarray(1),e):e},hn=function(t,e){var i=(t[0]&parseInt("11110000",2))>>>4;return(e=e||{}).soundFormat=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"][i],e.soundRate=["5.5-kHz","11-kHz","22-kHz","44-kHz"][(t[0]&parseInt("00001100",2))>>>2],e.soundSize=(t[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",e.soundType=t[0]&parseInt("00000001",2)?"Stereo":"Mono",10===i?function(t,e){return(e=e||{}).aacPacketType=["AAC Sequence Header","AAC Raw"][t[0]],e.data=on(t.subarray(1)),e}(t.subarray(1),e):e},pn=function(t){var e=function(t){return{tagType:sn[t[0]],dataSize:t[1]<<16|t[2]<<8|t[3],timestamp:t[7]<<24|t[4]<<16|t[5]<<8|t[6],streamID:t[8]<<16|t[9]<<8|t[10]}}(t);switch(t[0]){case 8:hn(t.subarray(11),e);break;case 9:dn(t.subarray(11),e)}return e},un={inspectTag:pn,inspect:function(t){var e,i,n=9,a=[];for(n+=4;n>>4>1&&(e+=t[4]+1),e},gn=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},mn={parseType:function(t,e){var i=ln(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},parsePat:function(t){var e=cn(t),i=4+fn(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},parsePmt:function(t){var e={},i=cn(t),n=4+fn(t);if(i&&(n+=t[n]+1),1&t[n+5]){var a;a=3+((15&t[n+1])<<8|t[n+2])-4;for(var r=12+((15&t[n+10])<<8|t[n+11]);r=t.byteLength)return null;var i,n=null;return 192&(i=t[e+7])&&((n={}).pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},videoPacketContainsKeyFrame:function(t){for(var e=4+fn(t),i=t.subarray(e),n=0,a=0,r=!1;a3&&"slice_layer_without_partitioning_rbsp_idr"===gn(31&i[a+3])&&(r=!0),r}},yn=je,bn={};bn.ts=mn,bn.aac=ri;var vn=f,Sn=188,wn=71,Tn=function(t,e,i){for(var n,a,r,s,o=0,d=Sn,h=!1;d<=t.byteLength;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o++,d++;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o+=Sn,d+=Sn}for(o=(d=t.byteLength)-Sn,h=!1;o>=0;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o--,d--;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o-=Sn,d-=Sn}},_n=function(t,e,i){for(var n,a,r,s,o,d,h,p=0,u=Sn,l=!1,c={data:[],size:0};u=0;)if(t[p]!==wn||t[u]!==wn)p--,u--;else{switch(n=t.subarray(p,u),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"video"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),l=!0)}if(l)break;p-=Sn,u-=Sn}},kn=function(t){var e={pid:null,table:null},i={};for(var n in function(t,e){for(var i,n=0,a=Sn;a=3;){switch(bn.aac.parseType(t,o)){case"timed-metadata":if(t.length-o<10){i=!0;break}if((s=bn.aac.parseId3TagSize(t,o))>t.length){i=!0;break}null===r&&(e=t.subarray(o,o+s),r=bn.aac.parseAacTimestamp(e)),o+=s;break;case"audio":if(t.length-o<7){i=!0;break}if((s=bn.aac.parseAdtsSize(t,o))>t.length){i=!0;break}null===a&&(e=t.subarray(o,o+s),a=bn.aac.parseSampleRate(e)),n++,o+=s;break;default:o++}if(i)return null}if(null===a||null===r)return null;var d=vn/a;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*n*d,pts:r+1024*n*d}]}}(t):kn(t))&&(i.audio||i.video)?(function(t,e){if(t.audio&&t.audio.length){var i=e;(void 0===i||isNaN(i))&&(i=t.audio[0].dts),t.audio.forEach((function(t){t.dts=yn(t.dts,i),t.pts=yn(t.pts,i),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn}))}if(t.video&&t.video.length){var n=e;if((void 0===n||isNaN(n))&&(n=t.video[0].dts),t.video.forEach((function(t){t.dts=yn(t.dts,n),t.pts=yn(t.pts,n),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn})),t.firstKeyFrame){var a=t.firstKeyFrame;a.dts=yn(a.dts,n),a.pts=yn(a.pts,n),a.dtsTime=a.dts/vn,a.ptsTime=a.pts/vn}}}(i,e),i):null},parseAudioPes_:Tn},An={codecs:ct,mp4:Ai,flv:Fi,mp2t:zi,partial:Ji};return An.mp4.tools=rn,An.flv.tools=un,An.mp2t.tools=Un,An})); +/*! @name mux.js @version 7.0.1 @license Apache-2.0 */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("global/window")):"function"==typeof define&&define.amd?define(["global/window"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).muxjs=e(t.window)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=e(t),n=function(){this.init=function(){var t={};this.on=function(e,i){t[e]||(t[e]=[]),t[e]=t[e].concat(i)},this.off=function(e,i){var n;return!!t[e]&&(n=t[e].indexOf(i),t[e]=t[e].slice(),t[e].splice(n,1),n>-1)},this.trigger=function(e){var i,n,a,r;if(i=t[e])if(2===arguments.length)for(a=i.length,n=0;n>5,d=(o=1024*(1+(3&e[h+6])))*v/S[(60&e[h+2])>>>2],e.byteLength-h>>6&3),channelcount:(1&e[h+2])<<2|(192&e[h+3])>>>6,samplerate:S[(60&e[h+2])>>>2],samplingfrequencyindex:(60&e[h+2])>>>2,samplesize:16,data:e.subarray(h+7+r,h+a)}),i++,h+=a}else"number"!=typeof p&&(p=h),h++;"number"==typeof p&&(this.skipWarn_(p,h),p=null),e=e.subarray(h)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){e=void 0,this.trigger("reset")},this.endTimeline=function(){e=void 0,this.trigger("endedtimeline")}}).prototype=new u;var w,T,_,k=c,U=function(t){var e=t.byteLength,i=0,n=0;this.length=function(){return 8*e},this.bitsAvailable=function(){return 8*e+n},this.loadWord=function(){var a=t.byteLength-e,r=new Uint8Array(4),s=Math.min(4,e);if(0===s)throw new Error("no bytes available");r.set(t.subarray(a,a+s)),i=new DataView(r.buffer).getUint32(0),n=8*s,e-=s},this.skipBits=function(t){var a;n>t?(i<<=t,n-=t):(t-=n,t-=8*(a=Math.floor(t/8)),e-=a,this.loadWord(),i<<=t,n-=t)},this.readBits=function(t){var a=Math.min(n,t),r=i>>>32-a;return(n-=a)>0?i<<=a:e>0&&this.loadWord(),(a=t-a)>0?r<>>t))return i<<=t,n-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(T=function(){var t,e,i=0;T.prototype.init.call(this),this.push=function(n){var a;e?((a=new Uint8Array(e.byteLength+n.data.byteLength)).set(e),a.set(n.data,e.byteLength),e=a):e=n.data;for(var r=e.byteLength;i3&&this.trigger("data",e.subarray(i+3)),e=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new u,_={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(w=function(){var t,e,i,n,a,r,s,o=new T;w.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(e=t.trackId,i=t.pts,n=t.dts,o.push(t))},o.on("data",(function(s){var o={trackId:e,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=a(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=a(s.subarray(1)),o.config=r(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",o)})),o.on("done",(function(){t.trigger("done")})),o.on("partialdone",(function(){t.trigger("partialdone")})),o.on("reset",(function(){t.trigger("reset")})),o.on("endedtimeline",(function(){t.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(t,e){var i,n=8,a=8;for(i=0;i>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},z=function(t){return A(H.hdlr,Q[t])},F=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(e[12]=t.samplerate>>>24&255,e[13]=t.samplerate>>>16&255,e[14]=t.samplerate>>>8&255,e[15]=255&t.samplerate),A(H.mdhd,e)},N=function(t){return A(H.mdia,F(t),z(t.type),L(t))},I=function(t){return A(H.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},L=function(t){return A(H.minf,"video"===t.type?A(H.vmhd,tt):A(H.smhd,et),C(),G(t))},x=function(t,e){for(var i=[],n=e.length;n--;)i[n]=j(e[n]);return A.apply(null,[H.moof,I(t)].concat(i))},O=function(t){for(var e=t.length,i=[];e--;)i[e]=R(t[e]);return A.apply(null,[H.moov,M(4294967295)].concat(i).concat(E(t)))},E=function(t){for(var e=t.length,i=[];e--;)i[e]=q(t[e]);return A.apply(null,[H.mvex].concat(i))},M=function(t){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return A(H.mvhd,e)},V=function(t){var e,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(i=0;i>>8),r.push(255&n[e].byteLength),r=r.concat(Array.prototype.slice.call(n[e]));for(e=0;e>>8),s.push(255&a[e].byteLength),s=s.concat(Array.prototype.slice.call(a[e]));if(i=[H.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),A(H.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length],r,[a.length],s))),A(H.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],t.sarRatio){var o=t.sarRatio[0],d=t.sarRatio[1];i.push(A(H.pasp,new Uint8Array([(4278190080&o)>>24,(16711680&o)>>16,(65280&o)>>8,255&o,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return A.apply(null,i)},dt=function(t){return A(H.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),D(t))},B=function(t){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return A(H.tkhd,e)},j=function(t){var e,i,n,a,r,s;return e=A(H.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/mt),s=Math.floor(t.baseMediaDecodeTime%mt),i=A(H.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),92,"audio"===t.type?(n=Y(t,92),A(H.traf,e,i,n)):(a=V(t),n=Y(t,a.length+92),A(H.traf,e,i,n,a))},R=function(t){return t.duration=t.duration||4294967295,A(H.trak,B(t),N(t))},q=function(t){var e=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(e[e.length-1]=0),A(H.trex,e)},ut=function(t,e){var i=0,n=0,a=0,r=0;return t.length&&(void 0!==t[0].duration&&(i=1),void 0!==t[0].size&&(n=2),void 0!==t[0].flags&&(a=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,i|n|a|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e]},pt=function(t,e){var i,n,a,r,s,o;for(e+=20+16*(r=t.samples||[]).length,a=ut(r,e),(n=new Uint8Array(a.length+16*r.length)).set(a),i=a.length,o=0;o>>24,n[i++]=(16711680&s.duration)>>>16,n[i++]=(65280&s.duration)>>>8,n[i++]=255&s.duration,n[i++]=(4278190080&s.size)>>>24,n[i++]=(16711680&s.size)>>>16,n[i++]=(65280&s.size)>>>8,n[i++]=255&s.size,n[i++]=s.flags.isLeading<<2|s.flags.dependsOn,n[i++]=s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,n[i++]=61440&s.flags.degradationPriority,n[i++]=15&s.flags.degradationPriority,n[i++]=(4278190080&s.compositionTimeOffset)>>>24,n[i++]=(16711680&s.compositionTimeOffset)>>>16,n[i++]=(65280&s.compositionTimeOffset)>>>8,n[i++]=255&s.compositionTimeOffset;return A(H.trun,n)},ht=function(t,e){var i,n,a,r,s,o;for(e+=20+8*(r=t.samples||[]).length,a=ut(r,e),(i=new Uint8Array(a.length+8*r.length)).set(a),n=a.length,o=0;o>>24,i[n++]=(16711680&s.duration)>>>16,i[n++]=(65280&s.duration)>>>8,i[n++]=255&s.duration,i[n++]=(4278190080&s.size)>>>24,i[n++]=(16711680&s.size)>>>16,i[n++]=(65280&s.size)>>>8,i[n++]=255&s.size;return A(H.trun,i)},Y=function(t,e){return"audio"===t.type?ht(t,e):pt(t,e)};var yt,bt,vt,St,wt,Tt,_t,kt={ftyp:P=function(){return A(H.ftyp,X,K,X,$)},mdat:function(t){return A(H.mdat,t)},moof:x,moov:O,initSegment:function(t){var e,i=P(),n=O(t);return(e=new Uint8Array(i.byteLength+n.byteLength)).set(i),e.set(n,i.byteLength),e}},Ut=function(t){return t>>>0},At=function(t){var e="";return e+=String.fromCharCode(t[0]),e+=String.fromCharCode(t[1]),e+=String.fromCharCode(t[2]),e+=String.fromCharCode(t[3])},Ct=Ut,Dt=function t(e,i){var n,a,r,s,o,d=[];if(!i.length)return null;for(n=0;n1?n+a:e.byteLength,r===i[0]&&(1===i.length?d.push(e.subarray(n+8,s)):(o=t(e.subarray(n+8,s),i.slice(1))).length&&(d=d.concat(o))),n=s;return d},Pt=function(t){for(var e=0,i=String.fromCharCode(t[e]),n="";"\0"!==i;)n+=i,e++,i=String.fromCharCode(t[e]);return n+=i},It=gt.getUint64,Lt=function(t,e){var i="\0"!==e.scheme_id_uri,n=0===t&&xt(e.presentation_time_delta)&&i,a=1===t&&xt(e.presentation_time)&&i;return!(t>1)&&n||a},xt=function(t){return void 0!==t||null!==t},Ot=function(t){var e,i,n,a,r,s,o,d=4,h=t[0];if(0===h)d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length,n=(p=new DataView(t.buffer)).getUint32(d),d+=4,r=p.getUint32(d),d+=4,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4;else if(1===h){var p;n=(p=new DataView(t.buffer)).getUint32(d),d+=4,a=It(t.subarray(d)),d+=8,s=p.getUint32(d),d+=4,o=p.getUint32(d),d+=4,d+=(e=Pt(t.subarray(d))).length,d+=(i=Pt(t.subarray(d))).length}var u={scheme_id_uri:e,value:i,timescale:n||1,presentation_time:a,presentation_time_delta:r,event_duration:s,id:o,message_data:new Uint8Array(t.subarray(d,t.byteLength))};return Lt(h,u)?u:void 0},Et=function(t,e,i,n){return t||0===t?t/e:n+i/e},Mt=function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),trackId:i.getUint32(4)},a=1&n.flags[2],r=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],d=32&n.flags[2],h=65536&n.flags[0],p=131072&n.flags[0];return e=8,a&&(e+=4,n.baseDataOffset=i.getUint32(12),e+=4),r&&(n.sampleDescriptionIndex=i.getUint32(e),e+=4),s&&(n.defaultSampleDuration=i.getUint32(e),e+=4),o&&(n.defaultSampleSize=i.getUint32(e),e+=4),d&&(n.defaultSampleFlags=i.getUint32(e)),h&&(n.durationIsEmpty=!0),!a&&p&&(n.baseDataOffsetIsMoof=!0),n},Rt=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Bt=function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},n=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1&i.flags[2],r=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],d=4&i.flags[1],h=8&i.flags[1],p=n.getUint32(4),u=8;for(a&&(i.dataOffset=n.getInt32(u),u+=4),r&&p&&(e={flags:Rt(t.subarray(u,u+4))},u+=4,s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e),p--);p--;)e={},s&&(e.duration=n.getUint32(u),u+=4),o&&(e.size=n.getUint32(u),u+=4),d&&(e.flags=Rt(t.subarray(u,u+4)),u+=4),h&&(1===i.version?e.compositionTimeOffset=n.getInt32(u):e.compositionTimeOffset=n.getUint32(u),u+=4),i.samples.push(e);return i},Nt=Ut,Ft=gt.getUint64,zt=function(t){var e={version:t[0],flags:new Uint8Array(t.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=Ft(t.subarray(4)):e.baseMediaDecodeTime=Nt(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),e},Vt=function(t,e,i){if(!t)return-1;for(var n=i;n11?(a.codec+=".",a.codec+=$t(p[9]),a.codec+=$t(p[10]),a.codec+=$t(p[11])):a.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(a.codec)?(p=u.subarray(28),"esds"===At(p.subarray(4,8))&&p.length>20&&0!==p[19]?(a.codec+="."+$t(p[19]),a.codec+="."+$t(p[20]>>>2&63).replace(/^0/,"")):a.codec="mp4a.40.2"):a.codec=a.codec.toLowerCase())}var l=Dt(t,["mdia","mdhd"])[0];l&&(a.timescale=Tt(l)),i.push(a)})),i},_t=function(t,e){return void 0===e&&(e=0),Dt(t,["emsg"]).map((function(t){var i=Ot(new Uint8Array(t)),n=Jt(i.message_data);return{cueTime:Et(i.presentation_time,i.timescale,i.presentation_time_delta,e),duration:Et(i.event_duration,i.timescale),frames:n}}))};var Qt,te={findBox:Dt,parseType:At,timescale:yt,startTime:bt,compositionStartTime:vt,videoTrackIds:St,tracks:wt,getTimescaleFromMediaHeader:Tt=function(t){var e=0===t[0]?12:20;return Kt(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])},getEmsgID3:_t},ee=function(t,e){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=e,i.compositionTimeOffset=t.pts-t.dts,i.duration=t.duration,i.size=4*t.length,i.size+=t.byteLength,t.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ie=function(t){var e,i,n=[],a=[];for(a.byteLength=0,a.nalCount=0,a.duration=0,n.byteLength=0,e=0;e1&&(e=t.shift(),t.byteLength-=e.byteLength,t.nalCount-=e.nalCount,t[0][0].dts=e.dts,t[0][0].pts=e.pts,t[0][0].duration+=e.duration),t},re=function(t,e){var i,n,a,r,s,o=e||0,d=[];for(i=0;if/2))){for((s=le()[t.samplerate])||(s=e[0].data),o=0;o=i?t:(e.minSegmentDts=1/0,t.filter((function(t){return t.dts>=i&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})))},ge=function(t){var e,i,n=[];for(e=0;e=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(t),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Pe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Pe.prototype.addText=function(t){this.rows[this.rowIdx]+=t},Pe.prototype.backspace=function(){if(!this.isEmpty()){var t=this.rows[this.rowIdx];this.rows[this.rowIdx]=t.substr(0,t.length-1)}};var Ie=function(t,e,i){this.serviceNum=t,this.text="",this.currentWindow=new Pe(-1),this.windows=[],this.stream=i,"string"==typeof e&&this.createTextDecoder(e)};Ie.prototype.init=function(t,e){this.startPts=t;for(var i=0;i<8;i++)this.windows[i]=new Pe(i),"function"==typeof e&&(this.windows[i].beforeRowOverflow=e)},Ie.prototype.setCurrentWindow=function(t){this.currentWindow=this.windows[t]},Ie.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}};var Le=function t(e){e=e||{},t.prototype.init.call(this);var i,n=this,a=e.captionServices||{},r={};Object.keys(a).forEach((function(t){i=a[t],/^SERVICE/.test(t)&&(r[t]=i.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(t){3===t.type?(n.new708Packet(),n.add708Bytes(t)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(t))}};Le.prototype=new u,Le.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Le.prototype.add708Bytes=function(t){var e=t.ccData,i=e>>>8,n=255&e;this.current708Packet.ptsVals.push(t.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Le.prototype.push708Packet=function(){var t=this.current708Packet,e=t.data,i=null,n=null,a=0,r=e[a++];for(t.seq=r>>6,t.sizeCode=63&r;a>5)&&n>0&&(i=r=e[a++]),this.pushServiceBlock(i,a,n),n>0&&(a+=n-1)},Le.prototype.pushServiceBlock=function(t,e,i){var n,a=e,r=this.current708Packet.data,s=this.services[t];for(s||(s=this.initService(t,a));a>5,r.rowLock=(16&n)>>4,r.columnLock=(8&n)>>3,r.priority=7&n,n=i[++t],r.relativePositioning=(128&n)>>7,r.anchorVertical=127&n,n=i[++t],r.anchorHorizontal=n,n=i[++t],r.anchorPoint=(240&n)>>4,r.rowCount=15&n,n=i[++t],r.columnCount=63&n,n=i[++t],r.windowStyle=(56&n)>>3,r.penStyle=7&n,r.virtualRowCount=r.rowCount+1,t},Le.prototype.setWindowAttributes=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.winAttr;return n=i[++t],a.fillOpacity=(192&n)>>6,a.fillRed=(48&n)>>4,a.fillGreen=(12&n)>>2,a.fillBlue=3&n,n=i[++t],a.borderType=(192&n)>>6,a.borderRed=(48&n)>>4,a.borderGreen=(12&n)>>2,a.borderBlue=3&n,n=i[++t],a.borderType+=(128&n)>>5,a.wordWrap=(64&n)>>6,a.printDirection=(48&n)>>4,a.scrollDirection=(12&n)>>2,a.justify=3&n,n=i[++t],a.effectSpeed=(240&n)>>4,a.effectDirection=(12&n)>>2,a.displayEffect=3&n,t},Le.prototype.flushDisplayed=function(t,e){for(var i=[],n=0;n<8;n++)e.windows[n].visible&&!e.windows[n].isEmpty()&&i.push(e.windows[n].getText());e.endPts=t,e.text=i.join("\n\n"),this.pushCaption(e),e.startPts=t},Le.prototype.pushCaption=function(t){""!==t.text&&(this.trigger("data",{startPts:t.startPts,endPts:t.endPts,text:t.text,stream:"cc708_"+t.serviceNum}),t.text="",t.startPts=t.endPts)},Le.prototype.displayWindows=function(t,e){var i=this.current708Packet.data[++t],n=this.getPts(t);this.flushDisplayed(n,e);for(var a=0;a<8;a++)i&1<>4,a.offset=(12&n)>>2,a.penSize=3&n,n=i[++t],a.italics=(128&n)>>7,a.underline=(64&n)>>6,a.edgeType=(56&n)>>3,a.fontStyle=7&n,t},Le.prototype.setPenColor=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penColor;return n=i[++t],a.fgOpacity=(192&n)>>6,a.fgRed=(48&n)>>4,a.fgGreen=(12&n)>>2,a.fgBlue=3&n,n=i[++t],a.bgOpacity=(192&n)>>6,a.bgRed=(48&n)>>4,a.bgGreen=(12&n)>>2,a.bgBlue=3&n,n=i[++t],a.edgeRed=(48&n)>>4,a.edgeGreen=(12&n)>>2,a.edgeBlue=3&n,t},Le.prototype.setPenLocation=function(t,e){var i=this.current708Packet.data,n=i[t],a=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,n=i[++t],a.row=15&n,n=i[++t],a.column=63&n,t},Le.prototype.reset=function(t,e){var i=this.getPts(t);return this.flushDisplayed(i,e),this.initService(e.serviceNum,t)};var xe={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Oe=function(t){return null===t?"":(t=xe[t]||t,String.fromCharCode(t))},Ee=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Me=function(){for(var t=[],e=15;e--;)t.push({text:"",indent:0,offset:0});return t},Re=function t(e,i){t.prototype.init.call(this),this.field_=e||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var e,i,n,a,r;if((e=32639&t.ccData)!==this.lastControlCode_){if(4096==(61440&e)?this.lastControlCode_=e:e!==this.PADDING_&&(this.lastControlCode_=null),n=e>>>8,a=255&e,e!==this.PADDING_)if(e===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(e===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=t.pts;else if(e===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(e===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(e===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(e===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(e===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(e===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=Me();else if(e===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Me();else if(e===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=Me()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(n,a))r=Oe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(n,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),r=Oe((n=(3&n)<<8)|a),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(n,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(n,a)){var s=3&a;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(n,a)){var o=Ee.indexOf(7968&e);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(t.pts,o)),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&e)){var d=(14&e)>>1;this.column_=4*d,this.nonDisplayed_[this.row_].indent+=d}this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(n)&&(0===a&&(a=null),r=Oe(n),r+=Oe(a),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Re.prototype=new u,Re.prototype.flushDisplayed=function(t){var e=this,i=function(t){e.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."})},n=[];this.displayed_.forEach((function(t,e){if(t&&t.text&&t.text.length){try{t.text=t.text.trim()}catch(t){i(e)}t.text.length&&n.push({text:t.text,line:e+1,position:10+Math.min(70,10*t.indent)+2.5*t.offset})}else null==t&&i(e)})),n.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,content:n,stream:this.name_})},Re.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Me(),this.nonDisplayed_=Me(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Re.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Re.prototype.isSpecialCharacter=function(t,e){return t===this.EXT_&&e>=48&&e<=63},Re.prototype.isExtCharacter=function(t,e){return(t===this.EXT_+1||t===this.EXT_+2)&&e>=32&&e<=63},Re.prototype.isMidRowCode=function(t,e){return t===this.EXT_&&e>=32&&e<=47},Re.prototype.isOffsetControlCode=function(t,e){return t===this.OFFSET_&&e>=33&&e<=35},Re.prototype.isPAC=function(t,e){return t>=this.BASE_&&t=64&&e<=127},Re.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Re.prototype.isNormalChar=function(t){return t>=32&&t<=127},Re.prototype.setRollUp=function(t,e){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=Me(),this.displayed_=Me()),void 0!==e&&e!==this.row_)for(var i=0;i"}),"");this[this.mode_](t,i)},Re.prototype.clearFormatting=function(t){if(this.formatting_.length){var e=this.formatting_.reverse().reduce((function(t,e){return t+""}),"");this.formatting_=[],this[this.mode_](t,e)}},Re.prototype.popOn=function(t,e){var i=this.nonDisplayed_[this.row_].text;i+=e,this.nonDisplayed_[this.row_].text=i},Re.prototype.rollUp=function(t,e){var i=this.displayed_[this.row_].text;i+=e,this.displayed_[this.row_].text=i},Re.prototype.shiftRowsUp_=function(){var t;for(t=0;te&&(i=-1);Math.abs(e-t)>4294967296;)t+=8589934592*i;return t},Ve=function t(e){var i,n;t.prototype.init.call(this),this.type_=e||Fe,this.push=function(t){this.type_!==Fe&&t.type!==this.type_||(void 0===n&&(n=t.dts),t.dts=ze(t.dts,n),t.pts=ze(t.pts,n),i=t.dts,this.trigger("data",t))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ve.prototype=new u;var Ge,We=Ve,je=ze;(Ge=function(t){var e,i={descriptor:t&&t.descriptor},n=0,a=[],r=0;if(Ge.prototype.init.call(this),this.dispatchType=Ne.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(e=0;e>>2;p*=4,p+=3&h[7],o.timeStamp=p,void 0===e.pts&&void 0===e.dts&&(e.pts=o.timeStamp,e.dts=o.timeStamp),this.trigger("timestamp",o)}e.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=e[n]+1),0===i.pid)i.type="pat",t(e.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(e.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,n,i]):this.processPes_(e,n,i)},this.processPes_=function(t,e,i){i.pid===this.programMapTable.video?i.streamType=Ne.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ne.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=t.subarray(e),this.trigger("data",i)}}).prototype=new u,Ye.STREAM_TYPES={h264:27,adts:15},(He=function(){var t,e=this,i=!1,n={data:[],size:0},a={data:[],size:0},r={data:[],size:0},s=function(t,i,n){var a,r,s=new Uint8Array(t.size),o={type:i},d=0,h=0;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,d=0;d>>3,u.pts*=4,u.pts+=(6&p[13])>>>1,u.dts=u.pts,64&l&&(u.dts=(14&p[14])<<27|(255&p[15])<<20|(254&p[16])<<12|(255&p[17])<<5|(254&p[18])>>>3,u.dts*=4,u.dts+=(6&p[18])>>>1)),u.data=p.subarray(9+p[8])),a="video"===i||o.packetLength<=t.size,(n||a)&&(t.size=0,t.data.length=0),a&&e.trigger("data",o)}};He.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,e;switch(o.streamType){case Ne.H264_STREAM_TYPE:t=n,e="video";break;case Ne.ADTS_STREAM_TYPE:t=a,e="audio";break;case Ne.METADATA_STREAM_TYPE:t=r,e="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(t,e,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i=!0,e.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(r,"timed-metadata")},this.flush=function(){if(!i&&t){var n={type:"metadata",tracks:[]};null!==t.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),e.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new u;var Ze={PAT_PID:0,MP2T_PACKET_LENGTH:$e,TransportPacketStream:qe,TransportParseStream:Ye,ElementaryStream:He,TimestampRolloverStream:Ke,CaptionStream:Be.CaptionStream,Cea608Stream:Be.Cea608Stream,Cea708Stream:Be.Cea708Stream,MetadataStream:Xe};for(var Je in Ne)Ne.hasOwnProperty(Je)&&(Ze[Je]=Ne[Je]);var Qe,ti=Ze,ei=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ii=function(t,e){var i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return i=i>=0?i:0,(16&t[e+5])>>4?i+20:i+10},ni=function t(e,i){return e.length-i<10||e[i]!=="I".charCodeAt(0)||e[i+1]!=="D".charCodeAt(0)||e[i+2]!=="3".charCodeAt(0)?i:t(e,i+=ii(e,i))},ai=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},ri={isLikelyAacData:function(t){var e=ni(t,0);return t.length>=e+2&&255==(255&t[e])&&240==(240&t[e+1])&&16==(22&t[e+1])},parseId3TagSize:ii,parseAdtsSize:function(t,e){var i=(224&t[e+5])>>5,n=t[e+4]<<3;return 6144&t[e+3]|n|i},parseType:function(t,e){return t[e]==="I".charCodeAt(0)&&t[e+1]==="D".charCodeAt(0)&&t[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[e]&&240==(240&t[e+1])?"audio":null},parseSampleRate:function(t){for(var e=0;e+5>>2];e++}return null},parseAacTimestamp:function(t){var e,i,n;e=10,64&t[5]&&(e+=4,e+=ai(t.subarray(10,14)));do{if((i=ai(t.subarray(e+4,e+8)))<1)return null;if("PRIV"===String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])){n=t.subarray(e+10,e+i+10);for(var a=0;a>>2;return s*=4,s+=3&r[7]}break}}e+=10,e+=i}while(e=3;)if(t[d]!=="I".charCodeAt(0)||t[d+1]!=="D".charCodeAt(0)||t[d+2]!=="3".charCodeAt(0))if(255!=(255&t[d])||240!=(240&t[d+1]))d++;else{if(t.length-d<7)break;if(d+(o=ri.parseAdtsSize(t,d))>t.length)break;r={type:"audio",data:t.subarray(d,d+o),pts:e,dts:e},this.trigger("data",r),d+=o}else{if(t.length-d<10)break;if(d+(o=ri.parseId3TagSize(t,d))>t.length)break;a={type:"timed-metadata",data:t.subarray(d,d+o)},this.trigger("data",a),d+=o}n=t.length-d,t=n>0?t.subarray(d):new Uint8Array},this.reset=function(){t=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){t=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new u;var si,oi,di,hi,pi=Qe,ui=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],li=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ci=lt.H264Stream,fi=ri.isLikelyAacData,gi=f,mi=function(t,e){e.stream=t,this.trigger("log",e)},yi=function(t,e){for(var i=Object.keys(e),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=r,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(t){var e,i,n,a,r,o,d,h;for(r=t.byteLength,o=t.nalCount,d=t.duration,e=i=0;en.pts?e++:(i++,r-=a.byteLength,o-=a.nalCount,d-=a.duration);return 0===i?t:i===t.length?null:((h=t.slice(i)).byteLength=r,h.duration=d,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(t){var e,i,n,a,r,o,d;for(e=s.length-1,i=t.length-1,r=null,o=!1;e>=0&&i>=0;){if(n=s[e],a=t[i],n.pts===a.pts){o=!0;break}n.pts>a.pts?e--:(e===s.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(d=o?i:r))return t;var h=t.slice(d),p=h.reduce((function(t,e){return t.byteLength+=e.byteLength,t.duration+=e.duration,t.nalCount+=e.nalCount,t}),{byteLength:0,duration:0,nalCount:0});return h.byteLength=p.byteLength,h.duration=p.duration,h.nalCount=p.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(t){s=t}}).prototype=new u,(hi=function(t,e){this.numberOfTracks=0,this.metadataStream=e,void 0!==(t=t||{}).remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,"boolean"==typeof t.keepOriginalTimestamps?this.keepOriginalTimestamps=t.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,hi.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track,this.pendingBoxes.push(t.boxes)),void("audio"===t.track.type&&(this.audioTrack=t.track,this.pendingBoxes.unshift(t.boxes))))}}).prototype=new u,hi.prototype.flush=function(t){var e,i,n,a,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,li.forEach((function(t){s.info[t]=this.videoTrack[t]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ui.forEach((function(t){s.info[t]=this.audioTrack[t]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=kt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},hi.prototype.setRemux=function(t){this.remuxTracks=t},(di=function(t){var e,i,n=this,a=!0;di.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="aac",a.metadataStream=new ti.MetadataStream,a.aacStream=new pi,a.audioTimestampRolloverStream=new ti.TimestampRolloverStream("audio"),a.timedMetadataTimestampRolloverStream=new ti.TimestampRolloverStream("timed-metadata"),a.adtsStream=new k,a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.aacStream,a.aacStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),a.aacStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(a.coalesceStream),a.metadataStream.on("timestamp",(function(t){a.aacStream.setTimestamp(t.timeStamp)})),a.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||a.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e}))})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setupTsPipeline=function(){var a={};this.transmuxPipeline_=a,a.type="ts",a.metadataStream=new ti.MetadataStream,a.packetStream=new ti.TransportPacketStream,a.parseStream=new ti.TransportParseStream,a.elementaryStream=new ti.ElementaryStream,a.timestampRolloverStream=new ti.TimestampRolloverStream,a.adtsStream=new k,a.h264Stream=new ci,a.captionStream=new ti.CaptionStream(t),a.coalesceStream=new hi(t,a.metadataStream),a.headOfPipeline=a.packetStream,a.packetStream.pipe(a.parseStream).pipe(a.elementaryStream).pipe(a.timestampRolloverStream),a.timestampRolloverStream.pipe(a.h264Stream),a.timestampRolloverStream.pipe(a.adtsStream),a.timestampRolloverStream.pipe(a.metadataStream).pipe(a.coalesceStream),a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream),a.elementaryStream.on("data",(function(r){var s;if("metadata"===r.type){for(s=r.tracks.length;s--;)e||"video"!==r.tracks[s].type?i||"audio"!==r.tracks[s].type||((i=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(e=r.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;e&&!a.videoSegmentStream&&(a.coalesceStream.numberOfTracks++,a.videoSegmentStream=new si(e,t),a.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),a.videoSegmentStream.on("timelineStartInfo",(function(e){i&&!t.keepOriginalTimestamps&&(i.timelineStartInfo=e,a.audioSegmentStream.setEarliestDts(e.dts-n.baseMediaDecodeTime))})),a.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),a.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),a.videoSegmentStream.on("baseMediaDecodeTime",(function(t){i&&a.audioSegmentStream.setVideoBaseMediaDecodeTime(t)})),a.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)),i&&!a.audioSegmentStream&&(a.coalesceStream.numberOfTracks++,a.audioSegmentStream=new oi(i,t),a.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),a.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),a.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!e})}})),a.coalesceStream.on("data",this.trigger.bind(this,"data")),a.coalesceStream.on("id3Frame",(function(t){t.dispatchType=a.metadataStream.dispatchType,n.trigger("id3Frame",t)})),a.coalesceStream.on("caption",this.trigger.bind(this,"caption")),a.coalesceStream.on("done",this.trigger.bind(this,"done")),yi(this,a)},this.setBaseMediaDecodeTime=function(n){var a=this.transmuxPipeline_;t.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,be(i),a.audioTimestampRolloverStream&&a.audioTimestampRolloverStream.discontinuity()),e&&(a.videoSegmentStream&&(a.videoSegmentStream.gopCache_=[]),e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,be(e),a.captionStream.reset()),a.timestampRolloverStream&&a.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.setRemux=function(e){var i=this.transmuxPipeline_;t.remux=e,i&&i.coalesceStream&&i.coalesceStream.setRemux(e)},this.alignGopsWith=function(t){e&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.getLogTrigger_=function(t){var e=this;return function(i){i.stream=t,e.trigger("log",i)}},this.push=function(t){if(a){var e=fi(t);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),a=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){a=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new u;var Si,wi={Transmuxer:di,VideoSegmentStream:si,AudioSegmentStream:oi,AUDIO_PROPERTIES:ui,VIDEO_PROPERTIES:li,generateSegmentTimingInfo:vi},Ti=ke,_i=Be.CaptionStream,ki=function(t,e){for(var i=t,n=0;n0?zt(p[0]).baseMediaDecodeTime:0,l=Dt(s,["trun"]);e===h&&l.length>0&&(n=function(t,e,i){var n,a,r,s,o=new DataView(t.buffer,t.byteOffset,t.byteLength),d={logs:[],seiNals:[]};for(a=0;a+40;){var d=e.shift();this.parse(d,r,s)}return(o=function(t,e,i){if(null===e)return null;var n=Ui(t,e)[e]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(t,i,n))&&o.logs&&(a.logs=a.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),a):a.logs.length?{logs:a.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach((function(e){t.push(e)}))},this.flushStream=function(){if(!this.isInitialized())return null;r?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){a.captions=[],a.captionStreams={},a.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){e=[],i=null,n=null,a?this.clearParsedCaptions():a={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()}};(Si=function(t,e){var i,n=0,a=16384,r=function(t,e){var i,n=t.position+e;n0)throw new Error("Attempted to create new NAL wihout closing the old one");n=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var e,i;this.length===n+4?this.length-=4:n>0&&(e=n+4,i=this.length-e,this.position=n,this.view.setUint32(this.position,i),this.position=this.length,t&&t.push(this.bytes.subarray(e,e+i))),n=0},this.writeMetaDataDouble=function(t,e){var i;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(s,this.position),this.position+=5;else if("height"===t)this.bytes.set(o,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(d,this.position),this.position+=12;else for(i=0;i>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case Si.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=e?0:1;break;case Si.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,n),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return i=this.length-11,this.bytes[1]=(16711680&i)>>>16,this.bytes[2]=(65280&i)>>>8,this.bytes[3]=(255&i)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=Si.frameTime(this.bytes),this}}).AUDIO_TAG=8,Si.VIDEO_TAG=9,Si.METADATA_TAG=18,Si.isAudioFrame=function(t){return Si.AUDIO_TAG===t[0]},Si.isVideoFrame=function(t){return Si.VIDEO_TAG===t[0]},Si.isMetaData=function(t){return Si.METADATA_TAG===t[0]},Si.isKeyFrame=function(t){return Si.isVideoFrame(t)?23===t[11]:!!Si.isAudioFrame(t)||!!Si.isMetaData(t)},Si.frameTime=function(t){var e=t[4]<<16;return e|=t[5]<<8,e|=t[6]<<0,e|=t[7]<<24};var Ci=Si,Di=function t(e){this.numberOfTracks=0,this.metadataStream=e.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,t.prototype.init.call(this),this.push=function(t){return t.content||t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};(Di.prototype=new u).flush=function(t){var e,i,n,a,r={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks=n[0]&&(s=n.shift(),this.writeMetaDataTags(o,s)),(t.extraData!==e||a.pts-s>=1e3)&&(this.writeMetaDataTags(o,a.pts),e=t.extraData,s=a.pts),(r=new Ci(Ci.AUDIO_TAG)).pts=a.pts,r.dts=a.dts,r.writeBytes(a.data),o.push(r.finalize());n.length=0,e=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(e,i){var n;(n=new Ci(Ci.METADATA_TAG)).pts=i,n.dts=i,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===t.channelcount),n.writeMetaDataDouble("audiosamplerate",t.samplerate),n.writeMetaDataDouble("audiosamplesize",16),e.push(n.finalize()),(n=new Ci(Ci.AUDIO_TAG,!0)).pts=i,n.dts=i,n.view.setUint16(n.position,t.extraData),n.position+=2,n.length=Math.max(n.length,n.position),e.push(n.finalize())},this.onVideoKeyFrame=function(t){n.push(t)}}).prototype=new u,(Ii=function(t){var e,i,n=[];Ii.prototype.init.call(this),this.finishFrame=function(n,a){if(a){if(e&&t&&t.newMetadata&&(a.keyFrame||0===n.length)){var r=Oi(e,a.dts).finalize(),s=Ei(t,a.dts).finalize();r.metaDataTag=s.metaDataTag=!0,n.push(r),n.push(s),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),n.push(a.finalize()),i=null}},this.push=function(e){xi(t,e),e.pts=Math.round(e.pts/90),e.dts=Math.round(e.dts/90),n.push(e)},this.flush=function(){for(var a,r=new Ri;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0!==n.length){for(;n.length;)"seq_parameter_set_rbsp"===(a=n.shift()).nalUnitType?(t.newMetadata=!0,e=a.config,t.width=e.width,t.height=e.height,t.sps=[a.data],t.profileIdc=e.profileIdc,t.levelIdc=e.levelIdc,t.profileCompatibility=e.profileCompatibility,i.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],i.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(i&&this.finishFrame(r,i),(i=new Ci(Ci.VIDEO_TAG)).pts=a.pts,i.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(i.keyFrame=!0),i.endNalUnit()),i.startNalUnit(),i.writeBytes(a.data);i&&this.finishFrame(r,i),this.trigger("data",{track:t,tags:r.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new u,(Pi=function(t){var e,i,n,a,r,s,o,d,h,p,u,l,c=this;Pi.prototype.init.call(this),t=t||{},this.metadataStream=new ti.MetadataStream,t.metadataStream=this.metadataStream,e=new ti.TransportPacketStream,i=new ti.TransportParseStream,n=new ti.ElementaryStream,a=new ti.TimestampRolloverStream("video"),r=new ti.TimestampRolloverStream("audio"),s=new ti.TimestampRolloverStream("timed-metadata"),o=new k,d=new Bi,l=new Mi(t),e.pipe(i).pipe(n),n.pipe(a).pipe(d),n.pipe(r).pipe(o),n.pipe(s).pipe(this.metadataStream).pipe(l),u=new ti.CaptionStream(t),d.pipe(u).pipe(l),n.on("data",(function(t){var e,i,n;if("metadata"===t.type){for(e=t.tracks.length;e--;)"video"===t.tracks[e].type?i=t.tracks[e]:"audio"===t.tracks[e].type&&(n=t.tracks[e]);i&&!h&&(l.numberOfTracks++,h=new Ii(i),d.pipe(h).pipe(l)),n&&!p&&(l.numberOfTracks++,p=new Li(n),o.pipe(p).pipe(l),h&&h.on("keyframe",p.onVideoKeyFrame))}})),this.push=function(t){e.push(t)},this.flush=function(){e.flush()},this.resetCaptions=function(){u.reset()},l.on("data",(function(t){c.trigger("data",t)})),l.on("done",(function(){c.trigger("done")}))}).prototype=new u;var Ni=function(t,e,i){var n,a,r,s=new Uint8Array(9),o=new DataView(s.buffer);return t=t||0,e=void 0===e||e,i=void 0===i||i,o.setUint8(0,70),o.setUint8(1,76),o.setUint8(2,86),o.setUint8(3,1),o.setUint8(4,(e?4:0)|(i?1:0)),o.setUint32(5,s.byteLength),t<=0?((a=new Uint8Array(s.byteLength+4)).set(s),a.set([0,0,0,0],s.byteLength),a):((n=new Ci(Ci.METADATA_TAG)).pts=n.dts=0,n.writeMetaDataDouble("duration",t),r=n.finalize().length,(a=new Uint8Array(s.byteLength+r)).set(s),a.set(o.byteLength,r),a)},Fi={tag:Ci,Transmuxer:Pi,getFlvHeader:Ni},zi=ti,Vi=f,Gi=function t(e,i){var n=[],a=0,r=0,s=0,o=1/0,d=null,h=null;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),e&&ui.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(t){r=t},this.setVideoBaseMediaDecodeTime=function(t){o=t},this.setAudioAppendStart=function(t){s=t},this.processFrames_=function(){var t,p,u,l,c;0!==n.length&&0!==(t=fe(n,e,r)).length&&(e.baseMediaDecodeTime=ve(e,i.keepOriginalTimestamps),ce(e,t,s,o),e.samples=ge(t),u=kt.mdat(me(t)),n=[],p=kt.moof(a,[e]),a++,e.initSegment=kt.initSegment([e]),(l=new Uint8Array(p.byteLength+u.byteLength)).set(p),l.set(u,p.byteLength),be(e),null===d&&(h=d=t[0].pts),h+=t.length*(1024*Vi/e.samplerate),c={start:d},this.trigger("timingInfo",c),this.trigger("data",{track:e,boxes:l}))},this.flush=function(){this.processFrames_(),this.trigger("timingInfo",{start:d,end:h}),this.resetTiming_(),this.trigger("done","AudioSegmentStream")},this.partialFlush=function(){this.processFrames_(),this.trigger("partialdone","AudioSegmentStream")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline","AudioSegmentStream")},this.resetTiming_=function(){be(e),d=null,h=null},this.reset=function(){this.resetTiming_(),n=[],this.trigger("reset")}};Gi.prototype=new u;var Wi=Gi,ji=function t(e,i){var n,a,r,s=0,o=[],d=[],h=null,p=null,u=!0;i=i||{},t.prototype.init.call(this),this.push=function(t){Se(e,t),void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],li.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||a||(a=t.data,e.pps=[t.data]),o.push(t)},this.processNals_=function(t){var n;for(o=d.concat(o);o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0!==o.length){var a=ie(o);if(a.length)if(d=a[a.length-1],t&&(a.pop(),a.duration-=d.duration,a.nalCount-=d.length,a.byteLength-=d.byteLength),a.length){if(this.trigger("timelineStartInfo",e.timelineStartInfo),u){if(!(r=ne(a))[0][0].keyFrame){if(!(r=ae(r))[0][0].keyFrame)return o=[].concat.apply([],a).concat(d),void(d=[]);(a=[].concat.apply([],r)).duration=r.duration}u=!1}for(null===h&&(h=a[0].pts,p=h),p+=a.duration,this.trigger("timingInfo",{start:h,end:p}),n=0;nMALFORMED DATA");else switch(31&t[e]){case 1:a.push("slice_layer_without_partitioning_rbsp");break;case 5:a.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:a.push("sei_rbsp");break;case 7:a.push("seq_parameter_set_rbsp");break;case 8:a.push("pic_parameter_set_rbsp");break;case 9:a.push("access_unit_delimiter_rbsp");break;default:a.push("UNKNOWN NAL - "+t[e]&31)}return a},an={avc1:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:e.getUint16(6),width:e.getUint16(24),height:e.getUint16(26),horizresolution:e.getUint16(28)+e.getUint16(30)/16,vertresolution:e.getUint16(32)+e.getUint16(34)/16,frameCount:e.getUint16(40),depth:e.getUint16(74),config:$i(t.subarray(78,t.byteLength))}},avcC:function(t){var e,i,n,a,r=new DataView(t.buffer,t.byteOffset,t.byteLength),s={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},o=31&t[5];for(n=6,a=0;a>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={majorBrand:At(t.subarray(0,4)),minorVersion:e.getUint32(4),compatibleBrands:[]},n=8;n>10)),a.language+=String.fromCharCode(96+((992&e)>>5)),a.language+=String.fromCharCode(96+(31&e)),a},mdia:function(t){return{boxes:$i(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:$i(t)}},mp4a:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={dataReferenceIndex:e.getUint16(6),channelcount:e.getUint16(16),samplesize:e.getUint16(18),samplerate:e.getUint16(24)+e.getUint16(26)/65536};return t.byteLength>28&&(i.streamDescriptor=$i(t.subarray(28))[0]),i},moof:function(t){return{boxes:$i(t)}},moov:function(t){return{boxes:$i(t)}},mvex:function(t){return{boxes:$i(t)}},mvhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===n.version?(i+=4,n.creationTime=en(e.getUint32(i)),i+=8,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=en(e.getUint32(i)),i+=4,n.modificationTime=en(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,n.rate=e.getUint16(i)+e.getUint16(i+2)/16,i+=4,n.volume=e.getUint8(i)+e.getUint8(i+1)/8,i+=2,i+=2,i+=8,n.matrix=new Uint32Array(t.subarray(i,i+36)),i+=36,i+=24,n.nextTrackId=e.getUint32(i),n},pdin:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:e.getUint32(4),initialDelay:e.getUint32(8)}},sdtp:function(t){var e,i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(e=4;e>4,isDependedOn:(12&t[e])>>2,hasRedundancy:3&t[e]});return i},sidx:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=e.getUint32(n),i.firstOffset=e.getUint32(n+4),n+=8):(i.earliestPresentationTime=Qi(t.subarray(n)),i.firstOffset=Qi(t.subarray(n+8)),n+=16),n+=2;var a=e.getUint16(n);for(n+=2;a>0;n+=12,a--)i.references.push({referenceType:(128&t[n])>>>7,referencedSize:2147483647&e.getUint32(n),subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(128&t[n+8]),sapType:(112&t[n+8])>>>4,sapDeltaTime:268435455&e.getUint32(n+8)});return i},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:$i(t)}},ctts:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),compositionOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=8,a--)n.compositionOffsets.push({sampleCount:i.getUint32(e),sampleOffset:i[0===n.version?"getUint32":"getInt32"](e+4)});return n},stss:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:i.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),syncSamples:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.syncSamples.push(i.getUint32(e));return n},stco:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},a=i.getUint32(4);for(e=8;a;e+=4,a--)n.chunkOffsets.push(i.getUint32(e));return n},stsc:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=i.getUint32(4),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(e=8;n;e+=12,n--)a.sampleToChunks.push({firstChunk:i.getUint32(e),samplesPerChunk:i.getUint32(e+4),sampleDescriptionIndex:i.getUint32(e+8)});return a},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:$i(t.subarray(8))}},stsz:function(t){var e,i=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(e=12;e>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:e.getUint16(22)}},trun:Bt,"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:e.getUint16(4),opcolor:new Uint16Array([e.getUint16(6),e.getUint16(8),e.getUint16(10)])}}},rn={inspect:$i=function(t){for(var e,i,n,a,r,s=0,o=[],d=new ArrayBuffer(t.length),h=new Uint8Array(d),p=0;p1?s+i:t.byteLength,(r=(an[n]||function(t){return{data:t}})(t.subarray(s+8,a))).size=i,r.type=n,o.push(r),s=a;return o},textify:Zi=function(t,e){var i;return e=e||0,i=new Array(2*e+1).join(" "),t.map((function(t,n){return i+t.type+"\n"+Object.keys(t).filter((function(t){return"type"!==t&&"boxes"!==t})).map((function(e){var n=i+" "+e+": ",a=t[e];if(a instanceof Uint8Array||a instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)).map((function(t){return" "+("00"+t.toString(16)).slice(-2)})).join("").match(/.{1,24}/g);return r?1===r.length?n+"<"+r.join("").slice(1)+">":n+"<\n"+r.map((function(t){return i+" "+t})).join("\n")+"\n"+i+" >":n+"<>"}return n+JSON.stringify(a,null,2).split("\n").map((function(t,e){return 0===e?t:i+" "+t})).join("\n")})).join("\n")+(t.boxes?"\n"+Zi(t.boxes,e+1):"")})).join("\n")},parseType:At,findBox:Dt,parseTraf:an.traf,parseTfdt:an.tfdt,parseHdlr:an.hdlr,parseTfhd:an.tfhd,parseTrun:an.trun,parseSidx:an.sidx},sn={8:"audio",9:"video",18:"metadata"},on=function(t){for(var e,i=[];t.byteLength>0;)e=0,i.push("0x"+("00"+t[e++].toString(16)).slice(-2).toUpperCase()),t=t.subarray(1);return i.join(" ")},dn=function(t,e){var i=t[0]&parseInt("00001111",2);return(e=e||{}).frameType=["Unknown","Keyframe (for AVC, a seekable frame)","Inter frame (for AVC, a nonseekable frame)","Disposable inter frame (H.263 only)","Generated keyframe (reserved for server use only)","Video info/command frame"][(t[0]&parseInt("11110000",2))>>>4],e.codecID=i,7===i?function(t,e){var i=t[1]&parseInt("01111111",2)<<16|t[2]<<8|t[3];return(e=e||{}).avcPacketType=["AVC Sequence Header","AVC NALU","AVC End-of-Sequence"][t[0]],e.CompositionTime=t[1]&parseInt("10000000",2)?-i:i,1===t[0]?e.nalUnitTypeRaw=on(t.subarray(4,100)):e.data=on(t.subarray(4)),e}(t.subarray(1),e):e},hn=function(t,e){var i=(t[0]&parseInt("11110000",2))>>>4;return(e=e||{}).soundFormat=["Linear PCM, platform endian","ADPCM","MP3","Linear PCM, little endian","Nellymoser 16-kHz mono","Nellymoser 8-kHz mono","Nellymoser","G.711 A-law logarithmic PCM","G.711 mu-law logarithmic PCM","reserved","AAC","Speex","MP3 8-Khz","Device-specific sound"][i],e.soundRate=["5.5-kHz","11-kHz","22-kHz","44-kHz"][(t[0]&parseInt("00001100",2))>>>2],e.soundSize=(t[0]&parseInt("00000010",2))>>>1?"16-bit":"8-bit",e.soundType=t[0]&parseInt("00000001",2)?"Stereo":"Mono",10===i?function(t,e){return(e=e||{}).aacPacketType=["AAC Sequence Header","AAC Raw"][t[0]],e.data=on(t.subarray(1)),e}(t.subarray(1),e):e},pn=function(t){var e=function(t){return{tagType:sn[t[0]],dataSize:t[1]<<16|t[2]<<8|t[3],timestamp:t[7]<<24|t[4]<<16|t[5]<<8|t[6],streamID:t[8]<<16|t[9]<<8|t[10]}}(t);switch(t[0]){case 8:hn(t.subarray(11),e);break;case 9:dn(t.subarray(11),e)}return e},un={inspectTag:pn,inspect:function(t){var e,i,n=9,a=[];for(n+=4;n>>4>1&&(e+=t[4]+1),e},gn=function(t){switch(t){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},mn={parseType:function(t,e){var i=ln(t);return 0===i?"pat":i===e?"pmt":e?"pes":null},parsePat:function(t){var e=cn(t),i=4+fn(t);return e&&(i+=t[i]+1),(31&t[i+10])<<8|t[i+11]},parsePmt:function(t){var e={},i=cn(t),n=4+fn(t);if(i&&(n+=t[n]+1),1&t[n+5]){var a;a=3+((15&t[n+1])<<8|t[n+2])-4;for(var r=12+((15&t[n+10])<<8|t[n+11]);r=t.byteLength)return null;var i,n=null;return 192&(i=t[e+7])&&((n={}).pts=(14&t[e+9])<<27|(255&t[e+10])<<20|(254&t[e+11])<<12|(255&t[e+12])<<5|(254&t[e+13])>>>3,n.pts*=4,n.pts+=(6&t[e+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&t[e+14])<<27|(255&t[e+15])<<20|(254&t[e+16])<<12|(255&t[e+17])<<5|(254&t[e+18])>>>3,n.dts*=4,n.dts+=(6&t[e+18])>>>1)),n},videoPacketContainsKeyFrame:function(t){for(var e=4+fn(t),i=t.subarray(e),n=0,a=0,r=!1;a3&&"slice_layer_without_partitioning_rbsp_idr"===gn(31&i[a+3])&&(r=!0),r}},yn=je,bn={};bn.ts=mn,bn.aac=ri;var vn=f,Sn=188,wn=71,Tn=function(t,e,i){for(var n,a,r,s,o=0,d=Sn,h=!1;d<=t.byteLength;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o++,d++;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o+=Sn,d+=Sn}for(o=(d=t.byteLength)-Sn,h=!1;o>=0;)if(t[o]!==wn||t[d]!==wn&&d!==t.byteLength)o--,d--;else{switch(n=t.subarray(o,d),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"audio"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),h=!0)}if(h)break;o-=Sn,d-=Sn}},_n=function(t,e,i){for(var n,a,r,s,o,d,h,p=0,u=Sn,l=!1,c={data:[],size:0};u=0;)if(t[p]!==wn||t[u]!==wn)p--,u--;else{switch(n=t.subarray(p,u),bn.ts.parseType(n,e.pid)){case"pes":a=bn.ts.parsePesType(n,e.table),r=bn.ts.parsePayloadUnitStartIndicator(n),"video"===a&&r&&(s=bn.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),l=!0)}if(l)break;p-=Sn,u-=Sn}},kn=function(t){var e={pid:null,table:null},i={};for(var n in function(t,e){for(var i,n=0,a=Sn;a=3;){switch(bn.aac.parseType(t,o)){case"timed-metadata":if(t.length-o<10){i=!0;break}if((s=bn.aac.parseId3TagSize(t,o))>t.length){i=!0;break}null===r&&(e=t.subarray(o,o+s),r=bn.aac.parseAacTimestamp(e)),o+=s;break;case"audio":if(t.length-o<7){i=!0;break}if((s=bn.aac.parseAdtsSize(t,o))>t.length){i=!0;break}null===a&&(e=t.subarray(o,o+s),a=bn.aac.parseSampleRate(e)),n++,o+=s;break;default:o++}if(i)return null}if(null===a||null===r)return null;var d=vn/a;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*n*d,pts:r+1024*n*d}]}}(t):kn(t))&&(i.audio||i.video)?(function(t,e){if(t.audio&&t.audio.length){var i=e;(void 0===i||isNaN(i))&&(i=t.audio[0].dts),t.audio.forEach((function(t){t.dts=yn(t.dts,i),t.pts=yn(t.pts,i),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn}))}if(t.video&&t.video.length){var n=e;if((void 0===n||isNaN(n))&&(n=t.video[0].dts),t.video.forEach((function(t){t.dts=yn(t.dts,n),t.pts=yn(t.pts,n),t.dtsTime=t.dts/vn,t.ptsTime=t.pts/vn})),t.firstKeyFrame){var a=t.firstKeyFrame;a.dts=yn(a.dts,n),a.pts=yn(a.pts,n),a.dtsTime=a.dts/vn,a.ptsTime=a.pts/vn}}}(i,e),i):null},parseAudioPes_:Tn},An={codecs:ct,mp4:Ai,flv:Fi,mp2t:zi,partial:Ji};return An.mp4.tools=rn,An.flv.tools=un,An.mp2t.tools=Un,An})); diff --git a/node_modules/mux.js/es/flv/coalesce-stream.js b/node_modules/mux.js/es/flv/coalesce-stream.js index 4bf5ca92e6..ce63c5d462 100644 --- a/node_modules/mux.js/es/flv/coalesce-stream.js +++ b/node_modules/mux.js/es/flv/coalesce-stream.js @@ -33,7 +33,7 @@ var CoalesceStream = function CoalesceStream(options) { this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/es/m2ts/caption-stream.js b/node_modules/mux.js/es/m2ts/caption-stream.js index 47d140a6c2..aee29bb47d 100644 --- a/node_modules/mux.js/es/m2ts/caption-stream.js +++ b/node_modules/mux.js/es/m2ts/caption-stream.js @@ -707,19 +707,35 @@ Cea708Stream.prototype.handleText = function (i, service, options) { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(function (byte) { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + + ; + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service + if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + var unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -1364,13 +1380,19 @@ var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since ther var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. +// We keep track of positioning information as we go by storing the +// number of indentations and the tab offset in this buffer. var createDisplayBuffer = function createDisplayBuffer() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ + text: '', + indent: 0, + offset: 0 + }); } return result; @@ -1439,9 +1461,9 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { this.startPts_ = packet.pts; } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -1474,9 +1496,9 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // backspace the "e" and insert "è". // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations // regardless of field and data channel. // Then byte-shift to the left and OR with char1 so we can pass the @@ -1508,7 +1530,11 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes) + var offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + + this.nonDisplayed_[this.row_].offset = offset; + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { // There's no logic for PAC -> row mapping, so we have to just // find the row code in an array and use its index :( @@ -1542,7 +1568,10 @@ var Cea608Stream = function Cea608Stream(field, dataChannel) { // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + var indentations = (data & 0xe) >> 1; + this.column_ = indentations * 4; // add to the number of indentations for positioning + + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -1573,29 +1602,52 @@ Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the // display buffer Cea608Stream.prototype.flushDisplayed = function (pts) { - var content = this.displayed_ // remove spaces from the start and end of the string - .map(function (row, index) { - try { - return row.trim(); - } catch (e) { - // Ordinarily, this shouldn't happen. However, caption - // parsing errors should not throw exceptions and - // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + var _this = this; + + var logWarning = function logWarning(index) { + _this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + + var content = []; + this.displayed_.forEach(function (row, i) { + if (row && row.text && row.text.length) { + try { + // remove spaces from the start and end of the string + row.text = row.text.trim(); + } catch (e) { + // Ordinarily, this shouldn't happen. However, caption + // parsing errors should not throw exceptions and + // break playback. + logWarning(i); + } // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + + + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5 + }); + } + } else if (row === undefined || row === null) { + logWarning(i); } - }, this) // combine all text rows to display in one cue - .join('\n') // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content: content, stream: this.name_ }); } @@ -1804,7 +1856,11 @@ Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) { // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { + text: '', + indent: 0, + offset: 0 + }; } } @@ -1841,27 +1897,35 @@ Cea608Stream.prototype.clearFormatting = function (pts) { Cea608Stream.prototype.popOn = function (pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; // buffer characters + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.shiftRowsUp_ = function () { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { + text: '', + indent: 0, + offset: 0 + }; } // shift displayed rows up @@ -1870,13 +1934,17 @@ Cea608Stream.prototype.shiftRowsUp_ = function () { } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { + text: '', + indent: 0, + offset: 0 + }; }; Cea608Stream.prototype.paintOn = function (pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports diff --git a/node_modules/mux.js/es/mp4/caption-parser.js b/node_modules/mux.js/es/mp4/caption-parser.js index 77398d9b0f..1bd65a4df3 100644 --- a/node_modules/mux.js/es/mp4/caption-parser.js +++ b/node_modules/mux.js/es/mp4/caption-parser.js @@ -248,7 +248,10 @@ var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) { * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption + * @return {Object[]} parsedCaptions[].content - A list of individual caption segments + * @return {String} parsedCaptions[].content.text - The visible content of the caption segment + * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment + * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 **/ diff --git a/node_modules/mux.js/es/mp4/transmuxer.js b/node_modules/mux.js/es/mp4/transmuxer.js index aecff4de90..a7796c6de0 100644 --- a/node_modules/mux.js/es/mp4/transmuxer.js +++ b/node_modules/mux.js/es/mp4/transmuxer.js @@ -654,7 +654,7 @@ _CoalesceStream = function CoalesceStream(options, metadataStream) { this.push = function (output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/lib/flv/coalesce-stream.js b/node_modules/mux.js/lib/flv/coalesce-stream.js index 927aa2f276..4ac9632b1b 100644 --- a/node_modules/mux.js/lib/flv/coalesce-stream.js +++ b/node_modules/mux.js/lib/flv/coalesce-stream.js @@ -35,7 +35,7 @@ var CoalesceStream = function(options) { this.push = function(output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/lib/m2ts/caption-stream.js b/node_modules/mux.js/lib/m2ts/caption-stream.js index 0a6f472ff1..286c8ad197 100644 --- a/node_modules/mux.js/lib/m2ts/caption-stream.js +++ b/node_modules/mux.js/lib/m2ts/caption-stream.js @@ -688,18 +688,32 @@ Cea708Stream.prototype.handleText = function(i, service, options) { var char; var charCodeArray; + // Converts an array of bytes to a unicode hex string. + function toHexString(byteArray) { + return byteArray.map((byte) => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + }; + + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } + // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } - char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); + // Takes a unicode hex string and creates a single character. + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { @@ -1231,10 +1245,12 @@ var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, // CEA-608 captions are rendered onto a 34x15 matrix of character // cells. The "bottom" row is the last element in the outer array. +// We keep track of positioning information as we go by storing the +// number of indentations and the tab offset in this buffer. var createDisplayBuffer = function() { var result = [], i = BOTTOM_ROW + 1; while (i--) { - result.push(''); + result.push({ text: '', indent: 0, offset: 0 }); } return result; }; @@ -1312,9 +1328,9 @@ var Cea608Stream = function(field, dataChannel) { } else if (data === this.BACKSPACE_) { if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } } else if (data === this.ERASE_DISPLAYED_MEMORY_) { this.flushDisplayed(packet.pts); @@ -1352,9 +1368,9 @@ var Cea608Stream = function(field, dataChannel) { // Delete the previous character if (this.mode_ === 'popOn') { - this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1); + this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1); } else { - this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1); } // Bitmask char0 so that we can apply character transformations @@ -1390,7 +1406,13 @@ var Cea608Stream = function(field, dataChannel) { // increments, with an additional offset code of 1-3 to reach any // of the 32 columns specified by CEA-608. So all we need to do // here is increment the column cursor by the given offset. - this.column_ += (char1 & 0x03); + const offset = (char1 & 0x03); + + // For an offest value 1-3, set the offset for that caption + // in the non-displayed array. + this.nonDisplayed_[this.row_].offset = offset; + + this.column_ += offset; // Detect PACs (Preamble Address Codes) } else if (this.isPAC(char0, char1)) { @@ -1427,7 +1449,11 @@ var Cea608Stream = function(field, dataChannel) { // increments the column cursor by 4, so we can get the desired // column position by bit-shifting to the right (to get n/2) // and multiplying by 4. - this.column_ = ((data & 0xe) >> 1) * 4; + const indentations = ((data & 0xe) >> 1); + + this.column_ = indentations * 4; + // add to the number of indentations for positioning + this.nonDisplayed_[this.row_].indent += indentations; } if (this.isColorPAC(char1)) { @@ -1458,32 +1484,51 @@ Cea608Stream.prototype = new Stream(); // Trigger a cue point that captures the current state of the // display buffer Cea608Stream.prototype.flushDisplayed = function(pts) { - var content = this.displayed_ - // remove spaces from the start and end of the string - .map(function(row, index) { + const logWarning = (index) => { + this.trigger('log', { + level: 'warn', + message: 'Skipping a malformed 608 caption at index ' + index + '.' + }); + }; + const content = []; + + this.displayed_.forEach((row, i) => { + if (row && row.text && row.text.length) { + try { - return row.trim(); + // remove spaces from the start and end of the string + row.text = row.text.trim(); } catch (e) { // Ordinarily, this shouldn't happen. However, caption // parsing errors should not throw exceptions and // break playback. - this.trigger('log', { - level: 'warn', - message: 'Skipping a malformed 608 caption at index ' + index + '.' - }); - return ''; + logWarning(i); } - }, this) - // combine all text rows to display in one cue - .join('\n') - // and remove blank rows from the start and end, but not the middle - .replace(/^\n+|\n+$/g, ''); + // See the below link for more details on the following fields: + // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608 + if (row.text.length) { + content.push({ + // The text to be displayed in the caption from this specific row, with whitespace removed. + text: row.text, + // Value between 1 and 15 representing the PAC row used to calculate line height. + line: i + 1, + // A number representing the indent position by percentage (CEA-608 PAC indent code). + // The value will be a number between 10 and 80. Offset is used to add an aditional + // value to the position if necessary. + position: 10 + Math.min(70, row.indent * 10) + (row.offset * 2.5), + }); + } + } + else if (row === undefined || row === null) { + logWarning(i); + } + }); if (content.length) { this.trigger('data', { startPts: this.startPts_, endPts: pts, - text: content, + content, stream: this.name_ }); } @@ -1686,7 +1731,7 @@ Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) { // move currently displayed captions (up or down) to the new base row for (var i = 0; i < this.rollUpRows_; i++) { this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i]; - this.displayed_[this.row_ - i] = ''; + this.displayed_[this.row_ - i] = { text: '', indent: 0, offset: 0 }; } } @@ -1722,18 +1767,18 @@ Cea608Stream.prototype.clearFormatting = function(pts) { // Mode Implementations Cea608Stream.prototype.popOn = function(pts, text) { - var baseRow = this.nonDisplayed_[this.row_]; + var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters baseRow += text; - this.nonDisplayed_[this.row_] = baseRow; + this.nonDisplayed_[this.row_].text = baseRow; }; Cea608Stream.prototype.rollUp = function(pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; @@ -1741,24 +1786,24 @@ Cea608Stream.prototype.shiftRowsUp_ = function() { var i; // clear out inactive rows for (i = 0; i < this.topRow_; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { text: '', indent: 0, offset: 0 }; } for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) { - this.displayed_[i] = ''; + this.displayed_[i] = { text: '', indent: 0, offset: 0 }; } // shift displayed rows up for (i = this.topRow_; i < this.row_; i++) { this.displayed_[i] = this.displayed_[i + 1]; } // clear out the bottom row - this.displayed_[this.row_] = ''; + this.displayed_[this.row_] = { text: '', indent: 0, offset: 0 }; }; Cea608Stream.prototype.paintOn = function(pts, text) { - var baseRow = this.displayed_[this.row_]; + var baseRow = this.displayed_[this.row_].text; baseRow += text; - this.displayed_[this.row_] = baseRow; + this.displayed_[this.row_].text = baseRow; }; // exports diff --git a/node_modules/mux.js/lib/mp4/caption-parser.js b/node_modules/mux.js/lib/mp4/caption-parser.js index 77a9a8e9dd..8c4e39573b 100644 --- a/node_modules/mux.js/lib/mp4/caption-parser.js +++ b/node_modules/mux.js/lib/mp4/caption-parser.js @@ -245,7 +245,10 @@ var parseCaptionNals = function(segment, videoTrackId) { * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds - * @return {String} parsedCaptions[].text - The visible content of the caption + * @return {Object[]} parsedCaptions[].content - A list of individual caption segments + * @return {String} parsedCaptions[].content.text - The visible content of the caption segment + * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment + * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80 **/ var parseEmbeddedCaptions = function(segment, trackId, timescale) { var captionNals; diff --git a/node_modules/mux.js/lib/mp4/transmuxer.js b/node_modules/mux.js/lib/mp4/transmuxer.js index 58d644826e..a248585856 100644 --- a/node_modules/mux.js/lib/mp4/transmuxer.js +++ b/node_modules/mux.js/lib/mp4/transmuxer.js @@ -727,7 +727,7 @@ CoalesceStream = function(options, metadataStream) { this.push = function(output) { // buffer incoming captions until the associated video segment // finishes - if (output.text) { + if (output.content || output.text) { return this.pendingCaptions.push(output); } // buffer incoming id3 tags until the final flush diff --git a/node_modules/mux.js/package.json b/node_modules/mux.js/package.json index ddab80c531..3ef6001939 100644 --- a/node_modules/mux.js/package.json +++ b/node_modules/mux.js/package.json @@ -1,6 +1,6 @@ { "name": "mux.js", - "version": "6.3.0", + "version": "7.0.1", "description": "A collection of lightweight utilities for inspecting and manipulating video container formats.", "repository": { "type": "git", diff --git a/node_modules/mux.js/test/caption-parser.test.js b/node_modules/mux.js/test/caption-parser.test.js index 77c3e2e3c7..c02365abd0 100644 --- a/node_modules/mux.js/test/caption-parser.test.js +++ b/node_modules/mux.js/test/caption-parser.test.js @@ -49,7 +49,7 @@ QUnit.test('parse captions from real segment', function(assert) { cc = captionParser.parse(dashSegment, trackIds, timescales); assert.equal(cc.captions.length, 1); - assert.equal(cc.captions[0].text, '00:00:00', + assert.equal(cc.captions[0].content[0].text, '00:00:00', 'real segment caption has correct text'); assert.equal(cc.captions[0].stream, 'CC1', 'real segment caption has correct stream'); @@ -86,7 +86,7 @@ QUnit.test('parseTrackId for version 0 and version 1 boxes', function(assert) { { 1: 90000 }); // timescales); assert.equal(v0Captions.captions.length, 1, 'got 1 version0 caption'); - assert.equal(v0Captions.captions[0].text, 'test string #1', + assert.equal(v0Captions.captions[0].content[0].text, 'test string #1', 'got the expected version0 caption text'); assert.equal(v0Captions.captions[0].stream, 'CC1', 'returned the correct caption stream CC1'); @@ -108,7 +108,7 @@ QUnit.test('parseTrackId for version 0 and version 1 boxes', function(assert) { { 2: 90000 }); // timescales assert.equal(v1Captions.captions.length, 1, 'got version1 caption'); - assert.equal(v1Captions.captions[0].text, 'test string #2', + assert.equal(v1Captions.captions[0].content[0].text, 'test string #2', 'got the expected version1 caption text'); assert.equal(v1Captions.captions[0].stream, 'CC4', 'returned the correct caption stream CC4'); diff --git a/node_modules/mux.js/test/caption-stream.test.js b/node_modules/mux.js/test/caption-stream.test.js index 8d79056917..f0821a82a8 100644 --- a/node_modules/mux.js/test/caption-stream.test.js +++ b/node_modules/mux.js/test/caption-stream.test.js @@ -261,8 +261,8 @@ QUnit.test('can be parsed from a segment', function(assert) { transmuxer.flush(); assert.equal(captions.length, 2, 'parsed two captions'); - assert.equal(captions[0].text.indexOf('ASUKA'), 0, 'parsed the start of the first caption'); - assert.ok(captions[0].text.indexOf('Japanese') > 0, 'parsed the end of the first caption'); + assert.equal(captions[0].content[0].text.indexOf('ASUKA'), 0, 'parsed the start of the first caption'); + assert.ok(captions[0].content[0].text.indexOf('Japanese') > 0, 'parsed the end of the first caption'); assert.equal(captions[0].startTime, 1, 'parsed the start time'); assert.equal(captions[0].endTime, 4, 'parsed the end time'); }); @@ -291,8 +291,8 @@ QUnit.test('dispatches caption track information', function(assert) { assert.deepEqual(captionStreams, {CC1: true, CC3: true}, 'found captions in CC1 and CC3'); assert.equal(captions.length, 4, 'parsed eight captions'); - assert.equal(captions[0].text, 'être une période de questions', 'parsed the text of the first caption in CC3'); - assert.equal(captions[1].text, 'PERIOD, FOLKS.', 'parsed the text of the first caption in CC1'); + assert.equal(captions[0].content[0].text, 'être une période de questions', 'parsed the text of the first caption in CC3'); + assert.equal(captions[1].content[0].text, 'PERIOD, FOLKS.', 'parsed the text of the first caption in CC1'); }); QUnit.test('sorting is fun', function(assert) { @@ -341,8 +341,8 @@ QUnit.test('sorting is fun', function(assert) { captionStream.flush(); assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'test string #1', 'parsed caption 1'); - assert.equal(captions[1].text, 'test string #2', 'parsed caption 2'); + assert.equal(captions[0].content[0].text, 'test string #1', 'parsed caption 1'); + assert.equal(captions[1].content[0].text, 'test string #2', 'parsed caption 2'); }); QUnit.test('drops duplicate segments', function(assert) { @@ -405,7 +405,7 @@ QUnit.test('drops duplicate segments', function(assert) { captionStream.flush(); assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].text, 'test string data', 'parsed caption properly'); + assert.equal(captions[0].content[0].text, 'test string data', 'parsed caption properly'); }); QUnit.test('drops duplicate segments with multi-segment DTS values', function(assert) { @@ -555,8 +555,8 @@ QUnit.test('drops duplicate segments with multi-segment DTS values', function(as captionStream.flush(); assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'test string data stuff', 'parsed caption properly'); - assert.equal(captions[1].text, 'and even more text data here!', 'parsed caption properly'); + assert.equal(captions[0].content[0].text, 'test string data stuff', 'parsed caption properly'); + assert.equal(captions[1].content[0].text, 'and even more text data here!', 'parsed caption properly'); }); QUnit.test('doesn\'t ignore older segments if reset', function(assert) { @@ -647,7 +647,7 @@ QUnit.test('doesn\'t ignore older segments if reset', function(assert) { assert.equal(captionStream.latestDts_, 4000, 'DTS is tracked correctly'); assert.equal(captions.length, 1, 'detected one caption'); - assert.equal(captions[0].text, 'after reset data!!', 'parsed caption properly'); + assert.equal(captions[0].content[0].text, 'after reset data!!', 'parsed caption properly'); }); QUnit.test('extracts all theoretical caption channels', function(assert) { @@ -690,13 +690,14 @@ QUnit.test('extracts all theoretical caption channels', function(assert) { captionStream.flush(); assert.equal(captions.length, 6, 'got all captions'); - assert.equal(captions[0].text, '1a', 'cc1 first row'); - assert.equal(captions[1].text, '2a', 'cc2 first row'); - assert.equal(captions[2].text, '1a\n1b1c', 'cc1 first and second row'); - assert.equal(captions[3].text, '3a', 'cc3 first row'); - assert.equal(captions[4].text, '4a4b', 'cc4 first row'); - assert.equal(captions[5].text, '2a\n2b', 'cc2 first and second row'); - + assert.equal(captions[0].content[0].text, '1a', 'cc1 first row'); + assert.equal(captions[1].content[0].text, '2a', 'cc2 first row'); + assert.equal(captions[2].content[0].text, '1a', 'cc1 first row'); + assert.equal(captions[2].content[1].text, '1b1c', 'cc1 second row'); + assert.equal(captions[3].content[0].text, '3a', 'cc3 first row'); + assert.equal(captions[4].content[0].text, '4a4b', 'cc4 first row'); + assert.equal(captions[5].content[0].text, '2a', 'cc2 first row'); + assert.equal(captions[5].content[1].text, '2b', 'cc2 second row'); }); QUnit.test('drops data until first command that sets activeChannel for a field', function(assert) { @@ -763,9 +764,9 @@ QUnit.test('drops data until first command that sets activeChannel for a field', captionStream.flush(); assert.equal(captions.length, 2, 'received 2 captions'); - assert.equal(captions[0].text, 'field0', 'received only confirmed field0 data'); + assert.equal(captions[0].content[0].text, 'field0', 'received only confirmed field0 data'); assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].text, 'field1', 'received only confirmed field1 data'); + assert.equal(captions[1].content[0].text, 'field1', 'received only confirmed field1 data'); assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); }); @@ -855,33 +856,33 @@ QUnit.test('clears buffer and drops data until first command that sets activeCha seiNals1.forEach(captionStream.push, captionStream); captionStream.flush(); - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14], 'field0', + assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14].text, 'field0', 'there is data in non-displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14], 'field1', + assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14].text, 'field1', 'there is data in non-displayed memory for field 1 before reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14], 'field0', + assert.equal(captionStream.ccStreams_[0].displayed_[14].text, 'field0', 'there is data in displayed memory for field 0 before reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14], 'field1', + assert.equal(captionStream.ccStreams_[3].displayed_[14].text, 'field1', 'there is data in displayed memory for field 1 before reset'); captionStream.reset(); - assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14], '', + assert.equal(captionStream.ccStreams_[0].nonDisplayed_[14].text, '', 'there is no data in non-displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14], '', + assert.equal(captionStream.ccStreams_[3].nonDisplayed_[14].text, '', 'there is no data in non-displayed memory for field 1 after reset'); - assert.equal(captionStream.ccStreams_[0].displayed_[14], '', + assert.equal(captionStream.ccStreams_[0].displayed_[14].text, '', 'there is no data in displayed memory for field 0 after reset'); - assert.equal(captionStream.ccStreams_[3].displayed_[14], '', + assert.equal(captionStream.ccStreams_[3].displayed_[14].text, '', 'there is no data in displayed memory for field 1 after reset'); seiNals2.forEach(captionStream.push, captionStream); captionStream.flush(); assert.equal(captions.length, 2, 'detected two captions'); - assert.equal(captions[0].text, 'but this', 'parsed caption properly'); + assert.equal(captions[0].content[0].text, 'but this', 'parsed caption properly'); assert.equal(captions[0].stream, 'CC1', 'caption went to right channel'); - assert.equal(captions[1].text, 'and this', 'parsed caption properly'); + assert.equal(captions[1].content[0].text, 'and this', 'parsed caption properly'); assert.equal(captions[1].stream, 'CC4', 'caption went to right channel'); }); @@ -898,10 +899,15 @@ QUnit.test("don't mess up 608 captions when 708 are present", function(assert) { captionStream.flush(); assert.equal(captions.length, 3, 'parsed three captions'); - assert.equal(captions[0].text, 'BUT IT\'S NOT SUFFERING\nRIGHW.', 'parsed first caption correctly'); + // first caption stream + assert.equal(captions[0].content[0].text, 'BUT IT\'S NOT SUFFERING', 'first stream: parsed first content text correctly'); + assert.equal(captions[0].content[1].text, 'RIGHW.', 'first stream: parsed second content text correctly'); // there is also bad data in the captions, but the null ascii character is removed - assert.equal(captions[1].text, 'IT\'S NOT A THREAT TO ANYBODY.', 'parsed second caption correctly'); - assert.equal(captions[2].text, 'WE TRY NOT TO PUT AN ANIMAL DOWN\nIF WE DON\'T HAVE TO.', 'parsed third caption correctly'); + // second caption stream + assert.equal(captions[1].content[0].text, 'IT\'S NOT A THREAT TO ANYBODY.', 'second stream: parsed content text correctly'); + // third stream + assert.equal(captions[2].content[0].text, 'WE TRY NOT TO PUT AN ANIMAL DOWN', 'third stream: parsed first content text correctly'); + assert.equal(captions[2].content[1].text, 'IF WE DON\'T HAVE TO.', 'third stream: parsed second content text correctly'); }); QUnit.test("both 608 and 708 captions are available by default", function(assert) { @@ -1009,7 +1015,7 @@ QUnit.test('ignores XDS and Text packets', function(assert) { captionStream.flush(); assert.equal(captions.length, 1, 'only parsed real caption'); - assert.equal(captions[0].text, 'hi', 'caption is correct'); + assert.equal(captions[0].content[0].text, 'hi', 'caption is correct'); }); @@ -1051,9 +1057,9 @@ QUnit.test('special and extended character codes work regardless of field and da seiNals.forEach(captionStream.push, captionStream); captionStream.flush(); - assert.deepEqual(captions[0].text, String.fromCharCode(0xae), 'CC2 special character correct'); - assert.deepEqual(captions[1].text, String.fromCharCode(0xab), 'CC3 extended character correct'); - assert.deepEqual(captions[2].text, String.fromCharCode(0xbb), 'CC4 extended character correct'); + assert.deepEqual(captions[0].content[0].text, String.fromCharCode(0xae), 'CC2 special character correct'); + assert.deepEqual(captions[1].content[0].text, String.fromCharCode(0xab), 'CC3 extended character correct'); + assert.deepEqual(captions[2].content[0].text, String.fromCharCode(0xbb), 'CC4 extended character correct'); }); QUnit.test('number of roll up rows takes precedence over base row command', function(assert) { @@ -1100,8 +1106,9 @@ QUnit.test('number of roll up rows takes precedence over base row command', func seis.forEach(captionStream.push, captionStream); captionStream.flush(); - assert.deepEqual(captions[0].text, '-', 'RU2 caption is correct'); - assert.deepEqual(captions[1].text, '-\nso', 'RU3 caption is correct'); + assert.deepEqual(captions[0].content[0].text, '-', 'RU2 caption is correct'); + assert.deepEqual(captions[1].content[0].text, '-', 'first RU3 caption is correct'); + assert.deepEqual(captions[1].content[1].text, 'so', 'second RU3 caption is correct'); packets = [ // switching from row 11 to 0 @@ -1119,7 +1126,8 @@ QUnit.test('number of roll up rows takes precedence over base row command', func seis.forEach(captionStream.push, captionStream); captionStream.flush(); - assert.deepEqual(captions[2].text, '-\nso', 'RU3 caption is correct'); + assert.deepEqual(captions[2].content[0].text, '-', 'first RU3 caption is correct'); + assert.deepEqual(captions[2].content[1].text, 'so', 'second RU3 caption is correct'); }); var cea608Stream; @@ -1162,7 +1170,7 @@ QUnit.test('converts non-ASCII character codes to ASCII', function(assert) { }); packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, + assert.equal(captions[0].content[0].text, String.fromCharCode(0xe1, 0xe9, 0xed, 0xf3, 0xfa, 0xe7, 0xf7, 0xd1, 0xf1, 0x2588), 'translated non-standard characters'); }); @@ -1205,7 +1213,7 @@ QUnit.test('properly handles special character codes', function(assert) { packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, + assert.equal(captions[0].content[0].text, String.fromCharCode(0xae, 0xb0, 0xbd, 0xbf, 0x2122, 0xa2, 0xa3, 0x266a, 0xe0, 0xa0, 0xe8, 0xe2, 0xea, 0xee, 0xf4, 0xfb), 'translated special characters'); @@ -1248,7 +1256,7 @@ QUnit.test('properly handles extended character codes', function(assert) { packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, '«LÀ-LÅ LAÑD♪»', + assert.equal(captions[0].content[0].text, '«LÀ-LÅ LAÑD♪»', 'translated special characters'); }); @@ -1278,7 +1286,11 @@ QUnit.test('pop-on mode', function(assert) { assert.deepEqual(captions[0], { startPts: 1000, endPts: 10 * 1000, - text: 'hi', + content: [{ + line: 15, + position: 10, + text: 'hi' + }], stream: 'CC1' }, 'parsed the caption'); }); @@ -1313,7 +1325,11 @@ QUnit.test('ignores null characters', function(assert) { assert.deepEqual(captions[0], { startPts: 1000, endPts: 10 * 1000, - text: 'mu x', + content: [{ + line: 15, + position: 10, + text: 'mu x' + }], stream: 'CC1' }, 'ignored null characters'); }); @@ -1354,24 +1370,36 @@ QUnit.test('recognizes the Erase Displayed Memory command', function(assert) { assert.deepEqual(captions[0], { startPts: 1 * 1000, endPts: 1.5 * 1000, - text: '01', + content: [{ + line: 15, + position: 10, + text: '01' + }], stream: 'CC1' }, 'parsed the first caption'); assert.deepEqual(captions[1], { startPts: 2 * 1000, endPts: 3 * 1000, - text: '23', + content: [{ + line: 15, + position: 10, + text: '23' + }], stream: 'CC1' }, 'parsed the second caption'); assert.deepEqual(captions[2], { startPts: 3 * 1000, endPts: 4 * 1000, - text: '34', + content: [{ + line: 15, + position: 10, + text: '34' + }], stream: 'CC1' }, 'parsed the third caption'); }); -QUnit.test('backspaces are applied to non-displayed memory for pop-on mode', function(assert) { +QUnit.test('correct content text is added to non-displayed memory for pop-on mode', function(assert) { var captions = [], packets; cea608Stream.on('data', function(caption) { captions.push(caption); @@ -1402,7 +1430,8 @@ QUnit.test('backspaces are applied to non-displayed memory for pop-on mode', fun packets.forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '310\n\n023', 'applied the backspaces'); + assert.equal(captions[0].content[0].text, '310', 'first content text'); + assert.equal(captions[0].content[1].text, '023', 'second content text'); }); QUnit.test('backspaces on cleared memory are no-ops', function(assert) { @@ -1455,7 +1484,11 @@ QUnit.test('recognizes the Erase Non-Displayed Memory command', function(assert) assert.deepEqual(captions[0], { startPts: 1 * 1000, endPts: 2 * 1000, - text: '23', + content: [{ + line: 15, + position: 10, + text: '23' + }], stream: 'CC1' }, 'cleared the non-displayed memory'); }); @@ -1483,7 +1516,7 @@ QUnit.test('ignores unrecognized commands', function(assert) { packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, '01', 'skipped the unrecognized commands'); + assert.equal(captions[0].content[0].text, '01', 'skipped the unrecognized commands'); }); QUnit.skip('applies preamble address codes', function(assert) { @@ -1513,7 +1546,7 @@ QUnit.test('applies mid-row underline', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1536,7 +1569,7 @@ QUnit.test('applies mid-row italics', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1559,7 +1592,7 @@ QUnit.test('applies mid-row italics underline', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'no yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'no yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1583,7 +1616,7 @@ QUnit.test('applies PAC underline', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1605,7 +1638,7 @@ QUnit.test('applies PAC white italics', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1627,11 +1660,11 @@ QUnit.test('applies PAC white italics underline', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by CR'); + assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by CR'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); -QUnit.test('closes formatting at PAC row change', function(assert) { +QUnit.test('includes all caption text at PAC row change', function(assert) { var captions = []; cea608Stream.on('data', function(caption) { captions.push(caption); @@ -1656,7 +1689,8 @@ QUnit.test('closes formatting at PAC row change', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.\nno', 'properly closed by PAC row change'); + assert.equal(captions[0].content[0].text, 'yes.', 'first content text'); + assert.equal(captions[0].content[1].text, 'no', 'second content text'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1682,7 +1716,7 @@ QUnit.test('closes formatting at EOC', function(assert) { ]; packets.forEach(cea608Stream.push, cea608Stream); - assert.equal(captions[0].text, 'yes.', 'properly closed by EOC'); + assert.equal(captions[0].content[0].text, 'yes.', 'properly closed by EOC'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1707,7 +1741,7 @@ QUnit.test('closes formatting at negating mid-row code', function(assert) { packets.forEach(cea608Stream.push, cea608Stream); cea608Stream.flushDisplayed(); - assert.equal(captions[0].text, 'no yes. no', 'properly closed by negating mid-row code'); + assert.equal(captions[0].content[0].text, 'no yes. no', 'properly closed by negating mid-row code'); assert.deepEqual(cea608Stream.formatting_, [], 'formatting is empty'); }); @@ -1733,7 +1767,11 @@ QUnit.test('roll-up display mode', function(assert) { assert.deepEqual(captions[0], { startPts: 0 * 1000, endPts: 3 * 1000, - text: '01', + content: [{ + line: 15, + position: 10, + text: '01' + }], stream: 'CC1' }, 'parsed the caption'); captions = []; @@ -1755,7 +1793,18 @@ QUnit.test('roll-up display mode', function(assert) { assert.deepEqual(captions[0], { startPts: 3 * 1000, endPts: 5 * 1000, - text: '01\n23', + content: [ + { + line: 14, + position: 10, + text: '01' + }, + { + line: 15, + position: 10, + text: '23' + } + ], stream: 'CC1' }, 'parsed the new caption and kept the caption up after the new caption'); }); @@ -1783,7 +1832,11 @@ QUnit.test('roll-up displays multiple rows simultaneously', function(assert) { assert.deepEqual(captions[0], { startPts: 0 * 1000, endPts: 1 * 1000, - text: '01', + content: [{ + line: 15, + position: 10, + text: '01' + }], stream: 'CC1' }, 'created a caption for the first period'); captions = []; @@ -1803,7 +1856,18 @@ QUnit.test('roll-up displays multiple rows simultaneously', function(assert) { assert.deepEqual(captions[0], { startPts: 1 * 1000, endPts: 3 * 1000, - text: '01\n23', + content: [ + { + line: 14, + position: 10, + text: '01' + }, + { + line: 15, + position: 10, + text: '23' + } + ], stream: 'CC1' }, 'created the top and bottom rows after the shift up'); captions = []; @@ -1823,7 +1887,18 @@ QUnit.test('roll-up displays multiple rows simultaneously', function(assert) { assert.deepEqual(captions[0], { startPts: 3 * 1000, endPts: 5 * 1000, - text: '23\n45', + "content": [ + { + line: 14, + position: 10, + text: '23' + }, + { + line: 15, + position: 10, + text: '45' + } + ], stream: 'CC1' }, 'created the top and bottom rows after the shift up'); }); @@ -1894,13 +1969,13 @@ QUnit.test('switching to roll-up from pop-on wipes memories and flushes captions ].forEach(cea608Stream.push, cea608Stream); var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val; + acc += val.text; return acc; - }); + }, ''); var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val; + acc += val.text; return acc; - }); + }, ''); assert.equal(captions.length, 2, 'both captions flushed'); assert.equal(displayed, '', 'displayed memory is wiped'); @@ -1908,13 +1983,21 @@ QUnit.test('switching to roll-up from pop-on wipes memories and flushes captions assert.deepEqual(captions[0], { startPts: 1000, endPts: 2000, - text: 'hi', + content: [{ + line: 15, + position: 10, + text: 'hi', + }], stream: 'CC1' }, 'first caption correct'); assert.deepEqual(captions[1], { startPts: 2000, endPts: 3000, - text: 'oh', + content: [{ + line: 15, + position: 10, + text: 'oh', + }], stream: 'CC1' }, 'second caption correct'); }); @@ -1934,13 +2017,13 @@ QUnit.test('switching to roll-up from paint-on wipes memories and flushes captio ].forEach(cea608Stream.push, cea608Stream); var displayed = cea608Stream.displayed_.reduce(function(acc, val) { - acc += val; + acc += val.text; return acc; - }); + }, ''); var nonDisplayed = cea608Stream.nonDisplayed_.reduce(function(acc, val) { - acc += val; + acc += val.text; return acc; - }); + }, ''); assert.equal(captions.length, 1, 'flushed caption'); assert.equal(displayed, '', 'displayed memory is wiped'); @@ -1948,7 +2031,11 @@ QUnit.test('switching to roll-up from paint-on wipes memories and flushes captio assert.deepEqual(captions[0], { startPts: 0, endPts: 1000, - text: 'hi', + content: [{ + line: 15, + position: 10, + text: 'hi', + }], stream: 'CC1' }, 'caption correct'); }); @@ -1983,10 +2070,10 @@ QUnit.test('switching to paint-on from pop-on flushes display', function(assert) ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 2, 'detected 2 captions'); - assert.equal(captions[0].text, 'hi', 'pop-on caption received'); + assert.equal(captions[0].content[0].text, 'hi', 'pop-on caption received'); assert.equal(captions[0].startPts, 1000, 'proper start pts'); assert.equal(captions[0].endPts, 2000, 'proper end pts'); - assert.equal(captions[1].text, 'io', 'paint-on caption received'); + assert.equal(captions[1].content[0].text, 'io', 'paint-on caption received'); assert.equal(captions[1].startPts, 2000, 'proper start pts'); assert.equal(captions[1].endPts, 4000, 'proper end pts'); }); @@ -2017,7 +2104,7 @@ QUnit.test('backspaces are reflected in the generated captions', function(assert ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '023', 'applied the backspace'); + assert.equal(captions[0].content[0].text, '023', 'applied the backspace'); }); QUnit.test('backspaces can remove a caption entirely', function(assert) { @@ -2079,7 +2166,7 @@ QUnit.test('a second identical control code immediately following the first is i ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '01', 'only two backspaces processed'); + assert.equal(captions[0].content[0].text, '01', 'only two backspaces processed'); }); QUnit.test('a second identical control code separated by only padding from the first is ignored', function(assert) { @@ -2115,7 +2202,7 @@ QUnit.test('a second identical control code separated by only padding from the f ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '010', 'only one backspace processed'); + assert.equal(captions[0].content[0].text, '010', 'only one backspace processed'); }); QUnit.test('preamble address codes on same row are NOT converted into spaces', function(assert) { @@ -2145,10 +2232,10 @@ QUnit.test('preamble address codes on same row are NOT converted into spaces', f ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, '0102', 'PACs were NOT converted to space'); + assert.equal(captions[0].content[0].text, '0102', 'PACs were NOT converted to space'); }); -QUnit.test('preserves newlines from PACs in pop-on mode', function(assert) { +QUnit.test('generates correct content with PACs in pop-on mode', function(assert) { var captions = []; cea608Stream.on('data', function(caption) { captions.push(caption); @@ -2184,7 +2271,9 @@ QUnit.test('preserves newlines from PACs in pop-on mode', function(assert) { ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, 'TEST\n\nSTRING\nDATA', 'Position PACs were converted to newlines'); + assert.equal(captions[0].content[0].text, 'TEST', 'first content text'); + assert.equal(captions[0].content[1].text, 'STRING', 'second content text'); + assert.equal(captions[0].content[2].text, 'DATA', 'third content text'); }); QUnit.test('extracts real-world cc1 and cc3 channels', function(assert) { @@ -2252,14 +2341,14 @@ QUnit.test('extracts real-world cc1 and cc3 channels', function(assert) { cea608Stream3.push(packet); }); - var cc1 = {stream: 'CC1', text: 'PERIOD, FOLKS.'}; - var cc3 = {stream: 'CC3', text: 'être une période de questions'}; + var cc1 = {stream: 'CC1', content: [{ text: 'PERIOD, FOLKS.'}] }; + var cc3 = {stream: 'CC3', content: [{ text: 'être une période de questions' }] }; assert.equal(captions.length, 2, 'caption emitted'); assert.equal(captions[0].stream, cc1.stream, 'cc1 stream detected'); - assert.equal(captions[0].text, cc1.text, 'cc1 stream extracted successfully'); + assert.equal(captions[0].content[0].text, cc1.content[0].text, 'cc1 stream extracted successfully'); assert.equal(captions[1].stream, cc3.stream, 'cc3 stream detected'); - assert.equal(captions[1].text, cc3.text, 'cc3 stream extracted successfully'); + assert.equal(captions[1].content[0].text, cc3.content[0].text, 'cc3 stream extracted successfully'); }); QUnit.test('backspaces stop at the beginning of the line', function(assert) { @@ -2307,7 +2396,7 @@ QUnit.test('reset works', function(assert) { { pts: 0, ccData: characters('01'), type: 0 } ].forEach(cea608Stream.push, cea608Stream); var buffer = cea608Stream.displayed_.map(function(row) { - return row.trim(); + return row.text.trim(); }).join('\n') .replace(/^\n+|\n+$/g, ''); @@ -2316,7 +2405,7 @@ QUnit.test('reset works', function(assert) { cea608Stream.reset(); buffer = cea608Stream.displayed_ .map(function(row) { - return row.trim(); + return row.text.trim(); }) .join('\n') .replace(/^\n+|\n+$/g, ''); @@ -2348,12 +2437,16 @@ QUnit.test('paint-on mode', function(assert) { assert.deepEqual(captions[0], { startPts: 1000, endPts: 3000, - text: 'hi', + content: [{ + line: 15, + position: 10, + text: 'hi', + }], stream: 'CC1' }, 'parsed the caption'); }); -QUnit.test('preserves newlines from PACs in paint-on mode', function(assert) { +QUnit.test('generates correct text from PACs in paint-on mode', function(assert) { var captions = []; cea608Stream.on('data', function(caption) { captions.push(caption); @@ -2383,10 +2476,12 @@ QUnit.test('preserves newlines from PACs in paint-on mode', function(assert) { ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'caption emitted'); - assert.equal(captions[0].text, 'TEST\n\nSTRING\nDATA', 'Position PACs were converted to newlines'); + assert.equal(captions[0].content[0].text, 'TEST', 'first content text'); + assert.equal(captions[0].content[1].text, 'STRING', 'second content text'); + assert.equal(captions[0].content[2].text, 'DATA', 'third content text'); }); -QUnit.test('backspaces are reflected in the generated captions (paint-on)', function(assert) { +QUnit.test('multiple caption texts are generated (paint-on)', function(assert) { var captions = []; cea608Stream.on('data', function(caption) { captions.push(caption); @@ -2410,7 +2505,113 @@ QUnit.test('backspaces are reflected in the generated captions (paint-on)', func ].forEach(cea608Stream.push, cea608Stream); assert.equal(captions.length, 1, 'detected a caption'); - assert.equal(captions[0].text, '310\n\n023', 'applied the backspaces'); + assert.equal(captions[0].content[0].text, '310', 'first caption text'); + assert.equal(captions[0].content[1].text, '023', 'second caption text'); +}); + +QUnit.test('PAC indent code increases the position', function(assert) { + var captions = []; + cea608Stream.on('data', function(caption) { + captions.push(caption); + }); + + var packets = [ + // RCL, resume caption loading + { ccData: 0x1420, type: 0 }, + // PAC indent code representing 4 indentations. + { ccData: 5240, type: 0 }, + { ccData: characters('te'), type: 0 }, + { ccData: characters('st'), type: 0 }, + // EOC, End of Caption + { pts: 1 * 1000, ccData: 0x142f, type: 0 }, + // RCL, resume caption loading + { ccData: 0x1420, type: 0 }, + // EOC, End of Caption + { pts: 2 * 1000, ccData: 0x142f, type: 0 } + ]; + + packets.forEach(cea608Stream.push, cea608Stream); + assert.equal(captions[0].content[0].text, 'test', 'content text'); + assert.equal(captions[0].content[0].line, 15, 'positions the caption to the bottom of the screen'); + assert.equal(captions[0].content[0].position, 50, 'positions the caption to the right of the screen'); +}); + +QUnit.test('PAC offset code increases the position', function(assert) { + var captions = []; + cea608Stream.on('data', function(caption) { + captions.push(caption); + }); + + var packets = [ + // RCL, resume caption loading + { ccData: 0x1420, type: 0 }, + // PAC: row 1, indent 0 + { pts: 6750, ccData: 0x1150, type: 0 }, + // TO2 (tab offset 2 columns) + { pts: 6755, ccData: 0x1722, type: 0 }, + { ccData: characters('te'), type: 0 }, + { ccData: characters('st'), type: 0 }, + // EOC, End of Caption + { pts: 1 * 1000, ccData: 0x142f, type: 0 }, + // RCL, resume caption loading + { ccData: 0x1420, type: 0 }, + // EOC, End of Caption + { pts: 2 * 1000, ccData: 0x142f, type: 0 } + ]; + + packets.forEach(cea608Stream.push, cea608Stream); + assert.equal(captions[0].content[0].text, 'test', 'content text'); + assert.equal(captions[0].content[0].line, 1, 'positions the caption to the bottom of the screen'); + // Two tab offset columns adds 5 to the position (2 * 2.5) + assert.equal(captions[0].content[0].position, 15, 'positions the caption to the right'); +}); + +QUnit.test('PAC row command ensures we have the correct line property for captions', function(assert) { + var captions = []; + cea608Stream.on('data', function(caption) { + captions.push(caption); + }); + + var packets = [ + // RU2 (roll-up, 2 rows) + { pts: 6675, ccData: 0x1425, type: 0 }, + // CR (carriange return), flush nothing + { pts: 6675, ccData: 0x142d, type: 0 }, + // PAC: row 2, indent 0 + // This should ensure the captions are at the top of the screen. + { pts: 6675, ccData: 0x1170, type: 0 }, + // text: YEAR. + { pts: 6676, ccData: 0x5945, type: 0 }, + { pts: 6676, ccData: 0x4152, type: 0 }, + { pts: 6676, ccData: 0x2e00, type: 0 }, + // RU2 (roll-up, 2 rows) + { pts: 6677, ccData: 0x1425, type: 0 }, + // CR (carriange return), flush 1 row + { pts: 6677, ccData: 0x142d, type: 0 }, + // EDM (erase displayed memory), flush 2 displayed roll-up rows + { pts: 6697, ccData: 0x142c, type: 0 }, + // RDC (resume direct captioning), wipes memories, flushes nothing + { pts: 6749, ccData: 0x1429, type: 0 }, + // PAC: row 1, indent 0 + { pts: 6750, ccData: 0x1150, type: 0 }, + // EOC, End of Caption + { pts: 1 * 1000, ccData: 0x142f, type: 0 }, + // RCL, resume caption loading + { ccData: 0x1420, type: 0 }, + // EOC, End of Caption + { pts: 2 * 1000, ccData: 0x142f, type: 0 } + ]; + + // First caption stream is at the second most bottom row. + packets.forEach(cea608Stream.push, cea608Stream); + assert.equal(captions[0].content[0].text, 'YEAR.', 'content text'); + assert.equal(captions[0].content[0].line, 2, 'positions the caption in the second most bottom row'); + assert.equal(captions[0].content[0].position, 10, 'position of the caption'); + + // Second caption stream is at the most bottom row. + assert.equal(captions[1].content[0].text, 'YEAR.', 'content text'); + assert.equal(captions[1].content[0].line, 1, 'positions the caption in the most bottom row'); + assert.equal(captions[1].content[0].position, 10, 'position of the caption'); }); QUnit.test('mix of all modes (extract from CNN)', function(assert) { @@ -2606,45 +2807,101 @@ QUnit.test('mix of all modes (extract from CNN)', function(assert) { assert.equal(captions.length, 7, 'detected 7 captions of varying types'); assert.deepEqual(captions[0], { + content: [{ + line: 2, + position: 10, + text: 'YEAR.', + }], startPts: 6675, endPts: 6677, - text: 'YEAR.', stream: 'CC1' }, 'parsed the 1st roll-up caption'); assert.deepEqual(captions[1], { + content: [ + { + line: 1, + position: 10, + text: 'YEAR.', + }, + { + line: 2, + position: 10, + text: 'GO TO CNNHEROS.COM.', + } + ], startPts: 6677, endPts: 6697, - text: 'YEAR.\nGO TO CNNHEROS.COM.', stream: 'CC1' }, 'parsed the 2nd roll-up caption'); assert.deepEqual(captions[2], { + content: [ + { + line: 1, + position: 10, + text: 'Did your Senator or Congressman', + }, + { + line: 2, + position: 10, + text: 'get elected by talking tough', + } + ], startPts: 6749, endPts: 6781, - text: 'Did your Senator or Congressman\nget elected by talking tough', stream: 'CC1' }, 'parsed the paint-on caption'); assert.deepEqual(captions[3], { + content: [{ + line: 1, + position: 22.5, + text: 'on the national debt?', + }], startPts: 6782, endPts: 6797, - text: 'on the national debt?', stream: 'CC1' }, 'parsed the 1st pop-on caption'); assert.deepEqual(captions[4], { + content: [ + { + line: 1, + position: 25, + text: 'Will they stay true', + }, + { + line: 2, + position: 30, + text: 'to their words?', + } + ], startPts: 6798, endPts: 6838, - text: 'Will they stay true\nto their words?', stream: 'CC1' }, 'parsed the 2nd pop-on caption'); assert.deepEqual(captions[5], { + content: [{ + line: 2, + position: 10, + text: '>>> NO MORE SPECULATION, NO MORE', + }], startPts: 6841, endPts: 6844, - text: '>>> NO MORE SPECULATION, NO MORE', stream: 'CC1' }, 'parsed the 3rd roll-up caption'); assert.deepEqual(captions[6], { + content: [ + { + line: 1, + position: 10, + text: '>>> NO MORE SPECULATION, NO MORE', + }, + { + line: 2, + position: 10, + text: 'RUMORS OR GUESSING GAMES.', + } + ], startPts: 6844, endPts: 6846, - text: '>>> NO MORE SPECULATION, NO MORE\nRUMORS OR GUESSING GAMES.', stream: 'CC1' }, 'parsed the 4th roll-up caption'); @@ -2794,6 +3051,33 @@ QUnit.test('Decodes multibyte characters if valid encoding option is provided an } }); +QUnit.test('Decodes multi-byte characters as unicode if no valid encoding option is provided', function(assert) { + var captions = []; + + cea708Stream = new m2ts.Cea708Stream({ + captionServices: { + SERVICE1: {} + } + }); + + cea708Stream.on('data', function(caption) { + captions.push(caption); + }); + + cc708Korean.forEach(cea708Stream.push, cea708Stream); + + cea708Stream.flushDisplayed(4721138662, cea708Stream.services[1]); + + assert.equal(captions.length, 1, 'parsed single caption correctly'); + + assert.notOk(cea708Stream.services[1].textDecoder_, 'TextDecoder was not created'); + assert.equal( + captions[0].text, + '듏낡 ', + 'parsed multibyte characters correctly' + ); +}); + QUnit.test('Creates TextDecoder only if valid encoding value is provided', function(assert) { var secondCea708Stream; diff --git a/node_modules/video.js/CHANGELOG.md b/node_modules/video.js/CHANGELOG.md index a91bd55b3a..ea87887cd0 100644 --- a/node_modules/video.js/CHANGELOG.md +++ b/node_modules/video.js/CHANGELOG.md @@ -1,3 +1,19 @@ + +## [8.6.1](https://github.com/videojs/video.js/compare/v8.6.0...v8.6.1) (2023-10-12) + +### Bug Fixes + +* **control-bar:** incorrect display when control bar display is locked ([#8435](https://github.com/videojs/video.js/issues/8435)) ([473176f](https://github.com/videojs/video.js/commit/473176f)) +* **error:** chromium reset mediaError when the poster is invalid ([#8410](https://github.com/videojs/video.js/issues/8410)) ([68f1429](https://github.com/videojs/video.js/commit/68f1429)), closes [#8409](https://github.com/videojs/video.js/issues/8409) +* Resolves captions sizing issue when minified ([#8442](https://github.com/videojs/video.js/issues/8442)) ([9267c46](https://github.com/videojs/video.js/commit/9267c46)) +* **types:** improves quality of typescript definitions ([#8218](https://github.com/videojs/video.js/issues/8218)) ([781eb43](https://github.com/videojs/video.js/commit/781eb43)) +* **types:** use typeof for registerComponent and registerPlugin ([#8451](https://github.com/videojs/video.js/issues/8451)) ([2c36d25](https://github.com/videojs/video.js/commit/2c36d25)) + +### Chores + +* **types:** fix issues in exported types ([#8333](https://github.com/videojs/video.js/issues/8333)) ([bad086d](https://github.com/videojs/video.js/commit/bad086d)) +* update VHS and mux.js versions ([#8462](https://github.com/videojs/video.js/issues/8462)) ([9701de9](https://github.com/videojs/video.js/commit/9701de9)) + # [8.6.0](https://github.com/videojs/video.js/compare/v8.5.3...v8.6.0) (2023-09-25) diff --git a/node_modules/video.js/core.es.js b/node_modules/video.js/core.es.js index 0a6a82d7f9..8e6a3ba32e 100644 --- a/node_modules/video.js/core.es.js +++ b/node_modules/video.js/core.es.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -17,7 +17,7 @@ import safeParseTuple from 'safe-json-parse/tuple'; import XHR from '@videojs/xhr'; import vtt from 'videojs-vtt.js'; -var version = "8.6.0"; +var version = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1997,7 +1997,7 @@ function _cleanUpEvents(elem, type) { * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2720,7 +2720,7 @@ class EventTarget { /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2737,7 +2737,7 @@ class EventTarget { * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget.prototype.allowedEvents_ = {}; @@ -3973,7 +3973,6 @@ class Component { /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -3984,6 +3983,7 @@ class Component { * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4438,9 +4438,8 @@ class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4456,9 +4455,8 @@ class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4504,7 +4502,7 @@ class Component { * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4679,7 +4677,7 @@ class Component { * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4691,7 +4689,7 @@ class Component { * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6316,7 +6314,7 @@ class TrackList extends EventTarget { * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6366,7 +6364,7 @@ class AudioTrackList extends TrackList { /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -7469,7 +7467,9 @@ class TextTrack extends Track { */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -7512,6 +7512,7 @@ class TextTrack extends Track { /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -7770,6 +7771,10 @@ class HTMLTrackElement extends EventTarget { }); } } + +/** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -7863,7 +7868,7 @@ ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8299,7 +8304,7 @@ class Tech extends Component { * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9063,7 +9068,7 @@ Tech.withSourceHandlers = function (_Tech) { * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9088,7 +9093,7 @@ Tech.withSourceHandlers = function (_Tech) { /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9143,7 +9148,7 @@ Tech.withSourceHandlers = function (_Tech) { * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -9922,7 +9927,7 @@ class ClickableComponent extends Component { * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -10678,7 +10683,7 @@ class Button extends ClickableComponent { * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -10732,7 +10737,7 @@ class BigPlayButton extends Button { * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -10743,7 +10748,7 @@ class BigPlayButton extends Button { const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -10763,10 +10768,29 @@ class BigPlayButton extends Button { this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -10852,7 +10876,7 @@ class CloseButton extends Button { * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -14479,7 +14503,7 @@ class Menu extends Component { /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15076,7 +15100,7 @@ class MenuItem extends ClickableComponent { * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20135,8 +20159,8 @@ const DEFAULT_BREAKPOINTS = { * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -21875,7 +21899,9 @@ class Player extends Component { */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -22831,7 +22857,7 @@ class Player extends Component { * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25035,7 +25061,7 @@ const markPluginAsActive = (player, name) => { * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25188,7 +25214,7 @@ class Plugin { * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25207,7 +25233,7 @@ class Plugin { * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25423,7 +25449,7 @@ Player.prototype.hasPlugin = function (name) { * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25431,14 +25457,14 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25446,11 +25472,11 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -25777,10 +25803,10 @@ videojs.getComponent = Component.getComponent; * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -25863,9 +25889,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin; * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin +* + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); diff --git a/node_modules/video.js/core.js b/node_modules/video.js/core.js index e6dbd84b57..d35ddb286e 100644 --- a/node_modules/video.js/core.js +++ b/node_modules/video.js/core.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -28,7 +28,7 @@ var safeParseTuple__default = /*#__PURE__*/_interopDefaultLegacy(safeParseTuple) var XHR__default = /*#__PURE__*/_interopDefaultLegacy(XHR); var vtt__default = /*#__PURE__*/_interopDefaultLegacy(vtt); -var version = "8.6.0"; +var version = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -2008,7 +2008,7 @@ function _cleanUpEvents(elem, type) { * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2731,7 +2731,7 @@ class EventTarget { /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2748,7 +2748,7 @@ class EventTarget { * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget.prototype.allowedEvents_ = {}; @@ -3984,7 +3984,6 @@ class Component { /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -3995,6 +3994,7 @@ class Component { * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4449,9 +4449,8 @@ class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4467,9 +4466,8 @@ class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4515,7 +4513,7 @@ class Component { * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4690,7 +4688,7 @@ class Component { * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4702,7 +4700,7 @@ class Component { * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6327,7 +6325,7 @@ class TrackList extends EventTarget { * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6377,7 +6375,7 @@ class AudioTrackList extends TrackList { /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -7480,7 +7478,9 @@ class TextTrack extends Track { */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window__default["default"].vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -7523,6 +7523,7 @@ class TextTrack extends Track { /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -7781,6 +7782,10 @@ class HTMLTrackElement extends EventTarget { }); } } + +/** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -7874,7 +7879,7 @@ ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8310,7 +8315,7 @@ class Tech extends Component { * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9074,7 +9079,7 @@ Tech.withSourceHandlers = function (_Tech) { * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9099,7 +9104,7 @@ Tech.withSourceHandlers = function (_Tech) { /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9154,7 +9159,7 @@ Tech.withSourceHandlers = function (_Tech) { * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -9933,7 +9938,7 @@ class ClickableComponent extends Component { * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -10689,7 +10694,7 @@ class Button extends ClickableComponent { * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -10743,7 +10748,7 @@ class BigPlayButton extends Button { * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -10754,7 +10759,7 @@ class BigPlayButton extends Button { const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -10774,10 +10779,29 @@ class BigPlayButton extends Button { this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -10863,7 +10887,7 @@ class CloseButton extends Button { * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -14490,7 +14514,7 @@ class Menu extends Component { /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15087,7 +15111,7 @@ class MenuItem extends ClickableComponent { * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20146,8 +20170,8 @@ const DEFAULT_BREAKPOINTS = { * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -21886,7 +21910,9 @@ class Player extends Component { */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -22842,7 +22868,7 @@ class Player extends Component { * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25046,7 +25072,7 @@ const markPluginAsActive = (player, name) => { * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25199,7 +25225,7 @@ class Plugin { * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25218,7 +25244,7 @@ class Plugin { * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25434,7 +25460,7 @@ Player.prototype.hasPlugin = function (name) { * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25442,14 +25468,14 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25457,11 +25483,11 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -25788,10 +25814,10 @@ videojs.getComponent = Component.getComponent; * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -25874,9 +25900,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin; * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin +* + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); diff --git a/node_modules/video.js/dist/alt/video-js-cdn.css b/node_modules/video.js/dist/alt/video-js-cdn.css index 83ce07f73c..b3d4b98b0f 100644 --- a/node_modules/video.js/dist/alt/video-js-cdn.css +++ b/node_modules/video.js/dist/alt/video-js-cdn.css @@ -911,6 +911,10 @@ body.vjs-pip-window .video-js { background-color: rgba(43, 51, 63, 0.7); } +.video-js:not(.vjs-controls-disabled, .vjs-using-native-controls, .vjs-error) .vjs-control-bar.vjs-lock-showing { + display: flex !important; +} + .vjs-has-started .vjs-control-bar, .vjs-audio-only-mode .vjs-control-bar { display: flex; diff --git a/node_modules/video.js/dist/alt/video-js-cdn.min.css b/node_modules/video.js/dist/alt/video-js-cdn.min.css index 09c1ae64f8..0de9c2456a 100644 --- a/node_modules/video.js/dist/alt/video-js-cdn.min.css +++ b/node_modules/video.js/dist/alt/video-js-cdn.min.css @@ -1 +1 @@ -.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABUgAAsAAAAAItAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV33Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADwwAABdk9R/WHmhlYWQAABGcAAAAKwAAADYn8kSnaGhlYQAAEcgAAAAdAAAAJA+RCL1obXR4AAAR6AAAABMAAAC8Q44AAGxvY2EAABH8AAAAYAAAAGB7SIHGbWF4cAAAElwAAAAfAAAAIAFAAI9uYW1lAAASfAAAASUAAAIK1cf1oHBvc3QAABOkAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7xDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADbZCycAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1gUV5auc6urCmxEGrq6VRD6ATQP5dHPKK8GRIyoKApoEBUDAiGzGmdUfKNRM4qLZrUZdGKcGN/GZJKd0SyOWTbfbmZ2NxqzM5IxRtNZd78vwYlJdtREoO7sudVNq6PmmxmKqrqPU+eee173P80Bh39Cu9DOEY4DHZBK3i20D/QRLcfxbE5sEVtwLpZzclw4ibFIkSCJUcZ4MBpMnnzwuKNsGWBL5i3qy6kO2dVpvUpKbkAP9fq62rdeGJ+TM/7C1nbIutfuWrWk5ci4zMxxR1qW/N+9JsmCGXj9VKWhFx/6tr/nz78INDm2C9yPF/fDcxLuyKxLBZ1ZBz2QTi+RSkiH5RrDQJ/GgGQadX9m0YSURs7GpSG905Zsk41uj14yul1OtieZ7QUk5GRG/YiS7PYYPSAZNRed9sq3+bOpz00rKb7pe/ZEZvbALxZAHT3AFoH8GXP3rt67QFn40kt8W13FjLTDb48c+fSi5/7h0P4dL5yz7DPtbmgmYxfQA9RL2+EOfTcvdp+1vmuBpvOll1As1S6ak0IvJzC7sKWJFtJgBd2uWcg+0Zyg7dzQfhcjXRgXGZRf5/a4A58IDU777Nl252AUk4m2ByRRjqTNqIDCEJeAnU3iCFwrkrNwXEzg4yFevBwypzxkcX+AIfk3VEKl3XmWbT8788SzvpvFJaiOezL6QyuSr9VNf97csNu0z3LuhR0wATUxZAfVBwVOy+nQFhxYdWaXlXe4HC4zWGWzzsrLDtmhI9pOWOHv7PTT7XybH1Z0+v2d5Abd3kmG+TsH23CS/KwTxx/JkzEwx6jcQOUc42LLwHJ/J93uZ9ygh3HuZGwqsY9dWDHQ58dxNqyqKRQTYdxwTubiOSs3FiMDkq0WSZQgCT0GBDOg2lxOAd1FlPVGs4AKBAcYHHaP2wPkHaivmLF5zYqnIZrvcHx5gN4k/6tchNW1DtdgNL2KrxEkS/kfnIHoVnp1VjmjpTf5r0lTzLj0mdS28tX+XGorU364eMPmnWVl8J36nlKGw3CZhjEiuMw8h8mKvhGD+4/lElBWjAhLJMg6fTw4zPZ8cOmcGQBm2Qxml1nAm13CpYGq1JKUlJJUzQn1PTAO0mgv6VMMpA/DuRfSWEu4lDIxdbAtdWIKvnn2Vk766CWfz9fpY0sH/UpdP50rfszaVpdVRmvIejEdLMk45s4Bu0EWHjeOySmFyZSiMahvZdNSn29peoI/YexYfKQTLeurTXXwEVLeSfInTWHkkMaeUx7sBvOCSTSj3AlcKjfueyS36tCrXDlgRtF0etFq9jhc1kfKuBT/OwMr0F4UUTTh1AN0g20+H/ScPcsIEsYu9d/zN5PmjprPtNwI1ZZcDK6iC97Mcjp2y2aX36f+QbpGHrgRuHlXJ+Zf6PFRL2uQSp8vxHeF2IoRb8Rd2rhMzsNxSRmEuKK4JFnkojhMcx6jzqHzGMGFcW+MhBj0bhf6cowN+45I4LHvwT6fteu7M42wGRI/pxcg6/MZdEvt1U1XaulHFXuLmqov/MukvRVL35/b3ODM1+4aPjtzeK7zmUkV2h3DN54HaQ9GzJvxHRb6Ks2gB81fwqraT+A7GvZJrRLRofU6G0urNL+zFw3v0FaVDFxsKEZW56F31r6ip6vOL+FCObBPuIMRiXld9RaMdLzRIOGhPey2T9vA/35DmZPK9IWaT9d/WgOGMieYqJ/dzjLIhZU118gbysxrNUGefxD6UO/hyNNllpFTOIbx32kSFQctnweV5PxTMHLjRqiAN+fQE9gL+Xy5WB6MOS4GJJuYbDUHhcKDhHGRbLzOpjsjdM1+iwAZLGeieehACX2hhI7SjK/ZUTNrvVje31TxJiFBGYViWFkCn9PMeX9fS6qVbzfCj4fOCTzDnuWy2c4xA7mdNkA3RS9FH2VeqzdCBlixxbzXjvkHU1I8BOYFb1pZvPIHSSIj4svT8xpzcxtXN+ZKyjdDvbz08niiF3PqV9Tn5NST8vg48MTaY8E5xqSSIsWoWHo+LtAzxdH/GDUyp37CBEYfso04F/NlMTcDJUTpECLY0HFGQHImE8xsEUdgnrQlixIvGhJA1BvxpDHGxEMBYFeNOHcBJlSjwe2JcSfbBEsGOPPBHg/6SBBOCsLLw0SpUxod0Z1bFMfLkbQ3UiZxEyd0Dx8t+SRBu18Q9msFbI4e3p1THEfkSEh7kEJ5orR10qTWDvbgPWn5aWvCYyOAjwgXyjJi34uMjo58L25cmRAeQZWI2PA1QQLsPESAH8WGFwZZ4SPoR73BHPzIPMJj9AreBzKUmrH4todT18ANvi1oc3YGjUT/0j+ExUwq8PI9BLaCQIpvewwYu2evAG/Vo/5avPdY7o+BemLLXw3y+AdkzP9bpIxB1wm5EYq8fesHbPEPtm6HrHvtx4jcGPR8fDDpkZBefIjB46QnlUNRltv4Z/pO/J6dxEjhYAtmoMeq+GozvUVvNYOW3m6GCIhoprcfr97B8AcIQYsfD8ljUvGNjvkrpj0ETA48ZMIxCeqsRIsQALE0gi2GB+glSOfbOjW3GSBM9yPq8/rpJXrJDz0BPxV6xdN4uiCGDQed3WhgFkBUZEFsmeyyBpzXrm7UGTBZG8Lh5aubFufk5eUsbrrFGr7McYdbltxa0nKYqRKbQjvikXYkTGM0f2xuyM3Ly21oXnWfvf6I1BmZwfh7EWWIYsg2nHhsDhOnczhJcmI6eBAmy3jZ3RiJmKQR/JA99FcwsfaVbNDDyi1rL9NPj9hfo61wjM6BjzOLijLpeTgk/pL+ip6tfYWupzeOgPny2tcUu9J/9mhxJlgyi985NFRbvCVewXUNXLJaW0RxZqtRYtnfYdcYomXQWdnJHQA3jiEEkeTQWcWxdDP9IvvVWvo2TK553XEMEq+s69/QDU1Q7p0zxwsm9qS379whr8NI2PJqLUyGyfNeX3eFfnJU2U+uHR9cVV1IqgurqwuV44XVp0h2qN55X5XJwtk59yP0IZuHrqBOBIuIYhkcoT6Kx79Pu2HS/IPZIMOqLWs/pteOOk4NPgEb6QAIdAPsyZk5Mwd+wVaHMexJv719W7xCu2l37UG6lvYdBcvHa08p89741zd63phTRGqL5ggo6SlvdbWXzCqsPq78NnSu7wnKy2HNZbVoRCI7UJEOyRj+sPE002tOOY7Qa5fXboFWkLNeqYUSZRocp9XwSUZxcQZ9Hw6LV2pOoVmvHQEDbGIENEG5i6bLgMSM4n8+FNLTtAds99DaWEvgcf4o5SyYe9x+kF6/tGoTPAdRmS/XQIEy//QxKC2oqioAI3tS5auvxCtzT6y6RK8fhChYcwCJaMJhxc0vqSxQ/qmgsrKAlBZUHlauheTpvd9uj5DnLzJct6qfq5fXbYHVIGcfrIVJihbaVLu1wW7Vbs8zK0A8e9Jvb91S9cVMjPrazD6gpfeZTXzYbCFMcppVRsGMpp55OWgx1/3JeAxW1Y7AORgM/m3rWrsdLkQVmEVSU16cX/e7uvkvpqRiQsG06XJ0t64Tf+l0nG1dt025gyOIZlvq5u9KSU1N2TW/rsWnnMRPyTDkctbhvIcNvYIXWyLzdwYLoYesUbaQG4iK2cWO2gdpeUYLqDD0MUTOPhDIGnZEs58yArR86FznuWEsU4YDi2x26dA4klkn8Qa6vhk2QUfX4Jxm/ngX9r7ogn1dmlmwqZmuhxtdg9XN/DEcUgqb+9hMyNansfaQET2mcROCmGEMVqxm5u+h6kN2MOwgqykV2wH9yQG9DvVFU38Pogaf4FVuE62KI/oJ02RDdWW2w5dqQwU/8+N1q1DlvsL863u61KLE7x/o8w0VJQM/Y/SQ3unIrqxueEa1BqT5VFNsO7p39/UC771a77RowpaKe9nvJQIT1Pog5LGx8XblBKmCNGTf3xMogAQvPnz9PYKX/08sVDTG1OKUlOLUgS/UaZtm1NAaYTsl7i9ZQ+L6O4Rl0OGa577LuWvc+C+x96/vYh0lLBuM+7XwI/dTLtdT7v4d6rRTWDnku0IBrqFnZ5bVIqKP8lasJlithWnaLhTsr8qFJBulF/70p4undou36HeTJ5+jv1fCybeQ8nH3+Xv6aENczmOFlab+hqMDg1rLOt12A+tiUFrYDwQ6c3RUJp601nzegTNX6WlYAI2zSUV945F6zU56ZmZVQaWspWcIADxJ9GmljQUnL2p2Dpr5T8H+5KJFu+vqBq8qvyHRzStLHPEO5SPYCV9nZe0yZT2RcH0oHvegSzNEJ0oGWU8iQWM12dgPEugngVceGIwZgPFp0BiT1a0a3R5Rcot7ihfA1J/20v96jX7zmTX9s583H0kwx6WnLd09cXrR9LGroOa9sHNbdyz8wcKk5lqhaVFJZNwmqtw884MXNdvJujpBa3xzuSaZH9sxa06Z7x+HJSduPbdYHv/DgmEhfbehvlmGN7JUkcG78GDM12CeyFFTPNqVeNxC1gzjz+c2nVo63Xxs8rKJWXoBJM0tmEbfGm4qzpoOH3xpzQfyxLzW1gnE9NHo6tol1eMEic4ZVPrjnVi0kqAe2sQ2bgqupScaq8WGlUWgWHI51SKJl/UYT6zccNsCSkBtiVZLsiefuFSDYT3Fi8Zk7EUnmjTRYtsFeuDDJS05MW79M3mr3mla+d8dzac31KTPmBYfFiYSUef48PhPjm9ryZsSGZZkdNvzq0Y9rdNcwDq5Dg5C3QW+7UN64IKptvS3tvHbvu5c9pv1Exau21rc9LIpwpQwUjTq8576yeVDz5+4WZ1nXT43wV60rPLJbDp/UksNrP3iQ2SA63Pst058gOYDbhRnRUw8l/sRt4HbxPzO4WYpInCpuVgSbVh6JXuwnnJngKTTCwaPWmG5Xbhpm1U0Yt3FyBGpGYemPM77p2TD904JjgJ2QFpFLeYpGx8X15Qx1Zk31p5ki9ZLUuXE0lmuJlcakJMVLeFS1iIvrB8drY0aloilakqCZwzwRORtxlgwxS4IThggJd4TDxoiaAIT80fFPGrCPPru+puFn504P/ybr4ihA/6dKASLshEJic7xE8tmzu3KzA7TABBe8y5fNbWo3ilQn/SuFKM16b2l5bOeayqfGhYmhIulU+fVNDdWVv4NMzX10MBHyPR5uhWUu8D9P1VnIMt4nGNgZGBgAOJ/1bf64vltvjJwszOAwAOlmqvINEc/WJyDgQlEAQA+dgnjAHicY2BkYGBnAAGOPgaG//85+hkYGVCBPgBGJwNkAAAAeJxjYGBgYB/EmKMPtxwAhg4B0gAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAe4CLgKKAtAC/ANiA4wDqAPgBDAEsATaBQgFWgXABggGLgZwBqwG9gdOB4oH0ggqCHAIhgicCMgJJAlWCYgJrAnyCkAKdgrkC7J4nGNgZGBg0GdoZmBnAAEmIOYCQgaG/2A+AwAaqwHQAHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkXlT2zAQxf1C4thJAwRajt4HRy8VMwwfSJHXsQZZcnUQ+PYoTtwpM+wf2t9brWZ2n5JBsol58nJcYYAdDDFCijEy5JhgileYYRd72MccBzjEa7zBEY5xglO8xTu8xwd8xCd8xhd8xTec4RwXuMR3/MBP/MJvMPzBFYpk2Cr+OF0fTEgrFI1aHhxN740KDbEmeJpsWZlVj40s+45aLuv9KijlhCXSjLQnu/d/4UH6sWul1mRzFxZeekUuE7z10mg3qMtM1FGQddPSrLQyvJR6OaukItYXDp6pCJrmz0umqkau5pZ2hFmm7m+ImG5W2t0kZoJXUtPhVnYTbbdOBdeCVGqpJe7XKTqSbRK7zbdwXfR0U+SVsStuS3Y76em6+Ic3xYiHUppc04Nn0lMzay3dSxNcp8auDlWlaCi48yetFD7Y9USsx87G45cuop1ZxQUtjLnL4j53FO0a+5X08UXqQ7NQNo92R0XOz7sxWEnxN2TneJI8Acttu4Q=) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;margin:-.6em;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file +.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABUgAAsAAAAAItAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV33Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADwwAABdk9R/WHmhlYWQAABGcAAAAKwAAADYn8kSnaGhlYQAAEcgAAAAdAAAAJA+RCL1obXR4AAAR6AAAABMAAAC8Q44AAGxvY2EAABH8AAAAYAAAAGB7SIHGbWF4cAAAElwAAAAfAAAAIAFAAI9uYW1lAAASfAAAASUAAAIK1cf1oHBvc3QAABOkAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7xDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADbZCycAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1gUV5auc6urCmxEGrq6VRD6ATQP5dHPKK8GRIyoKApoEBUDAiGzGmdUfKNRM4qLZrUZdGKcGN/GZJKd0SyOWTbfbmZ2NxqzM5IxRtNZd78vwYlJdtREoO7sudVNq6PmmxmKqrqPU+eee173P80Bh39Cu9DOEY4DHZBK3i20D/QRLcfxbE5sEVtwLpZzclw4ibFIkSCJUcZ4MBpMnnzwuKNsGWBL5i3qy6kO2dVpvUpKbkAP9fq62rdeGJ+TM/7C1nbIutfuWrWk5ci4zMxxR1qW/N+9JsmCGXj9VKWhFx/6tr/nz78INDm2C9yPF/fDcxLuyKxLBZ1ZBz2QTi+RSkiH5RrDQJ/GgGQadX9m0YSURs7GpSG905Zsk41uj14yul1OtieZ7QUk5GRG/YiS7PYYPSAZNRed9sq3+bOpz00rKb7pe/ZEZvbALxZAHT3AFoH8GXP3rt67QFn40kt8W13FjLTDb48c+fSi5/7h0P4dL5yz7DPtbmgmYxfQA9RL2+EOfTcvdp+1vmuBpvOll1As1S6ak0IvJzC7sKWJFtJgBd2uWcg+0Zyg7dzQfhcjXRgXGZRf5/a4A58IDU777Nl252AUk4m2ByRRjqTNqIDCEJeAnU3iCFwrkrNwXEzg4yFevBwypzxkcX+AIfk3VEKl3XmWbT8788SzvpvFJaiOezL6QyuSr9VNf97csNu0z3LuhR0wATUxZAfVBwVOy+nQFhxYdWaXlXe4HC4zWGWzzsrLDtmhI9pOWOHv7PTT7XybH1Z0+v2d5Abd3kmG+TsH23CS/KwTxx/JkzEwx6jcQOUc42LLwHJ/J93uZ9ygh3HuZGwqsY9dWDHQ58dxNqyqKRQTYdxwTubiOSs3FiMDkq0WSZQgCT0GBDOg2lxOAd1FlPVGs4AKBAcYHHaP2wPkHaivmLF5zYqnIZrvcHx5gN4k/6tchNW1DtdgNL2KrxEkS/kfnIHoVnp1VjmjpTf5r0lTzLj0mdS28tX+XGorU364eMPmnWVl8J36nlKGw3CZhjEiuMw8h8mKvhGD+4/lElBWjAhLJMg6fTw4zPZ8cOmcGQBm2Qxml1nAm13CpYGq1JKUlJJUzQn1PTAO0mgv6VMMpA/DuRfSWEu4lDIxdbAtdWIKvnn2Vk766CWfz9fpY0sH/UpdP50rfszaVpdVRmvIejEdLMk45s4Bu0EWHjeOySmFyZSiMahvZdNSn29peoI/YexYfKQTLeurTXXwEVLeSfInTWHkkMaeUx7sBvOCSTSj3AlcKjfueyS36tCrXDlgRtF0etFq9jhc1kfKuBT/OwMr0F4UUTTh1AN0g20+H/ScPcsIEsYu9d/zN5PmjprPtNwI1ZZcDK6iC97Mcjp2y2aX36f+QbpGHrgRuHlXJ+Zf6PFRL2uQSp8vxHeF2IoRb8Rd2rhMzsNxSRmEuKK4JFnkojhMcx6jzqHzGMGFcW+MhBj0bhf6cowN+45I4LHvwT6fteu7M42wGRI/pxcg6/MZdEvt1U1XaulHFXuLmqov/MukvRVL35/b3ODM1+4aPjtzeK7zmUkV2h3DN54HaQ9GzJvxHRb6Ks2gB81fwqraT+A7GvZJrRLRofU6G0urNL+zFw3v0FaVDFxsKEZW56F31r6ip6vOL+FCObBPuIMRiXld9RaMdLzRIOGhPey2T9vA/35DmZPK9IWaT9d/WgOGMieYqJ/dzjLIhZU118gbysxrNUGefxD6UO/hyNNllpFTOIbx32kSFQctnweV5PxTMHLjRqiAN+fQE9gL+Xy5WB6MOS4GJJuYbDUHhcKDhHGRbLzOpjsjdM1+iwAZLGeieehACX2hhI7SjK/ZUTNrvVje31TxJiFBGYViWFkCn9PMeX9fS6qVbzfCj4fOCTzDnuWy2c4xA7mdNkA3RS9FH2VeqzdCBlixxbzXjvkHU1I8BOYFb1pZvPIHSSIj4svT8xpzcxtXN+ZKyjdDvbz08niiF3PqV9Tn5NST8vg48MTaY8E5xqSSIsWoWHo+LtAzxdH/GDUyp37CBEYfso04F/NlMTcDJUTpECLY0HFGQHImE8xsEUdgnrQlixIvGhJA1BvxpDHGxEMBYFeNOHcBJlSjwe2JcSfbBEsGOPPBHg/6SBBOCsLLw0SpUxod0Z1bFMfLkbQ3UiZxEyd0Dx8t+SRBu18Q9msFbI4e3p1THEfkSEh7kEJ5orR10qTWDvbgPWn5aWvCYyOAjwgXyjJi34uMjo58L25cmRAeQZWI2PA1QQLsPESAH8WGFwZZ4SPoR73BHPzIPMJj9AreBzKUmrH4todT18ANvi1oc3YGjUT/0j+ExUwq8PI9BLaCQIpvewwYu2evAG/Vo/5avPdY7o+BemLLXw3y+AdkzP9bpIxB1wm5EYq8fesHbPEPtm6HrHvtx4jcGPR8fDDpkZBefIjB46QnlUNRltv4Z/pO/J6dxEjhYAtmoMeq+GozvUVvNYOW3m6GCIhoprcfr97B8AcIQYsfD8ljUvGNjvkrpj0ETA48ZMIxCeqsRIsQALE0gi2GB+glSOfbOjW3GSBM9yPq8/rpJXrJDz0BPxV6xdN4uiCGDQed3WhgFkBUZEFsmeyyBpzXrm7UGTBZG8Lh5aubFufk5eUsbrrFGr7McYdbltxa0nKYqRKbQjvikXYkTGM0f2xuyM3Ly21oXnWfvf6I1BmZwfh7EWWIYsg2nHhsDhOnczhJcmI6eBAmy3jZ3RiJmKQR/JA99FcwsfaVbNDDyi1rL9NPj9hfo61wjM6BjzOLijLpeTgk/pL+ip6tfYWupzeOgPny2tcUu9J/9mhxJlgyi985NFRbvCVewXUNXLJaW0RxZqtRYtnfYdcYomXQWdnJHQA3jiEEkeTQWcWxdDP9IvvVWvo2TK553XEMEq+s69/QDU1Q7p0zxwsm9qS379whr8NI2PJqLUyGyfNeX3eFfnJU2U+uHR9cVV1IqgurqwuV44XVp0h2qN55X5XJwtk59yP0IZuHrqBOBIuIYhkcoT6Kx79Pu2HS/IPZIMOqLWs/pteOOk4NPgEb6QAIdAPsyZk5Mwd+wVaHMexJv719W7xCu2l37UG6lvYdBcvHa08p89741zd63phTRGqL5ggo6SlvdbWXzCqsPq78NnSu7wnKy2HNZbVoRCI7UJEOyRj+sPE002tOOY7Qa5fXboFWkLNeqYUSZRocp9XwSUZxcQZ9Hw6LV2pOoVmvHQEDbGIENEG5i6bLgMSM4n8+FNLTtAds99DaWEvgcf4o5SyYe9x+kF6/tGoTPAdRmS/XQIEy//QxKC2oqioAI3tS5auvxCtzT6y6RK8fhChYcwCJaMJhxc0vqSxQ/qmgsrKAlBZUHlauheTpvd9uj5DnLzJct6qfq5fXbYHVIGcfrIVJihbaVLu1wW7Vbs8zK0A8e9Jvb91S9cVMjPrazD6gpfeZTXzYbCFMcppVRsGMpp55OWgx1/3JeAxW1Y7AORgM/m3rWrsdLkQVmEVSU16cX/e7uvkvpqRiQsG06XJ0t64Tf+l0nG1dt025gyOIZlvq5u9KSU1N2TW/rsWnnMRPyTDkctbhvIcNvYIXWyLzdwYLoYesUbaQG4iK2cWO2gdpeUYLqDD0MUTOPhDIGnZEs58yArR86FznuWEsU4YDi2x26dA4klkn8Qa6vhk2QUfX4Jxm/ngX9r7ogn1dmlmwqZmuhxtdg9XN/DEcUgqb+9hMyNansfaQET2mcROCmGEMVqxm5u+h6kN2MOwgqykV2wH9yQG9DvVFU38Pogaf4FVuE62KI/oJ02RDdWW2w5dqQwU/8+N1q1DlvsL863u61KLE7x/o8w0VJQM/Y/SQ3unIrqxueEa1BqT5VFNsO7p39/UC771a77RowpaKe9nvJQIT1Pog5LGx8XblBKmCNGTf3xMogAQvPnz9PYKX/08sVDTG1OKUlOLUgS/UaZtm1NAaYTsl7i9ZQ+L6O4Rl0OGa577LuWvc+C+x96/vYh0lLBuM+7XwI/dTLtdT7v4d6rRTWDnku0IBrqFnZ5bVIqKP8lasJlithWnaLhTsr8qFJBulF/70p4undou36HeTJ5+jv1fCybeQ8nH3+Xv6aENczmOFlab+hqMDg1rLOt12A+tiUFrYDwQ6c3RUJp601nzegTNX6WlYAI2zSUV945F6zU56ZmZVQaWspWcIADxJ9GmljQUnL2p2Dpr5T8H+5KJFu+vqBq8qvyHRzStLHPEO5SPYCV9nZe0yZT2RcH0oHvegSzNEJ0oGWU8iQWM12dgPEugngVceGIwZgPFp0BiT1a0a3R5Rcot7ihfA1J/20v96jX7zmTX9s583H0kwx6WnLd09cXrR9LGroOa9sHNbdyz8wcKk5lqhaVFJZNwmqtw884MXNdvJujpBa3xzuSaZH9sxa06Z7x+HJSduPbdYHv/DgmEhfbehvlmGN7JUkcG78GDM12CeyFFTPNqVeNxC1gzjz+c2nVo63Xxs8rKJWXoBJM0tmEbfGm4qzpoOH3xpzQfyxLzW1gnE9NHo6tol1eMEic4ZVPrjnVi0kqAe2sQ2bgqupScaq8WGlUWgWHI51SKJl/UYT6zccNsCSkBtiVZLsiefuFSDYT3Fi8Zk7EUnmjTRYtsFeuDDJS05MW79M3mr3mla+d8dzac31KTPmBYfFiYSUef48PhPjm9ryZsSGZZkdNvzq0Y9rdNcwDq5Dg5C3QW+7UN64IKptvS3tvHbvu5c9pv1Exau21rc9LIpwpQwUjTq8576yeVDz5+4WZ1nXT43wV60rPLJbDp/UksNrP3iQ2SA63Pst058gOYDbhRnRUw8l/sRt4HbxPzO4WYpInCpuVgSbVh6JXuwnnJngKTTCwaPWmG5Xbhpm1U0Yt3FyBGpGYemPM77p2TD904JjgJ2QFpFLeYpGx8X15Qx1Zk31p5ki9ZLUuXE0lmuJlcakJMVLeFS1iIvrB8drY0aloilakqCZwzwRORtxlgwxS4IThggJd4TDxoiaAIT80fFPGrCPPru+puFn504P/ybr4ihA/6dKASLshEJic7xE8tmzu3KzA7TABBe8y5fNbWo3ilQn/SuFKM16b2l5bOeayqfGhYmhIulU+fVNDdWVv4NMzX10MBHyPR5uhWUu8D9P1VnIMt4nGNgZGBgAOJ/1bf64vltvjJwszOAwAOlmqvINEc/WJyDgQlEAQA+dgnjAHicY2BkYGBnAAGOPgaG//85+hkYGVCBPgBGJwNkAAAAeJxjYGBgYB/EmKMPtxwAhg4B0gAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAe4CLgKKAtAC/ANiA4wDqAPgBDAEsATaBQgFWgXABggGLgZwBqwG9gdOB4oH0ggqCHAIhgicCMgJJAlWCYgJrAnyCkAKdgrkC7J4nGNgZGBg0GdoZmBnAAEmIOYCQgaG/2A+AwAaqwHQAHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkXlT2zAQxf1C4thJAwRajt4HRy8VMwwfSJHXsQZZcnUQ+PYoTtwpM+wf2t9brWZ2n5JBsol58nJcYYAdDDFCijEy5JhgileYYRd72MccBzjEa7zBEY5xglO8xTu8xwd8xCd8xhd8xTec4RwXuMR3/MBP/MJvMPzBFYpk2Cr+OF0fTEgrFI1aHhxN740KDbEmeJpsWZlVj40s+45aLuv9KijlhCXSjLQnu/d/4UH6sWul1mRzFxZeekUuE7z10mg3qMtM1FGQddPSrLQyvJR6OaukItYXDp6pCJrmz0umqkau5pZ2hFmm7m+ImG5W2t0kZoJXUtPhVnYTbbdOBdeCVGqpJe7XKTqSbRK7zbdwXfR0U+SVsStuS3Y76em6+Ic3xYiHUppc04Nn0lMzay3dSxNcp8auDlWlaCi48yetFD7Y9USsx87G45cuop1ZxQUtjLnL4j53FO0a+5X08UXqQ7NQNo92R0XOz7sxWEnxN2TneJI8Acttu4Q=) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;margin:-.6em;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file diff --git a/node_modules/video.js/dist/alt/video.core.js b/node_modules/video.js/dist/alt/video.core.js index 6b4ab74ed7..e7ed5cbb2f 100644 --- a/node_modules/video.js/dist/alt/video.core.js +++ b/node_modules/video.js/dist/alt/video.core.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -16,7 +16,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojs = factory()); })(this, (function () { 'use strict'; - var version = "8.6.0"; + var version = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1996,7 +1996,7 @@ * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2719,7 +2719,7 @@ /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2736,7 +2736,7 @@ * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget.prototype.allowedEvents_ = {}; @@ -4169,7 +4169,6 @@ /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4180,6 +4179,7 @@ * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4634,9 +4634,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4652,9 +4651,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4700,7 +4698,7 @@ * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4875,7 +4873,7 @@ * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4887,7 +4885,7 @@ * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6524,7 +6522,7 @@ * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6574,7 +6572,7 @@ /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -8012,7 +8010,9 @@ */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -8055,6 +8055,7 @@ /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -8313,6 +8314,10 @@ }); } } + + /** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -10110,7 +10115,7 @@ * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -10546,7 +10551,7 @@ * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -11310,7 +11315,7 @@ * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -11335,7 +11340,7 @@ /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -11390,7 +11395,7 @@ * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -12169,7 +12174,7 @@ * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -12925,7 +12930,7 @@ * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -12979,7 +12984,7 @@ * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -12990,7 +12995,7 @@ const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -13010,10 +13015,29 @@ this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -13099,7 +13123,7 @@ * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -16726,7 +16750,7 @@ /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -17323,7 +17347,7 @@ * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -22382,8 +22406,8 @@ * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -24122,7 +24146,9 @@ */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -25078,7 +25104,7 @@ * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -27282,7 +27308,7 @@ * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -27435,7 +27461,7 @@ * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -27454,7 +27480,7 @@ * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -27670,7 +27696,7 @@ * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27678,14 +27704,14 @@ * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27693,11 +27719,11 @@ * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -28024,10 +28050,10 @@ * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -28110,9 +28136,11 @@ * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); diff --git a/node_modules/video.js/dist/alt/video.core.min.js b/node_modules/video.js/dist/alt/video.core.min.js index 397c548a97..37c3663429 100644 --- a/node_modules/video.js/dist/alt/video.core.min.js +++ b/node_modules/video.js/dist/alt/video.core.min.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -9,7 +9,7 @@ * Available under Apache License Version 2.0 * */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var D="8.6.0";const B={},H=function(e,t){return B[e]=B[e]||[],t&&(B[e]=B[e].concat(t)),B[e]};function R(e,t){return!((t=H(e).indexOf(t))<=-1||(B[e]=B[e].slice(),B[e].splice(t,1),0))}const F={prefixed:!0};var V=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],z=V[0];let q;for(let e=0;e{var e,s=h.levels[s],r=new RegExp(`^(${s})$`);let n=l;if("log"!==t&&i.unshift(t.toUpperCase()+":"),c&&(n="%c"+l,i.unshift(c)),i.unshift(n+":"),d&&(d.push([].concat(i)),e=d.length-1e3,d.splice(0,0i(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==s?s:a),o.createNewLogger=(e,t,s)=>i(e,t,s),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>d?[].concat(d):[],o.history.filter=t=>(d||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{d&&(d.length=0)},o.history.disable=()=>{null!==d&&(d.length=0,d=null)},o.history.enable=()=>{null===d&&(d=[])},o.error=(...e)=>s("error",t,e),o.warn=(...e)=>s("warn",t,e),o.debug=(...e)=>s("debug",t,e),o}("VIDEOJS"),U=l.createLogger,K=Object.prototype.toString;function W(t,s){$(t).forEach(e=>s(t[e],e))}function X(s,i,e=0){return $(s).reduce((e,t)=>i(e,s[t],t),e)}function n(e){return!!e&&"object"==typeof e}function G(e){return n(e)&&"[object Object]"===K.call(e)&&e.constructor===Object}function h(...e){const s={};return e.forEach(e=>{e&&W(e,(e,t)=>{G(e)?(G(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function Y(e={}){var t,s=[];for(const i in e)e.hasOwnProperty(i)&&(t=e[i],s.push(t));return s}function Q(t,s,i,e=!0){const r=e=>Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,s,n)}var J=Object.freeze({__proto__:null,each:W,reduce:X,isObject:n,isPlain:G,merge:h,values:Y,defineLazyProperty:Q});let Z=!1,ee=null,o=!1,te,se=!1,ie=!1,re=!1,c=!1,ne=null,ae=null,oe=null,le=!1,he=!1,ce=!1,de=!1;const ue=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var pe,e=window.navigator&&window.navigator.userAgentData;if(e&&(o="Android"===e.platform,ie=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),re=Boolean(e.brands.find(e=>"Chromium"===e.brand)),c=!ie&&re,ne=ae=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,he="Windows"===e.platform),!re){const N=window.navigator&&window.navigator.userAgent||"";Z=/iPod/i.test(N),ee=(e=N.match(/OS (\d+)_/i))&&e[1]?e[1]:null,o=/Android/i.test(N),te=(e=N.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ct=e[1]&&parseFloat(e[1]),pe=e[2]&&parseFloat(e[2]),ct&&pe?parseFloat(e[1]+"."+e[2]):ct||null):null,se=/Firefox/i.test(N),ie=/Edg/i.test(N),re=/Chrome/i.test(N)||/CriOS/i.test(N),c=!ie&&re,ne=ae=(pe=N.match(/(Chrome|CriOS)\/(\d+)/))&&pe[2]?parseFloat(pe[2]):null,oe=function(){var e=/MSIE\s(\d+)\.\d/.exec(N);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(N)&&/rv:11.0/.test(N)?11:t}(),le=/Safari/i.test(N)&&!c&&!o&&!ie,he=/Windows/i.test(N),ce=/iPad/i.test(N)||le&&ue&&!/iPhone/i.test(N),de=/iPhone/i.test(N)&&!ce}const u=de||ce||Z,ge=(le||u)&&!c;e=Object.freeze({__proto__:null,get IS_IPOD(){return Z},get IOS_VERSION(){return ee},get IS_ANDROID(){return o},get ANDROID_VERSION(){return te},get IS_FIREFOX(){return se},get IS_EDGE(){return ie},get IS_CHROMIUM(){return re},get IS_CHROME(){return c},get CHROMIUM_VERSION(){return ne},get CHROME_VERSION(){return ae},get IE_VERSION(){return oe},get IS_SAFARI(){return le},get IS_WINDOWS(){return he},get IS_IPAD(){return ce},get IS_IPHONE(){return de},TOUCH_ENABLED:ue,IS_IOS:u,IS_ANY_SAFARI:ge});function me(e){return"string"==typeof e&&Boolean(e.trim())}function ve(){return document===window.document}function _e(e){return n(e)&&1===e.nodeType}function fe(){try{return window.parent!==window.self}catch(e){return!0}}function ye(s){return function(e,t){return me(e)?(t=_e(t=me(t)?document.querySelector(t):t)?t:document)[s]&&t[s](e):document[s](null)}}function p(e="div",s={},t={},i){const r=document.createElement(e);return Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];"textContent"===e?be(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),i&&Re(r,i),r}function be(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Te(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function we(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ee(t,e,s){return"boolean"!=typeof(s="function"==typeof s?s(t,e):s)&&(s=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,s)),t}function Se(s,i){Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];null===t||"undefined"==typeof t||!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})}function xe(e){var s={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(s[e]=t[e])}),s.height||(s.height=parseFloat($e(e,"height"))),s.width||(s.width=parseFloat($e(e,"width"))),s}}function Le(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,s=e.offsetHeight;let i=0,r=0;for(;e.offsetParent&&e!==document[F.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:s}}function Ne(t,e){var s={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var i,r=$e(e,"transform");/^matrix/.test(r)?(i=r.slice(7,-1).split(/,\s/).map(Number),s.x+=i[4],s.y+=i[5]):/^matrix3d/.test(r)&&(i=r.slice(9,-1).split(/,\s/).map(Number),s.x+=i[12],s.y+=i[13]),e=e.parentNode}}var n={},a=Le(e.target),t=Le(t),o=t.width,l=t.height;let h=e.offsetY-(t.top-a.top),c=e.offsetX-(t.left-a.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-t.left,h=e.changedTouches[0].pageY+t.top,u)&&(c-=s.x,h-=s.y),n.y=1-Math.max(0,Math.min(1,h/l)),n.x=Math.max(0,Math.min(1,c/o)),n}function De(e){return n(e)&&3===e.nodeType}function Be(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function He(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>_e(e="function"==typeof e?e():e)||De(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function Re(t,e){return He(e).forEach(e=>t.appendChild(e)),t}function Fe(e,t){return Re(Be(e),t)}function Ve(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const ze=ye("querySelector"),qe=ye("querySelectorAll");function $e(t,s){if(!t||!s)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(s)||e[s]:""}}function Ue(i){[...document.styleSheets].forEach(t=>{try{var s=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=s,i.document.head.appendChild(e)}catch(e){s=document.createElement("link");s.rel="stylesheet",s.type=t.type,s.media=t.media.mediaText,s.href=t.href,i.document.head.appendChild(s)}})}var Ke=Object.freeze({__proto__:null,isReal:ve,isEl:_e,isInFrame:fe,createEl:p,textContent:be,prependTo:Te,hasClass:ke,addClass:Ce,removeClass:we,toggleClass:Ee,setAttributes:Se,getAttributes:xe,getAttribute:je,setAttribute:Pe,removeAttribute:Ie,blockTextSelection:Me,unblockTextSelection:Ae,getBoundingClientRect:Oe,findPosition:Le,getPointerPosition:Ne,isTextNode:De,emptyEl:Be,normalizeContent:He,appendContent:Re,insertContent:Fe,isSingleLeftClick:Ve,$:ze,$$:qe,computedStyle:$e,copyStyleSheetsToWindow:Ue});let We=!1,Xe;function Ge(){if(!1!==Xe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),s=Array.prototype.slice.call(document.getElementsByTagName("video-js")),i=e.concat(t,s);if(i&&0=i&&(s(...e),r=t)}}function ht(i,r,n,a=window){let o;function e(){const e=this,t=arguments;let s=function(){o=null,s=null,n||i.apply(e,t)};!o&&n&&i.apply(e,t),a.clearTimeout(o),o=a.setTimeout(s,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ct=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:f,throttle:r,debounce:ht});let dt;class s{on(e,t){var s=this.addEventListener;this.addEventListener=()=>{},v(this,e,t),this.addEventListener=s}off(e,t){_(this,e,t)}one(e,t){var s=this.addEventListener;this.addEventListener=()=>{},at(this,e,t),this.addEventListener=s}any(e,t){var s=this.addEventListener;this.addEventListener=()=>{},ot(this,e,t),this.addEventListener=s}trigger(e){var t=e.type||e;e=st(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),nt(this,e)}queueTrigger(e){dt=dt||new Map;const t=e.type||e;let s=dt.get(this);s||(s=new Map,dt.set(this,s));var i=s.get(t),i=(s.delete(t),window.clearTimeout(i),window.setTimeout(()=>{s.delete(t),0===s.size&&(s=null,dt.delete(this)),this.trigger(e)},0));s.set(t,i)}}s.prototype.allowedEvents_={},s.prototype.addEventListener=s.prototype.on,s.prototype.removeEventListener=s.prototype.off,s.prototype.dispatchEvent=s.prototype.trigger;const ut=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),pt=t=>t instanceof s||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),gt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,mt=(e,t,s)=>{if(!e||!e.nodeName&&!pt(e))throw new Error(`Invalid target for ${ut(t)}#${s}; must be a DOM node or evented object.`)},vt=(e,t,s)=>{if(!gt(e))throw new Error(`Invalid event type for ${ut(t)}#${s}; must be a non-empty string or array.`)},_t=(e,t,s)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${ut(t)}#${s}; must be a function.`)},ft=(e,t,s)=>{var i=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return i?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,mt(r,e,s),vt(n,e,s),_t(a,e,s),a=f(e,a),{isTargetingSelf:i,target:r,type:n,listener:a}},yt=(e,t,s,i)=>{mt(e,e,t),e.nodeName?lt[t](e,s,i):e[t](s,i)},bt={on(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"on");if(yt(s,"on",i,r),!t){const n=()=>this.off(s,i,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,yt(this,"on","dispose",n),yt(s,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"one");if(t)yt(s,"one",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,yt(s,"one",i,n)}},any(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"any");if(t)yt(s,"any",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,yt(s,"any",i,n)}},off(e,t,s){!e||gt(e)?_(this.eventBusEl_,e,t):(e=e,t=t,mt(e,this,"off"),vt(t,this,"off"),_t(s,this,"off"),s=f(this,s),this.off("dispose",s),e.nodeName?(_(e,t,s),_(e,"dispose",s)):pt(e)&&(e.off(t,s),e.off("dispose",s)))},trigger(e,t){mt(this.eventBusEl_,this,"trigger");var s=e&&"string"!=typeof e?e.type:e;if(gt(s))return nt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${ut(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function Tt(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=p("span",{className:"vjs-event-bus"});Object.assign(e,bt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&g.has(e)&&g.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const kt={state:{},setState(e){"function"==typeof e&&(e=e());let s;return W(e,(e,t)=>{this.state[t]!==e&&((s=s||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),s&&pt(this)&&this.trigger({changes:s,type:"statechanged"}),s}};function Ct(e,t){Object.assign(e,kt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&pt(e)&&e.on("statechanged",e.handleStateChanged)}function wt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function y(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Et(e,t){return y(e)===y(t)}var St=Object.freeze({__proto__:null,toLowerCase:wt,toTitleCase:y,titleCaseEquals:Et}),xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function jt(e,t){return e(t={exports:{}},t.exports),t.exports}var a=jt(function(e,t){function s(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),i[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}s.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var s=i[t.toLowerCase()];if(s)return s===e;if(s=r[t.toLowerCase()])return s===e}else if("number"==typeof t)return t===e;return!1}};for(var i=(t=e.exports=s).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)i[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)i[n-48]=n;for(n=1;n<13;n++)i["f"+n]=n+111;for(n=0;n<10;n++)i["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in i)o[i[n]]=n;for(a in r)i[a]=r[a]});a.code,a.codes,a.aliases,a.names,a.title;class b{constructor(e,t,s){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=h({},this.options_),t=this.options_=h(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+m++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(Tt(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Ct(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(s),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=h(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,s){return p(e,t,s)}localize(e,i,t=e){var s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],s=s&&s.split("-")[0],r=r&&r[s];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=i?a.replace(/\{(\d+)\}/g,function(e,t){t=i[t-1];let s="undefined"==typeof t?e:t;return s}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let s=this;for(let e=0;e{let t,s;return s="string"==typeof e?(t=e,i[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:s}}).filter(e=>{e=b.getComponent(e.opts.componentClass||y(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let s=e.opts;!1!==(s=void 0!==r[t]?r[t]:s)&&((s=!0===s?{}:s).playerOptions=this.options_.playerOptions,e=this.addChild(t,s))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(s)&&this.setTimeoutIds_.delete(s),e()},t),this.setTimeoutIds_.add(s),s}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=f(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=f(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var s;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=f(this,t),s=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,s),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,s])=>{this[e].forEach((e,t)=>this[s](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var s=b.getComponent("Tech"),s=s&&s.isTech(e),i=b===e||b.prototype.isPrototypeOf(e.prototype);if(s||!i){let e;throw e=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=y(t),b.components_||(b.components_={});i=b.getComponent("Player");if("Player"===t&&i&&i.players){const r=i.players;s=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return b.components_[t]=e,b.components_[wt(t)]=e}static getComponent(e){if(e&&b.components_)return b.components_[e]}}function Pt(e,t,s,i){var r=i,n=s.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function T(e,t){return Array.isArray(e)?It(e):void 0===e||void 0===t?It():It([[e,t]])}b.registerComponent("Component",b);function Mt(e,t){e=e<0?0:e;let s=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:i=s="-")||0s&&(n=s),i+=n-r;return i/s}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:n(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Ft(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,s)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Vt=function(e){var t=e.$$("track");const s=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Ft(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===s.indexOf(e)}).map(Ft))},zt=function(e,s){return e.forEach(function(e){const t=s.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),s.textTracks()};Ft;const qt="vjs-modal-dialog";class $t extends b{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=p("div",{className:qt+"-content"},{role:"document"}),this.descEl_=p("p",{className:qt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),be(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return qt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var s,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(s=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),s=t.parentNode,i=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,s.removeChild(t),this.empty(),Fe(t,e),this.trigger("modalfill"),i?s.insertBefore(t,i):s.appendChild(t),this.getChild("closeButton"));e&&s.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),Be(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),a.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(a.isEventKey(e,"Tab")){var s=this.focusableEls_(),i=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}$t.prototype.options_={pauseOnOpen:!0,temporary:!0},b.registerComponent("ModalDialog",$t);class Ut extends s{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},pt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(s){let i;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class Gt{constructor(e){Gt.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let s=0;function i(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),s.flush()}function fs(e,i){var t={uri:e};(e=is(e))&&(t.cors=e),(e="use-credentials"===i.tech_.crossOrigin())&&(t.withCredentials=e),cs(t,f(this,function(e,t,s){if(e)return l.error(e,t);i.loaded_=!0,"function"!=typeof window.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return _s(s,i);l.error("vttjs failed to load, stopping trying to process "+i.src)}):_s(s,i)}))}class ys extends es{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=h(e,{kind:Jt[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Zt[e.mode]||"disabled";const s=e.default,i=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new Gt(this.cues_)),n=new Gt(this.activeCues_);let a=!1;this.timeupdateHandler=f(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return t},set(e){Zt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||fs(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var s=this.tech_.currentTime(),i=[];for(let e=0,t=this.cues.length;e=s&&i.push(r)}if(a=!1,i.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=ks.LOADED,this.trigger({type:"load",target:this})})}}ks.prototype.allowedEvents_={load:"load"},ks.NONE=0,ks.LOADING=1,ks.LOADED=2,ks.ERROR=3;const w={audio:{ListClass:class extends Ut{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){Kt(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&Kt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Kt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:bs,capitalName:"Audio"},video:{ListClass:class extends Ut{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){Wt(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,Wt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Ts,capitalName:"Video"},text:{ListClass:Xt,TrackClass:ys,capitalName:"Text"}},Cs=(Object.keys(w).forEach(function(e){w[e].getterName=e+"Tracks",w[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:Xt,TrackClass:ys,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(s=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=s.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?c.length&&c[c.length-1]===o.substr(2).replace(">","")&&(c.pop(),h=h.parentNode):(i=xs(o.substr(1,o.length-2)))?(s=e.document.createProcessingInstruction("timestamp",i),h.appendChild(s)):(i=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=i[1],n=i[3],a=void 0,a=Ms[r],s=a?(a=e.document.createElement(a),(r=Os[r])&&n&&(a[r]=n.trim()),a):null)&&(r=h,Ls[(n=s).localName]&&Ls[n.localName]!==r.localName||(i[2]&&((a=i[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;As.hasOwnProperty(e)&&(e=As[e],s.style[t?"background-color":"color"]=e)}),s.className=a.join(" ")),c.push(i[1]),h.appendChild(s),h=s)):h.appendChild(e.document.createTextNode((n=o,Is.innerHTML=n,n=Is.textContent,Is.textContent="",n)));return l}var Ds=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Bs(e){var t=[],s="";if(e&&e.childNodes)for(n(t,e);s=function e(t){var s,i,r;return t&&t.length?(i=(s=t.pop()).textContent||s.innerText)?(r=i.match(/^.*(\n|\r)/))?r[t.length=0]:i:"ruby"===s.tagName?e(t):s.childNodes?(n(t,s),e(t)):void 0:null}(t);)for(var i=0;i=s[0]&&e<=s[1])return 1}}(s.charCodeAt(i)))return"rtl";return"ltr";function n(e,t){for(var s=t.childNodes.length-1;0<=s;s--)e.push(t.childNodes[s])}}function Hs(){}function Rs(e,t,s){Hs.call(this),this.cue=t,this.cueDiv=Ns(e,t.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(i,this.cueDiv),this.div=e.document.createElement("div"),i={direction:Bs(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:s.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function x(e){var t,s,i,r;e.div&&(t=e.div.offsetHeight,s=e.div.offsetWidth,i=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||i,this.height=e.height||t,this.bottom=e.bottom||i+(e.height||t),this.width=e.width||s,this.lineHeight=void 0!==r?r:e.lineHeight}function Fs(e,t,o,l){var s,i=new x(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,s=t.textTrackList,i=0,r=0;rd&&(c=c<0?-1:1,c*=Math.ceil(d/h)*h),n<0&&(c+=""===r.vertical?o.height:o.width,a=a.reverse()),i.move(u,c)}else{var p=i.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],i=new x(t)}d=function(e,t){for(var s,i=new x(e),r=1,n=0;ne.left&&this.tope.top},x.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},x.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},x.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},x.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},x.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,s=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,i=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||i,height:e.height||t,bottom:e.bottom||i+(e.height||t),width:e.width||s}},Vs.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Vs.convertCueToDOMTree=function(e,t){return e&&t?Ns(e,t):null};Vs.processCues=function(e,t,s){if(!e||!t||!s)return null;for(;s.firstChild;)s.removeChild(s.firstChild);var i=e.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",s.appendChild(i),function(e){for(var t=0;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),E.names.forEach(e=>{e=E[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new E.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(f(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return T(0,0)}bufferedPercent(){return Bt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(w.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let s=t.length;for(;s--;){var i=t[s];"text"===e&&this.removeRemoteTextTrack(i),t.removeTrack(i)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var s=e[t];this.removeRemoteTextTrack(s)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?T(0,0):T()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){w.names.forEach(e=>{var t=w[e];const s=()=>{this.trigger(e+"trackchange")},i=this[t.getterName]();i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),this.on("dispose",()=>{i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&G(Qs)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const s=this.textTracks(),e=this.remoteTextTracks(),t=e=>s.addTrack(e.track),i=e=>s.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",i),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(s.track)),s}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=m++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return j.canPlayType(e.type)}static isTech(e){return e.prototype instanceof j||e instanceof j||e===j}static registerTech(e,t){if(j.techs_||(j.techs_={}),!j.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!j.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(j.canPlaySource)return e=y(e),j.techs_[e]=t,j.techs_[wt(e)]=t,"Tech"!==e&&j.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return j.techs_&&j.techs_[e]?j.techs_[e]:(e=y(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}E.names.forEach(function(e){const t=E[e];j.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),j.prototype.featuresVolumeControl=!0,j.prototype.featuresMuteControl=!0,j.prototype.featuresFullscreenResize=!1,j.prototype.featuresPlaybackRate=!1,j.prototype.featuresProgressEvents=!1,j.prototype.featuresSourceset=!1,j.prototype.featuresTimeupdateEvents=!1,j.prototype.featuresNativeTextTracks=!1,j.prototype.featuresVideoFrameCallback=!1,j.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let s=r.sourceHandlers;s=s||(r.sourceHandlers=[]),void 0===t&&(t=s.length),s.splice(t,0,e)},r.canPlayType=function(t){var s,i=r.sourceHandlers||[];for(let e=0;efunction s(i={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)s(i,Js[t],r,n,a,o);else if(t){const h=oi(n,t);if(!h.setSource)return a.push(h),s(i,l,r,n,a,o);h.setSource(Object.assign({},i),function(e,t){if(e)return s(i,l,r,n,a,o);a.push(h),s(t,i.type===t.type?l:Js[t.type],r,n,a,o)})}else l.length?s(i,l,r,n,a,o):o?r(i,a):s(i,Js["*"],r,n,a,!0)}(t,Js[t.type],s,e),1)}function si(e,t,s,i=null){var r="call"+y(s),r=e.reduce(ai(r),i),i=r===ei,t=i?null:t[s](r),n=e,a=s,o=t,l=i;for(let e=n.length-1;0<=e;e--){var h=n[e];h[a]&&h[a](l,o)}return t}const ii={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},ri={setCurrentTime:1,setMuted:1,setVolume:1},ni={play:1,pause:1};function ai(s){return(e,t)=>e===ei?ei:t[s]?t[s](e):e}function oi(e,t){var s=Zs[e.id()];let i=null;if(null==s)i=t(e),Zs[e.id()]=[[t,i]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},s={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),s=Object.assign({role:"button"},s),this.tabIndex_=t.tabIndex;e=p(e,t,s);return this.player_.options_.experimentalSvgIcons||e.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=p("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var s=this.localize(e);this.controlText_=e,be(this.controlTextEl_,s),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",s)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){a.isEventKey(e,"Space")||a.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}b.registerComponent("ClickableComponent",pi);class gi extends pi{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return p("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(p("picture",{className:"vjs-poster",tabIndex:-1},{},p("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?k(this.player_.play()):this.player_.pause())}}gi.prototype.crossorigin=gi.prototype.crossOrigin,b.registerComponent("PosterImage",gi);const mi={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function vi(e,t){let s;if(4===e.length)s=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");s=e.slice(1)}return"rgba("+parseInt(s.slice(0,2),16)+","+parseInt(s.slice(2,4),16)+","+parseInt(s.slice(4,6),16)+","+t+")"}function _i(e,t,s){try{e.style[t]=s}catch(e){}}function fi(e){return e?e+"px":""}class yi extends b{constructor(i,e,t){super(i,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};i.on("loadstart",e=>this.toggleDisplay(e)),i.on("texttrackchange",e=>this.updateDisplay(e)),i.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),i.ready(f(this,function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",r),i.on("playerresize",r);const e=window.screen.orientation||window,s=window.screen.orientation?"change":"orientationchange";e.addEventListener(s,r),i.on("dispose",()=>e.removeEventListener(s,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)k(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const s=e&&e.getChild("playToggle");s?(e=()=>s.focus(),Rt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Ti.prototype.controlText_="Play Video",b.registerComponent("BigPlayButton",Ti);P;b.registerComponent("CloseButton",class extends P{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){a.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class ki extends P{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?k(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}ki.prototype.controlText_="Play",b.registerComponent("PlayToggle",ki);class Ci extends b{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),s=p("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(s),this.contentEl_=p("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Nt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Ci.prototype.labelText_="Time",Ci.prototype.controlText_="Time",b.registerComponent("TimeDisplay",Ci);class wi extends Ci{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}wi.prototype.labelText_="Current Time",wi.prototype.controlText_="Current Time",b.registerComponent("CurrentTimeDisplay",wi);class Ei extends Ci{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Ei.prototype.labelText_="Duration",Ei.prototype.controlText_="Duration",b.registerComponent("DurationDisplay",Ei);class Si extends b{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),s=super.createEl("span",{textContent:"/"});return t.appendChild(s),e.appendChild(t),e}}b.registerComponent("TimeDivider",Si);class xi extends Ci{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(p("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}xi.prototype.labelText_="Remaining Time",xi.prototype.controlText_="Remaining Time",b.registerComponent("RemainingTimeDisplay",xi);class ji extends b{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=p("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(p("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}b.registerComponent("LiveDisplay",ji);class Pi extends P{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=p("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function Ii(e,t,s){return e=Number(e),Math.min(s,Math.max(t,isNaN(e)?t:e))}Pi.prototype.controlText_="Seek to live, currently playing live",b.registerComponent("SeekToLive",Pi);t=Object.freeze({__proto__:null,clamp:Ii});class Mi extends b{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},s={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),s=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},s),super.createEl(e,t,s)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||c||e.preventDefault(),Me(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Ae(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(Ii(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Ne(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){a.isEventKey(e,"Left")||a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):a.isEventKey(e,"Right")||a.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}b.registerComponent("Slider",Mi);const Ai=(e,t)=>Ii(e/t*100,0,100).toFixed(2)+"%";class Oi extends b{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=p("span",{className:"vjs-control-text"}),s=p("span",{textContent:this.localize("Loaded")}),i=document.createTextNode(": ");return this.percentageEl_=p("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(s),t.appendChild(i),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,s=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),r=this.partEls_,e=Ai(i,e);this.percent_!==e&&(this.el_.style.width=e,be(this.percentageEl_,e),this.percent_=e);for(let t=0;ts.length;e--)this.el_.removeChild(r[e-1]);r.length=s.length})}}b.registerComponent("LoadProgressBar",Oi);class Li extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,s,i){var r=Le(this.el_),n=Oe(this.player_.el()),s=t.width*s;if(n&&r){var a=t.left-n.left+s,s=t.width-s+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(i)}}write(e){be(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,s,i=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((s=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Nt(s,t):Nt(a,i),this.update(r,n,e),o&&o()})}}b.registerComponent("TimeTooltip",Li);class Ni extends b{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var s,i=this.getChild("timeTooltip");i&&(s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),i.updateTime(e,t,s))}}Ni.prototype.options_={children:[]},u||o||Ni.prototype.options_.children.push("timeTooltip"),b.registerComponent("PlayProgressBar",Ni);class Di extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var s=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,s,()=>{this.el_.style.left=e.width*t+"px"})}}Di.prototype.options_={children:["timeTooltip"]},b.registerComponent("MouseTimeDisplay",Di);class Bi extends Mi{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=f(this,this.update),this.update=r(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let s=this.player_.duration();t&&t.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(100*i).toFixed(2)),this.percent_=i),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Nt(e,s),Nt(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Oe(this.el()),this.getProgress())}),i}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var s=this.player_.liveTracker;return s&&s.isLive()?(t=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Ve(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,s=!1){if(Ve(t)&&!isNaN(this.player_.duration())){s||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;s=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=s)return void t.seekToLiveEdge();var i=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=i+s*t.liveWindow())>=r?r:e)<=i?i+.1:e)===1/0)return}else(e=s*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?k(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,s=this.player_.liveTracker;a.isEventKey(e,"Space")||a.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):a.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):a.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),s&&s.isLive()?this.userSeek_(s.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(a(e))?(e.preventDefault(),e.stopPropagation(),t=10*(a.codes[a(e)]-a.codes[0])/100,s&&s.isLive()?this.userSeek_(s.seekableStart()+s.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):a.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):a.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Bi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||o||Bi.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),b.registerComponent("SeekBar",Bi);class Hi extends b{constructor(e,t){super(e,t),this.handleMouseMove=r(f(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=r(f(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,s,i,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay"),t||s)&&(i=Le(r=n.el()),r=Ii(r=Ne(r,e).x,0,1),s&&s.update(i,r),t)&&t.update(i,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&k(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Hi.prototype.options_={children:["seekBar"]},b.registerComponent("ProgressControl",Hi);class Ri extends P{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Ri.prototype.controlText_="Picture-in-Picture",b.registerComponent("PictureInPictureToggle",Ri);class Fi extends P{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Fi.prototype.controlText_="Fullscreen",b.registerComponent("FullscreenToggle",Fi);class Vi extends b{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}b.registerComponent("VolumeLevel",Vi);class zi extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,s,i,e){if(!i){var i=Oe(this.el_),r=Oe(this.player_.el()),s=t.width*s;if(!r||!i)return;var n=t.left-r.left+s,s=t.width-s+(r.right-t.right);let e=i.width/2;ni.width&&(e=i.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){be(this.el_,e)}updateVolume(e,t,s,i,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,s,i.toFixed(0)),r&&r()})}}b.registerComponent("VolumeLevelTooltip",zi);class qi extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,s){var i=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,s,i,()=>{s?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}qi.prototype.options_={children:["volumeLevelTooltip"]},b.registerComponent("MouseVolumeLevelDisplay",qi);class $i extends Mi{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Ve(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,s,i,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Oe(i=this.el()),s=this.vertical(),i=Ne(i,e),i=Ii(i=s?i.y:i.x,0,1),r.update(t,i,s)),Ve(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}$i.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||o||$i.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),$i.prototype.playerEvent="volumechange",b.registerComponent("VolumeBar",$i);class Ui extends b{constructor(e,t={}){var s,i;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!G(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.throttledHandleMouseMove=r(f(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Ui.prototype.options_={children:["volumeBar"]},b.registerComponent("VolumeControl",Ui);class Ki extends P{constructor(e,t){var s,i;super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),s=this.player_.lastVolume_();0===t?(this.player_.volume(s<.1?.1:s),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),we(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Ki.prototype.controlText_="Mute",b.registerComponent("MuteToggle",Ki);class Wi extends b{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!G(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){a.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),v(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){a.isEventKey(e,"Esc")&&this.handleMouseOut()}}Wi.prototype.options_={children:["muteToggle","volumeControl"]},b.registerComponent("VolumePanel",Wi);P;b.registerComponent("SkipForward",class extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()?s.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class Xi extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()&&s.seekableStart();let i;i=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Xi.prototype.controlText_="Skip Backward",b.registerComponent("SkipBackward",Xi);class Gi extends b{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof b&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof b&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=p(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),v(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){a.isEventKey(e,"Left")||a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(a.isEventKey(e,"Right")||a.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}b.registerComponent("Menu",Gi);class Yi extends b{constructor(e,t={}){super(e,t),this.menuButton_=new P(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=P.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),v(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new Gi(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=p("li",{className:"vjs-menu-title",textContent:y(this.options_.title),tabIndex:-1}),e=new b(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;ea.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}b.registerComponent("MenuItem",Zi);class er extends Zi{constructor(e,t){var s=t.track;const i=e.textTracks(),r=(t.label=s.label||s.language||"Unknown",t.selected="showing"===s.mode,super(e,t),this.track=s,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),i.addEventListener("change",r),i.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),i.removeEventListener("change",r),i.removeEventListener("selectedlanguagechange",n)}),void 0===i.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),i.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,s=this.player_.textTracks();if(super.handleClick(e),s)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var s=t[e];if(s.kind===this.kind_)return s}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(y(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var s=[];if(this.track_){var i=this.track_.cues;if(i)for(let e=0,t=i.length;e{this.handleTracksChange.apply(this,e)});i.addEventListener("change",r),this.on("dispose",()=>{i.removeEventListener("change",r)})}createEl(e,t,s){e=super.createEl(e,t,s),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(p("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}pr.prototype.contentElType="button",b.registerComponent("PlaybackRateMenuItem",pr);class gr extends Yi{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=p("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),s=[];for(let e=t.length-1;0<=e;e--)s.push(new pr(this.player(),{rate:t[e]+"x"}));return s}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}_r.prototype.options_=Object.assign({},$t.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),b.registerComponent("ErrorDisplay",_r);const fr="vjs-text-track-settings";var ws=["#000","Black"],xt=["#00F","Blue"],yr=["#0FF","Cyan"],br=["#0F0","Green"],Tr=["#F0F","Magenta"],kr=["#F00","Red"],Cr=["#FFF","White"],wr=["#FF0","Yellow"],Er=["1","Opaque"],Sr=["0.5","Semi-Transparent"],xr=["0","Transparent"];const jr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ws,Cr,kr,br,xt,wr,Tr,yr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Er,Sr,xr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Cr,ws,kr,br,xt,wr,Tr,yr]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Er,Sr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[xr,Sr,Er]}};function Pr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}jr.windowColor.options=jr.backgroundColor.options;class Ir extends $t{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=p("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),W(jr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",s="label"){e=jr[e];const i=e.id.replace("%s",this.id_),r=[t,i].join(" ").trim();return[`<${s} id="${i}" class="${"label"===s?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return p("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return p("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return p("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(jr,(e,t,s)=>{i=this.$(t.selector),t=t.parser;var i=Pr(i.options[i.options.selectedIndex].value,t);return void 0!==i&&(e[s]=i),e},{})}setValues(n){W(jr,(e,t)=>{var s=this.$(e.selector),i=n[t],r=e.parser;if(i)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(fr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(fr,JSON.stringify(e)):window.localStorage.removeItem(fr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}b.registerComponent("TextTrackSettings",Ir);class Mr extends b{constructor(e,t){let s=t.ResizeObserver||window.ResizeObserver;super(e,h({createEl:!(s=null===t.ResizeObserver?!1:s),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=ht(()=>{this.resizeHandler()},100,!1,this),s?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){_(this,"resize",t),_(this,"unload",e),e=null};v(this.el_.contentWindow,"unload",e),v(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}b.registerComponent("ResizeManager",Mr);const Ar={trackingThreshold:20,liveTolerance:15};class Or extends b{constructor(e,t){super(e,h(Ar,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),s=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+s,this.liveCurrentTime()),s=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-s)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:p("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+m++}),description:p("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+m++})},p("div",{className:"vjs-title-bar"},{},Y(this.els))}updateDom_(){var e=this.player_.tech_;const i=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],s=this.els[e],e=r[e];Be(s),t&&be(s,t),i&&(i.removeAttribute(e),t)&&i.setAttribute(e,s.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}b.registerComponent("TitleBar",Lr);function Nr(s){const i=s.el();if(!i.resetSourceWatch_){const t={},e=Fr(s),r=t=>(...e)=>{e=t.apply(i,e);return Br(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{i[e]&&(t[e]=i[e],i[e]=r(t[e]))}),Object.defineProperty(i,"innerHTML",h(e,{set:r(e.set)})),i.resetSourceWatch_=()=>{i.resetSourceWatch_=null,Object.keys(t).forEach(e=>{i[e]=t[e]}),Object.defineProperty(i,"innerHTML",e)},s.one("sourceset",i.resetSourceWatch_)}}function Dr(s){if(s.featuresSourceset){const i=s.el();if(!i.resetSourceset_){e=s;const t=Rr([e.el(),window.HTMLMediaElement.prototype,Vr],"src");var e;const r=i.setAttribute,n=i.load;Object.defineProperty(i,"src",h(t,{set:e=>{e=t.set.call(i,e);return s.triggerSourceset(i.src),e}})),i.setAttribute=(e,t)=>{t=r.call(i,e,t);return/src/i.test(e)&&s.triggerSourceset(i.src),t},i.load=()=>{var e=n.call(i);return Br(s)||(s.triggerSourceset(""),Nr(s)),e},i.currentSrc?s.triggerSourceset(i.currentSrc):Br(s)||Nr(s),i.resetSourceset_=()=>{i.resetSourceset_=null,i.load=n,i.setAttribute=r,Object.defineProperty(i,"src",t),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}const Br=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var s=t.$$("source"),i=[];let e="";if(!s.length)return!1;for(let e=0;e{let i={};for(let e=0;eRr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,Hr],"innerHTML"),Vr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ss(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class I extends j{constructor(e,t){super(e,t);t=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var i=this.el_.childNodes;let e=i.length;for(var r=[];e--;){var n=i[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),s||this.el_.hasAttribute("crossorigin")||!is(n.src)||(s=!0)):r.push(n))}for(let e=0;e{i=[];for(let e=0;es.removeEventListener("change",e)),()=>{for(let e=0;e{s.removeEventListener("change",e),s.removeEventListener("change",r),s.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{s.removeEventListener("change",e),s.addEventListener("change",e),s.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const s=e.toLowerCase();this[s+"TracksListeners_"]&&Object.keys(this[s+"TracksListeners_"]).forEach(e=>{this.el()[s+"Tracks"].removeEventListener(e,this[s+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[s+"TracksListeners_"]=null,this.proxyNativeTracksForType_(s)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(s){var e=w[s];const i=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&i&&i.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===s&&this[Cs.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let s=0;s{const s=n[t];i.addEventListener(t,s),this.on("dispose",e=>i.removeEventListener(t,s))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){w.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),I.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=h({},this.options_.tag&&xe(this.options_.tag)),ue&&!0===this.options_.nativeControlsForTouch||delete e.controls,Se(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,s=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)k(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){I.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,s):super.addTextTrack(e,t,s)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var s=this.$$("track");let e=s.length;for(;e--;)t!==s[e]&&t!==s[e].track||this.el().removeChild(s[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Q(I,"TEST_VID",function(){var e,t;if(ve())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),I.isSupported=function(){try{I.TEST_VID.volume=.5}catch(e){return!1}return!(!I.TEST_VID||!I.TEST_VID.canPlayType)},I.canPlayType=function(e){return I.TEST_VID.canPlayType(e)},I.canPlaySource=function(e,t){return I.canPlayType(e.type)},I.canControlVolume=function(){try{const t=I.TEST_VID.volume;I.TEST_VID.volume=t/2+.1;var e=t!==I.TEST_VID.volume;return e&&u?(window.setTimeout(()=>{I&&I.prototype&&(I.prototype.featuresVolumeControl=t!==I.TEST_VID.volume)}),!1):e}catch(e){return!1}},I.canMuteVolume=function(){try{var e=I.TEST_VID.muted;return I.TEST_VID.muted=!e,I.TEST_VID.muted?Pe(I.TEST_VID,"muted","muted"):Ie(I.TEST_VID,"muted"),e!==I.TEST_VID.muted}catch(e){return!1}},I.canControlPlaybackRate=function(){if(o&&c&&ae<58)return!1;try{var e=I.TEST_VID.playbackRate;return I.TEST_VID.playbackRate=e/2+.1,e!==I.TEST_VID.playbackRate}catch(e){return!1}},I.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},I.supportsNativeTextTracks=function(){return ge||u&&c},I.supportsNativeVideoTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.videoTracks)},I.supportsNativeAudioTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.audioTracks)},I.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){Q(I.prototype,e,()=>I[t](),!0)}),I.prototype.featuresVolumeControl=I.canControlVolume(),I.prototype.movingMediaElementInDOM=!u,I.prototype.featuresFullscreenResize=!0,I.prototype.featuresProgressEvents=!0,I.prototype.featuresTimeupdateEvents=!0,I.prototype.featuresVideoFrameCallback=!(!I.TEST_VID||!I.TEST_VID.requestVideoFrameCallback),I.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},I.resetMediaElement=function(t){if(t){var s=t.querySelectorAll("source");let e=s.length;for(;e--;)t.removeChild(s[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){I.prototype["set"+y(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){I.prototype["set"+y(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]()}}),j.withSourceHandlers(I),I.nativeSourceHandler={},I.nativeSourceHandler.canPlayType=function(e){try{return I.TEST_VID.canPlayType(e)}catch(e){return""}},I.nativeSourceHandler.canHandleSource=function(e,t){return e.type?I.nativeSourceHandler.canPlayType(e.type):e.src?(e=rs(e.src),I.nativeSourceHandler.canPlayType("video/"+e)):""},I.nativeSourceHandler.handleSource=function(e,t,s){t.setSrc(e.src)},I.nativeSourceHandler.dispose=function(){},I.registerSourceHandler(I.nativeSourceHandler),j.registerTech("Html5",I);const zr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],qr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},$r=["tiny","xsmall","small","medium","large","xlarge","huge"],Ur={},Kr=($r.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ur[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class M extends b{constructor(e,t,s){if(e.id=e.id||t.id||"vjs_video_"+m++,(t=Object.assign(M.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(i=e.closest("[lang]"))&&(t.language=i.getAttribute("lang")),super(null,t,s),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=U(this.id_),this.fsApi_=F,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&xe(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=M.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Tt(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(v(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var i=h(this.options_),s=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=i,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((s=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((i=s.documentElement).style.display="none",this.el_.appendChild(i),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ue&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),M.players[this.id_]=this,D.split(".")[0]);this.addClass("vjs-v"+s),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),_(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),M.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Zs[e.id()]=null,E.names.forEach(e=>{e=this[E[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,s,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const i="video-js"===this.tag.tagName.toLowerCase(),r=(e?s=this.el_=t.parentNode:i||(s=this.el_=super.createEl("div")),xe(t));if(i){for(s=this.el_=t,t=this.tag=document.createElement("video");s.children.length;)t.appendChild(s.firstChild);ke(s,"video-js")||Ce(s,"video-js"),s.appendChild(t),e=this.playerElIngest_=s,Object.keys(s).forEach(e=>{try{t[e]=s[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",c&&he&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){i&&"class"===e||s.setAttribute(e,r[e]),i&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=s.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Je("vjs-styles-dimensions"),n=ze(".vjs-styles-defaults"),(a=ze("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},pt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,s,i;r=(s=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{var e,s=h.levels[s],r=new RegExp(`^(${s})$`);let n=l;if("log"!==t&&i.unshift(t.toUpperCase()+":"),c&&(n="%c"+l,i.unshift(c)),i.unshift(n+":"),d&&(d.push([].concat(i)),e=d.length-1e3,d.splice(0,0i(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==s?s:a),o.createNewLogger=(e,t,s)=>i(e,t,s),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>d?[].concat(d):[],o.history.filter=t=>(d||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{d&&(d.length=0)},o.history.disable=()=>{null!==d&&(d.length=0,d=null)},o.history.enable=()=>{null===d&&(d=[])},o.error=(...e)=>s("error",t,e),o.warn=(...e)=>s("warn",t,e),o.debug=(...e)=>s("debug",t,e),o}("VIDEOJS"),U=l.createLogger,K=Object.prototype.toString;function W(t,s){$(t).forEach(e=>s(t[e],e))}function X(s,i,e=0){return $(s).reduce((e,t)=>i(e,s[t],t),e)}function n(e){return!!e&&"object"==typeof e}function G(e){return n(e)&&"[object Object]"===K.call(e)&&e.constructor===Object}function h(...e){const s={};return e.forEach(e=>{e&&W(e,(e,t)=>{G(e)?(G(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function Y(e={}){var t,s=[];for(const i in e)e.hasOwnProperty(i)&&(t=e[i],s.push(t));return s}function Q(t,s,i,e=!0){const r=e=>Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,s,n)}var J=Object.freeze({__proto__:null,each:W,reduce:X,isObject:n,isPlain:G,merge:h,values:Y,defineLazyProperty:Q});let Z=!1,ee=null,o=!1,te,se=!1,ie=!1,re=!1,c=!1,ne=null,ae=null,oe=null,le=!1,he=!1,ce=!1,de=!1;const ue=Boolean(me()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var pe,e=window.navigator&&window.navigator.userAgentData;if(e&&(o="Android"===e.platform,ie=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),re=Boolean(e.brands.find(e=>"Chromium"===e.brand)),c=!ie&&re,ne=ae=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,he="Windows"===e.platform),!re){const N=window.navigator&&window.navigator.userAgent||"";Z=/iPod/i.test(N),ee=(e=N.match(/OS (\d+)_/i))&&e[1]?e[1]:null,o=/Android/i.test(N),te=(e=N.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ct=e[1]&&parseFloat(e[1]),pe=e[2]&&parseFloat(e[2]),ct&&pe?parseFloat(e[1]+"."+e[2]):ct||null):null,se=/Firefox/i.test(N),ie=/Edg/i.test(N),re=/Chrome/i.test(N)||/CriOS/i.test(N),c=!ie&&re,ne=ae=(pe=N.match(/(Chrome|CriOS)\/(\d+)/))&&pe[2]?parseFloat(pe[2]):null,oe=function(){var e=/MSIE\s(\d+)\.\d/.exec(N);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(N)&&/rv:11.0/.test(N)?11:t}(),le=/Safari/i.test(N)&&!c&&!o&&!ie,he=/Windows/i.test(N),ce=/iPad/i.test(N)||le&&ue&&!/iPhone/i.test(N),de=/iPhone/i.test(N)&&!ce}const u=de||ce||Z,ge=(le||u)&&!c;e=Object.freeze({__proto__:null,get IS_IPOD(){return Z},get IOS_VERSION(){return ee},get IS_ANDROID(){return o},get ANDROID_VERSION(){return te},get IS_FIREFOX(){return se},get IS_EDGE(){return ie},get IS_CHROMIUM(){return re},get IS_CHROME(){return c},get CHROMIUM_VERSION(){return ne},get CHROME_VERSION(){return ae},get IE_VERSION(){return oe},get IS_SAFARI(){return le},get IS_WINDOWS(){return he},get IS_IPAD(){return ce},get IS_IPHONE(){return de},TOUCH_ENABLED:ue,IS_IOS:u,IS_ANY_SAFARI:ge});function ve(e){return"string"==typeof e&&Boolean(e.trim())}function me(){return document===window.document}function _e(e){return n(e)&&1===e.nodeType}function fe(){try{return window.parent!==window.self}catch(e){return!0}}function ye(s){return function(e,t){return ve(e)?(t=_e(t=ve(t)?document.querySelector(t):t)?t:document)[s]&&t[s](e):document[s](null)}}function p(e="div",s={},t={},i){const r=document.createElement(e);return Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];"textContent"===e?be(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),i&&Re(r,i),r}function be(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Te(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function we(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ee(t,e,s){return"boolean"!=typeof(s="function"==typeof s?s(t,e):s)&&(s=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,s)),t}function Se(s,i){Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];null===t||"undefined"==typeof t||!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})}function xe(e){var s={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(s[e]=t[e])}),s.height||(s.height=parseFloat($e(e,"height"))),s.width||(s.width=parseFloat($e(e,"width"))),s}}function Le(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,s=e.offsetHeight;let i=0,r=0;for(;e.offsetParent&&e!==document[F.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:s}}function Ne(t,e){var s={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var i,r=$e(e,"transform");/^matrix/.test(r)?(i=r.slice(7,-1).split(/,\s/).map(Number),s.x+=i[4],s.y+=i[5]):/^matrix3d/.test(r)&&(i=r.slice(9,-1).split(/,\s/).map(Number),s.x+=i[12],s.y+=i[13]),e=e.parentNode}}var n={},a=Le(e.target),t=Le(t),o=t.width,l=t.height;let h=e.offsetY-(t.top-a.top),c=e.offsetX-(t.left-a.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-t.left,h=e.changedTouches[0].pageY+t.top,u)&&(c-=s.x,h-=s.y),n.y=1-Math.max(0,Math.min(1,h/l)),n.x=Math.max(0,Math.min(1,c/o)),n}function De(e){return n(e)&&3===e.nodeType}function Be(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function He(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>_e(e="function"==typeof e?e():e)||De(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function Re(t,e){return He(e).forEach(e=>t.appendChild(e)),t}function Fe(e,t){return Re(Be(e),t)}function Ve(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const ze=ye("querySelector"),qe=ye("querySelectorAll");function $e(t,s){if(!t||!s)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(s)||e[s]:""}}function Ue(i){[...document.styleSheets].forEach(t=>{try{var s=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=s,i.document.head.appendChild(e)}catch(e){s=document.createElement("link");s.rel="stylesheet",s.type=t.type,s.media=t.media.mediaText,s.href=t.href,i.document.head.appendChild(s)}})}var Ke=Object.freeze({__proto__:null,isReal:me,isEl:_e,isInFrame:fe,createEl:p,textContent:be,prependTo:Te,hasClass:ke,addClass:Ce,removeClass:we,toggleClass:Ee,setAttributes:Se,getAttributes:xe,getAttribute:je,setAttribute:Pe,removeAttribute:Ie,blockTextSelection:Me,unblockTextSelection:Ae,getBoundingClientRect:Oe,findPosition:Le,getPointerPosition:Ne,isTextNode:De,emptyEl:Be,normalizeContent:He,appendContent:Re,insertContent:Fe,isSingleLeftClick:Ve,$:ze,$$:qe,computedStyle:$e,copyStyleSheetsToWindow:Ue});let We=!1,Xe;function Ge(){if(!1!==Xe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),s=Array.prototype.slice.call(document.getElementsByTagName("video-js")),i=e.concat(t,s);if(i&&0=i&&(s(...e),r=t)}}function ht(i,r,n,a=window){let o;function e(){const e=this,t=arguments;let s=function(){o=null,s=null,n||i.apply(e,t)};!o&&n&&i.apply(e,t),a.clearTimeout(o),o=a.setTimeout(s,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ct=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:f,throttle:r,debounce:ht});let dt;class s{on(e,t){var s=this.addEventListener;this.addEventListener=()=>{},m(this,e,t),this.addEventListener=s}off(e,t){_(this,e,t)}one(e,t){var s=this.addEventListener;this.addEventListener=()=>{},at(this,e,t),this.addEventListener=s}any(e,t){var s=this.addEventListener;this.addEventListener=()=>{},ot(this,e,t),this.addEventListener=s}trigger(e){var t=e.type||e;e=st(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),nt(this,e)}queueTrigger(e){dt=dt||new Map;const t=e.type||e;let s=dt.get(this);s||(s=new Map,dt.set(this,s));var i=s.get(t),i=(s.delete(t),window.clearTimeout(i),window.setTimeout(()=>{s.delete(t),0===s.size&&(s=null,dt.delete(this)),this.trigger(e)},0));s.set(t,i)}}s.prototype.allowedEvents_={},s.prototype.addEventListener=s.prototype.on,s.prototype.removeEventListener=s.prototype.off,s.prototype.dispatchEvent=s.prototype.trigger;const ut=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),pt=t=>t instanceof s||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),gt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,vt=(e,t,s)=>{if(!e||!e.nodeName&&!pt(e))throw new Error(`Invalid target for ${ut(t)}#${s}; must be a DOM node or evented object.`)},mt=(e,t,s)=>{if(!gt(e))throw new Error(`Invalid event type for ${ut(t)}#${s}; must be a non-empty string or array.`)},_t=(e,t,s)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${ut(t)}#${s}; must be a function.`)},ft=(e,t,s)=>{var i=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return i?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,vt(r,e,s),mt(n,e,s),_t(a,e,s),a=f(e,a),{isTargetingSelf:i,target:r,type:n,listener:a}},yt=(e,t,s,i)=>{vt(e,e,t),e.nodeName?lt[t](e,s,i):e[t](s,i)},bt={on(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"on");if(yt(s,"on",i,r),!t){const n=()=>this.off(s,i,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,yt(this,"on","dispose",n),yt(s,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"one");if(t)yt(s,"one",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,yt(s,"one",i,n)}},any(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=ft(this,e,"any");if(t)yt(s,"any",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,yt(s,"any",i,n)}},off(e,t,s){!e||gt(e)?_(this.eventBusEl_,e,t):(e=e,t=t,vt(e,this,"off"),mt(t,this,"off"),_t(s,this,"off"),s=f(this,s),this.off("dispose",s),e.nodeName?(_(e,t,s),_(e,"dispose",s)):pt(e)&&(e.off(t,s),e.off("dispose",s)))},trigger(e,t){vt(this.eventBusEl_,this,"trigger");var s=e&&"string"!=typeof e?e.type:e;if(gt(s))return nt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${ut(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function Tt(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=p("span",{className:"vjs-event-bus"});Object.assign(e,bt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&g.has(e)&&g.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const kt={state:{},setState(e){"function"==typeof e&&(e=e());let s;return W(e,(e,t)=>{this.state[t]!==e&&((s=s||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),s&&pt(this)&&this.trigger({changes:s,type:"statechanged"}),s}};function Ct(e,t){Object.assign(e,kt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&pt(e)&&e.on("statechanged",e.handleStateChanged)}function wt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function y(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Et(e,t){return y(e)===y(t)}var St=Object.freeze({__proto__:null,toLowerCase:wt,toTitleCase:y,titleCaseEquals:Et}),xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function jt(e,t){return e(t={exports:{}},t.exports),t.exports}var a=jt(function(e,t){function s(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),i[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}s.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var s=i[t.toLowerCase()];if(s)return s===e;if(s=r[t.toLowerCase()])return s===e}else if("number"==typeof t)return t===e;return!1}};for(var i=(t=e.exports=s).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)i[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)i[n-48]=n;for(n=1;n<13;n++)i["f"+n]=n+111;for(n=0;n<10;n++)i["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in i)o[i[n]]=n;for(a in r)i[a]=r[a]});a.code,a.codes,a.aliases,a.names,a.title;class b{constructor(e,t,s){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=h({},this.options_),t=this.options_=h(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+v++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(Tt(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Ct(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(s),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=h(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,s){return p(e,t,s)}localize(e,i,t=e){var s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],s=s&&s.split("-")[0],r=r&&r[s];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=i?a.replace(/\{(\d+)\}/g,function(e,t){t=i[t-1];let s="undefined"==typeof t?e:t;return s}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let s=this;for(let e=0;e{let t,s;return s="string"==typeof e?(t=e,i[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:s}}).filter(e=>{e=b.getComponent(e.opts.componentClass||y(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let s=e.opts;!1!==(s=void 0!==r[t]?r[t]:s)&&((s=!0===s?{}:s).playerOptions=this.options_.playerOptions,e=this.addChild(t,s))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(s)&&this.setTimeoutIds_.delete(s),e()},t),this.setTimeoutIds_.add(s),s}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=f(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=f(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var s;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=f(this,t),s=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,s),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,s])=>{this[e].forEach((e,t)=>this[s](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var s=b.getComponent("Tech"),s=s&&s.isTech(e),i=b===e||b.prototype.isPrototypeOf(e.prototype);if(s||!i){let e;throw e=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=y(t),b.components_||(b.components_={});i=b.getComponent("Player");if("Player"===t&&i&&i.players){const r=i.players;s=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return b.components_[t]=e,b.components_[wt(t)]=e}static getComponent(e){if(e&&b.components_)return b.components_[e]}}function Pt(e,t,s,i){var r=i,n=s.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function T(e,t){return Array.isArray(e)?It(e):void 0===e||void 0===t?It():It([[e,t]])}b.registerComponent("Component",b);function Mt(e,t){e=e<0?0:e;let s=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:i=s="-")||0s&&(n=s),i+=n-r;return i/s}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:n(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Ft(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,s)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Vt=function(e){var t=e.$$("track");const s=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Ft(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===s.indexOf(e)}).map(Ft))},zt=function(e,s){return e.forEach(function(e){const t=s.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),s.textTracks()};Ft;const qt="vjs-modal-dialog";class $t extends b{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=p("div",{className:qt+"-content"},{role:"document"}),this.descEl_=p("p",{className:qt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),be(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return qt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var s,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(s=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),s=t.parentNode,i=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,s.removeChild(t),this.empty(),Fe(t,e),this.trigger("modalfill"),i?s.insertBefore(t,i):s.appendChild(t),this.getChild("closeButton"));e&&s.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),Be(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),a.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(a.isEventKey(e,"Tab")){var s=this.focusableEls_(),i=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}$t.prototype.options_={pauseOnOpen:!0,temporary:!0},b.registerComponent("ModalDialog",$t);class Ut extends s{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},pt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(s){let i;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class Gt{constructor(e){Gt.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let s=0;function i(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),s.flush()}function fs(e,i){var t={uri:e};(e=is(e))&&(t.cors=e),(e="use-credentials"===i.tech_.crossOrigin())&&(t.withCredentials=e),cs(t,f(this,function(e,t,s){if(e)return l.error(e,t);i.loaded_=!0,"function"!=typeof window.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return _s(s,i);l.error("vttjs failed to load, stopping trying to process "+i.src)}):_s(s,i)}))}class ys extends es{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=h(e,{kind:Jt[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Zt[e.mode]||"disabled";const s=e.default,i=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new Gt(this.cues_)),n=new Gt(this.activeCues_);let a=!1;this.timeupdateHandler=f(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return t},set(e){Zt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||fs(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var s=this.tech_.currentTime(),i=[];for(let e=0,t=this.cues.length;e=s&&i.push(r)}if(a=!1,i.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=ks.LOADED,this.trigger({type:"load",target:this})})}}ks.prototype.allowedEvents_={load:"load"},ks.NONE=0,ks.LOADING=1,ks.LOADED=2,ks.ERROR=3;const w={audio:{ListClass:class extends Ut{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){Kt(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&Kt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Kt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:bs,capitalName:"Audio"},video:{ListClass:class extends Ut{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){Wt(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,Wt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Ts,capitalName:"Video"},text:{ListClass:Xt,TrackClass:ys,capitalName:"Text"}},Cs=(Object.keys(w).forEach(function(e){w[e].getterName=e+"Tracks",w[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:Xt,TrackClass:ys,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(s=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=s.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?c.length&&c[c.length-1]===o.substr(2).replace(">","")&&(c.pop(),h=h.parentNode):(i=xs(o.substr(1,o.length-2)))?(s=e.document.createProcessingInstruction("timestamp",i),h.appendChild(s)):(i=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=i[1],n=i[3],a=void 0,a=Ms[r],s=a?(a=e.document.createElement(a),(r=Os[r])&&n&&(a[r]=n.trim()),a):null)&&(r=h,Ls[(n=s).localName]&&Ls[n.localName]!==r.localName||(i[2]&&((a=i[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;As.hasOwnProperty(e)&&(e=As[e],s.style[t?"background-color":"color"]=e)}),s.className=a.join(" ")),c.push(i[1]),h.appendChild(s),h=s)):h.appendChild(e.document.createTextNode((n=o,Is.innerHTML=n,n=Is.textContent,Is.textContent="",n)));return l}var Ds=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Bs(e){var t=[],s="";if(e&&e.childNodes)for(n(t,e);s=function e(t){var s,i,r;return t&&t.length?(i=(s=t.pop()).textContent||s.innerText)?(r=i.match(/^.*(\n|\r)/))?r[t.length=0]:i:"ruby"===s.tagName?e(t):s.childNodes?(n(t,s),e(t)):void 0:null}(t);)for(var i=0;i=s[0]&&e<=s[1])return 1}}(s.charCodeAt(i)))return"rtl";return"ltr";function n(e,t){for(var s=t.childNodes.length-1;0<=s;s--)e.push(t.childNodes[s])}}function Hs(){}function Rs(e,t,s){Hs.call(this),this.cue=t,this.cueDiv=Ns(e,t.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(i,this.cueDiv),this.div=e.document.createElement("div"),i={direction:Bs(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:s.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function x(e){var t,s,i,r;e.div&&(t=e.div.offsetHeight,s=e.div.offsetWidth,i=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||i,this.height=e.height||t,this.bottom=e.bottom||i+(e.height||t),this.width=e.width||s,this.lineHeight=void 0!==r?r:e.lineHeight}function Fs(e,t,o,l){var s,i=new x(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,s=t.textTrackList,i=0,r=0;rd&&(c=c<0?-1:1,c*=Math.ceil(d/h)*h),n<0&&(c+=""===r.vertical?o.height:o.width,a=a.reverse()),i.move(u,c)}else{var p=i.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],i=new x(t)}d=function(e,t){for(var s,i=new x(e),r=1,n=0;ne.left&&this.tope.top},x.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},x.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},x.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},x.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},x.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,s=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,i=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||i,height:e.height||t,bottom:e.bottom||i+(e.height||t),width:e.width||s}},Vs.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Vs.convertCueToDOMTree=function(e,t){return e&&t?Ns(e,t):null};Vs.processCues=function(e,t,s){if(!e||!t||!s)return null;for(;s.firstChild;)s.removeChild(s.firstChild);var i=e.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",s.appendChild(i),function(e){for(var t=0;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),E.names.forEach(e=>{e=E[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new E.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(f(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return T(0,0)}bufferedPercent(){return Bt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(w.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let s=t.length;for(;s--;){var i=t[s];"text"===e&&this.removeRemoteTextTrack(i),t.removeTrack(i)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var s=e[t];this.removeRemoteTextTrack(s)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?T(0,0):T()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){w.names.forEach(e=>{var t=w[e];const s=()=>{this.trigger(e+"trackchange")},i=this[t.getterName]();i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),this.on("dispose",()=>{i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&G(Qs)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const s=this.textTracks(),e=this.remoteTextTracks(),t=e=>s.addTrack(e.track),i=e=>s.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",i),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(s.track)),s}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=v++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return j.canPlayType(e.type)}static isTech(e){return e.prototype instanceof j||e instanceof j||e===j}static registerTech(e,t){if(j.techs_||(j.techs_={}),!j.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!j.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(j.canPlaySource)return e=y(e),j.techs_[e]=t,j.techs_[wt(e)]=t,"Tech"!==e&&j.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return j.techs_&&j.techs_[e]?j.techs_[e]:(e=y(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}E.names.forEach(function(e){const t=E[e];j.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),j.prototype.featuresVolumeControl=!0,j.prototype.featuresMuteControl=!0,j.prototype.featuresFullscreenResize=!1,j.prototype.featuresPlaybackRate=!1,j.prototype.featuresProgressEvents=!1,j.prototype.featuresSourceset=!1,j.prototype.featuresTimeupdateEvents=!1,j.prototype.featuresNativeTextTracks=!1,j.prototype.featuresVideoFrameCallback=!1,j.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let s=r.sourceHandlers;s=s||(r.sourceHandlers=[]),void 0===t&&(t=s.length),s.splice(t,0,e)},r.canPlayType=function(t){var s,i=r.sourceHandlers||[];for(let e=0;efunction s(i={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)s(i,Js[t],r,n,a,o);else if(t){const h=oi(n,t);if(!h.setSource)return a.push(h),s(i,l,r,n,a,o);h.setSource(Object.assign({},i),function(e,t){if(e)return s(i,l,r,n,a,o);a.push(h),s(t,i.type===t.type?l:Js[t.type],r,n,a,o)})}else l.length?s(i,l,r,n,a,o):o?r(i,a):s(i,Js["*"],r,n,a,!0)}(t,Js[t.type],s,e),1)}function si(e,t,s,i=null){var r="call"+y(s),r=e.reduce(ai(r),i),i=r===ei,t=i?null:t[s](r),n=e,a=s,o=t,l=i;for(let e=n.length-1;0<=e;e--){var h=n[e];h[a]&&h[a](l,o)}return t}const ii={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},ri={setCurrentTime:1,setMuted:1,setVolume:1},ni={play:1,pause:1};function ai(s){return(e,t)=>e===ei?ei:t[s]?t[s](e):e}function oi(e,t){var s=Zs[e.id()];let i=null;if(null==s)i=t(e),Zs[e.id()]=[[t,i]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},s={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),s=Object.assign({role:"button"},s),this.tabIndex_=t.tabIndex;e=p(e,t,s);return this.player_.options_.experimentalSvgIcons||e.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=p("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var s=this.localize(e);this.controlText_=e,be(this.controlTextEl_,s),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",s)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){a.isEventKey(e,"Space")||a.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}b.registerComponent("ClickableComponent",pi);class gi extends pi{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return p("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(p("picture",{className:"vjs-poster",tabIndex:-1},{},p("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?k(this.player_.play()):this.player_.pause())}}gi.prototype.crossorigin=gi.prototype.crossOrigin,b.registerComponent("PosterImage",gi);const vi={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function mi(e,t){let s;if(4===e.length)s=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");s=e.slice(1)}return"rgba("+parseInt(s.slice(0,2),16)+","+parseInt(s.slice(2,4),16)+","+parseInt(s.slice(4,6),16)+","+t+")"}function _i(e,t,s){try{e.style[t]=s}catch(e){}}function fi(e){return e?e+"px":""}class yi extends b{constructor(i,e,t){super(i,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};i.on("loadstart",e=>this.toggleDisplay(e)),i.on("texttrackchange",e=>this.updateDisplay(e)),i.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),i.ready(f(this,function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",r),i.on("playerresize",r);const e=window.screen.orientation||window,s=window.screen.orientation?"change":"orientationchange";e.addEventListener(s,r),i.on("dispose",()=>e.removeEventListener(s,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)k(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const s=e&&e.getChild("playToggle");s?(e=()=>s.focus(),Rt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Ti.prototype.controlText_="Play Video",b.registerComponent("BigPlayButton",Ti);P;b.registerComponent("CloseButton",class extends P{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){a.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class ki extends P{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?k(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}ki.prototype.controlText_="Play",b.registerComponent("PlayToggle",ki);class Ci extends b{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),s=p("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(s),this.contentEl_=p("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Nt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Ci.prototype.labelText_="Time",Ci.prototype.controlText_="Time",b.registerComponent("TimeDisplay",Ci);class wi extends Ci{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}wi.prototype.labelText_="Current Time",wi.prototype.controlText_="Current Time",b.registerComponent("CurrentTimeDisplay",wi);class Ei extends Ci{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Ei.prototype.labelText_="Duration",Ei.prototype.controlText_="Duration",b.registerComponent("DurationDisplay",Ei);class Si extends b{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),s=super.createEl("span",{textContent:"/"});return t.appendChild(s),e.appendChild(t),e}}b.registerComponent("TimeDivider",Si);class xi extends Ci{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(p("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}xi.prototype.labelText_="Remaining Time",xi.prototype.controlText_="Remaining Time",b.registerComponent("RemainingTimeDisplay",xi);class ji extends b{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=p("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(p("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}b.registerComponent("LiveDisplay",ji);class Pi extends P{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=p("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function Ii(e,t,s){return e=Number(e),Math.min(s,Math.max(t,isNaN(e)?t:e))}Pi.prototype.controlText_="Seek to live, currently playing live",b.registerComponent("SeekToLive",Pi);t=Object.freeze({__proto__:null,clamp:Ii});class Mi extends b{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},s={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),s=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},s),super.createEl(e,t,s)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||c||e.preventDefault(),Me(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Ae(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(Ii(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Ne(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){a.isEventKey(e,"Left")||a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):a.isEventKey(e,"Right")||a.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}b.registerComponent("Slider",Mi);const Ai=(e,t)=>Ii(e/t*100,0,100).toFixed(2)+"%";class Oi extends b{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=p("span",{className:"vjs-control-text"}),s=p("span",{textContent:this.localize("Loaded")}),i=document.createTextNode(": ");return this.percentageEl_=p("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(s),t.appendChild(i),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,s=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),r=this.partEls_,e=Ai(i,e);this.percent_!==e&&(this.el_.style.width=e,be(this.percentageEl_,e),this.percent_=e);for(let t=0;ts.length;e--)this.el_.removeChild(r[e-1]);r.length=s.length})}}b.registerComponent("LoadProgressBar",Oi);class Li extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,s,i){var r=Le(this.el_),n=Oe(this.player_.el()),s=t.width*s;if(n&&r){var a=t.left-n.left+s,s=t.width-s+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(i)}}write(e){be(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,s,i=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((s=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Nt(s,t):Nt(a,i),this.update(r,n,e),o&&o()})}}b.registerComponent("TimeTooltip",Li);class Ni extends b{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var s,i=this.getChild("timeTooltip");i&&(s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),i.updateTime(e,t,s))}}Ni.prototype.options_={children:[]},u||o||Ni.prototype.options_.children.push("timeTooltip"),b.registerComponent("PlayProgressBar",Ni);class Di extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var s=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,s,()=>{this.el_.style.left=e.width*t+"px"})}}Di.prototype.options_={children:["timeTooltip"]},b.registerComponent("MouseTimeDisplay",Di);class Bi extends Mi{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=f(this,this.update),this.update=r(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let s=this.player_.duration();t&&t.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(100*i).toFixed(2)),this.percent_=i),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Nt(e,s),Nt(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Oe(this.el()),this.getProgress())}),i}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var s=this.player_.liveTracker;return s&&s.isLive()?(t=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Ve(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,s=!1){if(Ve(t)&&!isNaN(this.player_.duration())){s||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;s=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=s)return void t.seekToLiveEdge();var i=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=i+s*t.liveWindow())>=r?r:e)<=i?i+.1:e)===1/0)return}else(e=s*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?k(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,s=this.player_.liveTracker;a.isEventKey(e,"Space")||a.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):a.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):a.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),s&&s.isLive()?this.userSeek_(s.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(a(e))?(e.preventDefault(),e.stopPropagation(),t=10*(a.codes[a(e)]-a.codes[0])/100,s&&s.isLive()?this.userSeek_(s.seekableStart()+s.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):a.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):a.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Bi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||o||Bi.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),b.registerComponent("SeekBar",Bi);class Hi extends b{constructor(e,t){super(e,t),this.handleMouseMove=r(f(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=r(f(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,s,i,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay"),t||s)&&(i=Le(r=n.el()),r=Ii(r=Ne(r,e).x,0,1),s&&s.update(i,r),t)&&t.update(i,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&k(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Hi.prototype.options_={children:["seekBar"]},b.registerComponent("ProgressControl",Hi);class Ri extends P{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Ri.prototype.controlText_="Picture-in-Picture",b.registerComponent("PictureInPictureToggle",Ri);class Fi extends P{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Fi.prototype.controlText_="Fullscreen",b.registerComponent("FullscreenToggle",Fi);class Vi extends b{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}b.registerComponent("VolumeLevel",Vi);class zi extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,s,i,e){if(!i){var i=Oe(this.el_),r=Oe(this.player_.el()),s=t.width*s;if(!r||!i)return;var n=t.left-r.left+s,s=t.width-s+(r.right-t.right);let e=i.width/2;ni.width&&(e=i.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){be(this.el_,e)}updateVolume(e,t,s,i,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,s,i.toFixed(0)),r&&r()})}}b.registerComponent("VolumeLevelTooltip",zi);class qi extends b{constructor(e,t){super(e,t),this.update=r(f(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,s){var i=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,s,i,()=>{s?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}qi.prototype.options_={children:["volumeLevelTooltip"]},b.registerComponent("MouseVolumeLevelDisplay",qi);class $i extends Mi{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Ve(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,s,i,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Oe(i=this.el()),s=this.vertical(),i=Ne(i,e),i=Ii(i=s?i.y:i.x,0,1),r.update(t,i,s)),Ve(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}$i.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||o||$i.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),$i.prototype.playerEvent="volumechange",b.registerComponent("VolumeBar",$i);class Ui extends b{constructor(e,t={}){var s,i;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!G(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.throttledHandleMouseMove=r(f(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Ui.prototype.options_={children:["volumeBar"]},b.registerComponent("VolumeControl",Ui);class Ki extends P{constructor(e,t){var s,i;super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),s=this.player_.lastVolume_();0===t?(this.player_.volume(s<.1?.1:s),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),we(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Ki.prototype.controlText_="Mute",b.registerComponent("MuteToggle",Ki);class Wi extends b{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!G(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){a.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),m(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){a.isEventKey(e,"Esc")&&this.handleMouseOut()}}Wi.prototype.options_={children:["muteToggle","volumeControl"]},b.registerComponent("VolumePanel",Wi);P;b.registerComponent("SkipForward",class extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()?s.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class Xi extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()&&s.seekableStart();let i;i=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Xi.prototype.controlText_="Skip Backward",b.registerComponent("SkipBackward",Xi);class Gi extends b{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof b&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof b&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=p(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),m(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){a.isEventKey(e,"Left")||a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(a.isEventKey(e,"Right")||a.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}b.registerComponent("Menu",Gi);class Yi extends b{constructor(e,t={}){super(e,t),this.menuButton_=new P(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=P.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),m(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new Gi(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=p("li",{className:"vjs-menu-title",textContent:y(this.options_.title),tabIndex:-1}),e=new b(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;ea.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}b.registerComponent("MenuItem",Zi);class er extends Zi{constructor(e,t){var s=t.track;const i=e.textTracks(),r=(t.label=s.label||s.language||"Unknown",t.selected="showing"===s.mode,super(e,t),this.track=s,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),i.addEventListener("change",r),i.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),i.removeEventListener("change",r),i.removeEventListener("selectedlanguagechange",n)}),void 0===i.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),i.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,s=this.player_.textTracks();if(super.handleClick(e),s)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var s=t[e];if(s.kind===this.kind_)return s}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(y(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var s=[];if(this.track_){var i=this.track_.cues;if(i)for(let e=0,t=i.length;e{this.handleTracksChange.apply(this,e)});i.addEventListener("change",r),this.on("dispose",()=>{i.removeEventListener("change",r)})}createEl(e,t,s){e=super.createEl(e,t,s),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(p("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}pr.prototype.contentElType="button",b.registerComponent("PlaybackRateMenuItem",pr);class gr extends Yi{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=p("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),s=[];for(let e=t.length-1;0<=e;e--)s.push(new pr(this.player(),{rate:t[e]+"x"}));return s}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}_r.prototype.options_=Object.assign({},$t.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),b.registerComponent("ErrorDisplay",_r);const fr="vjs-text-track-settings";var ws=["#000","Black"],xt=["#00F","Blue"],yr=["#0FF","Cyan"],br=["#0F0","Green"],Tr=["#F0F","Magenta"],kr=["#F00","Red"],Cr=["#FFF","White"],wr=["#FF0","Yellow"],Er=["1","Opaque"],Sr=["0.5","Semi-Transparent"],xr=["0","Transparent"];const jr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ws,Cr,kr,br,xt,wr,Tr,yr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Er,Sr,xr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Cr,ws,kr,br,xt,wr,Tr,yr]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Er,Sr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[xr,Sr,Er]}};function Pr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}jr.windowColor.options=jr.backgroundColor.options;class Ir extends $t{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=p("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),W(jr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",s="label"){e=jr[e];const i=e.id.replace("%s",this.id_),r=[t,i].join(" ").trim();return[`<${s} id="${i}" class="${"label"===s?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return p("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return p("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return p("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(jr,(e,t,s)=>{i=this.$(t.selector),t=t.parser;var i=Pr(i.options[i.options.selectedIndex].value,t);return void 0!==i&&(e[s]=i),e},{})}setValues(n){W(jr,(e,t)=>{var s=this.$(e.selector),i=n[t],r=e.parser;if(i)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(fr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(fr,JSON.stringify(e)):window.localStorage.removeItem(fr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}b.registerComponent("TextTrackSettings",Ir);class Mr extends b{constructor(e,t){let s=t.ResizeObserver||window.ResizeObserver;super(e,h({createEl:!(s=null===t.ResizeObserver?!1:s),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=ht(()=>{this.resizeHandler()},100,!1,this),s?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){_(this,"resize",t),_(this,"unload",e),e=null};m(this.el_.contentWindow,"unload",e),m(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}b.registerComponent("ResizeManager",Mr);const Ar={trackingThreshold:20,liveTolerance:15};class Or extends b{constructor(e,t){super(e,h(Ar,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),s=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+s,this.liveCurrentTime()),s=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-s)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:p("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+v++}),description:p("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+v++})},p("div",{className:"vjs-title-bar"},{},Y(this.els))}updateDom_(){var e=this.player_.tech_;const i=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],s=this.els[e],e=r[e];Be(s),t&&be(s,t),i&&(i.removeAttribute(e),t)&&i.setAttribute(e,s.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}b.registerComponent("TitleBar",Lr);function Nr(s){const i=s.el();if(!i.resetSourceWatch_){const t={},e=Fr(s),r=t=>(...e)=>{e=t.apply(i,e);return Br(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{i[e]&&(t[e]=i[e],i[e]=r(t[e]))}),Object.defineProperty(i,"innerHTML",h(e,{set:r(e.set)})),i.resetSourceWatch_=()=>{i.resetSourceWatch_=null,Object.keys(t).forEach(e=>{i[e]=t[e]}),Object.defineProperty(i,"innerHTML",e)},s.one("sourceset",i.resetSourceWatch_)}}function Dr(s){if(s.featuresSourceset){const i=s.el();if(!i.resetSourceset_){e=s;const t=Rr([e.el(),window.HTMLMediaElement.prototype,Vr],"src");var e;const r=i.setAttribute,n=i.load;Object.defineProperty(i,"src",h(t,{set:e=>{e=t.set.call(i,e);return s.triggerSourceset(i.src),e}})),i.setAttribute=(e,t)=>{t=r.call(i,e,t);return/src/i.test(e)&&s.triggerSourceset(i.src),t},i.load=()=>{var e=n.call(i);return Br(s)||(s.triggerSourceset(""),Nr(s)),e},i.currentSrc?s.triggerSourceset(i.currentSrc):Br(s)||Nr(s),i.resetSourceset_=()=>{i.resetSourceset_=null,i.load=n,i.setAttribute=r,Object.defineProperty(i,"src",t),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}const Br=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var s=t.$$("source"),i=[];let e="";if(!s.length)return!1;for(let e=0;e{let i={};for(let e=0;eRr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,Hr],"innerHTML"),Vr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ss(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class I extends j{constructor(e,t){super(e,t);t=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var i=this.el_.childNodes;let e=i.length;for(var r=[];e--;){var n=i[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),s||this.el_.hasAttribute("crossorigin")||!is(n.src)||(s=!0)):r.push(n))}for(let e=0;e{i=[];for(let e=0;es.removeEventListener("change",e)),()=>{for(let e=0;e{s.removeEventListener("change",e),s.removeEventListener("change",r),s.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{s.removeEventListener("change",e),s.addEventListener("change",e),s.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const s=e.toLowerCase();this[s+"TracksListeners_"]&&Object.keys(this[s+"TracksListeners_"]).forEach(e=>{this.el()[s+"Tracks"].removeEventListener(e,this[s+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[s+"TracksListeners_"]=null,this.proxyNativeTracksForType_(s)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(s){var e=w[s];const i=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&i&&i.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===s&&this[Cs.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let s=0;s{const s=n[t];i.addEventListener(t,s),this.on("dispose",e=>i.removeEventListener(t,s))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){w.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),I.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=h({},this.options_.tag&&xe(this.options_.tag)),ue&&!0===this.options_.nativeControlsForTouch||delete e.controls,Se(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,s=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)k(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){I.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,s):super.addTextTrack(e,t,s)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var s=this.$$("track");let e=s.length;for(;e--;)t!==s[e]&&t!==s[e].track||this.el().removeChild(s[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Q(I,"TEST_VID",function(){var e,t;if(me())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),I.isSupported=function(){try{I.TEST_VID.volume=.5}catch(e){return!1}return!(!I.TEST_VID||!I.TEST_VID.canPlayType)},I.canPlayType=function(e){return I.TEST_VID.canPlayType(e)},I.canPlaySource=function(e,t){return I.canPlayType(e.type)},I.canControlVolume=function(){try{const t=I.TEST_VID.volume;I.TEST_VID.volume=t/2+.1;var e=t!==I.TEST_VID.volume;return e&&u?(window.setTimeout(()=>{I&&I.prototype&&(I.prototype.featuresVolumeControl=t!==I.TEST_VID.volume)}),!1):e}catch(e){return!1}},I.canMuteVolume=function(){try{var e=I.TEST_VID.muted;return I.TEST_VID.muted=!e,I.TEST_VID.muted?Pe(I.TEST_VID,"muted","muted"):Ie(I.TEST_VID,"muted"),e!==I.TEST_VID.muted}catch(e){return!1}},I.canControlPlaybackRate=function(){if(o&&c&&ae<58)return!1;try{var e=I.TEST_VID.playbackRate;return I.TEST_VID.playbackRate=e/2+.1,e!==I.TEST_VID.playbackRate}catch(e){return!1}},I.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},I.supportsNativeTextTracks=function(){return ge||u&&c},I.supportsNativeVideoTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.videoTracks)},I.supportsNativeAudioTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.audioTracks)},I.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){Q(I.prototype,e,()=>I[t](),!0)}),I.prototype.featuresVolumeControl=I.canControlVolume(),I.prototype.movingMediaElementInDOM=!u,I.prototype.featuresFullscreenResize=!0,I.prototype.featuresProgressEvents=!0,I.prototype.featuresTimeupdateEvents=!0,I.prototype.featuresVideoFrameCallback=!(!I.TEST_VID||!I.TEST_VID.requestVideoFrameCallback),I.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},I.resetMediaElement=function(t){if(t){var s=t.querySelectorAll("source");let e=s.length;for(;e--;)t.removeChild(s[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){I.prototype["set"+y(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){I.prototype["set"+y(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]()}}),j.withSourceHandlers(I),I.nativeSourceHandler={},I.nativeSourceHandler.canPlayType=function(e){try{return I.TEST_VID.canPlayType(e)}catch(e){return""}},I.nativeSourceHandler.canHandleSource=function(e,t){return e.type?I.nativeSourceHandler.canPlayType(e.type):e.src?(e=rs(e.src),I.nativeSourceHandler.canPlayType("video/"+e)):""},I.nativeSourceHandler.handleSource=function(e,t,s){t.setSrc(e.src)},I.nativeSourceHandler.dispose=function(){},I.registerSourceHandler(I.nativeSourceHandler),j.registerTech("Html5",I);const zr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],qr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},$r=["tiny","xsmall","small","medium","large","xlarge","huge"],Ur={},Kr=($r.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ur[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class M extends b{constructor(e,t,s){if(e.id=e.id||t.id||"vjs_video_"+v++,(t=Object.assign(M.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(i=e.closest("[lang]"))&&(t.language=i.getAttribute("lang")),super(null,t,s),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=U(this.id_),this.fsApi_=F,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&xe(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=M.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Tt(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(m(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var i=h(this.options_),s=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=i,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((s=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((i=s.documentElement).style.display="none",this.el_.appendChild(i),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ue&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),M.players[this.id_]=this,D.split(".")[0]);this.addClass("vjs-v"+s),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),_(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),M.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Zs[e.id()]=null,E.names.forEach(e=>{e=this[E[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,s,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const i="video-js"===this.tag.tagName.toLowerCase(),r=(e?s=this.el_=t.parentNode:i||(s=this.el_=super.createEl("div")),xe(t));if(i){for(s=this.el_=t,t=this.tag=document.createElement("video");s.children.length;)t.appendChild(s.firstChild);ke(s,"video-js")||Ce(s,"video-js"),s.appendChild(t),e=this.playerElIngest_=s,Object.keys(s).forEach(e=>{try{t[e]=s[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",c&&he&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){i&&"class"===e||s.setAttribute(e,r[e]),i&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=s.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Je("vjs-styles-dimensions"),n=ze(".vjs-styles-defaults"),(a=ze("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},pt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,s,i;r=(s=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=E[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${y(t)}_`](e))}),Object.keys(qr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${qr[t]}_`].bind(this),event:e}):this[`handleTech${qr[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||Te(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){E.names.forEach(e=>{e=E[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Vt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var s=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var s=this.play();if(Rt(s))return s.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():s():Rt(e=this.play())&&(e=e.catch(s)),Rt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,s="";"string"!=typeof t&&(t=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!s&&(s=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var s=e.cache_.sources.filter(e=>e.src===t);if(s.length)return s[0].type;var i=e.$$("source");for(let e=0;ee.src&&e.src===t),i=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var s=this.currentSource().src,i=t.src;(e=!s||/^blob:/.test(s)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===s)?e:()=>{})(i),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?k(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=k){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),s=Boolean(ge||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),s&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&s&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||T(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:T(0,0)}bufferedPercent(){return Bt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let s=e.end(e.length-1);return s=s>t?t:s}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function i(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(i,i),n.then(e,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,s)=>{function i(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(i,i),n.then(e,s))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&k(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,v(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){a.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,we(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(p("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Ue(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,s,i=this.options_["userActions"];i&&i.hotkeys&&(t=this.el_.ownerDocument.activeElement,s=t.tagName.toLowerCase(),t.isContentEditable||("input"===s?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(s))||("function"==typeof i.hotkeys?i.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>a.isEventKey(e,"f"),muteKey:s=e=>a.isEventKey(e,"m"),playPauseKey:i=e=>a.isEventKey(e,"k")||a.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=b.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):s.call(this,e)?(e.preventDefault(),e.stopPropagation(),b.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),b.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(i){var r;for(let t=0,s=this.options_.techOrder;ts.some(e=>{if(r=i(t,e))return!0})),r}var s=this.options_.techOrder.map(e=>[e,j.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let i;var r,n=([e,t],s)=>{if(t.canPlaySource(s,this.options_[e.toLowerCase()]))return{source:s,tech:e}};return(i=this.options_.sourceOrder?t(e,s,(r=n,(e,t)=>r(t,e))):t(s,e,n))||!1}handleSrc_(e,i){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=li(e);if(r.length){if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),ti(this,r[0],(e,t)=>{var s;if(this.middleware_=t,i||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(s))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",t)};this.one("error",t),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",s)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Et(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():k(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),pt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:s,remainingTimeDisplay:i}=this.controlBar||{},s=(s||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),i&&i.updateContent(),s&&(s.update(),s.loadProgressBar)&&s.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(H("beforeerror").forEach(e=>{e=e(this,t);n(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),H("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,s,i;const r=f(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===s&&e.screenY===i||(s=e.screenX,i=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||o||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var s=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(s),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,s){if(this.tech_)return this.tech_.addTextTrack(e,t,s)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),pt(this))&&this.trigger("languagechange")}languages(){return h(M.prototype.options_.languages,this.languages_)}toJSON(){var t=h(this.options_),s=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(s)}),s.open(),s}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),s=this.currentWidth();for(let e=0;e<$r.length;e++){var i=$r[e];if(s<=this.breakpoints_[i]){if(t===i)return;t&&this.removeClass(Ur[t]),this.addClass(Ur[i]),this.breakpoint_=i;break}}}}removeCurrentBreakpoint_(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0!==e&&(this.breakpoint_="",this.breakpoints_=Object.assign({},Kr,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Ur[this.breakpoint_]||""}loadMedia(e,t){var s,i,r,n,a,o,l;e&&"object"==typeof e&&(s=this.crossOrigin(),{artist:e,artwork:i,description:r,poster:n,src:a,textTracks:o,title:l}=(this.reset(),this.cache_.media=h(e),this.cache_.media),!i&&n&&(this.cache_.media.artwork=[{src:n,type:ci(n)}]),s&&this.crossOrigin(s),a&&this.src(a),n&&this.poster(n),Array.isArray(o)&&o.forEach(e=>this.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?h(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:ci(t.poster)}]),t)}static getTagSettings(e){var t,s={sources:[],tracks:[]},i=xe(e),r=i["data-setup"];if(ke(e,"vjs-fill")&&(i.fill=!0),ke(e,"vjs-fluid")&&(i.fluid=!0),null!==r&&([r,t]=Ht(r||"{}"),r&&l.error(r),Object.assign(i,t)),Object.assign(s,i),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}E.names.forEach(function(e){const t=E[e];M.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),M.prototype.crossorigin=M.prototype.crossOrigin,M.players={};Cr=window.navigator;M.prototype.options_={techOrder:j.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Cr&&(Cr.languages&&Cr.languages[0]||Cr.userLanguage||Cr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){M.prototype[e]=function(){return this.techGet_(e)}}),zr.forEach(function(e){M.prototype[`handleTech${y(e)}_`]=function(){return this.trigger(e)}}),b.registerComponent("Player",M);function Wr(t,s){function i(){en(this,{name:t,plugin:s,instance:null},!0);var e=s.apply(this,arguments);return Zr(this,t),en(this,{name:t,plugin:s,instance:e}),e}return Object.keys(s).forEach(function(e){i[e]=s[e]}),i}const Xr="plugin",Gr="activePlugins_",Yr={},Qr=e=>Yr.hasOwnProperty(e),Jr=e=>Qr(e)?Yr[e]:void 0,Zr=(e,t)=>{e[Gr]=e[Gr]||{},e[Gr][t]=!0},en=(e,t,s)=>{s=(s?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},tn=(s,i)=>(i.prototype.name=s,function(...e){en(this,{name:s,plugin:i,instance:null},!0);const t=new i(this,...e);return this[s]=()=>t,en(this,t.getEventHash()),t});class A{constructor(e){if(this.constructor===A)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Tt(this),delete this.trigger,Ct(this,this.constructor.defaultState),Zr(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return nt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Gr][e]=!1,this.player=this.state=null,t[e]=tn(e,Yr[e])}static isBasic(e){e="string"==typeof e?Jr(e):e;return"function"==typeof e&&!A.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Qr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(M.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Yr[e]=t,e!==Xr&&(A.isBasic(t)?M.prototype[e]=Wr(e,t):M.prototype[e]=tn(e,t)),t}static deregisterPlugin(e){if(e===Xr)throw new Error("Cannot de-register base plugin.");Qr(e)&&(delete Yr[e],delete M.prototype[e])}static getPlugins(e=Object.keys(Yr)){let s;return e.forEach(e=>{var t=Jr(e);t&&((s=s||{})[e]=t)}),s}static getPluginVersion(e){e=Jr(e);return e&&e.VERSION||""}}function O(e,s,i,r){{var n=s+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}A.getPlugin=Jr,A.BASE_PLUGIN_NAME=Xr,A.registerPlugin(Xr,A),M.prototype.usingPlugin=function(e){return!!this[Gr]&&!0===this[Gr][e]},M.prototype.hasPlugin=function(e){return!!Qr(e)};const sn=e=>0===e.indexOf("#")?e.slice(1):e;function L(e,t,s){let i=L.getPlayer(e);if(i)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&i.ready(s);else{const r="string"==typeof e?ze("#"+sn(e)):e;if(!_e(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),H("beforesetup").forEach(e=>{e=e(r,h(t));!n(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=h(t,e)}),b.getComponent("Player"));i=new e(r,t,s),H("setup").forEach(e=>e(i))}return i}return L.hooks_=B,L.hooks=H,L.hook=function(e,t){H(e,t)},L.hookOnce=function(i,e){H(i,[].concat(e).map(t=>{const s=(...e)=>(R(i,s),t(...e));return s}))},L.removeHook=R,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ve()&&!(ws=ze(".vjs-styles-defaults"))&&(ws=Je("vjs-styles-defaults"),(kr=ze("head"))&&kr.insertBefore(ws,kr.firstChild),Ze(ws,` + `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var s=y(e),i=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==s&&this.tag&&(j.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${i}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};E.names.forEach(e=>{e=E[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${y(t)}_`](e))}),Object.keys(qr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${qr[t]}_`].bind(this),event:e}):this[`handleTech${qr[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||Te(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){E.names.forEach(e=>{e=E[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Vt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var s=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var s=this.play();if(Rt(s))return s.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():s():Rt(e=this.play())&&(e=e.catch(s)),Rt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,s="";"string"!=typeof t&&(t=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!s&&(s=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var s=e.cache_.sources.filter(e=>e.src===t);if(s.length)return s[0].type;var i=e.$$("source");for(let e=0;ee.src&&e.src===t),i=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var s=this.currentSource().src,i=t.src;(e=!s||/^blob:/.test(s)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===s)?e:()=>{})(i),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?k(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=k){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),s=Boolean(ge||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),s&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&s&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||T(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:T(0,0)}bufferedPercent(){return Bt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let s=e.end(e.length-1);return s=s>t?t:s}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function i(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(i,i),n.then(e,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,s)=>{function i(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(i,i),n.then(e,s))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&k(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,m(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){a.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,we(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(p("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Ue(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,s,i=this.options_["userActions"];i&&i.hotkeys&&(t=this.el_.ownerDocument.activeElement,s=t.tagName.toLowerCase(),t.isContentEditable||("input"===s?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(s))||("function"==typeof i.hotkeys?i.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>a.isEventKey(e,"f"),muteKey:s=e=>a.isEventKey(e,"m"),playPauseKey:i=e=>a.isEventKey(e,"k")||a.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=b.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):s.call(this,e)?(e.preventDefault(),e.stopPropagation(),b.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),b.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(i){var r;for(let t=0,s=this.options_.techOrder;ts.some(e=>{if(r=i(t,e))return!0})),r}var s=this.options_.techOrder.map(e=>[e,j.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let i;var r,n=([e,t],s)=>{if(t.canPlaySource(s,this.options_[e.toLowerCase()]))return{source:s,tech:e}};return(i=this.options_.sourceOrder?t(e,s,(r=n,(e,t)=>r(t,e))):t(s,e,n))||!1}handleSrc_(e,i){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=li(e);if(r.length){if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),ti(this,r[0],(e,t)=>{var s;if(this.middleware_=t,i||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(s))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",t)};this.one("error",t),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",s)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Et(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():k(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),pt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:s,remainingTimeDisplay:i}=this.controlBar||{},s=(s||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),i&&i.updateContent(),s&&(s.update(),s.loadProgressBar)&&s.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(H("beforeerror").forEach(e=>{e=e(this,t);n(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),H("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,s,i;const r=f(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===s&&e.screenY===i||(s=e.screenX,i=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||o||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var s=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(s),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,s){if(this.tech_)return this.tech_.addTextTrack(e,t,s)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),pt(this))&&this.trigger("languagechange")}languages(){return h(M.prototype.options_.languages,this.languages_)}toJSON(){var t=h(this.options_),s=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(s)}),s.open(),s}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),s=this.currentWidth();for(let e=0;e<$r.length;e++){var i=$r[e];if(s<=this.breakpoints_[i]){if(t===i)return;t&&this.removeClass(Ur[t]),this.addClass(Ur[i]),this.breakpoint_=i;break}}}}removeCurrentBreakpoint_(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0!==e&&(this.breakpoint_="",this.breakpoints_=Object.assign({},Kr,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Ur[this.breakpoint_]||""}loadMedia(e,t){var s,i,r,n,a,o,l;e&&"object"==typeof e&&(s=this.crossOrigin(),{artist:e,artwork:i,description:r,poster:n,src:a,textTracks:o,title:l}=(this.reset(),this.cache_.media=h(e),this.cache_.media),!i&&n&&(this.cache_.media.artwork=[{src:n,type:ci(n)}]),s&&this.crossOrigin(s),a&&this.src(a),n&&this.poster(n),Array.isArray(o)&&o.forEach(e=>this.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?h(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:ci(t.poster)}]),t)}static getTagSettings(e){var t,s={sources:[],tracks:[]},i=xe(e),r=i["data-setup"];if(ke(e,"vjs-fill")&&(i.fill=!0),ke(e,"vjs-fluid")&&(i.fluid=!0),null!==r&&([r,t]=Ht(r||"{}"),r&&l.error(r),Object.assign(i,t)),Object.assign(s,i),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}E.names.forEach(function(e){const t=E[e];M.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),M.prototype.crossorigin=M.prototype.crossOrigin,M.players={};Cr=window.navigator;M.prototype.options_={techOrder:j.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Cr&&(Cr.languages&&Cr.languages[0]||Cr.userLanguage||Cr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){M.prototype[e]=function(){return this.techGet_(e)}}),zr.forEach(function(e){M.prototype[`handleTech${y(e)}_`]=function(){return this.trigger(e)}}),b.registerComponent("Player",M);function Wr(t,s){function i(){en(this,{name:t,plugin:s,instance:null},!0);var e=s.apply(this,arguments);return Zr(this,t),en(this,{name:t,plugin:s,instance:e}),e}return Object.keys(s).forEach(function(e){i[e]=s[e]}),i}const Xr="plugin",Gr="activePlugins_",Yr={},Qr=e=>Yr.hasOwnProperty(e),Jr=e=>Qr(e)?Yr[e]:void 0,Zr=(e,t)=>{e[Gr]=e[Gr]||{},e[Gr][t]=!0},en=(e,t,s)=>{s=(s?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},tn=(s,i)=>(i.prototype.name=s,function(...e){en(this,{name:s,plugin:i,instance:null},!0);const t=new i(this,...e);return this[s]=()=>t,en(this,t.getEventHash()),t});class A{constructor(e){if(this.constructor===A)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Tt(this),delete this.trigger,Ct(this,this.constructor.defaultState),Zr(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return nt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Gr][e]=!1,this.player=this.state=null,t[e]=tn(e,Yr[e])}static isBasic(e){e="string"==typeof e?Jr(e):e;return"function"==typeof e&&!A.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Qr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(M.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Yr[e]=t,e!==Xr&&(A.isBasic(t)?M.prototype[e]=Wr(e,t):M.prototype[e]=tn(e,t)),t}static deregisterPlugin(e){if(e===Xr)throw new Error("Cannot de-register base plugin.");Qr(e)&&(delete Yr[e],delete M.prototype[e])}static getPlugins(e=Object.keys(Yr)){let s;return e.forEach(e=>{var t=Jr(e);t&&((s=s||{})[e]=t)}),s}static getPluginVersion(e){e=Jr(e);return e&&e.VERSION||""}}function O(e,s,i,r){{var n=s+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}A.getPlugin=Jr,A.BASE_PLUGIN_NAME=Xr,A.registerPlugin(Xr,A),M.prototype.usingPlugin=function(e){return!!this[Gr]&&!0===this[Gr][e]},M.prototype.hasPlugin=function(e){return!!Qr(e)};const sn=e=>0===e.indexOf("#")?e.slice(1):e;function L(e,t,s){let i=L.getPlayer(e);if(i)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&i.ready(s);else{const r="string"==typeof e?ze("#"+sn(e)):e;if(!_e(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),H("beforesetup").forEach(e=>{e=e(r,h(t));!n(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=h(t,e)}),b.getComponent("Player"));i=new e(r,t,s),H("setup").forEach(e=>e(i))}return i}return L.hooks_=B,L.hooks=H,L.hook=function(e,t){H(e,t)},L.hookOnce=function(i,e){H(i,[].concat(e).map(t=>{const s=(...e)=>(R(i,s),t(...e));return s}))},L.removeHook=R,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&me()&&!(ws=ze(".vjs-styles-defaults"))&&(ws=Je("vjs-styles-defaults"),(kr=ze("head"))&&kr.insertBefore(ws,kr.firstChild),Ze(ws,` .video-js { width: 300px; height: 150px; @@ -27,4 +27,4 @@ .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } - `)),Ye(1,L),L.VERSION=D,L.options=M.prototype.options_,L.getPlayers=()=>M.players,L.getPlayer=e=>{var t=M.players;let s;if("string"==typeof e){var i=sn(e),r=t[i];if(r)return r;s=ze("#"+i)}else s=e;if(_e(s)){var{player:r,playerId:i}=s;if(r||t[i])return r||t[i]}},L.getAllPlayers=()=>Object.keys(M.players).map(e=>M.players[e]).filter(Boolean),L.players=M.players,L.getComponent=b.getComponent,L.registerComponent=(e,t)=>(j.isTech(t)&&l.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),b.registerComponent.call(b,e,t)),L.getTech=j.getTech,L.registerTech=j.registerTech,L.use=function(e,t){Js[e]=Js[e]||[],Js[e].push(t)},Object.defineProperty(L,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(L.middleware,"TERMINATOR",{value:ei,writeable:!1,enumerable:!0}),L.browser=e,L.obj=J,L.mergeOptions=O(9,"videojs.mergeOptions","videojs.obj.merge",h),L.defineLazyProperty=O(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Q),L.bind=O(9,"videojs.bind","native Function.prototype.bind",f),L.registerPlugin=A.registerPlugin,L.deregisterPlugin=A.deregisterPlugin,L.plugin=(e,t)=>(l.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),A.registerPlugin(e,t)),L.getPlugins=A.getPlugins,L.getPlugin=A.getPlugin,L.getPluginVersion=A.getPluginVersion,L.addLanguage=function(e,t){return e=(""+e).toLowerCase(),L.options.languages=h(L.options.languages,{[e]:t}),L.options.languages[e]},L.log=l,L.createLogger=U,L.time=Dt,L.createTimeRange=O(9,"videojs.createTimeRange","videojs.time.createTimeRanges",T),L.createTimeRanges=O(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",T),L.formatTime=O(9,"videojs.formatTime","videojs.time.formatTime",Nt),L.setFormatTime=O(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ot),L.resetFormatTime=O(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Lt),L.parseUrl=O(9,"videojs.parseUrl","videojs.url.parseUrl",ts),L.isCrossOrigin=O(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",is),L.EventTarget=s,L.any=ot,L.on=v,L.one=at,L.off=_,L.trigger=nt,L.xhr=cs,L.TextTrack=ys,L.AudioTrack=bs,L.VideoTrack=Ts,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{L[e]=function(){return l.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ke[e].apply(null,arguments)}}),L.computedStyle=O(9,"videojs.computedStyle","videojs.dom.computedStyle",$e),L.dom=Ke,L.fn=ct,L.num=t,L.str=St,L.url=ns,L}); \ No newline at end of file + `)),Ye(1,L),L.VERSION=D,L.options=M.prototype.options_,L.getPlayers=()=>M.players,L.getPlayer=e=>{var t=M.players;let s;if("string"==typeof e){var i=sn(e),r=t[i];if(r)return r;s=ze("#"+i)}else s=e;if(_e(s)){var{player:r,playerId:i}=s;if(r||t[i])return r||t[i]}},L.getAllPlayers=()=>Object.keys(M.players).map(e=>M.players[e]).filter(Boolean),L.players=M.players,L.getComponent=b.getComponent,L.registerComponent=(e,t)=>(j.isTech(t)&&l.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),b.registerComponent.call(b,e,t)),L.getTech=j.getTech,L.registerTech=j.registerTech,L.use=function(e,t){Js[e]=Js[e]||[],Js[e].push(t)},Object.defineProperty(L,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(L.middleware,"TERMINATOR",{value:ei,writeable:!1,enumerable:!0}),L.browser=e,L.obj=J,L.mergeOptions=O(9,"videojs.mergeOptions","videojs.obj.merge",h),L.defineLazyProperty=O(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Q),L.bind=O(9,"videojs.bind","native Function.prototype.bind",f),L.registerPlugin=A.registerPlugin,L.deregisterPlugin=A.deregisterPlugin,L.plugin=(e,t)=>(l.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),A.registerPlugin(e,t)),L.getPlugins=A.getPlugins,L.getPlugin=A.getPlugin,L.getPluginVersion=A.getPluginVersion,L.addLanguage=function(e,t){return e=(""+e).toLowerCase(),L.options.languages=h(L.options.languages,{[e]:t}),L.options.languages[e]},L.log=l,L.createLogger=U,L.time=Dt,L.createTimeRange=O(9,"videojs.createTimeRange","videojs.time.createTimeRanges",T),L.createTimeRanges=O(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",T),L.formatTime=O(9,"videojs.formatTime","videojs.time.formatTime",Nt),L.setFormatTime=O(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ot),L.resetFormatTime=O(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Lt),L.parseUrl=O(9,"videojs.parseUrl","videojs.url.parseUrl",ts),L.isCrossOrigin=O(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",is),L.EventTarget=s,L.any=ot,L.on=m,L.one=at,L.off=_,L.trigger=nt,L.xhr=cs,L.TextTrack=ys,L.AudioTrack=bs,L.VideoTrack=Ts,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{L[e]=function(){return l.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ke[e].apply(null,arguments)}}),L.computedStyle=O(9,"videojs.computedStyle","videojs.dom.computedStyle",$e),L.dom=Ke,L.fn=ct,L.num=t,L.str=St,L.url=ns,L}); \ No newline at end of file diff --git a/node_modules/video.js/dist/alt/video.core.novtt.js b/node_modules/video.js/dist/alt/video.core.novtt.js index 18051be5ca..203039f198 100644 --- a/node_modules/video.js/dist/alt/video.core.novtt.js +++ b/node_modules/video.js/dist/alt/video.core.novtt.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -16,7 +16,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojs = factory()); })(this, (function () { 'use strict'; - var version = "8.6.0"; + var version = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1996,7 +1996,7 @@ * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2719,7 +2719,7 @@ /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2736,7 +2736,7 @@ * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget.prototype.allowedEvents_ = {}; @@ -4169,7 +4169,6 @@ /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4180,6 +4179,7 @@ * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4634,9 +4634,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4652,9 +4651,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4700,7 +4698,7 @@ * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4875,7 +4873,7 @@ * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4887,7 +4885,7 @@ * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6524,7 +6522,7 @@ * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6574,7 +6572,7 @@ /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -8012,7 +8010,9 @@ */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -8055,6 +8055,7 @@ /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -8313,6 +8314,10 @@ }); } } + + /** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -8408,7 +8413,7 @@ * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8844,7 +8849,7 @@ * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9608,7 +9613,7 @@ * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9633,7 +9638,7 @@ /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9688,7 +9693,7 @@ * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -10467,7 +10472,7 @@ * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -11223,7 +11228,7 @@ * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -11277,7 +11282,7 @@ * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -11288,7 +11293,7 @@ const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -11308,10 +11313,29 @@ this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -11397,7 +11421,7 @@ * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -15024,7 +15048,7 @@ /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15621,7 +15645,7 @@ * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20680,8 +20704,8 @@ * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -22420,7 +22444,9 @@ */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -23376,7 +23402,7 @@ * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25580,7 +25606,7 @@ * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25733,7 +25759,7 @@ * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25752,7 +25778,7 @@ * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25968,7 +25994,7 @@ * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25976,14 +26002,14 @@ * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25991,11 +26017,11 @@ * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -26322,10 +26348,10 @@ * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -26408,9 +26434,11 @@ * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); diff --git a/node_modules/video.js/dist/alt/video.core.novtt.min.js b/node_modules/video.js/dist/alt/video.core.novtt.min.js index 8a4fae8c4d..54447db9f4 100644 --- a/node_modules/video.js/dist/alt/video.core.novtt.min.js +++ b/node_modules/video.js/dist/alt/video.core.novtt.min.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -9,7 +9,7 @@ * Available under Apache License Version 2.0 * */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var D="8.6.0";const s={},B=function(e,t){return s[e]=s[e]||[],t&&(s[e]=s[e].concat(t)),s[e]};function H(e,t){return!((t=B(e).indexOf(t))<=-1||(s[e]=s[e].slice(),s[e].splice(t,1),0))}const F={prefixed:!0};var R=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],z=R[0];let V;for(let e=0;e{var e,s=h.levels[s],r=new RegExp(`^(${s})$`);let n=l;if("log"!==t&&i.unshift(t.toUpperCase()+":"),c&&(n="%c"+l,i.unshift(c)),i.unshift(n+":"),d&&(d.push([].concat(i)),e=d.length-1e3,d.splice(0,0i(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==s?s:a),o.createNewLogger=(e,t,s)=>i(e,t,s),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>d?[].concat(d):[],o.history.filter=t=>(d||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{d&&(d.length=0)},o.history.disable=()=>{null!==d&&(d.length=0,d=null)},o.history.enable=()=>{null===d&&(d=[])},o.error=(...e)=>s("error",t,e),o.warn=(...e)=>s("warn",t,e),o.debug=(...e)=>s("debug",t,e),o}("VIDEOJS"),$=l.createLogger,K=Object.prototype.toString;function U(t,s){q(t).forEach(e=>s(t[e],e))}function W(s,i,e=0){return q(s).reduce((e,t)=>i(e,s[t],t),e)}function n(e){return!!e&&"object"==typeof e}function X(e){return n(e)&&"[object Object]"===K.call(e)&&e.constructor===Object}function h(...e){const s={};return e.forEach(e=>{e&&U(e,(e,t)=>{X(e)?(X(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function G(e={}){var t,s=[];for(const i in e)e.hasOwnProperty(i)&&(t=e[i],s.push(t));return s}function Y(t,s,i,e=!0){const r=e=>Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,s,n)}var Q=Object.freeze({__proto__:null,each:U,reduce:W,isObject:n,isPlain:X,merge:h,values:G,defineLazyProperty:Y});let J=!1,Z=null,o=!1,ee,te=!1,se=!1,ie=!1,c=!1,re=null,ne=null,ae=null,oe=!1,le=!1,he=!1,ce=!1;const de=Boolean(ge()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var ue,e=window.navigator&&window.navigator.userAgentData;if(e&&(o="Android"===e.platform,se=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ie=Boolean(e.brands.find(e=>"Chromium"===e.brand)),c=!se&&ie,re=ne=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,le="Windows"===e.platform),!ie){const N=window.navigator&&window.navigator.userAgent||"";J=/iPod/i.test(N),Z=(e=N.match(/OS (\d+)_/i))&&e[1]?e[1]:null,o=/Android/i.test(N),ee=(e=N.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ht=e[1]&&parseFloat(e[1]),ue=e[2]&&parseFloat(e[2]),ht&&ue?parseFloat(e[1]+"."+e[2]):ht||null):null,te=/Firefox/i.test(N),se=/Edg/i.test(N),ie=/Chrome/i.test(N)||/CriOS/i.test(N),c=!se&&ie,re=ne=(ue=N.match(/(Chrome|CriOS)\/(\d+)/))&&ue[2]?parseFloat(ue[2]):null,ae=function(){var e=/MSIE\s(\d+)\.\d/.exec(N);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(N)&&/rv:11.0/.test(N)?11:t}(),oe=/Safari/i.test(N)&&!c&&!o&&!se,le=/Windows/i.test(N),he=/iPad/i.test(N)||oe&&de&&!/iPhone/i.test(N),ce=/iPhone/i.test(N)&&!he}const u=ce||he||J,pe=(oe||u)&&!c;e=Object.freeze({__proto__:null,get IS_IPOD(){return J},get IOS_VERSION(){return Z},get IS_ANDROID(){return o},get ANDROID_VERSION(){return ee},get IS_FIREFOX(){return te},get IS_EDGE(){return se},get IS_CHROMIUM(){return ie},get IS_CHROME(){return c},get CHROMIUM_VERSION(){return re},get CHROME_VERSION(){return ne},get IE_VERSION(){return ae},get IS_SAFARI(){return oe},get IS_WINDOWS(){return le},get IS_IPAD(){return he},get IS_IPHONE(){return ce},TOUCH_ENABLED:de,IS_IOS:u,IS_ANY_SAFARI:pe});function ve(e){return"string"==typeof e&&Boolean(e.trim())}function ge(){return document===window.document}function me(e){return n(e)&&1===e.nodeType}function _e(){try{return window.parent!==window.self}catch(e){return!0}}function ye(s){return function(e,t){return ve(e)?(t=me(t=ve(t)?document.querySelector(t):t)?t:document)[s]&&t[s](e):document[s](null)}}function p(e="div",s={},t={},i){const r=document.createElement(e);return Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];"textContent"===e?fe(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),i&&He(r,i),r}function fe(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function be(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Te(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function ke(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function Ce(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function we(t,e,s){return"boolean"!=typeof(s="function"==typeof s?s(t,e):s)&&(s=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,s)),t}function Ee(s,i){Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];null===t||"undefined"==typeof t||!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})}function Se(e){var s={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(s[e]=t[e])}),s.height||(s.height=parseFloat(qe(e,"height"))),s.width||(s.width=parseFloat(qe(e,"width"))),s}}function Ae(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,s=e.offsetHeight;let i=0,r=0;for(;e.offsetParent&&e!==document[F.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:s}}function Le(t,e){var s={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var i,r=qe(e,"transform");/^matrix/.test(r)?(i=r.slice(7,-1).split(/,\s/).map(Number),s.x+=i[4],s.y+=i[5]):/^matrix3d/.test(r)&&(i=r.slice(9,-1).split(/,\s/).map(Number),s.x+=i[12],s.y+=i[13]),e=e.parentNode}}var n={},a=Ae(e.target),t=Ae(t),o=t.width,l=t.height;let h=e.offsetY-(t.top-a.top),c=e.offsetX-(t.left-a.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-t.left,h=e.changedTouches[0].pageY+t.top,u)&&(c-=s.x,h-=s.y),n.y=1-Math.max(0,Math.min(1,h/l)),n.x=Math.max(0,Math.min(1,c/o)),n}function Ne(e){return n(e)&&3===e.nodeType}function De(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Be(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>me(e="function"==typeof e?e():e)||Ne(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return Be(e).forEach(e=>t.appendChild(e)),t}function Fe(e,t){return He(De(e),t)}function Re(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const ze=ye("querySelector"),Ve=ye("querySelectorAll");function qe(t,s){if(!t||!s)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(s)||e[s]:""}}function $e(i){[...document.styleSheets].forEach(t=>{try{var s=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=s,i.document.head.appendChild(e)}catch(e){s=document.createElement("link");s.rel="stylesheet",s.type=t.type,s.media=t.media.mediaText,s.href=t.href,i.document.head.appendChild(s)}})}var Ke=Object.freeze({__proto__:null,isReal:ge,isEl:me,isInFrame:_e,createEl:p,textContent:fe,prependTo:be,hasClass:Te,addClass:ke,removeClass:Ce,toggleClass:we,setAttributes:Ee,getAttributes:Se,getAttribute:xe,setAttribute:je,removeAttribute:Pe,blockTextSelection:Ie,unblockTextSelection:Me,getBoundingClientRect:Oe,findPosition:Ae,getPointerPosition:Le,isTextNode:Ne,emptyEl:De,normalizeContent:Be,appendContent:He,insertContent:Fe,isSingleLeftClick:Re,$:ze,$$:Ve,computedStyle:qe,copyStyleSheetsToWindow:$e});let Ue=!1,We;function Xe(){if(!1!==We.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),s=Array.prototype.slice.call(document.getElementsByTagName("video-js")),i=e.concat(t,s);if(i&&0=i&&(s(...e),r=t)}}function lt(i,r,n,a=window){let o;function e(){const e=this,t=arguments;let s=function(){o=null,s=null,n||i.apply(e,t)};!o&&n&&i.apply(e,t),a.clearTimeout(o),o=a.setTimeout(s,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ht=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:y,throttle:r,debounce:lt});let ct;class i{on(e,t){var s=this.addEventListener;this.addEventListener=()=>{},m(this,e,t),this.addEventListener=s}off(e,t){_(this,e,t)}one(e,t){var s=this.addEventListener;this.addEventListener=()=>{},nt(this,e,t),this.addEventListener=s}any(e,t){var s=this.addEventListener;this.addEventListener=()=>{},at(this,e,t),this.addEventListener=s}trigger(e){var t=e.type||e;e=tt(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),rt(this,e)}queueTrigger(e){ct=ct||new Map;const t=e.type||e;let s=ct.get(this);s||(s=new Map,ct.set(this,s));var i=s.get(t),i=(s.delete(t),window.clearTimeout(i),window.setTimeout(()=>{s.delete(t),0===s.size&&(s=null,ct.delete(this)),this.trigger(e)},0));s.set(t,i)}}i.prototype.allowedEvents_={},i.prototype.addEventListener=i.prototype.on,i.prototype.removeEventListener=i.prototype.off,i.prototype.dispatchEvent=i.prototype.trigger;const dt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),a=t=>t instanceof i||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),ut=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,pt=(e,t,s)=>{if(!e||!e.nodeName&&!a(e))throw new Error(`Invalid target for ${dt(t)}#${s}; must be a DOM node or evented object.`)},vt=(e,t,s)=>{if(!ut(e))throw new Error(`Invalid event type for ${dt(t)}#${s}; must be a non-empty string or array.`)},gt=(e,t,s)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${dt(t)}#${s}; must be a function.`)},mt=(e,t,s)=>{var i=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return i?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,pt(r,e,s),vt(n,e,s),gt(a,e,s),a=y(e,a),{isTargetingSelf:i,target:r,type:n,listener:a}},_t=(e,t,s,i)=>{pt(e,e,t),e.nodeName?ot[t](e,s,i):e[t](s,i)},yt={on(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"on");if(_t(s,"on",i,r),!t){const n=()=>this.off(s,i,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,_t(this,"on","dispose",n),_t(s,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"one");if(t)_t(s,"one",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,_t(s,"one",i,n)}},any(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"any");if(t)_t(s,"any",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,_t(s,"any",i,n)}},off(e,t,s){!e||ut(e)?_(this.eventBusEl_,e,t):(e=e,t=t,pt(e,this,"off"),vt(t,this,"off"),gt(s,this,"off"),s=y(this,s),this.off("dispose",s),e.nodeName?(_(e,t,s),_(e,"dispose",s)):a(e)&&(e.off(t,s),e.off("dispose",s)))},trigger(e,t){pt(this.eventBusEl_,this,"trigger");var s=e&&"string"!=typeof e?e.type:e;if(ut(s))return rt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${dt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function ft(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=p("span",{className:"vjs-event-bus"});Object.assign(e,yt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&v.has(e)&&v.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const bt={state:{},setState(e){"function"==typeof e&&(e=e());let s;return U(e,(e,t)=>{this.state[t]!==e&&((s=s||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),s&&a(this)&&this.trigger({changes:s,type:"statechanged"}),s}};function Tt(e,t){Object.assign(e,bt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&a(e)&&e.on("statechanged",e.handleStateChanged)}function kt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function f(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Ct(e,t){return f(e)===f(t)}var wt=Object.freeze({__proto__:null,toLowerCase:kt,toTitleCase:f,titleCaseEquals:Ct}),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Et(e,t){return e(t={exports:{}},t.exports),t.exports}var b=Et(function(e,t){function s(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),i[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}s.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var s=i[t.toLowerCase()];if(s)return s===e;if(s=r[t.toLowerCase()])return s===e}else if("number"==typeof t)return t===e;return!1}};for(var i=(t=e.exports=s).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)i[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)i[n-48]=n;for(n=1;n<13;n++)i["f"+n]=n+111;for(n=0;n<10;n++)i["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in i)o[i[n]]=n;for(a in r)i[a]=r[a]});b.code,b.codes,b.aliases,b.names,b.title;class T{constructor(e,t,s){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=h({},this.options_),t=this.options_=h(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+g++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(ft(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Tt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(s),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=h(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,s){return p(e,t,s)}localize(e,i,t=e){var s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],s=s&&s.split("-")[0],r=r&&r[s];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=i?a.replace(/\{(\d+)\}/g,function(e,t){t=i[t-1];let s="undefined"==typeof t?e:t;return s}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let s=this;for(let e=0;e{let t,s;return s="string"==typeof e?(t=e,i[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:s}}).filter(e=>{e=T.getComponent(e.opts.componentClass||f(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let s=e.opts;!1!==(s=void 0!==r[t]?r[t]:s)&&((s=!0===s?{}:s).playerOptions=this.options_.playerOptions,e=this.addChild(t,s))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(s)&&this.setTimeoutIds_.delete(s),e()},t),this.setTimeoutIds_.add(s),s}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=y(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=y(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var s;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=y(this,t),s=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,s),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,s])=>{this[e].forEach((e,t)=>this[s](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var s=T.getComponent("Tech"),s=s&&s.isTech(e),i=T===e||T.prototype.isPrototypeOf(e.prototype);if(s||!i){let e;throw e=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=f(t),T.components_||(T.components_={});i=T.getComponent("Player");if("Player"===t&&i&&i.players){const r=i.players;s=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return T.components_[t]=e,T.components_[kt(t)]=e}static getComponent(e){if(e&&T.components_)return T.components_[e]}}function St(e,t,s,i){var r=i,n=s.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function k(e,t){return Array.isArray(e)?xt(e):void 0===e||void 0===t?xt():xt([[e,t]])}T.registerComponent("Component",T);function jt(e,t){e=e<0?0:e;let s=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:i=s="-")||0s&&(n=s),i+=n-r;return i/s}function C(e){if(e instanceof C)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:n(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=C.defaultMessages[this.code]||"")}C.prototype.code=0,C.prototype.message="",C.prototype.status=null,C.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],C.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Bt(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,s)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Ht=function(e){var t=e.$$("track");const s=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Bt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===s.indexOf(e)}).map(Bt))},Ft=function(e,s){return e.forEach(function(e){const t=s.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),s.textTracks()};Bt;const Rt="vjs-modal-dialog";class zt extends T{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=p("div",{className:Rt+"-content"},{role:"document"}),this.descEl_=p("p",{className:Rt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),fe(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Rt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var s,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(s=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),s=t.parentNode,i=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,s.removeChild(t),this.empty(),Fe(t,e),this.trigger("modalfill"),i?s.insertBefore(t,i):s.appendChild(t),this.getChild("closeButton"));e&&s.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),De(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),b.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(b.isEventKey(e,"Tab")){var s=this.focusableEls_(),i=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}zt.prototype.options_={pauseOnOpen:!0,temporary:!0},T.registerComponent("ModalDialog",zt);class Vt extends i{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},a(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(s){let i;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class Ut{constructor(e){Ut.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let s=0;function i(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),s.flush()}function gs(e,i){var t={uri:e};(e=es(e))&&(t.cors=e),(e="use-credentials"===i.tech_.crossOrigin())&&(t.withCredentials=e),ls(t,y(this,function(e,t,s){if(e)return l.error(e,t);i.loaded_=!0,"function"!=typeof window.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return vs(s,i);l.error("vttjs failed to load, stopping trying to process "+i.src)}):vs(s,i)}))}class ms extends Qt{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=h(e,{kind:Gt[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Yt[e.mode]||"disabled";const s=e.default,i=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new Ut(this.cues_)),n=new Ut(this.activeCues_);let a=!1;this.timeupdateHandler=y(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return t},set(e){Yt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||gs(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var s=this.tech_.currentTime(),i=[];for(let e=0,t=this.cues.length;e=s&&i.push(r)}if(a=!1,i.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=fs.LOADED,this.trigger({type:"load",target:this})})}}fs.prototype.allowedEvents_={load:"load"},fs.NONE=0,fs.LOADING=1,fs.LOADED=2,fs.ERROR=3;const S={audio:{ListClass:class extends Vt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){qt(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&qt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,qt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:_s,capitalName:"Audio"},video:{ListClass:class extends Vt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){$t(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,$t(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:ys,capitalName:"Video"},text:{ListClass:Kt,TrackClass:ms,capitalName:"Text"}},bs=(Object.keys(S).forEach(function(e){S[e].getterName=e+"Tracks",S[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:Kt,TrackClass:ms,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(s=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=s.length;ethis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),x.names.forEach(e=>{e=x[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new x.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(y(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return k(0,0)}bufferedPercent(){return Lt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(S.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let s=t.length;for(;s--;){var i=t[s];"text"===e&&this.removeRemoteTextTrack(i),t.removeTrack(i)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var s=e[t];this.removeRemoteTextTrack(s)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new C(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?k(0,0):k()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){S.names.forEach(e=>{var t=S[e];const s=()=>{this.trigger(e+"trackchange")},i=this[t.getterName]();i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),this.on("dispose",()=>{i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&X(Ts)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const s=this.textTracks(),e=this.remoteTextTracks(),t=e=>s.addTrack(e.track),i=e=>s.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",i),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(s.track)),s}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=g++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return j.canPlayType(e.type)}static isTech(e){return e.prototype instanceof j||e instanceof j||e===j}static registerTech(e,t){if(j.techs_||(j.techs_={}),!j.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!j.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(j.canPlaySource)return e=f(e),j.techs_[e]=t,j.techs_[kt(e)]=t,"Tech"!==e&&j.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return j.techs_&&j.techs_[e]?j.techs_[e]:(e=f(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}x.names.forEach(function(e){const t=x[e];j.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),j.prototype.featuresVolumeControl=!0,j.prototype.featuresMuteControl=!0,j.prototype.featuresFullscreenResize=!1,j.prototype.featuresPlaybackRate=!1,j.prototype.featuresProgressEvents=!1,j.prototype.featuresSourceset=!1,j.prototype.featuresTimeupdateEvents=!1,j.prototype.featuresNativeTextTracks=!1,j.prototype.featuresVideoFrameCallback=!1,j.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let s=r.sourceHandlers;s=s||(r.sourceHandlers=[]),void 0===t&&(t=s.length),s.splice(t,0,e)},r.canPlayType=function(t){var s,i=r.sourceHandlers||[];for(let e=0;efunction s(i={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)s(i,ks[t],r,n,a,o);else if(t){const h=Ms(n,t);if(!h.setSource)return a.push(h),s(i,l,r,n,a,o);h.setSource(Object.assign({},i),function(e,t){if(e)return s(i,l,r,n,a,o);a.push(h),s(t,i.type===t.type?l:ks[t.type],r,n,a,o)})}else l.length?s(i,l,r,n,a,o):o?r(i,a):s(i,ks["*"],r,n,a,!0)}(t,ks[t.type],s,e),1)}function Ss(e,t,s,i=null){var r="call"+f(s),r=e.reduce(Is(r),i),i=r===ws,t=i?null:t[s](r),n=e,a=s,o=t,l=i;for(let e=n.length-1;0<=e;e--){var h=n[e];h[a]&&h[a](l,o)}return t}const xs={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},js={setCurrentTime:1,setMuted:1,setVolume:1},Ps={play:1,pause:1};function Is(s){return(e,t)=>e===ws?ws:t[s]?t[s](e):e}function Ms(e,t){var s=Cs[e.id()];let i=null;if(null==s)i=t(e),Cs[e.id()]=[[t,i]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},s={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),s=Object.assign({role:"button"},s),this.tabIndex_=t.tabIndex;e=p(e,t,s);return this.player_.options_.experimentalSvgIcons||e.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=p("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var s=this.localize(e);this.controlText_=e,fe(this.controlTextEl_,s),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",s)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){b.isEventKey(e,"Space")||b.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}T.registerComponent("ClickableComponent",Bs);class Hs extends Bs{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return p("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(p("picture",{className:"vjs-poster",tabIndex:-1},{},p("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?w(this.player_.play()):this.player_.pause())}}Hs.prototype.crossorigin=Hs.prototype.crossOrigin,T.registerComponent("PosterImage",Hs);const Fs={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Rs(e,t){let s;if(4===e.length)s=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");s=e.slice(1)}return"rgba("+parseInt(s.slice(0,2),16)+","+parseInt(s.slice(2,4),16)+","+parseInt(s.slice(4,6),16)+","+t+")"}function zs(e,t,s){try{e.style[t]=s}catch(e){}}function Vs(e){return e?e+"px":""}class qs extends T{constructor(i,e,t){super(i,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};i.on("loadstart",e=>this.toggleDisplay(e)),i.on("texttrackchange",e=>this.updateDisplay(e)),i.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),i.ready(y(this,function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",r),i.on("playerresize",r);const e=window.screen.orientation||window,s=window.screen.orientation?"change":"orientationchange";e.addEventListener(s,r),i.on("dispose",()=>e.removeEventListener(s,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)w(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const s=e&&e.getChild("playToggle");s?(e=()=>s.focus(),Dt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Ks.prototype.controlText_="Play Video",T.registerComponent("BigPlayButton",Ks);P;T.registerComponent("CloseButton",class extends P{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){b.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class Us extends P{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?w(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Us.prototype.controlText_="Play",T.registerComponent("PlayToggle",Us);class Ws extends T{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),s=p("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(s),this.contentEl_=p("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ot(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Ws.prototype.labelText_="Time",Ws.prototype.controlText_="Time",T.registerComponent("TimeDisplay",Ws);class Xs extends Ws{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Xs.prototype.labelText_="Current Time",Xs.prototype.controlText_="Current Time",T.registerComponent("CurrentTimeDisplay",Xs);class Gs extends Ws{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Gs.prototype.labelText_="Duration",Gs.prototype.controlText_="Duration",T.registerComponent("DurationDisplay",Gs);class Ys extends T{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),s=super.createEl("span",{textContent:"/"});return t.appendChild(s),e.appendChild(t),e}}T.registerComponent("TimeDivider",Ys);class Qs extends Ws{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(p("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}Qs.prototype.labelText_="Remaining Time",Qs.prototype.controlText_="Remaining Time",T.registerComponent("RemainingTimeDisplay",Qs);class Js extends T{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=p("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(p("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}T.registerComponent("LiveDisplay",Js);class Zs extends P{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=p("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function ei(e,t,s){return e=Number(e),Math.min(s,Math.max(t,isNaN(e)?t:e))}Zs.prototype.controlText_="Seek to live, currently playing live",T.registerComponent("SeekToLive",Zs);t=Object.freeze({__proto__:null,clamp:ei});class ti extends T{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},s={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),s=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},s),super.createEl(e,t,s)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||c||e.preventDefault(),Ie(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Me(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(ei(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Le(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){b.isEventKey(e,"Left")||b.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):b.isEventKey(e,"Right")||b.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}T.registerComponent("Slider",ti);const si=(e,t)=>ei(e/t*100,0,100).toFixed(2)+"%";class ii extends T{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=p("span",{className:"vjs-control-text"}),s=p("span",{textContent:this.localize("Loaded")}),i=document.createTextNode(": ");return this.percentageEl_=p("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(s),t.appendChild(i),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,s=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),r=this.partEls_,e=si(i,e);this.percent_!==e&&(this.el_.style.width=e,fe(this.percentageEl_,e),this.percent_=e);for(let t=0;ts.length;e--)this.el_.removeChild(r[e-1]);r.length=s.length})}}T.registerComponent("LoadProgressBar",ii);class ri extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,s,i){var r=Ae(this.el_),n=Oe(this.player_.el()),s=t.width*s;if(n&&r){var a=t.left-n.left+s,s=t.width-s+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(i)}}write(e){fe(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,s,i=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((s=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Ot(s,t):Ot(a,i),this.update(r,n,e),o&&o()})}}T.registerComponent("TimeTooltip",ri);class ni extends T{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var s,i=this.getChild("timeTooltip");i&&(s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),i.updateTime(e,t,s))}}ni.prototype.options_={children:[]},u||o||ni.prototype.options_.children.push("timeTooltip"),T.registerComponent("PlayProgressBar",ni);class ai extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var s=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,s,()=>{this.el_.style.left=e.width*t+"px"})}}ai.prototype.options_={children:["timeTooltip"]},T.registerComponent("MouseTimeDisplay",ai);class oi extends ti{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=y(this,this.update),this.update=r(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let s=this.player_.duration();t&&t.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(100*i).toFixed(2)),this.percent_=i),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ot(e,s),Ot(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Oe(this.el()),this.getProgress())}),i}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var s=this.player_.liveTracker;return s&&s.isLive()?(t=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Re(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,s=!1){if(Re(t)&&!isNaN(this.player_.duration())){s||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;s=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=s)return void t.seekToLiveEdge();var i=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=i+s*t.liveWindow())>=r?r:e)<=i?i+.1:e)===1/0)return}else(e=s*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?w(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,s=this.player_.liveTracker;b.isEventKey(e,"Space")||b.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):b.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):b.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),s&&s.isLive()?this.userSeek_(s.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(b(e))?(e.preventDefault(),e.stopPropagation(),t=10*(b.codes[b(e)]-b.codes[0])/100,s&&s.isLive()?this.userSeek_(s.seekableStart()+s.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):b.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):b.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}oi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||o||oi.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),T.registerComponent("SeekBar",oi);class li extends T{constructor(e,t){super(e,t),this.handleMouseMove=r(y(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=r(y(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,s,i,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay"),t||s)&&(i=Ae(r=n.el()),r=ei(r=Le(r,e).x,0,1),s&&s.update(i,r),t)&&t.update(i,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&w(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}li.prototype.options_={children:["seekBar"]},T.registerComponent("ProgressControl",li);class hi extends P{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}hi.prototype.controlText_="Picture-in-Picture",T.registerComponent("PictureInPictureToggle",hi);class ci extends P{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ci.prototype.controlText_="Fullscreen",T.registerComponent("FullscreenToggle",ci);class di extends T{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}T.registerComponent("VolumeLevel",di);class ui extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,s,i,e){if(!i){var i=Oe(this.el_),r=Oe(this.player_.el()),s=t.width*s;if(!r||!i)return;var n=t.left-r.left+s,s=t.width-s+(r.right-t.right);let e=i.width/2;ni.width&&(e=i.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){fe(this.el_,e)}updateVolume(e,t,s,i,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,s,i.toFixed(0)),r&&r()})}}T.registerComponent("VolumeLevelTooltip",ui);class pi extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,s){var i=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,s,i,()=>{s?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}pi.prototype.options_={children:["volumeLevelTooltip"]},T.registerComponent("MouseVolumeLevelDisplay",pi);class vi extends ti{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Re(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,s,i,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Oe(i=this.el()),s=this.vertical(),i=Le(i,e),i=ei(i=s?i.y:i.x,0,1),r.update(t,i,s)),Re(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}vi.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||o||vi.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),vi.prototype.playerEvent="volumechange",T.registerComponent("VolumeBar",vi);class gi extends T{constructor(e,t={}){var s,i;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!X(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.throttledHandleMouseMove=r(y(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gi.prototype.options_={children:["volumeBar"]},T.registerComponent("VolumeControl",gi);class mi extends P{constructor(e,t){var s,i;super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),s=this.player_.lastVolume_();0===t?(this.player_.volume(s<.1?.1:s),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Ce(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),ke(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}mi.prototype.controlText_="Mute",T.registerComponent("MuteToggle",mi);class _i extends T{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!X(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){b.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),m(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){b.isEventKey(e,"Esc")&&this.handleMouseOut()}}_i.prototype.options_={children:["muteToggle","volumeControl"]},T.registerComponent("VolumePanel",_i);P;T.registerComponent("SkipForward",class extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()?s.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class yi extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()&&s.seekableStart();let i;i=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}yi.prototype.controlText_="Skip Backward",T.registerComponent("SkipBackward",yi);class fi extends T{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof T&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof T&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=p(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),m(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){b.isEventKey(e,"Left")||b.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(b.isEventKey(e,"Right")||b.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}T.registerComponent("Menu",fi);class bi extends T{constructor(e,t={}){super(e,t),this.menuButton_=new P(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=P.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),m(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new fi(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=p("li",{className:"vjs-menu-title",textContent:f(this.options_.title),tabIndex:-1}),e=new T(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;eb.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}T.registerComponent("MenuItem",Ci);class wi extends Ci{constructor(e,t){var s=t.track;const i=e.textTracks(),r=(t.label=s.label||s.language||"Unknown",t.selected="showing"===s.mode,super(e,t),this.track=s,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),i.addEventListener("change",r),i.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),i.removeEventListener("change",r),i.removeEventListener("selectedlanguagechange",n)}),void 0===i.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),i.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,s=this.player_.textTracks();if(super.handleClick(e),s)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var s=t[e];if(s.kind===this.kind_)return s}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(f(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var s=[];if(this.track_){var i=this.track_.cues;if(i)for(let e=0,t=i.length;e{this.handleTracksChange.apply(this,e)});i.addEventListener("change",r),this.on("dispose",()=>{i.removeEventListener("change",r)})}createEl(e,t,s){e=super.createEl(e,t,s),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(p("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Bi.prototype.contentElType="button",T.registerComponent("PlaybackRateMenuItem",Bi);class Hi extends bi{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=p("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),s=[];for(let e=t.length-1;0<=e;e--)s.push(new Bi(this.player(),{rate:t[e]+"x"}));return s}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}zi.prototype.options_=Object.assign({},zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),T.registerComponent("ErrorDisplay",zi);const Vi="vjs-text-track-settings";var qi=["#000","Black"],$i=["#00F","Blue"],Ki=["#0FF","Cyan"],Ui=["#0F0","Green"],Wi=["#F0F","Magenta"],Xi=["#F00","Red"],Gi=["#FFF","White"],Yi=["#FF0","Yellow"],Qi=["1","Opaque"],Ji=["0.5","Semi-Transparent"],Zi=["0","Transparent"];const er={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[qi,Gi,Xi,Ui,$i,Yi,Wi,Ki]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Qi,Ji,Zi]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Gi,qi,Xi,Ui,$i,Yi,Wi,Ki]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Qi,Ji]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Zi,Ji,Qi]}};function tr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}er.windowColor.options=er.backgroundColor.options;class sr extends zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=p("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),U(er,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",s="label"){e=er[e];const i=e.id.replace("%s",this.id_),r=[t,i].join(" ").trim();return[`<${s} id="${i}" class="${"label"===s?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return p("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return p("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return p("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return W(er,(e,t,s)=>{i=this.$(t.selector),t=t.parser;var i=tr(i.options[i.options.selectedIndex].value,t);return void 0!==i&&(e[s]=i),e},{})}setValues(n){U(er,(e,t)=>{var s=this.$(e.selector),i=n[t],r=e.parser;if(i)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Vi))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Vi,JSON.stringify(e)):window.localStorage.removeItem(Vi)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}T.registerComponent("TextTrackSettings",sr);class ir extends T{constructor(e,t){let s=t.ResizeObserver||window.ResizeObserver;super(e,h({createEl:!(s=null===t.ResizeObserver?!1:s),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=lt(()=>{this.resizeHandler()},100,!1,this),s?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){_(this,"resize",t),_(this,"unload",e),e=null};m(this.el_.contentWindow,"unload",e),m(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}T.registerComponent("ResizeManager",ir);const rr={trackingThreshold:20,liveTolerance:15};class nr extends T{constructor(e,t){super(e,h(rr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),s=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+s,this.liveCurrentTime()),s=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-s)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:p("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+g++}),description:p("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+g++})},p("div",{className:"vjs-title-bar"},{},G(this.els))}updateDom_(){var e=this.player_.tech_;const i=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],s=this.els[e],e=r[e];De(s),t&&fe(s,t),i&&(i.removeAttribute(e),t)&&i.setAttribute(e,s.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}T.registerComponent("TitleBar",ar);function or(s){const i=s.el();if(!i.resetSourceWatch_){const t={},e=ur(s),r=t=>(...e)=>{e=t.apply(i,e);return hr(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{i[e]&&(t[e]=i[e],i[e]=r(t[e]))}),Object.defineProperty(i,"innerHTML",h(e,{set:r(e.set)})),i.resetSourceWatch_=()=>{i.resetSourceWatch_=null,Object.keys(t).forEach(e=>{i[e]=t[e]}),Object.defineProperty(i,"innerHTML",e)},s.one("sourceset",i.resetSourceWatch_)}}function lr(s){if(s.featuresSourceset){const i=s.el();if(!i.resetSourceset_){e=s;const t=dr([e.el(),window.HTMLMediaElement.prototype,pr],"src");var e;const r=i.setAttribute,n=i.load;Object.defineProperty(i,"src",h(t,{set:e=>{e=t.set.call(i,e);return s.triggerSourceset(i.src),e}})),i.setAttribute=(e,t)=>{t=r.call(i,e,t);return/src/i.test(e)&&s.triggerSourceset(i.src),t},i.load=()=>{var e=n.call(i);return hr(s)||(s.triggerSourceset(""),or(s)),e},i.currentSrc?s.triggerSourceset(i.currentSrc):hr(s)||or(s),i.resetSourceset_=()=>{i.resetSourceset_=null,i.load=n,i.setAttribute=r,Object.defineProperty(i,"src",t),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}const hr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var s=t.$$("source"),i=[];let e="";if(!s.length)return!1;for(let e=0;e{let i={};for(let e=0;edr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,cr],"innerHTML"),pr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Zt(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class I extends j{constructor(e,t){super(e,t);t=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var i=this.el_.childNodes;let e=i.length;for(var r=[];e--;){var n=i[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),s||this.el_.hasAttribute("crossorigin")||!es(n.src)||(s=!0)):r.push(n))}for(let e=0;e{i=[];for(let e=0;es.removeEventListener("change",e)),()=>{for(let e=0;e{s.removeEventListener("change",e),s.removeEventListener("change",r),s.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{s.removeEventListener("change",e),s.addEventListener("change",e),s.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const s=e.toLowerCase();this[s+"TracksListeners_"]&&Object.keys(this[s+"TracksListeners_"]).forEach(e=>{this.el()[s+"Tracks"].removeEventListener(e,this[s+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[s+"TracksListeners_"]=null,this.proxyNativeTracksForType_(s)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(s){var e=S[s];const i=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&i&&i.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===s&&this[bs.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let s=0;s{const s=n[t];i.addEventListener(t,s),this.on("dispose",e=>i.removeEventListener(t,s))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){S.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),I.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=h({},this.options_.tag&&Se(this.options_.tag)),de&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ee(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&je(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,s=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)w(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){I.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,s):super.addTextTrack(e,t,s)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var s=this.$$("track");let e=s.length;for(;e--;)t!==s[e]&&t!==s[e].track||this.el().removeChild(s[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Y(I,"TEST_VID",function(){var e,t;if(ge())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),I.isSupported=function(){try{I.TEST_VID.volume=.5}catch(e){return!1}return!(!I.TEST_VID||!I.TEST_VID.canPlayType)},I.canPlayType=function(e){return I.TEST_VID.canPlayType(e)},I.canPlaySource=function(e,t){return I.canPlayType(e.type)},I.canControlVolume=function(){try{const t=I.TEST_VID.volume;I.TEST_VID.volume=t/2+.1;var e=t!==I.TEST_VID.volume;return e&&u?(window.setTimeout(()=>{I&&I.prototype&&(I.prototype.featuresVolumeControl=t!==I.TEST_VID.volume)}),!1):e}catch(e){return!1}},I.canMuteVolume=function(){try{var e=I.TEST_VID.muted;return I.TEST_VID.muted=!e,I.TEST_VID.muted?je(I.TEST_VID,"muted","muted"):Pe(I.TEST_VID,"muted"),e!==I.TEST_VID.muted}catch(e){return!1}},I.canControlPlaybackRate=function(){if(o&&c&&ne<58)return!1;try{var e=I.TEST_VID.playbackRate;return I.TEST_VID.playbackRate=e/2+.1,e!==I.TEST_VID.playbackRate}catch(e){return!1}},I.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},I.supportsNativeTextTracks=function(){return pe||u&&c},I.supportsNativeVideoTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.videoTracks)},I.supportsNativeAudioTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.audioTracks)},I.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){Y(I.prototype,e,()=>I[t](),!0)}),I.prototype.featuresVolumeControl=I.canControlVolume(),I.prototype.movingMediaElementInDOM=!u,I.prototype.featuresFullscreenResize=!0,I.prototype.featuresProgressEvents=!0,I.prototype.featuresTimeupdateEvents=!0,I.prototype.featuresVideoFrameCallback=!(!I.TEST_VID||!I.TEST_VID.requestVideoFrameCallback),I.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},I.resetMediaElement=function(t){if(t){var s=t.querySelectorAll("source");let e=s.length;for(;e--;)t.removeChild(s[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){I.prototype["set"+f(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){I.prototype["set"+f(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]()}}),j.withSourceHandlers(I),I.nativeSourceHandler={},I.nativeSourceHandler.canPlayType=function(e){try{return I.TEST_VID.canPlayType(e)}catch(e){return""}},I.nativeSourceHandler.canHandleSource=function(e,t){return e.type?I.nativeSourceHandler.canPlayType(e.type):e.src?(e=ts(e.src),I.nativeSourceHandler.canPlayType("video/"+e)):""},I.nativeSourceHandler.handleSource=function(e,t,s){t.setSrc(e.src)},I.nativeSourceHandler.dispose=function(){},I.registerSourceHandler(I.nativeSourceHandler),j.registerTech("Html5",I);const vr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],gr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},mr=["tiny","xsmall","small","medium","large","xlarge","huge"],_r={},yr=(mr.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;_r[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class M extends T{constructor(e,t,s){if(e.id=e.id||t.id||"vjs_video_"+g++,(t=Object.assign(M.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(i=e.closest("[lang]"))&&(t.language=i.getAttribute("lang")),super(null,t,s),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=F,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Se(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=M.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),ft(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(m(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var i=h(this.options_),s=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=i,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((s=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((i=s.documentElement).style.display="none",this.el_.appendChild(i),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),de&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),M.players[this.id_]=this,D.split(".")[0]);this.addClass("vjs-v"+s),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),_(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),M.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Cs[e.id()]=null,x.names.forEach(e=>{e=this[x[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,s,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const i="video-js"===this.tag.tagName.toLowerCase(),r=(e?s=this.el_=t.parentNode:i||(s=this.el_=super.createEl("div")),Se(t));if(i){for(s=this.el_=t,t=this.tag=document.createElement("video");s.children.length;)t.appendChild(s.firstChild);Te(s,"video-js")||ke(s,"video-js"),s.appendChild(t),e=this.playerElIngest_=s,Object.keys(s).forEach(e=>{try{t[e]=s[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",c&&le&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){i&&"class"===e||s.setAttribute(e,r[e]),i&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=s.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Qe("vjs-styles-dimensions"),n=ze(".vjs-styles-defaults"),(a=ze("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},a(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,s,i;r=(s=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{var e,s=h.levels[s],r=new RegExp(`^(${s})$`);let n=l;if("log"!==t&&i.unshift(t.toUpperCase()+":"),c&&(n="%c"+l,i.unshift(c)),i.unshift(n+":"),d&&(d.push([].concat(i)),e=d.length-1e3,d.splice(0,0i(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==s?s:a),o.createNewLogger=(e,t,s)=>i(e,t,s),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>d?[].concat(d):[],o.history.filter=t=>(d||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{d&&(d.length=0)},o.history.disable=()=>{null!==d&&(d.length=0,d=null)},o.history.enable=()=>{null===d&&(d=[])},o.error=(...e)=>s("error",t,e),o.warn=(...e)=>s("warn",t,e),o.debug=(...e)=>s("debug",t,e),o}("VIDEOJS"),$=l.createLogger,K=Object.prototype.toString;function U(t,s){q(t).forEach(e=>s(t[e],e))}function W(s,i,e=0){return q(s).reduce((e,t)=>i(e,s[t],t),e)}function n(e){return!!e&&"object"==typeof e}function X(e){return n(e)&&"[object Object]"===K.call(e)&&e.constructor===Object}function h(...e){const s={};return e.forEach(e=>{e&&U(e,(e,t)=>{X(e)?(X(s[t])||(s[t]={}),s[t]=h(s[t],e)):s[t]=e})}),s}function G(e={}){var t,s=[];for(const i in e)e.hasOwnProperty(i)&&(t=e[i],s.push(t));return s}function Y(t,s,i,e=!0){const r=e=>Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,s,n)}var Q=Object.freeze({__proto__:null,each:U,reduce:W,isObject:n,isPlain:X,merge:h,values:G,defineLazyProperty:Y});let J=!1,Z=null,o=!1,ee,te=!1,se=!1,ie=!1,c=!1,re=null,ne=null,ae=null,oe=!1,le=!1,he=!1,ce=!1;const de=Boolean(ge()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var ue,e=window.navigator&&window.navigator.userAgentData;if(e&&(o="Android"===e.platform,se=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ie=Boolean(e.brands.find(e=>"Chromium"===e.brand)),c=!se&&ie,re=ne=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,le="Windows"===e.platform),!ie){const N=window.navigator&&window.navigator.userAgent||"";J=/iPod/i.test(N),Z=(e=N.match(/OS (\d+)_/i))&&e[1]?e[1]:null,o=/Android/i.test(N),ee=(e=N.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ht=e[1]&&parseFloat(e[1]),ue=e[2]&&parseFloat(e[2]),ht&&ue?parseFloat(e[1]+"."+e[2]):ht||null):null,te=/Firefox/i.test(N),se=/Edg/i.test(N),ie=/Chrome/i.test(N)||/CriOS/i.test(N),c=!se&&ie,re=ne=(ue=N.match(/(Chrome|CriOS)\/(\d+)/))&&ue[2]?parseFloat(ue[2]):null,ae=function(){var e=/MSIE\s(\d+)\.\d/.exec(N);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(N)&&/rv:11.0/.test(N)?11:t}(),oe=/Safari/i.test(N)&&!c&&!o&&!se,le=/Windows/i.test(N),he=/iPad/i.test(N)||oe&&de&&!/iPhone/i.test(N),ce=/iPhone/i.test(N)&&!he}const u=ce||he||J,pe=(oe||u)&&!c;e=Object.freeze({__proto__:null,get IS_IPOD(){return J},get IOS_VERSION(){return Z},get IS_ANDROID(){return o},get ANDROID_VERSION(){return ee},get IS_FIREFOX(){return te},get IS_EDGE(){return se},get IS_CHROMIUM(){return ie},get IS_CHROME(){return c},get CHROMIUM_VERSION(){return re},get CHROME_VERSION(){return ne},get IE_VERSION(){return ae},get IS_SAFARI(){return oe},get IS_WINDOWS(){return le},get IS_IPAD(){return he},get IS_IPHONE(){return ce},TOUCH_ENABLED:de,IS_IOS:u,IS_ANY_SAFARI:pe});function ve(e){return"string"==typeof e&&Boolean(e.trim())}function ge(){return document===window.document}function me(e){return n(e)&&1===e.nodeType}function _e(){try{return window.parent!==window.self}catch(e){return!0}}function ye(s){return function(e,t){return ve(e)?(t=me(t=ve(t)?document.querySelector(t):t)?t:document)[s]&&t[s](e):document[s](null)}}function p(e="div",s={},t={},i){const r=document.createElement(e);return Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];"textContent"===e?fe(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),i&&He(r,i),r}function fe(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function be(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Te(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function ke(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function Ce(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function we(t,e,s){return"boolean"!=typeof(s="function"==typeof s?s(t,e):s)&&(s=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,s)),t}function Ee(s,i){Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];null===t||"undefined"==typeof t||!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})}function Se(e){var s={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(s[e]=t[e])}),s.height||(s.height=parseFloat(qe(e,"height"))),s.width||(s.width=parseFloat(qe(e,"width"))),s}}function Ae(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,s=e.offsetHeight;let i=0,r=0;for(;e.offsetParent&&e!==document[F.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:s}}function Le(t,e){var s={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var i,r=qe(e,"transform");/^matrix/.test(r)?(i=r.slice(7,-1).split(/,\s/).map(Number),s.x+=i[4],s.y+=i[5]):/^matrix3d/.test(r)&&(i=r.slice(9,-1).split(/,\s/).map(Number),s.x+=i[12],s.y+=i[13]),e=e.parentNode}}var n={},a=Ae(e.target),t=Ae(t),o=t.width,l=t.height;let h=e.offsetY-(t.top-a.top),c=e.offsetX-(t.left-a.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-t.left,h=e.changedTouches[0].pageY+t.top,u)&&(c-=s.x,h-=s.y),n.y=1-Math.max(0,Math.min(1,h/l)),n.x=Math.max(0,Math.min(1,c/o)),n}function Ne(e){return n(e)&&3===e.nodeType}function De(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Be(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>me(e="function"==typeof e?e():e)||Ne(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return Be(e).forEach(e=>t.appendChild(e)),t}function Fe(e,t){return He(De(e),t)}function Re(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const ze=ye("querySelector"),Ve=ye("querySelectorAll");function qe(t,s){if(!t||!s)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(s)||e[s]:""}}function $e(i){[...document.styleSheets].forEach(t=>{try{var s=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=s,i.document.head.appendChild(e)}catch(e){s=document.createElement("link");s.rel="stylesheet",s.type=t.type,s.media=t.media.mediaText,s.href=t.href,i.document.head.appendChild(s)}})}var Ke=Object.freeze({__proto__:null,isReal:ge,isEl:me,isInFrame:_e,createEl:p,textContent:fe,prependTo:be,hasClass:Te,addClass:ke,removeClass:Ce,toggleClass:we,setAttributes:Ee,getAttributes:Se,getAttribute:xe,setAttribute:je,removeAttribute:Pe,blockTextSelection:Ie,unblockTextSelection:Me,getBoundingClientRect:Oe,findPosition:Ae,getPointerPosition:Le,isTextNode:Ne,emptyEl:De,normalizeContent:Be,appendContent:He,insertContent:Fe,isSingleLeftClick:Re,$:ze,$$:Ve,computedStyle:qe,copyStyleSheetsToWindow:$e});let Ue=!1,We;function Xe(){if(!1!==We.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),s=Array.prototype.slice.call(document.getElementsByTagName("video-js")),i=e.concat(t,s);if(i&&0=i&&(s(...e),r=t)}}function lt(i,r,n,a=window){let o;function e(){const e=this,t=arguments;let s=function(){o=null,s=null,n||i.apply(e,t)};!o&&n&&i.apply(e,t),a.clearTimeout(o),o=a.setTimeout(s,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ht=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:y,throttle:r,debounce:lt});let ct;class i{on(e,t){var s=this.addEventListener;this.addEventListener=()=>{},m(this,e,t),this.addEventListener=s}off(e,t){_(this,e,t)}one(e,t){var s=this.addEventListener;this.addEventListener=()=>{},nt(this,e,t),this.addEventListener=s}any(e,t){var s=this.addEventListener;this.addEventListener=()=>{},at(this,e,t),this.addEventListener=s}trigger(e){var t=e.type||e;e=tt(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),rt(this,e)}queueTrigger(e){ct=ct||new Map;const t=e.type||e;let s=ct.get(this);s||(s=new Map,ct.set(this,s));var i=s.get(t),i=(s.delete(t),window.clearTimeout(i),window.setTimeout(()=>{s.delete(t),0===s.size&&(s=null,ct.delete(this)),this.trigger(e)},0));s.set(t,i)}}i.prototype.allowedEvents_={},i.prototype.addEventListener=i.prototype.on,i.prototype.removeEventListener=i.prototype.off,i.prototype.dispatchEvent=i.prototype.trigger;const dt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),a=t=>t instanceof i||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),ut=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,pt=(e,t,s)=>{if(!e||!e.nodeName&&!a(e))throw new Error(`Invalid target for ${dt(t)}#${s}; must be a DOM node or evented object.`)},vt=(e,t,s)=>{if(!ut(e))throw new Error(`Invalid event type for ${dt(t)}#${s}; must be a non-empty string or array.`)},gt=(e,t,s)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${dt(t)}#${s}; must be a function.`)},mt=(e,t,s)=>{var i=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return i?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,pt(r,e,s),vt(n,e,s),gt(a,e,s),a=y(e,a),{isTargetingSelf:i,target:r,type:n,listener:a}},_t=(e,t,s,i)=>{pt(e,e,t),e.nodeName?ot[t](e,s,i):e[t](s,i)},yt={on(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"on");if(_t(s,"on",i,r),!t){const n=()=>this.off(s,i,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,_t(this,"on","dispose",n),_t(s,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"one");if(t)_t(s,"one",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,_t(s,"one",i,n)}},any(...e){const{isTargetingSelf:t,target:s,type:i,listener:r}=mt(this,e,"any");if(t)_t(s,"any",i,r);else{const n=(...e)=>{this.off(s,i,n),r.apply(null,e)};n.guid=r.guid,_t(s,"any",i,n)}},off(e,t,s){!e||ut(e)?_(this.eventBusEl_,e,t):(e=e,t=t,pt(e,this,"off"),vt(t,this,"off"),gt(s,this,"off"),s=y(this,s),this.off("dispose",s),e.nodeName?(_(e,t,s),_(e,"dispose",s)):a(e)&&(e.off(t,s),e.off("dispose",s)))},trigger(e,t){pt(this.eventBusEl_,this,"trigger");var s=e&&"string"!=typeof e?e.type:e;if(ut(s))return rt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${dt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function ft(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=p("span",{className:"vjs-event-bus"});Object.assign(e,yt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&v.has(e)&&v.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const bt={state:{},setState(e){"function"==typeof e&&(e=e());let s;return U(e,(e,t)=>{this.state[t]!==e&&((s=s||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),s&&a(this)&&this.trigger({changes:s,type:"statechanged"}),s}};function Tt(e,t){Object.assign(e,bt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&a(e)&&e.on("statechanged",e.handleStateChanged)}function kt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function f(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Ct(e,t){return f(e)===f(t)}var wt=Object.freeze({__proto__:null,toLowerCase:kt,toTitleCase:f,titleCaseEquals:Ct}),t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Et(e,t){return e(t={exports:{}},t.exports),t.exports}var b=Et(function(e,t){function s(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),i[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}s.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var s=i[t.toLowerCase()];if(s)return s===e;if(s=r[t.toLowerCase()])return s===e}else if("number"==typeof t)return t===e;return!1}};for(var i=(t=e.exports=s).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)i[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)i[n-48]=n;for(n=1;n<13;n++)i["f"+n]=n+111;for(n=0;n<10;n++)i["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in i)o[i[n]]=n;for(a in r)i[a]=r[a]});b.code,b.codes,b.aliases,b.names,b.title;class T{constructor(e,t,s){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=h({},this.options_),t=this.options_=h(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+g++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(ft(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Tt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(s),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=h(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,s){return p(e,t,s)}localize(e,i,t=e){var s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],s=s&&s.split("-")[0],r=r&&r[s];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=i?a.replace(/\{(\d+)\}/g,function(e,t){t=i[t-1];let s="undefined"==typeof t?e:t;return s}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let s=this;for(let e=0;e{let t,s;return s="string"==typeof e?(t=e,i[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:s}}).filter(e=>{e=T.getComponent(e.opts.componentClass||f(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let s=e.opts;!1!==(s=void 0!==r[t]?r[t]:s)&&((s=!0===s?{}:s).playerOptions=this.options_.playerOptions,e=this.addChild(t,s))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(s)&&this.setTimeoutIds_.delete(s),e()},t),this.setTimeoutIds_.add(s),s}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=y(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=y(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var s;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=y(this,t),s=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,s),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,s])=>{this[e].forEach((e,t)=>this[s](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var s=T.getComponent("Tech"),s=s&&s.isTech(e),i=T===e||T.prototype.isPrototypeOf(e.prototype);if(s||!i){let e;throw e=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=f(t),T.components_||(T.components_={});i=T.getComponent("Player");if("Player"===t&&i&&i.players){const r=i.players;s=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return T.components_[t]=e,T.components_[kt(t)]=e}static getComponent(e){if(e&&T.components_)return T.components_[e]}}function St(e,t,s,i){var r=i,n=s.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function k(e,t){return Array.isArray(e)?xt(e):void 0===e||void 0===t?xt():xt([[e,t]])}T.registerComponent("Component",T);function jt(e,t){e=e<0?0:e;let s=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:i=s="-")||0s&&(n=s),i+=n-r;return i/s}function C(e){if(e instanceof C)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:n(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=C.defaultMessages[this.code]||"")}C.prototype.code=0,C.prototype.message="",C.prototype.status=null,C.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],C.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Bt(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,s)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Ht=function(e){var t=e.$$("track");const s=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Bt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===s.indexOf(e)}).map(Bt))},Ft=function(e,s){return e.forEach(function(e){const t=s.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),s.textTracks()};Bt;const Rt="vjs-modal-dialog";class zt extends T{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=p("div",{className:Rt+"-content"},{role:"document"}),this.descEl_=p("p",{className:Rt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),fe(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Rt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var s,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(s=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),s=t.parentNode,i=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,s.removeChild(t),this.empty(),Fe(t,e),this.trigger("modalfill"),i?s.insertBefore(t,i):s.appendChild(t),this.getChild("closeButton"));e&&s.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),De(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),b.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(b.isEventKey(e,"Tab")){var s=this.focusableEls_(),i=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}zt.prototype.options_={pauseOnOpen:!0,temporary:!0},T.registerComponent("ModalDialog",zt);class Vt extends i{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},a(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(s){let i;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class Ut{constructor(e){Ut.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let s=0;function i(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),s.flush()}function gs(e,i){var t={uri:e};(e=es(e))&&(t.cors=e),(e="use-credentials"===i.tech_.crossOrigin())&&(t.withCredentials=e),ls(t,y(this,function(e,t,s){if(e)return l.error(e,t);i.loaded_=!0,"function"!=typeof window.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return vs(s,i);l.error("vttjs failed to load, stopping trying to process "+i.src)}):vs(s,i)}))}class ms extends Qt{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=h(e,{kind:Gt[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Yt[e.mode]||"disabled";const s=e.default,i=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new Ut(this.cues_)),n=new Ut(this.activeCues_);let a=!1;this.timeupdateHandler=y(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return t},set(e){Yt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||gs(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var s=this.tech_.currentTime(),i=[];for(let e=0,t=this.cues.length;e=s&&i.push(r)}if(a=!1,i.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=fs.LOADED,this.trigger({type:"load",target:this})})}}fs.prototype.allowedEvents_={load:"load"},fs.NONE=0,fs.LOADING=1,fs.LOADED=2,fs.ERROR=3;const S={audio:{ListClass:class extends Vt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){qt(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&qt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,qt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:_s,capitalName:"Audio"},video:{ListClass:class extends Vt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){$t(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,$t(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:ys,capitalName:"Video"},text:{ListClass:Kt,TrackClass:ms,capitalName:"Text"}},bs=(Object.keys(S).forEach(function(e){S[e].getterName=e+"Tracks",S[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:Kt,TrackClass:ms,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(s=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=s.length;ethis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),x.names.forEach(e=>{e=x[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new x.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(y(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return k(0,0)}bufferedPercent(){return Lt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(S.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let s=t.length;for(;s--;){var i=t[s];"text"===e&&this.removeRemoteTextTrack(i),t.removeTrack(i)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var s=e[t];this.removeRemoteTextTrack(s)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new C(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?k(0,0):k()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){S.names.forEach(e=>{var t=S[e];const s=()=>{this.trigger(e+"trackchange")},i=this[t.getterName]();i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),this.on("dispose",()=>{i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&X(Ts)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const s=this.textTracks(),e=this.remoteTextTracks(),t=e=>s.addTrack(e.track),i=e=>s.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",i),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(s.track)),s}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=g++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return j.canPlayType(e.type)}static isTech(e){return e.prototype instanceof j||e instanceof j||e===j}static registerTech(e,t){if(j.techs_||(j.techs_={}),!j.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!j.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(j.canPlaySource)return e=f(e),j.techs_[e]=t,j.techs_[kt(e)]=t,"Tech"!==e&&j.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return j.techs_&&j.techs_[e]?j.techs_[e]:(e=f(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}x.names.forEach(function(e){const t=x[e];j.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),j.prototype.featuresVolumeControl=!0,j.prototype.featuresMuteControl=!0,j.prototype.featuresFullscreenResize=!1,j.prototype.featuresPlaybackRate=!1,j.prototype.featuresProgressEvents=!1,j.prototype.featuresSourceset=!1,j.prototype.featuresTimeupdateEvents=!1,j.prototype.featuresNativeTextTracks=!1,j.prototype.featuresVideoFrameCallback=!1,j.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let s=r.sourceHandlers;s=s||(r.sourceHandlers=[]),void 0===t&&(t=s.length),s.splice(t,0,e)},r.canPlayType=function(t){var s,i=r.sourceHandlers||[];for(let e=0;efunction s(i={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)s(i,ks[t],r,n,a,o);else if(t){const h=Ms(n,t);if(!h.setSource)return a.push(h),s(i,l,r,n,a,o);h.setSource(Object.assign({},i),function(e,t){if(e)return s(i,l,r,n,a,o);a.push(h),s(t,i.type===t.type?l:ks[t.type],r,n,a,o)})}else l.length?s(i,l,r,n,a,o):o?r(i,a):s(i,ks["*"],r,n,a,!0)}(t,ks[t.type],s,e),1)}function Ss(e,t,s,i=null){var r="call"+f(s),r=e.reduce(Is(r),i),i=r===ws,t=i?null:t[s](r),n=e,a=s,o=t,l=i;for(let e=n.length-1;0<=e;e--){var h=n[e];h[a]&&h[a](l,o)}return t}const xs={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},js={setCurrentTime:1,setMuted:1,setVolume:1},Ps={play:1,pause:1};function Is(s){return(e,t)=>e===ws?ws:t[s]?t[s](e):e}function Ms(e,t){var s=Cs[e.id()];let i=null;if(null==s)i=t(e),Cs[e.id()]=[[t,i]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},s={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),s=Object.assign({role:"button"},s),this.tabIndex_=t.tabIndex;e=p(e,t,s);return this.player_.options_.experimentalSvgIcons||e.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=p("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var s=this.localize(e);this.controlText_=e,fe(this.controlTextEl_,s),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",s)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){b.isEventKey(e,"Space")||b.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}T.registerComponent("ClickableComponent",Bs);class Hs extends Bs{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return p("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(p("picture",{className:"vjs-poster",tabIndex:-1},{},p("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?w(this.player_.play()):this.player_.pause())}}Hs.prototype.crossorigin=Hs.prototype.crossOrigin,T.registerComponent("PosterImage",Hs);const Fs={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Rs(e,t){let s;if(4===e.length)s=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");s=e.slice(1)}return"rgba("+parseInt(s.slice(0,2),16)+","+parseInt(s.slice(2,4),16)+","+parseInt(s.slice(4,6),16)+","+t+")"}function zs(e,t,s){try{e.style[t]=s}catch(e){}}function Vs(e){return e?e+"px":""}class qs extends T{constructor(i,e,t){super(i,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};i.on("loadstart",e=>this.toggleDisplay(e)),i.on("texttrackchange",e=>this.updateDisplay(e)),i.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),i.ready(y(this,function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",r),i.on("playerresize",r);const e=window.screen.orientation||window,s=window.screen.orientation?"change":"orientationchange";e.addEventListener(s,r),i.on("dispose",()=>e.removeEventListener(s,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)w(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const s=e&&e.getChild("playToggle");s?(e=()=>s.focus(),Dt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Ks.prototype.controlText_="Play Video",T.registerComponent("BigPlayButton",Ks);P;T.registerComponent("CloseButton",class extends P{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){b.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class Us extends P{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?w(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Us.prototype.controlText_="Play",T.registerComponent("PlayToggle",Us);class Ws extends T{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),s=p("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(s),this.contentEl_=p("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ot(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Ws.prototype.labelText_="Time",Ws.prototype.controlText_="Time",T.registerComponent("TimeDisplay",Ws);class Xs extends Ws{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Xs.prototype.labelText_="Current Time",Xs.prototype.controlText_="Current Time",T.registerComponent("CurrentTimeDisplay",Xs);class Gs extends Ws{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Gs.prototype.labelText_="Duration",Gs.prototype.controlText_="Duration",T.registerComponent("DurationDisplay",Gs);class Ys extends T{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),s=super.createEl("span",{textContent:"/"});return t.appendChild(s),e.appendChild(t),e}}T.registerComponent("TimeDivider",Ys);class Qs extends Ws{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(p("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}Qs.prototype.labelText_="Remaining Time",Qs.prototype.controlText_="Remaining Time",T.registerComponent("RemainingTimeDisplay",Qs);class Js extends T{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=p("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(p("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}T.registerComponent("LiveDisplay",Js);class Zs extends P{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=p("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function ei(e,t,s){return e=Number(e),Math.min(s,Math.max(t,isNaN(e)?t:e))}Zs.prototype.controlText_="Seek to live, currently playing live",T.registerComponent("SeekToLive",Zs);t=Object.freeze({__proto__:null,clamp:ei});class ti extends T{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},s={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),s=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},s),super.createEl(e,t,s)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||c||e.preventDefault(),Ie(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Me(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(ei(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Le(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){b.isEventKey(e,"Left")||b.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):b.isEventKey(e,"Right")||b.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}T.registerComponent("Slider",ti);const si=(e,t)=>ei(e/t*100,0,100).toFixed(2)+"%";class ii extends T{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=p("span",{className:"vjs-control-text"}),s=p("span",{textContent:this.localize("Loaded")}),i=document.createTextNode(": ");return this.percentageEl_=p("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(s),t.appendChild(i),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,s=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),r=this.partEls_,e=si(i,e);this.percent_!==e&&(this.el_.style.width=e,fe(this.percentageEl_,e),this.percent_=e);for(let t=0;ts.length;e--)this.el_.removeChild(r[e-1]);r.length=s.length})}}T.registerComponent("LoadProgressBar",ii);class ri extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,s,i){var r=Ae(this.el_),n=Oe(this.player_.el()),s=t.width*s;if(n&&r){var a=t.left-n.left+s,s=t.width-s+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(i)}}write(e){fe(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,s,i=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((s=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Ot(s,t):Ot(a,i),this.update(r,n,e),o&&o()})}}T.registerComponent("TimeTooltip",ri);class ni extends T{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var s,i=this.getChild("timeTooltip");i&&(s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),i.updateTime(e,t,s))}}ni.prototype.options_={children:[]},u||o||ni.prototype.options_.children.push("timeTooltip"),T.registerComponent("PlayProgressBar",ni);class ai extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var s=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,s,()=>{this.el_.style.left=e.width*t+"px"})}}ai.prototype.options_={children:["timeTooltip"]},T.registerComponent("MouseTimeDisplay",ai);class oi extends ti{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=y(this,this.update),this.update=r(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let s=this.player_.duration();t&&t.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(100*i).toFixed(2)),this.percent_=i),this.currentTime_===e&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ot(e,s),Ot(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(Oe(this.el()),this.getProgress())}),i}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var s=this.player_.liveTracker;return s&&s.isLive()?(t=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Re(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,s=!1){if(Re(t)&&!isNaN(this.player_.duration())){s||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;s=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=s)return void t.seekToLiveEdge();var i=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=i+s*t.liveWindow())>=r?r:e)<=i?i+.1:e)===1/0)return}else(e=s*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?w(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,s=this.player_.liveTracker;b.isEventKey(e,"Space")||b.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):b.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):b.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),s&&s.isLive()?this.userSeek_(s.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(b(e))?(e.preventDefault(),e.stopPropagation(),t=10*(b.codes[b(e)]-b.codes[0])/100,s&&s.isLive()?this.userSeek_(s.seekableStart()+s.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):b.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):b.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}oi.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||o||oi.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),T.registerComponent("SeekBar",oi);class li extends T{constructor(e,t){super(e,t),this.handleMouseMove=r(y(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=r(y(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,s,i,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),s=n.getChild("mouseTimeDisplay"),t||s)&&(i=Ae(r=n.el()),r=ei(r=Le(r,e).x,0,1),s&&s.update(i,r),t)&&t.update(i,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&w(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}li.prototype.options_={children:["seekBar"]},T.registerComponent("ProgressControl",li);class hi extends P{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}hi.prototype.controlText_="Picture-in-Picture",T.registerComponent("PictureInPictureToggle",hi);class ci extends P{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ci.prototype.controlText_="Fullscreen",T.registerComponent("FullscreenToggle",ci);class di extends T{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}T.registerComponent("VolumeLevel",di);class ui extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,s,i,e){if(!i){var i=Oe(this.el_),r=Oe(this.player_.el()),s=t.width*s;if(!r||!i)return;var n=t.left-r.left+s,s=t.width-s+(r.right-t.right);let e=i.width/2;ni.width&&(e=i.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){fe(this.el_,e)}updateVolume(e,t,s,i,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,s,i.toFixed(0)),r&&r()})}}T.registerComponent("VolumeLevelTooltip",ui);class pi extends T{constructor(e,t){super(e,t),this.update=r(y(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,s){var i=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,s,i,()=>{s?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}pi.prototype.options_={children:["volumeLevelTooltip"]},T.registerComponent("MouseVolumeLevelDisplay",pi);class vi extends ti{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Re(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,s,i,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Oe(i=this.el()),s=this.vertical(),i=Le(i,e),i=ei(i=s?i.y:i.x,0,1),r.update(t,i,s)),Re(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}vi.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||o||vi.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),vi.prototype.playerEvent="volumechange",T.registerComponent("VolumeBar",vi);class gi extends T{constructor(e,t={}){var s,i;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!X(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.throttledHandleMouseMove=r(y(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gi.prototype.options_={children:["volumeBar"]},T.registerComponent("VolumeControl",gi);class mi extends P{constructor(e,t){var s,i;super(e,t),s=this,(i=e).tech_&&!i.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(i,"loadstart",function(){i.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),s=this.player_.lastVolume_();0===t?(this.player_.volume(s<.1?.1:s),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Ce(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),ke(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}mi.prototype.controlText_="Mute",T.registerComponent("MuteToggle",mi);class _i extends T{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!X(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){b.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),m(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){b.isEventKey(e,"Esc")&&this.handleMouseOut()}}_i.prototype.options_={children:["muteToggle","volumeControl"]},T.registerComponent("VolumePanel",_i);P;T.registerComponent("SkipForward",class extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()?s.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class yi extends P{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),s=this.player_.liveTracker,s=s&&s.isLive()&&s.seekableStart();let i;i=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}yi.prototype.controlText_="Skip Backward",T.registerComponent("SkipBackward",yi);class fi extends T{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof T&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof T&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=p(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),m(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){b.isEventKey(e,"Left")||b.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(b.isEventKey(e,"Right")||b.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}T.registerComponent("Menu",fi);class bi extends T{constructor(e,t={}){super(e,t),this.menuButton_=new P(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=P.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),m(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new fi(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=p("li",{className:"vjs-menu-title",textContent:f(this.options_.title),tabIndex:-1}),e=new T(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;eb.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}T.registerComponent("MenuItem",Ci);class wi extends Ci{constructor(e,t){var s=t.track;const i=e.textTracks(),r=(t.label=s.label||s.language||"Unknown",t.selected="showing"===s.mode,super(e,t),this.track=s,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),i.addEventListener("change",r),i.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),i.removeEventListener("change",r),i.removeEventListener("selectedlanguagechange",n)}),void 0===i.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),i.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,s=this.player_.textTracks();if(super.handleClick(e),s)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var s=t[e];if(s.kind===this.kind_)return s}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(f(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var s=[];if(this.track_){var i=this.track_.cues;if(i)for(let e=0,t=i.length;e{this.handleTracksChange.apply(this,e)});i.addEventListener("change",r),this.on("dispose",()=>{i.removeEventListener("change",r)})}createEl(e,t,s){e=super.createEl(e,t,s),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(p("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(p("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Bi.prototype.contentElType="button",T.registerComponent("PlaybackRateMenuItem",Bi);class Hi extends bi{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=p("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),s=[];for(let e=t.length-1;0<=e;e--)s.push(new Bi(this.player(),{rate:t[e]+"x"}));return s}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}zi.prototype.options_=Object.assign({},zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),T.registerComponent("ErrorDisplay",zi);const Vi="vjs-text-track-settings";var qi=["#000","Black"],$i=["#00F","Blue"],Ki=["#0FF","Cyan"],Ui=["#0F0","Green"],Wi=["#F0F","Magenta"],Xi=["#F00","Red"],Gi=["#FFF","White"],Yi=["#FF0","Yellow"],Qi=["1","Opaque"],Ji=["0.5","Semi-Transparent"],Zi=["0","Transparent"];const er={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[qi,Gi,Xi,Ui,$i,Yi,Wi,Ki]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Qi,Ji,Zi]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Gi,qi,Xi,Ui,$i,Yi,Wi,Ki]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Qi,Ji]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Zi,Ji,Qi]}};function tr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}er.windowColor.options=er.backgroundColor.options;class sr extends zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=p("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),U(er,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",s="label"){e=er[e];const i=e.id.replace("%s",this.id_),r=[t,i].join(" ").trim();return[`<${s} id="${i}" class="${"label"===s?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return p("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return p("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return p("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return W(er,(e,t,s)=>{i=this.$(t.selector),t=t.parser;var i=tr(i.options[i.options.selectedIndex].value,t);return void 0!==i&&(e[s]=i),e},{})}setValues(n){U(er,(e,t)=>{var s=this.$(e.selector),i=n[t],r=e.parser;if(i)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Vi))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Vi,JSON.stringify(e)):window.localStorage.removeItem(Vi)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}T.registerComponent("TextTrackSettings",sr);class ir extends T{constructor(e,t){let s=t.ResizeObserver||window.ResizeObserver;super(e,h({createEl:!(s=null===t.ResizeObserver?!1:s),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=lt(()=>{this.resizeHandler()},100,!1,this),s?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){_(this,"resize",t),_(this,"unload",e),e=null};m(this.el_.contentWindow,"unload",e),m(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}T.registerComponent("ResizeManager",ir);const rr={trackingThreshold:20,liveTolerance:15};class nr extends T{constructor(e,t){super(e,h(rr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),s=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+s,this.liveCurrentTime()),s=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-s)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:p("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+g++}),description:p("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+g++})},p("div",{className:"vjs-title-bar"},{},G(this.els))}updateDom_(){var e=this.player_.tech_;const i=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],s=this.els[e],e=r[e];De(s),t&&fe(s,t),i&&(i.removeAttribute(e),t)&&i.setAttribute(e,s.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}T.registerComponent("TitleBar",ar);function or(s){const i=s.el();if(!i.resetSourceWatch_){const t={},e=ur(s),r=t=>(...e)=>{e=t.apply(i,e);return hr(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{i[e]&&(t[e]=i[e],i[e]=r(t[e]))}),Object.defineProperty(i,"innerHTML",h(e,{set:r(e.set)})),i.resetSourceWatch_=()=>{i.resetSourceWatch_=null,Object.keys(t).forEach(e=>{i[e]=t[e]}),Object.defineProperty(i,"innerHTML",e)},s.one("sourceset",i.resetSourceWatch_)}}function lr(s){if(s.featuresSourceset){const i=s.el();if(!i.resetSourceset_){e=s;const t=dr([e.el(),window.HTMLMediaElement.prototype,pr],"src");var e;const r=i.setAttribute,n=i.load;Object.defineProperty(i,"src",h(t,{set:e=>{e=t.set.call(i,e);return s.triggerSourceset(i.src),e}})),i.setAttribute=(e,t)=>{t=r.call(i,e,t);return/src/i.test(e)&&s.triggerSourceset(i.src),t},i.load=()=>{var e=n.call(i);return hr(s)||(s.triggerSourceset(""),or(s)),e},i.currentSrc?s.triggerSourceset(i.currentSrc):hr(s)||or(s),i.resetSourceset_=()=>{i.resetSourceset_=null,i.load=n,i.setAttribute=r,Object.defineProperty(i,"src",t),i.resetSourceWatch_&&i.resetSourceWatch_()}}}}const hr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var s=t.$$("source"),i=[];let e="";if(!s.length)return!1;for(let e=0;e{let i={};for(let e=0;edr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,cr],"innerHTML"),pr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Zt(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class I extends j{constructor(e,t){super(e,t);t=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var i=this.el_.childNodes;let e=i.length;for(var r=[];e--;){var n=i[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),s||this.el_.hasAttribute("crossorigin")||!es(n.src)||(s=!0)):r.push(n))}for(let e=0;e{i=[];for(let e=0;es.removeEventListener("change",e)),()=>{for(let e=0;e{s.removeEventListener("change",e),s.removeEventListener("change",r),s.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{s.removeEventListener("change",e),s.addEventListener("change",e),s.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const s=e.toLowerCase();this[s+"TracksListeners_"]&&Object.keys(this[s+"TracksListeners_"]).forEach(e=>{this.el()[s+"Tracks"].removeEventListener(e,this[s+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[s+"TracksListeners_"]=null,this.proxyNativeTracksForType_(s)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(s){var e=S[s];const i=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&i&&i.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===s&&this[bs.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let s=0;s{const s=n[t];i.addEventListener(t,s),this.on("dispose",e=>i.removeEventListener(t,s))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){S.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),I.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=h({},this.options_.tag&&Se(this.options_.tag)),de&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ee(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&je(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,s=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)w(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){I.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,s):super.addTextTrack(e,t,s)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var s=this.$$("track");let e=s.length;for(;e--;)t!==s[e]&&t!==s[e].track||this.el().removeChild(s[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Y(I,"TEST_VID",function(){var e,t;if(ge())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),I.isSupported=function(){try{I.TEST_VID.volume=.5}catch(e){return!1}return!(!I.TEST_VID||!I.TEST_VID.canPlayType)},I.canPlayType=function(e){return I.TEST_VID.canPlayType(e)},I.canPlaySource=function(e,t){return I.canPlayType(e.type)},I.canControlVolume=function(){try{const t=I.TEST_VID.volume;I.TEST_VID.volume=t/2+.1;var e=t!==I.TEST_VID.volume;return e&&u?(window.setTimeout(()=>{I&&I.prototype&&(I.prototype.featuresVolumeControl=t!==I.TEST_VID.volume)}),!1):e}catch(e){return!1}},I.canMuteVolume=function(){try{var e=I.TEST_VID.muted;return I.TEST_VID.muted=!e,I.TEST_VID.muted?je(I.TEST_VID,"muted","muted"):Pe(I.TEST_VID,"muted"),e!==I.TEST_VID.muted}catch(e){return!1}},I.canControlPlaybackRate=function(){if(o&&c&&ne<58)return!1;try{var e=I.TEST_VID.playbackRate;return I.TEST_VID.playbackRate=e/2+.1,e!==I.TEST_VID.playbackRate}catch(e){return!1}},I.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},I.supportsNativeTextTracks=function(){return pe||u&&c},I.supportsNativeVideoTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.videoTracks)},I.supportsNativeAudioTracks=function(){return!(!I.TEST_VID||!I.TEST_VID.audioTracks)},I.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){Y(I.prototype,e,()=>I[t](),!0)}),I.prototype.featuresVolumeControl=I.canControlVolume(),I.prototype.movingMediaElementInDOM=!u,I.prototype.featuresFullscreenResize=!0,I.prototype.featuresProgressEvents=!0,I.prototype.featuresTimeupdateEvents=!0,I.prototype.featuresVideoFrameCallback=!(!I.TEST_VID||!I.TEST_VID.requestVideoFrameCallback),I.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},I.resetMediaElement=function(t){if(t){var s=t.querySelectorAll("source");let e=s.length;for(;e--;)t.removeChild(s[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){I.prototype["set"+f(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){I.prototype["set"+f(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){I.prototype[e]=function(){return this.el_[e]()}}),j.withSourceHandlers(I),I.nativeSourceHandler={},I.nativeSourceHandler.canPlayType=function(e){try{return I.TEST_VID.canPlayType(e)}catch(e){return""}},I.nativeSourceHandler.canHandleSource=function(e,t){return e.type?I.nativeSourceHandler.canPlayType(e.type):e.src?(e=ts(e.src),I.nativeSourceHandler.canPlayType("video/"+e)):""},I.nativeSourceHandler.handleSource=function(e,t,s){t.setSrc(e.src)},I.nativeSourceHandler.dispose=function(){},I.registerSourceHandler(I.nativeSourceHandler),j.registerTech("Html5",I);const vr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],gr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},mr=["tiny","xsmall","small","medium","large","xlarge","huge"],_r={},yr=(mr.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;_r[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class M extends T{constructor(e,t,s){if(e.id=e.id||t.id||"vjs_video_"+g++,(t=Object.assign(M.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(i=e.closest("[lang]"))&&(t.language=i.getAttribute("lang")),super(null,t,s),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=F,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Se(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=M.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),ft(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(m(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var i=h(this.options_),s=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=i,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((s=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((i=s.documentElement).style.display="none",this.el_.appendChild(i),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),de&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),M.players[this.id_]=this,D.split(".")[0]);this.addClass("vjs-v"+s),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),_(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),M.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Cs[e.id()]=null,x.names.forEach(e=>{e=this[x[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,s,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const i="video-js"===this.tag.tagName.toLowerCase(),r=(e?s=this.el_=t.parentNode:i||(s=this.el_=super.createEl("div")),Se(t));if(i){for(s=this.el_=t,t=this.tag=document.createElement("video");s.children.length;)t.appendChild(s.firstChild);Te(s,"video-js")||ke(s,"video-js"),s.appendChild(t),e=this.playerElIngest_=s,Object.keys(s).forEach(e=>{try{t[e]=s[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",c&&le&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){i&&"class"===e||s.setAttribute(e,r[e]),i&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=s.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Qe("vjs-styles-dimensions"),n=ze(".vjs-styles-defaults"),(a=ze("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},a(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,s,i;r=(s=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=x[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${f(t)}_`](e))}),Object.keys(gr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${gr[t]}_`].bind(this),event:e}):this[`handleTech${gr[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||be(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){x.names.forEach(e=>{e=x[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Ht(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var s=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var s=this.play();if(Dt(s))return s.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():s():Dt(e=this.play())&&(e=e.catch(s)),Dt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,s="";"string"!=typeof t&&(t=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!s&&(s=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var s=e.cache_.sources.filter(e=>e.src===t);if(s.length)return s[0].type;var i=e.$$("source");for(let e=0;ee.src&&e.src===t),i=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var s=this.currentSource().src,i=t.src;(e=!s||/^blob:/.test(s)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===s)?e:()=>{})(i),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?w(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=w){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),s=Boolean(pe||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),s&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&s&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||k(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:k(0,0)}bufferedPercent(){return Lt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let s=e.end(e.length-1);return s=s>t?t:s}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function i(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(i,i),n.then(e,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,s)=>{function i(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(i,i),n.then(e,s))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&w(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,m(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",ke(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){b.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Ce(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(p("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>($e(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,s,i=this.options_["userActions"];i&&i.hotkeys&&(t=this.el_.ownerDocument.activeElement,s=t.tagName.toLowerCase(),t.isContentEditable||("input"===s?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(s))||("function"==typeof i.hotkeys?i.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>b.isEventKey(e,"f"),muteKey:s=e=>b.isEventKey(e,"m"),playPauseKey:i=e=>b.isEventKey(e,"k")||b.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=T.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):s.call(this,e)?(e.preventDefault(),e.stopPropagation(),T.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),T.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(i){var r;for(let t=0,s=this.options_.techOrder;ts.some(e=>{if(r=i(t,e))return!0})),r}var s=this.options_.techOrder.map(e=>[e,j.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let i;var r,n=([e,t],s)=>{if(t.canPlaySource(s,this.options_[e.toLowerCase()]))return{source:s,tech:e}};return(i=this.options_.sourceOrder?t(e,s,(r=n,(e,t)=>r(t,e))):t(s,e,n))||!1}handleSrc_(e,i){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Os(e);if(r.length){if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),Es(this,r[0],(e,t)=>{var s;if(this.middleware_=t,i||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(s))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",t)};this.one("error",t),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",s)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Ct(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():w(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),a(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:s,remainingTimeDisplay:i}=this.controlBar||{},s=(s||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),i&&i.updateContent(),s&&(s.update(),s.loadProgressBar)&&s.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);n(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new C(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${C.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,s,i;const r=y(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===s&&e.screenY===i||(s=e.screenX,i=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||o||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var s=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(s),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,s){if(this.tech_)return this.tech_.addTextTrack(e,t,s)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),a(this))&&this.trigger("languagechange")}languages(){return h(M.prototype.options_.languages,this.languages_)}toJSON(){var t=h(this.options_),s=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(s)}),s.open(),s}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),s=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?h(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ls(t.poster)}]),t)}static getTagSettings(e){var t,s={sources:[],tracks:[]},i=Se(e),r=i["data-setup"];if(Te(e,"vjs-fill")&&(i.fill=!0),Te(e,"vjs-fluid")&&(i.fluid=!0),null!==r&&([r,t]=Nt(r||"{}"),r&&l.error(r),Object.assign(i,t)),Object.assign(s,i),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}x.names.forEach(function(e){const t=x[e];M.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),M.prototype.crossorigin=M.prototype.crossOrigin,M.players={};Gi=window.navigator;M.prototype.options_={techOrder:j.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Gi&&(Gi.languages&&Gi.languages[0]||Gi.userLanguage||Gi.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){M.prototype[e]=function(){return this.techGet_(e)}}),vr.forEach(function(e){M.prototype[`handleTech${f(e)}_`]=function(){return this.trigger(e)}}),T.registerComponent("Player",M);function fr(t,s){function i(){Sr(this,{name:t,plugin:s,instance:null},!0);var e=s.apply(this,arguments);return Er(this,t),Sr(this,{name:t,plugin:s,instance:e}),e}return Object.keys(s).forEach(function(e){i[e]=s[e]}),i}const br="plugin",Tr="activePlugins_",kr={},Cr=e=>kr.hasOwnProperty(e),wr=e=>Cr(e)?kr[e]:void 0,Er=(e,t)=>{e[Tr]=e[Tr]||{},e[Tr][t]=!0},Sr=(e,t,s)=>{s=(s?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},xr=(s,i)=>(i.prototype.name=s,function(...e){Sr(this,{name:s,plugin:i,instance:null},!0);const t=new i(this,...e);return this[s]=()=>t,Sr(this,t.getEventHash()),t});class O{constructor(e){if(this.constructor===O)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),ft(this),delete this.trigger,Tt(this,this.constructor.defaultState),Er(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return rt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Tr][e]=!1,this.player=this.state=null,t[e]=xr(e,kr[e])}static isBasic(e){e="string"==typeof e?wr(e):e;return"function"==typeof e&&!O.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Cr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(M.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return kr[e]=t,e!==br&&(O.isBasic(t)?M.prototype[e]=fr(e,t):M.prototype[e]=xr(e,t)),t}static deregisterPlugin(e){if(e===br)throw new Error("Cannot de-register base plugin.");Cr(e)&&(delete kr[e],delete M.prototype[e])}static getPlugins(e=Object.keys(kr)){let s;return e.forEach(e=>{var t=wr(e);t&&((s=s||{})[e]=t)}),s}static getPluginVersion(e){e=wr(e);return e&&e.VERSION||""}}function A(e,s,i,r){{var n=s+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}O.getPlugin=wr,O.BASE_PLUGIN_NAME=br,O.registerPlugin(br,O),M.prototype.usingPlugin=function(e){return!!this[Tr]&&!0===this[Tr][e]},M.prototype.hasPlugin=function(e){return!!Cr(e)};const jr=e=>0===e.indexOf("#")?e.slice(1):e;function L(e,t,s){let i=L.getPlayer(e);if(i)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&i.ready(s);else{const r="string"==typeof e?ze("#"+jr(e)):e;if(!me(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,h(t));!n(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=h(t,e)}),T.getComponent("Player"));i=new e(r,t,s),B("setup").forEach(e=>e(i))}return i}return L.hooks_=s,L.hooks=B,L.hook=function(e,t){B(e,t)},L.hookOnce=function(i,e){B(i,[].concat(e).map(t=>{const s=(...e)=>(H(i,s),t(...e));return s}))},L.removeHook=H,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ge()&&!(qi=ze(".vjs-styles-defaults"))&&(qi=Qe("vjs-styles-defaults"),(Xi=ze("head"))&&Xi.insertBefore(qi,Xi.firstChild),Je(qi,` + `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var s=f(e),i=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==s&&this.tag&&(j.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${i}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};x.names.forEach(e=>{e=x[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${f(t)}_`](e))}),Object.keys(gr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${gr[t]}_`].bind(this),event:e}):this[`handleTech${gr[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||be(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){x.names.forEach(e=>{e=x[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Ht(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var s=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var s=this.play();if(Dt(s))return s.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():s():Dt(e=this.play())&&(e=e.catch(s)),Dt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,s="";"string"!=typeof t&&(t=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!s&&(s=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var s=e.cache_.sources.filter(e=>e.src===t);if(s.length)return s[0].type;var i=e.$$("source");for(let e=0;ee.src&&e.src===t),i=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var s=this.currentSource().src,i=t.src;(e=!s||/^blob:/.test(s)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===s)?e:()=>{})(i),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?w(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=w){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),s=Boolean(pe||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),s&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&s&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||k(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:k(0,0)}bufferedPercent(){return Lt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let s=e.end(e.length-1);return s=s>t?t:s}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function i(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(i,i),n.then(e,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,s)=>{function i(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){i(),e()}function r(e,t){i(),s(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(i,i),n.then(e,s))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&w(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,m(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",ke(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){b.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Ce(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(p("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>($e(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,s,i=this.options_["userActions"];i&&i.hotkeys&&(t=this.el_.ownerDocument.activeElement,s=t.tagName.toLowerCase(),t.isContentEditable||("input"===s?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(s))||("function"==typeof i.hotkeys?i.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>b.isEventKey(e,"f"),muteKey:s=e=>b.isEventKey(e,"m"),playPauseKey:i=e=>b.isEventKey(e,"k")||b.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=T.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):s.call(this,e)?(e.preventDefault(),e.stopPropagation(),T.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),T.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(i){var r;for(let t=0,s=this.options_.techOrder;ts.some(e=>{if(r=i(t,e))return!0})),r}var s=this.options_.techOrder.map(e=>[e,j.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let i;var r,n=([e,t],s)=>{if(t.canPlaySource(s,this.options_[e.toLowerCase()]))return{source:s,tech:e}};return(i=this.options_.sourceOrder?t(e,s,(r=n,(e,t)=>r(t,e))):t(s,e,n))||!1}handleSrc_(e,i){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Os(e);if(r.length){if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),Es(this,r[0],(e,t)=>{var s;if(this.middleware_=t,i||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(s))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",t)};this.one("error",t),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",s)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Ct(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():w(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),a(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:s,remainingTimeDisplay:i}=this.controlBar||{},s=(s||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),i&&i.updateContent(),s&&(s.update(),s.loadProgressBar)&&s.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);n(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new C(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${C.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,s,i;const r=y(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===s&&e.screenY===i||(s=e.screenX,i=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||o||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var s=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(s),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,s){if(this.tech_)return this.tech_.addTextTrack(e,t,s)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),a(this))&&this.trigger("languagechange")}languages(){return h(M.prototype.options_.languages,this.languages_)}toJSON(){var t=h(this.options_),s=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(s)}),s.open(),s}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),s=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?h(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ls(t.poster)}]),t)}static getTagSettings(e){var t,s={sources:[],tracks:[]},i=Se(e),r=i["data-setup"];if(Te(e,"vjs-fill")&&(i.fill=!0),Te(e,"vjs-fluid")&&(i.fluid=!0),null!==r&&([r,t]=Nt(r||"{}"),r&&l.error(r),Object.assign(i,t)),Object.assign(s,i),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}x.names.forEach(function(e){const t=x[e];M.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),M.prototype.crossorigin=M.prototype.crossOrigin,M.players={};Gi=window.navigator;M.prototype.options_={techOrder:j.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Gi&&(Gi.languages&&Gi.languages[0]||Gi.userLanguage||Gi.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){M.prototype[e]=function(){return this.techGet_(e)}}),vr.forEach(function(e){M.prototype[`handleTech${f(e)}_`]=function(){return this.trigger(e)}}),T.registerComponent("Player",M);function fr(t,s){function i(){Sr(this,{name:t,plugin:s,instance:null},!0);var e=s.apply(this,arguments);return Er(this,t),Sr(this,{name:t,plugin:s,instance:e}),e}return Object.keys(s).forEach(function(e){i[e]=s[e]}),i}const br="plugin",Tr="activePlugins_",kr={},Cr=e=>kr.hasOwnProperty(e),wr=e=>Cr(e)?kr[e]:void 0,Er=(e,t)=>{e[Tr]=e[Tr]||{},e[Tr][t]=!0},Sr=(e,t,s)=>{s=(s?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},xr=(s,i)=>(i.prototype.name=s,function(...e){Sr(this,{name:s,plugin:i,instance:null},!0);const t=new i(this,...e);return this[s]=()=>t,Sr(this,t.getEventHash()),t});class O{constructor(e){if(this.constructor===O)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),ft(this),delete this.trigger,Tt(this,this.constructor.defaultState),Er(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return rt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Tr][e]=!1,this.player=this.state=null,t[e]=xr(e,kr[e])}static isBasic(e){e="string"==typeof e?wr(e):e;return"function"==typeof e&&!O.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Cr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(M.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return kr[e]=t,e!==br&&(O.isBasic(t)?M.prototype[e]=fr(e,t):M.prototype[e]=xr(e,t)),t}static deregisterPlugin(e){if(e===br)throw new Error("Cannot de-register base plugin.");Cr(e)&&(delete kr[e],delete M.prototype[e])}static getPlugins(e=Object.keys(kr)){let s;return e.forEach(e=>{var t=wr(e);t&&((s=s||{})[e]=t)}),s}static getPluginVersion(e){e=wr(e);return e&&e.VERSION||""}}function A(e,s,i,r){{var n=s+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}O.getPlugin=wr,O.BASE_PLUGIN_NAME=br,O.registerPlugin(br,O),M.prototype.usingPlugin=function(e){return!!this[Tr]&&!0===this[Tr][e]},M.prototype.hasPlugin=function(e){return!!Cr(e)};const jr=e=>0===e.indexOf("#")?e.slice(1):e;function L(e,t,s){let i=L.getPlayer(e);if(i)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&i.ready(s);else{const r="string"==typeof e?ze("#"+jr(e)):e;if(!me(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,h(t));!n(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=h(t,e)}),T.getComponent("Player"));i=new e(r,t,s),B("setup").forEach(e=>e(i))}return i}return L.hooks_=s,L.hooks=B,L.hook=function(e,t){B(e,t)},L.hookOnce=function(i,e){B(i,[].concat(e).map(t=>{const s=(...e)=>(H(i,s),t(...e));return s}))},L.removeHook=H,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ge()&&!(qi=ze(".vjs-styles-defaults"))&&(qi=Qe("vjs-styles-defaults"),(Xi=ze("head"))&&Xi.insertBefore(qi,Xi.firstChild),Je(qi,` .video-js { width: 300px; height: 150px; diff --git a/node_modules/video.js/dist/alt/video.debug.js b/node_modules/video.js/dist/alt/video.debug.js index d754c6af68..33e5f14f85 100644 --- a/node_modules/video.js/dist/alt/video.debug.js +++ b/node_modules/video.js/dist/alt/video.debug.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -16,7 +16,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojs = factory()); })(this, (function () { 'use strict'; - var version$5 = "8.6.0"; + var version$5 = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1996,7 +1996,7 @@ * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2719,7 +2719,7 @@ /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2736,7 +2736,7 @@ * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget$2.prototype.allowedEvents_ = {}; @@ -4169,7 +4169,6 @@ /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4180,6 +4179,7 @@ * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4634,9 +4634,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4652,9 +4651,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4700,7 +4698,7 @@ * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4875,7 +4873,7 @@ * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4887,7 +4885,7 @@ * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6524,7 +6522,7 @@ * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6574,7 +6572,7 @@ /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -8012,7 +8010,9 @@ */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -8055,6 +8055,7 @@ /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -8313,6 +8314,10 @@ }); } } + + /** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -10110,7 +10115,7 @@ * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -10546,7 +10551,7 @@ * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -11310,7 +11315,7 @@ * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -11335,7 +11340,7 @@ /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -11390,7 +11395,7 @@ * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -12169,7 +12174,7 @@ * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -12925,7 +12930,7 @@ * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -12979,7 +12984,7 @@ * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -12990,7 +12995,7 @@ const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -13010,10 +13015,29 @@ this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -13099,7 +13123,7 @@ * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -16726,7 +16750,7 @@ /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -17323,7 +17347,7 @@ * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -22382,8 +22406,8 @@ * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -24122,7 +24146,9 @@ */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -25078,7 +25104,7 @@ * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -27282,7 +27308,7 @@ * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -27435,7 +27461,7 @@ * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -27454,7 +27480,7 @@ * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -27670,7 +27696,7 @@ * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27678,14 +27704,14 @@ * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27693,11 +27719,11 @@ * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -28024,10 +28050,10 @@ * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -28110,9 +28136,11 @@ * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); @@ -39079,7 +39107,7 @@ }; var clock_1 = clock.ONE_SECOND_IN_TS; - /*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ + /*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ /** * @file resolve-url.js - Handling how URLs are resolved and manipulated @@ -39813,9 +39841,13 @@ const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); }; @@ -42253,7 +42285,10 @@ }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -45083,18 +45118,31 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { win.newLine(this.getPts(i)); @@ -52091,7 +52139,7 @@ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -59082,15 +59130,11 @@ */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -59126,15 +59170,11 @@ */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { track.mode = 'disabled'; @@ -59721,6 +59761,388 @@ return mediaTypes; }; + /** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + + class SteeringManifest { + constructor() { + this.priority_ = []; + } + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + get version() { + return this.version_; + } + get ttl() { + return this.ttl_; + } + get reloadUri() { + return this.reloadUri_; + } + get priority() { + return this.priority_; + } + } + /** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window.URL(steeringUrl); + const proxyServerUrlObject = new window.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + setSteeringParams_(url) { + const urlObject = new window.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + return [...this.availablePathways_][0]; + }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + const steeringURI = this.setSteeringParams_(reloadUri); + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + clearTTLTimeout_() { + window.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + abort() { + if (this.request_) { + this.request_.abort(); + } + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + } + /** * @file playlist-controller.js */ @@ -59948,6 +60370,10 @@ tech.addWebVttScript_(); }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_()); @@ -60033,6 +60459,32 @@ } this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -60181,8 +60633,9 @@ } let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; if (this.enableLowInitialPlaylist) { @@ -60763,10 +61216,22 @@ return this.mainPlaylistLoader_.load(isFinalRendition); } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -61104,6 +61569,7 @@ this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); } @@ -61444,6 +61910,110 @@ videoDuration }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + initContentSteeringController_() { + const initialMain = this.main(); + if (!initialMain.contentSteering) { + return; + } + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + this.switchMedia_(nextPlaylist, 'content-steering'); + } } /** @@ -62192,8 +62762,8 @@ const reloadSourceOnError = function (options) { initPlugin(this, options); }; - var version$4 = "3.6.0"; - var version$3 = "7.0.0"; + var version$4 = "3.7.0"; + var version$3 = "7.0.1"; var version$2 = "1.2.2"; var version$1 = "7.1.0"; var version = "4.0.1"; diff --git a/node_modules/video.js/dist/alt/video.novtt.js b/node_modules/video.js/dist/alt/video.novtt.js index 03e454aa3f..bcd2d28b65 100644 --- a/node_modules/video.js/dist/alt/video.novtt.js +++ b/node_modules/video.js/dist/alt/video.novtt.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -16,7 +16,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojs = factory()); })(this, (function () { 'use strict'; - var version$5 = "8.6.0"; + var version$5 = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1996,7 +1996,7 @@ * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2719,7 +2719,7 @@ /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2736,7 +2736,7 @@ * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget$2.prototype.allowedEvents_ = {}; @@ -4169,7 +4169,6 @@ /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4180,6 +4179,7 @@ * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4634,9 +4634,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4652,9 +4651,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4700,7 +4698,7 @@ * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4875,7 +4873,7 @@ * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4887,7 +4885,7 @@ * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6524,7 +6522,7 @@ * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6574,7 +6572,7 @@ /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -8012,7 +8010,9 @@ */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -8055,6 +8055,7 @@ /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -8313,6 +8314,10 @@ }); } } + + /** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -8408,7 +8413,7 @@ * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8844,7 +8849,7 @@ * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9608,7 +9613,7 @@ * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9633,7 +9638,7 @@ /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9688,7 +9693,7 @@ * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -10467,7 +10472,7 @@ * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -11223,7 +11228,7 @@ * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -11277,7 +11282,7 @@ * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -11288,7 +11293,7 @@ const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -11308,10 +11313,29 @@ this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -11397,7 +11421,7 @@ * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -15024,7 +15048,7 @@ /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15621,7 +15645,7 @@ * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20680,8 +20704,8 @@ * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -22420,7 +22444,9 @@ */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -23376,7 +23402,7 @@ * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25580,7 +25606,7 @@ * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25733,7 +25759,7 @@ * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25752,7 +25778,7 @@ * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25968,7 +25994,7 @@ * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25976,14 +26002,14 @@ * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25991,11 +26017,11 @@ * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -26322,10 +26348,10 @@ * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -26408,9 +26434,11 @@ * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); @@ -37377,7 +37405,7 @@ }; var clock_1 = clock.ONE_SECOND_IN_TS; - /*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ + /*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ /** * @file resolve-url.js - Handling how URLs are resolved and manipulated @@ -38111,9 +38139,13 @@ const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); }; @@ -40551,7 +40583,10 @@ }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -43381,18 +43416,31 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { win.newLine(this.getPts(i)); @@ -50389,7 +50437,7 @@ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -57380,15 +57428,11 @@ */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -57424,15 +57468,11 @@ */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { track.mode = 'disabled'; @@ -58019,6 +58059,388 @@ return mediaTypes; }; + /** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + + class SteeringManifest { + constructor() { + this.priority_ = []; + } + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + get version() { + return this.version_; + } + get ttl() { + return this.ttl_; + } + get reloadUri() { + return this.reloadUri_; + } + get priority() { + return this.priority_; + } + } + /** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window.URL(steeringUrl); + const proxyServerUrlObject = new window.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + setSteeringParams_(url) { + const urlObject = new window.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + return [...this.availablePathways_][0]; + }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + const steeringURI = this.setSteeringParams_(reloadUri); + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + clearTTLTimeout_() { + window.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + abort() { + if (this.request_) { + this.request_.abort(); + } + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + } + /** * @file playlist-controller.js */ @@ -58246,6 +58668,10 @@ tech.addWebVttScript_(); }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_()); @@ -58331,6 +58757,32 @@ } this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -58479,8 +58931,9 @@ } let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; if (this.enableLowInitialPlaylist) { @@ -59061,10 +59514,22 @@ return this.mainPlaylistLoader_.load(isFinalRendition); } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -59402,6 +59867,7 @@ this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); } @@ -59742,6 +60208,110 @@ videoDuration }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + initContentSteeringController_() { + const initialMain = this.main(); + if (!initialMain.contentSteering) { + return; + } + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + this.switchMedia_(nextPlaylist, 'content-steering'); + } } /** @@ -60490,8 +61060,8 @@ const reloadSourceOnError = function (options) { initPlugin(this, options); }; - var version$4 = "3.6.0"; - var version$3 = "7.0.0"; + var version$4 = "3.7.0"; + var version$3 = "7.0.1"; var version$2 = "1.2.2"; var version$1 = "7.1.0"; var version = "4.0.1"; diff --git a/node_modules/video.js/dist/alt/video.novtt.min.js b/node_modules/video.js/dist/alt/video.novtt.min.js index 2affdc7db3..2d3b2f171e 100644 --- a/node_modules/video.js/dist/alt/video.novtt.min.js +++ b/node_modules/video.js/dist/alt/video.novtt.min.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -9,7 +9,7 @@ * Available under Apache License Version 2.0 * */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var M="8.6.0";const U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}const j={prefixed:!0};var q=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=q[0];let V;for(let e=0;e{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),u&&(u.push([].concat(s)),e=u.length-1e3,u.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>u?[].concat(u):[],o.history.filter=t=>(u||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{u&&(u.length=0)},o.history.disable=()=>{null!==u&&(u.length=0,u=null)},o.history.enable=()=>{null===u&&(u=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),$=l.createLogger,W=Object.prototype.toString;function G(t,i){z(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return z(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===W.call(e)&&e.constructor===Object}function d(...e){const i={};return e.forEach(e=>{e&&G(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function Q(e={}){var t,i=[];for(const s in e)e.hasOwnProperty(s)&&(t=e[s],i.push(t));return i}function J(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var Z=Object.freeze({__proto__:null,each:G,reduce:X,isObject:K,isPlain:Y,merge:d,values:Q,defineLazyProperty:J});let ee=!1,te=null,ie=!1,se,re=!1,ne=!1,ae=!1,oe=!1,le=null,de=null,he=null,ue=!1,ce=!1,pe=!1,me=!1;const ge=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var fe,e=window.navigator&&window.navigator.userAgentData;if(e&&(ie="Android"===e.platform,ne=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ae=Boolean(e.brands.find(e=>"Chromium"===e.brand)),oe=!ne&&ae,le=de=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ce="Windows"===e.platform),!ae){const R=window.navigator&&window.navigator.userAgent||"";ee=/iPod/i.test(R),te=(e=R.match(/OS (\d+)_/i))&&e[1]?e[1]:null,ie=/Android/i.test(R),se=(e=R.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ft=e[1]&&parseFloat(e[1]),fe=e[2]&&parseFloat(e[2]),ft&&fe?parseFloat(e[1]+"."+e[2]):ft||null):null,re=/Firefox/i.test(R),ne=/Edg/i.test(R),ae=/Chrome/i.test(R)||/CriOS/i.test(R),oe=!ne&&ae,le=de=(fe=R.match(/(Chrome|CriOS)\/(\d+)/))&&fe[2]?parseFloat(fe[2]):null,he=function(){var e=/MSIE\s(\d+)\.\d/.exec(R);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(R)&&/rv:11.0/.test(R)?11:t}(),ue=/Safari/i.test(R)&&!oe&&!ie&&!ne,ce=/Windows/i.test(R),pe=/iPad/i.test(R)||ue&&ge&&!/iPhone/i.test(R),me=/iPhone/i.test(R)&&!pe}const c=me||pe||ee,ye=(ue||c)&&!oe;e=Object.freeze({__proto__:null,get IS_IPOD(){return ee},get IOS_VERSION(){return te},get IS_ANDROID(){return ie},get ANDROID_VERSION(){return se},get IS_FIREFOX(){return re},get IS_EDGE(){return ne},get IS_CHROMIUM(){return ae},get IS_CHROME(){return oe},get CHROMIUM_VERSION(){return le},get CHROME_VERSION(){return de},get IE_VERSION(){return he},get IS_SAFARI(){return ue},get IS_WINDOWS(){return ce},get IS_IPAD(){return pe},get IS_IPHONE(){return me},TOUCH_ENABLED:ge,IS_IOS:c,IS_ANY_SAFARI:ye});function _e(e){return"string"==typeof e&&Boolean(e.trim())}function ve(){return document===window.document}function be(e){return K(e)&&1===e.nodeType}function Te(){try{return window.parent!==window.self}catch(e){return!0}}function Se(i){return function(e,t){return _e(e)?(t=be(t=_e(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function o(e="div",i={},t={},s){const r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?we(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&He(r,s),r}function we(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ee(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function xe(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ie(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Ae(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function De(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Ge(e,"height"))),i.width||(i.width=parseFloat(Ge(e,"width"))),i}}function Ue(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[j.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Be(t,e){var i={x:0,y:0};if(c){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Ge(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e=e.parentNode}}var n={},a=Ue(e.target),t=Ue(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,c)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function Fe(e){return K(e)&&3===e.nodeType}function je(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function qe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>be(e="function"==typeof e?e():e)||Fe(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return qe(e).forEach(e=>t.appendChild(e)),t}function Ve(e,t){return He(je(e),t)}function ze(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const $e=Se("querySelector"),We=Se("querySelectorAll");function Ge(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Xe(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var Ke=Object.freeze({__proto__:null,isReal:ve,isEl:be,isInFrame:Te,createEl:o,textContent:we,prependTo:Ee,hasClass:ke,addClass:Ce,removeClass:xe,toggleClass:Ie,setAttributes:Ae,getAttributes:De,getAttribute:Le,setAttribute:Pe,removeAttribute:Oe,blockTextSelection:Ne,unblockTextSelection:Re,getBoundingClientRect:Me,findPosition:Ue,getPointerPosition:Be,isTextNode:Fe,emptyEl:je,normalizeContent:qe,appendContent:He,insertContent:Ve,isSingleLeftClick:ze,$:$e,$$:We,computedStyle:Ge,copyStyleSheetsToWindow:Xe});let Ye=!1,Qe;function Je(){if(!1!==Qe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function gt(s,r,n,a=window){let o;function e(){const e=this,t=arguments;let i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ft=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:m,throttle:mt,debounce:gt});let yt;class _t{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},dt(this,e,t),this.addEventListener=i}off(e,t){p(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ut(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ct(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=at(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ht(this,e)}queueTrigger(e){yt=yt||new Map;const t=e.type||e;let i=yt.get(this);i||(i=new Map,yt.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,yt.delete(this)),this.trigger(e)},0));i.set(t,s)}}_t.prototype.allowedEvents_={},_t.prototype.addEventListener=_t.prototype.on,_t.prototype.removeEventListener=_t.prototype.off,_t.prototype.dispatchEvent=_t.prototype.trigger;const vt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),bt=t=>t instanceof _t||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),Tt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,St=(e,t,i)=>{if(!e||!e.nodeName&&!bt(e))throw new Error(`Invalid target for ${vt(t)}#${i}; must be a DOM node or evented object.`)},wt=(e,t,i)=>{if(!Tt(e))throw new Error(`Invalid event type for ${vt(t)}#${i}; must be a non-empty string or array.`)},Et=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${vt(t)}#${i}; must be a function.`)},kt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,St(r,e,i),wt(n,e,i),Et(a,e,i),a=m(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Ct=(e,t,i,s)=>{St(e,e,t),e.nodeName?pt[t](e,i,s):e[t](i,s)},xt={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"on");if(Ct(i,"on",s,r),!t){const n=()=>this.off(i,s,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,Ct(this,"on","dispose",n),Ct(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"one");if(t)Ct(i,"one",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"one",s,n)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"any");if(t)Ct(i,"any",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"any",s,n)}},off(e,t,i){!e||Tt(e)?p(this.eventBusEl_,e,t):(e=e,t=t,St(e,this,"off"),wt(t,this,"off"),Et(i,this,"off"),i=m(this,i),this.off("dispose",i),e.nodeName?(p(e,t,i),p(e,"dispose",i)):bt(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){St(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(Tt(i))return ht(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${vt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function It(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=o("span",{className:"vjs-event-bus"});Object.assign(e,xt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const At={state:{},setState(e){"function"==typeof e&&(e=e());let i;return G(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&bt(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Dt(e,t){Object.assign(e,At),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&bt(e)&&e.on("statechanged",e.handleStateChanged)}function Lt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function g(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Pt(e,t){return g(e)===g(t)}var Ot=Object.freeze({__proto__:null,toLowerCase:Lt,toTitleCase:g,titleCaseEquals:Pt}),Nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rt(e,t){return e(t={exports:{}},t.exports),t.exports}var r=Rt(function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),s[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var i=s[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in s)o[s[n]]=n;for(a in r)s[a]=r[a]});r.code,r.codes,r.aliases,r.names,r.title;class f{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+st++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(It(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Dt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return o(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,s[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=f.getComponent(e.opts.componentClass||g(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==r[t]?r[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=m(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=m(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=m(this,t),i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=f.getComponent("Tech"),i=i&&i.isTech(e),s=f===e||f.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=g(t),f.components_||(f.components_={});s=f.getComponent("Player");if("Player"===t&&s&&s.players){const r=s.players;i=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return f.components_[t]=e,f.components_[Lt(t)]=e}static getComponent(e){if(e&&f.components_)return f.components_[e]}}function Mt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function Bt(e,t){return Array.isArray(e)?Ut(e):void 0===e||void 0===t?Ut():Ut([[e,t]])}f.registerComponent("Component",f);function Ft(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:K(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Kt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Yt=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Kt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(Kt))},Qt=function(e,i){return e.forEach(function(e){const t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Kt;const Jt="vjs-modal-dialog";class Zt extends f{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=o("div",{className:Jt+"-content"},{role:"document"}),this.descEl_=o("p",{className:Jt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),we(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Jt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Ve(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),je(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),r.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(r.isEventKey(e,"Tab")){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}Zt.prototype.options_={pauseOnOpen:!0,temporary:!0},f.registerComponent("ModalDialog",Zt);class ei extends _t{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},bt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class ri{constructor(e){ri.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Ai(e,s){var t={uri:e};(e=ci(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),Ti(t,m(this,function(e,t,i){if(e)return l.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Ii(i,s);l.error("vttjs failed to load, stopping trying to process "+s.src)}):Ii(i,s)}))}class Di extends di{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:oi[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=li[e.mode]||"disabled";const i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new ri(this.cues_)),n=new ri(this.activeCues_);let a=!1;this.timeupdateHandler=m(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){li[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Ai(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e=i&&s.push(r)}if(a=!1,s.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=Oi.LOADED,this.trigger({type:"load",target:this})})}}Oi.prototype.allowedEvents_={load:"load"},Oi.NONE=0,Oi.LOADING=1,Oi.LOADED=2,Oi.ERROR=3;const Ni={audio:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){ti(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&ti(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ti(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Li,capitalName:"Audio"},video:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){ii(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,ii(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Pi,capitalName:"Video"},text:{ListClass:si,TrackClass:Di,capitalName:"Text"}},Ri=(Object.keys(Ni).forEach(function(e){Ni[e].getterName=e+"Tracks",Ni[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:si,TrackClass:Di,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;ethis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(m(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Ni.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Bt(0,0):Bt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ni.names.forEach(e=>{var t=Ni[e];const i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Y(Mi)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=st++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return y.canPlayType(e.type)}static isTech(e){return e.prototype instanceof y||e instanceof y||e===y}static registerTech(e,t){if(y.techs_||(y.techs_={}),!y.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!y.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(y.canPlaySource)return e=g(e),y.techs_[e]=t,y.techs_[Lt(e)]=t,"Tech"!==e&&y.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return y.techs_&&y.techs_[e]?y.techs_[e]:(e=g(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){const t=a[e];y.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),y.prototype.featuresVolumeControl=!0,y.prototype.featuresMuteControl=!0,y.prototype.featuresFullscreenResize=!1,y.prototype.featuresPlaybackRate=!1,y.prototype.featuresProgressEvents=!1,y.prototype.featuresSourceset=!1,y.prototype.featuresTimeupdateEvents=!1,y.prototype.featuresNativeTextTracks=!1,y.prototype.featuresVideoFrameCallback=!1,y.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction i(s={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)i(s,Ui[t],r,n,a,o);else if(t){const d=Wi(n,t);if(!d.setSource)return a.push(d),i(s,l,r,n,a,o);d.setSource(Object.assign({},s),function(e,t){if(e)return i(s,l,r,n,a,o);a.push(d),i(t,s.type===t.type?l:Ui[t.type],r,n,a,o)})}else l.length?i(s,l,r,n,a,o):o?r(s,a):i(s,Ui["*"],r,n,a,!0)}(t,Ui[t.type],i,e),1)}function qi(e,t,i,s=null){var r="call"+g(i),r=e.reduce($i(r),s),s=r===Fi,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}const Hi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Vi={setCurrentTime:1,setMuted:1,setVolume:1},zi={play:1,pause:1};function $i(i){return(e,t)=>e===Fi?Fi:t[i]?t[i](e):e}function Wi(e,t){var i=Bi[e.id()];let s=null;if(null==i)s=t(e),Bi[e.id()]=[[t,s]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=o(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=o("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,we(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}f.registerComponent("ClickableComponent",Ji);class Zi extends Ji{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return o("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(o("picture",{className:"vjs-poster",tabIndex:-1},{},o("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xt(this.player_.play()):this.player_.pause())}}Zi.prototype.crossorigin=Zi.prototype.crossOrigin,f.registerComponent("PosterImage",Zi);const es={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function ts(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function is(e,t,i){try{e.style[t]=i}catch(e){}}function ss(e){return e?e+"px":""}class rs extends f{constructor(s,e,t){super(s,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(m(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);const e=window.screen.orientation||window,i=window.screen.orientation?"change":"orientationchange";e.addEventListener(i,r),s.on("dispose",()=>e.removeEventListener(i,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)Xt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const i=e&&e.getChild("playToggle");i?(e=()=>i.focus(),Gt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}as.prototype.controlText_="Play Video",f.registerComponent("BigPlayButton",as);s;f.registerComponent("CloseButton",class extends s{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){r.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class os extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Xt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}os.prototype.controlText_="Play",f.registerComponent("PlayToggle",os);class ls extends f{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=o("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=o("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Vt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}ls.prototype.labelText_="Time",ls.prototype.controlText_="Time",f.registerComponent("TimeDisplay",ls);class ds extends ls{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ds.prototype.labelText_="Current Time",ds.prototype.controlText_="Current Time",f.registerComponent("CurrentTimeDisplay",ds);class hs extends ls{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}hs.prototype.labelText_="Duration",hs.prototype.controlText_="Duration",f.registerComponent("DurationDisplay",hs);class us extends f{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}f.registerComponent("TimeDivider",us);class cs extends ls{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(o("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}cs.prototype.labelText_="Remaining Time",cs.prototype.controlText_="Remaining Time",f.registerComponent("RemainingTimeDisplay",cs);class ps extends f{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=o("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(o("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}f.registerComponent("LiveDisplay",ps);class ms extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=o("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function gs(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}ms.prototype.controlText_="Seek to live, currently playing live",f.registerComponent("SeekToLive",ms);Nt=Object.freeze({__proto__:null,clamp:gs});class fs extends f{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||oe||e.preventDefault(),Ne(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Re(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(gs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Be(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r.isEventKey(e,"Right")||r.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}f.registerComponent("Slider",fs);const ys=(e,t)=>gs(e/t*100,0,100).toFixed(2)+"%";class _s extends f{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=o("span",{className:"vjs-control-text"}),i=o("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=o("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=ys(s,e);this.percent_!==e&&(this.el_.style.width=e,we(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}f.registerComponent("LoadProgressBar",_s);class vs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,i,s){var r=Ue(this.el_),n=Me(this.player_.el()),i=t.width*i;if(n&&r){var a=t.left-n.left+i,i=t.width-i+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(s)}}write(e){we(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Vt(i,t):Vt(a,s),this.update(r,n,e),o&&o()})}}f.registerComponent("TimeTooltip",vs);class bs extends f{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}bs.prototype.options_={children:[]},c||ie||bs.prototype.options_.children.push("timeTooltip"),f.registerComponent("PlayProgressBar",bs);class Ts extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}Ts.prototype.options_={children:["timeTooltip"]},f.registerComponent("MouseTimeDisplay",Ts);class Ss extends fs{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=m(this,this.update),this.update=mt(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Vt(e,i),Vt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(Me(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ze(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(ze(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):r.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):r.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(r(e))?(e.preventDefault(),e.stopPropagation(),t=10*(r.codes[r(e)]-r.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):r.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):r.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ss.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},c||ie||Ss.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),f.registerComponent("SeekBar",Ss);class ws extends f{constructor(e,t){super(e,t),this.handleMouseMove=mt(m(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=mt(m(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=Ue(r=n.el()),r=gs(r=Be(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Xt(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}ws.prototype.options_={children:["seekBar"]},f.registerComponent("ProgressControl",ws);class Es extends s{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Es.prototype.controlText_="Picture-in-Picture",f.registerComponent("PictureInPictureToggle",Es);class ks extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ks.prototype.controlText_="Fullscreen",f.registerComponent("FullscreenToggle",ks);class Cs extends f{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}f.registerComponent("VolumeLevel",Cs);class xs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=Me(this.el_),r=Me(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){we(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}f.registerComponent("VolumeLevelTooltip",xs);class Is extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}Is.prototype.options_={children:["volumeLevelTooltip"]},f.registerComponent("MouseVolumeLevelDisplay",Is);class As extends fs{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ze(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Me(s=this.el()),i=this.vertical(),s=Be(s,e),s=gs(s=i?s.y:s.x,0,1),r.update(t,s,i)),ze(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}As.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},c||ie||As.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),As.prototype.playerEvent="volumechange",f.registerComponent("VolumeBar",As);class Ds extends f{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Y(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=mt(m(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Ds.prototype.options_={children:["volumeBar"]},f.registerComponent("VolumeControl",Ds);class Ls extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),c&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),xe(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Ls.prototype.controlText_="Mute",f.registerComponent("MuteToggle",Ls);class Ps extends f{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Y(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){r.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),dt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){r.isEventKey(e,"Esc")&&this.handleMouseOut()}}Ps.prototype.options_={children:["muteToggle","volumeControl"]},f.registerComponent("VolumePanel",Ps);s;f.registerComponent("SkipForward",class extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class Os extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Os.prototype.controlText_="Skip Backward",f.registerComponent("SkipBackward",Os);class Ns extends f{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof f&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof f&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=o(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),dt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(r.isEventKey(e,"Right")||r.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}f.registerComponent("Menu",Ns);class Rs extends f{constructor(e,t={}){super(e,t),this.menuButton_=new s(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=s.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),dt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new Ns(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=o("li",{className:"vjs-menu-title",textContent:g(this.options_.title),tabIndex:-1}),e=new f(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;er.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}f.registerComponent("MenuItem",Bs);class Fs extends Bs{constructor(e,t){var i=t.track;const s=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(g(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Js.prototype.contentElType="button",f.registerComponent("PlaybackRateMenuItem",Js);class Zs extends Rs{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=o("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new Js(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}ir.prototype.options_=Object.assign({},Zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),f.registerComponent("ErrorDisplay",ir);const sr="vjs-text-track-settings";var rr=["#000","Black"],nr=["#00F","Blue"],ar=["#0FF","Cyan"],or=["#0F0","Green"],t=["#F0F","Magenta"],lr=["#F00","Red"],dr=["#FFF","White"],n=["#FF0","Yellow"],hr=["1","Opaque"],ur=["0.5","Semi-Transparent"],cr=["0","Transparent"];const pr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rr,dr,lr,or,nr,n,t,ar]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[hr,ur,cr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[dr,rr,lr,or,nr,n,t,ar]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[hr,ur]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[cr,ur,hr]}};function mr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}pr.windowColor.options=pr.backgroundColor.options;class gr extends Zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=o("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),G(pr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){e=pr[e];const s=e.id.replace("%s",this.id_),r=[t,s].join(" ").trim();return[`<${i} id="${s}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return o("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return o("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return o("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(pr,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=mr(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){G(pr,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(sr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(sr,JSON.stringify(e)):window.localStorage.removeItem(sr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}f.registerComponent("TextTrackSettings",gr);class fr extends f{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=gt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){p(this,"resize",t),p(this,"unload",e),e=null};dt(this.el_.contentWindow,"unload",e),dt(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}f.registerComponent("ResizeManager",fr);const yr={trackingThreshold:20,liveTolerance:15};class _r extends f{constructor(e,t){super(e,d(yr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:o("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+st++}),description:o("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+st++})},o("div",{className:"vjs-title-bar"},{},Q(this.els))}updateDom_(){var e=this.player_.tech_;const s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];je(i),t&&we(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}f.registerComponent("TitleBar",vr);function br(i){const s=i.el();if(!s.resetSourceWatch_){const t={},e=kr(i),r=t=>(...e)=>{e=t.apply(s,e);return Sr(i),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{s[e]&&(t[e]=s[e],s[e]=r(t[e]))}),Object.defineProperty(s,"innerHTML",d(e,{set:r(e.set)})),s.resetSourceWatch_=()=>{s.resetSourceWatch_=null,Object.keys(t).forEach(e=>{s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},i.one("sourceset",s.resetSourceWatch_)}}function Tr(i){if(i.featuresSourceset){const s=i.el();if(!s.resetSourceset_){e=i;const t=Er([e.el(),window.HTMLMediaElement.prototype,Cr],"src");var e;const r=s.setAttribute,n=s.load;Object.defineProperty(s,"src",d(t,{set:e=>{e=t.set.call(s,e);return i.triggerSourceset(s.src),e}})),s.setAttribute=(e,t)=>{t=r.call(s,e,t);return/src/i.test(e)&&i.triggerSourceset(s.src),t},s.load=()=>{var e=n.call(s);return Sr(i)||(i.triggerSourceset(""),br(i)),e},s.currentSrc?i.triggerSourceset(s.currentSrc):Sr(i)||br(i),s.resetSourceset_=()=>{s.resetSourceset_=null,s.load=n,s.setAttribute=r,Object.defineProperty(s,"src",t),s.resetSourceWatch_&&s.resetSourceWatch_()}}}}const Sr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;eEr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,wr],"innerHTML"),Cr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ui(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class _ extends y{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!ci(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var e=Ni[i];const s=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&s&&s.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===i&&this[Ri.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{const i=n[t];s.addEventListener(t,i),this.on("dispose",e=>s.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Ni.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),_.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&De(this.options_.tag)),ge&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ae(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){_.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}J(_,"TEST_VID",function(){var e,t;if(ve())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),_.isSupported=function(){try{_.TEST_VID.volume=.5}catch(e){return!1}return!(!_.TEST_VID||!_.TEST_VID.canPlayType)},_.canPlayType=function(e){return _.TEST_VID.canPlayType(e)},_.canPlaySource=function(e,t){return _.canPlayType(e.type)},_.canControlVolume=function(){try{const t=_.TEST_VID.volume;_.TEST_VID.volume=t/2+.1;var e=t!==_.TEST_VID.volume;return e&&c?(window.setTimeout(()=>{_&&_.prototype&&(_.prototype.featuresVolumeControl=t!==_.TEST_VID.volume)}),!1):e}catch(e){return!1}},_.canMuteVolume=function(){try{var e=_.TEST_VID.muted;return _.TEST_VID.muted=!e,_.TEST_VID.muted?Pe(_.TEST_VID,"muted","muted"):Oe(_.TEST_VID,"muted"),e!==_.TEST_VID.muted}catch(e){return!1}},_.canControlPlaybackRate=function(){if(ie&&oe&&de<58)return!1;try{var e=_.TEST_VID.playbackRate;return _.TEST_VID.playbackRate=e/2+.1,e!==_.TEST_VID.playbackRate}catch(e){return!1}},_.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},_.supportsNativeTextTracks=function(){return ye||c&&oe},_.supportsNativeVideoTracks=function(){return!(!_.TEST_VID||!_.TEST_VID.videoTracks)},_.supportsNativeAudioTracks=function(){return!(!_.TEST_VID||!_.TEST_VID.audioTracks)},_.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){J(_.prototype,e,()=>_[t](),!0)}),_.prototype.featuresVolumeControl=_.canControlVolume(),_.prototype.movingMediaElementInDOM=!c,_.prototype.featuresFullscreenResize=!0,_.prototype.featuresProgressEvents=!0,_.prototype.featuresTimeupdateEvents=!0,_.prototype.featuresVideoFrameCallback=!(!_.TEST_VID||!_.TEST_VID.requestVideoFrameCallback),_.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},_.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){_.prototype["set"+g(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){_.prototype["set"+g(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]()}}),y.withSourceHandlers(_),_.nativeSourceHandler={},_.nativeSourceHandler.canPlayType=function(e){try{return _.TEST_VID.canPlayType(e)}catch(e){return""}},_.nativeSourceHandler.canHandleSource=function(e,t){return e.type?_.nativeSourceHandler.canPlayType(e.type):e.src?(e=pi(e.src),_.nativeSourceHandler.canPlayType("video/"+e)):""},_.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},_.nativeSourceHandler.dispose=function(){},_.registerSourceHandler(_.nativeSourceHandler),y.registerTech("Html5",_);const xr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ir={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ar=["tiny","xsmall","small","medium","large","xlarge","huge"],Dr={},Lr=(Ar.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Dr[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class v extends f{constructor(e,t,i){if(e.id=e.id||t.id||"vjs_video_"+st++,(t=Object.assign(v.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(s=e.closest("[lang]"))&&(t.language=s.getAttribute("lang")),super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=j,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&De(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=v.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),It(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(dt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),i=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((i=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=i.documentElement).style.display="none",this.el_.appendChild(s),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ge&&this.addClass("vjs-touch-enabled"),c||this.addClass("vjs-workinghover"),v.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+i),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),p(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),p(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),v.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Bi[e.id()]=null,a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),De(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);ke(i,"video-js")||Ce(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",oe&&ce&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=tt("vjs-styles-dimensions"),n=$e(".vjs-styles-defaults"),(a=$e("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},bt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),u&&(u.push([].concat(s)),e=u.length-1e3,u.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>u?[].concat(u):[],o.history.filter=t=>(u||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{u&&(u.length=0)},o.history.disable=()=>{null!==u&&(u.length=0,u=null)},o.history.enable=()=>{null===u&&(u=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),$=l.createLogger,W=Object.prototype.toString;function G(t,i){z(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return z(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===W.call(e)&&e.constructor===Object}function d(...e){const i={};return e.forEach(e=>{e&&G(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function Q(e={}){var t,i=[];for(const s in e)e.hasOwnProperty(s)&&(t=e[s],i.push(t));return i}function J(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var Z=Object.freeze({__proto__:null,each:G,reduce:X,isObject:K,isPlain:Y,merge:d,values:Q,defineLazyProperty:J});let ee=!1,te=null,ie=!1,se,re=!1,ne=!1,ae=!1,oe=!1,le=null,de=null,he=null,ue=!1,ce=!1,pe=!1,me=!1;const ge=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var fe,e=window.navigator&&window.navigator.userAgentData;if(e&&(ie="Android"===e.platform,ne=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ae=Boolean(e.brands.find(e=>"Chromium"===e.brand)),oe=!ne&&ae,le=de=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ce="Windows"===e.platform),!ae){const R=window.navigator&&window.navigator.userAgent||"";ee=/iPod/i.test(R),te=(e=R.match(/OS (\d+)_/i))&&e[1]?e[1]:null,ie=/Android/i.test(R),se=(e=R.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ft=e[1]&&parseFloat(e[1]),fe=e[2]&&parseFloat(e[2]),ft&&fe?parseFloat(e[1]+"."+e[2]):ft||null):null,re=/Firefox/i.test(R),ne=/Edg/i.test(R),ae=/Chrome/i.test(R)||/CriOS/i.test(R),oe=!ne&&ae,le=de=(fe=R.match(/(Chrome|CriOS)\/(\d+)/))&&fe[2]?parseFloat(fe[2]):null,he=function(){var e=/MSIE\s(\d+)\.\d/.exec(R);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(R)&&/rv:11.0/.test(R)?11:t}(),ue=/Safari/i.test(R)&&!oe&&!ie&&!ne,ce=/Windows/i.test(R),pe=/iPad/i.test(R)||ue&&ge&&!/iPhone/i.test(R),me=/iPhone/i.test(R)&&!pe}const c=me||pe||ee,ye=(ue||c)&&!oe;e=Object.freeze({__proto__:null,get IS_IPOD(){return ee},get IOS_VERSION(){return te},get IS_ANDROID(){return ie},get ANDROID_VERSION(){return se},get IS_FIREFOX(){return re},get IS_EDGE(){return ne},get IS_CHROMIUM(){return ae},get IS_CHROME(){return oe},get CHROMIUM_VERSION(){return le},get CHROME_VERSION(){return de},get IE_VERSION(){return he},get IS_SAFARI(){return ue},get IS_WINDOWS(){return ce},get IS_IPAD(){return pe},get IS_IPHONE(){return me},TOUCH_ENABLED:ge,IS_IOS:c,IS_ANY_SAFARI:ye});function _e(e){return"string"==typeof e&&Boolean(e.trim())}function ve(){return document===window.document}function be(e){return K(e)&&1===e.nodeType}function Te(){try{return window.parent!==window.self}catch(e){return!0}}function Se(i){return function(e,t){return _e(e)?(t=be(t=_e(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function o(e="div",i={},t={},s){const r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?we(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&He(r,s),r}function we(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ee(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function xe(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ie(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Ae(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function De(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Ge(e,"height"))),i.width||(i.width=parseFloat(Ge(e,"width"))),i}}function Ue(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[j.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Be(t,e){var i={x:0,y:0};if(c){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Ge(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e=e.parentNode}}var n={},a=Ue(e.target),t=Ue(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,c)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function Fe(e){return K(e)&&3===e.nodeType}function je(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function qe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>be(e="function"==typeof e?e():e)||Fe(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return qe(e).forEach(e=>t.appendChild(e)),t}function Ve(e,t){return He(je(e),t)}function ze(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const $e=Se("querySelector"),We=Se("querySelectorAll");function Ge(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Xe(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var Ke=Object.freeze({__proto__:null,isReal:ve,isEl:be,isInFrame:Te,createEl:o,textContent:we,prependTo:Ee,hasClass:ke,addClass:Ce,removeClass:xe,toggleClass:Ie,setAttributes:Ae,getAttributes:De,getAttribute:Le,setAttribute:Pe,removeAttribute:Oe,blockTextSelection:Ne,unblockTextSelection:Re,getBoundingClientRect:Me,findPosition:Ue,getPointerPosition:Be,isTextNode:Fe,emptyEl:je,normalizeContent:qe,appendContent:He,insertContent:Ve,isSingleLeftClick:ze,$:$e,$$:We,computedStyle:Ge,copyStyleSheetsToWindow:Xe});let Ye=!1,Qe;function Je(){if(!1!==Qe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function gt(s,r,n,a=window){let o;function e(){const e=this,t=arguments;let i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ft=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:m,throttle:mt,debounce:gt});let yt;class _t{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},dt(this,e,t),this.addEventListener=i}off(e,t){p(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ut(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ct(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=at(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ht(this,e)}queueTrigger(e){yt=yt||new Map;const t=e.type||e;let i=yt.get(this);i||(i=new Map,yt.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,yt.delete(this)),this.trigger(e)},0));i.set(t,s)}}_t.prototype.allowedEvents_={},_t.prototype.addEventListener=_t.prototype.on,_t.prototype.removeEventListener=_t.prototype.off,_t.prototype.dispatchEvent=_t.prototype.trigger;const vt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),bt=t=>t instanceof _t||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),Tt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,St=(e,t,i)=>{if(!e||!e.nodeName&&!bt(e))throw new Error(`Invalid target for ${vt(t)}#${i}; must be a DOM node or evented object.`)},wt=(e,t,i)=>{if(!Tt(e))throw new Error(`Invalid event type for ${vt(t)}#${i}; must be a non-empty string or array.`)},Et=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${vt(t)}#${i}; must be a function.`)},kt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,St(r,e,i),wt(n,e,i),Et(a,e,i),a=m(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Ct=(e,t,i,s)=>{St(e,e,t),e.nodeName?pt[t](e,i,s):e[t](i,s)},xt={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"on");if(Ct(i,"on",s,r),!t){const n=()=>this.off(i,s,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,Ct(this,"on","dispose",n),Ct(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"one");if(t)Ct(i,"one",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"one",s,n)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"any");if(t)Ct(i,"any",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"any",s,n)}},off(e,t,i){!e||Tt(e)?p(this.eventBusEl_,e,t):(e=e,t=t,St(e,this,"off"),wt(t,this,"off"),Et(i,this,"off"),i=m(this,i),this.off("dispose",i),e.nodeName?(p(e,t,i),p(e,"dispose",i)):bt(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){St(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(Tt(i))return ht(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${vt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function It(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=o("span",{className:"vjs-event-bus"});Object.assign(e,xt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const At={state:{},setState(e){"function"==typeof e&&(e=e());let i;return G(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&bt(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Dt(e,t){Object.assign(e,At),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&bt(e)&&e.on("statechanged",e.handleStateChanged)}function Lt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function g(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Pt(e,t){return g(e)===g(t)}var Ot=Object.freeze({__proto__:null,toLowerCase:Lt,toTitleCase:g,titleCaseEquals:Pt}),Nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rt(e,t){return e(t={exports:{}},t.exports),t.exports}var r=Rt(function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),s[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var i=s[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in s)o[s[n]]=n;for(a in r)s[a]=r[a]});r.code,r.codes,r.aliases,r.names,r.title;class f{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+st++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(It(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Dt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return o(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,s[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=f.getComponent(e.opts.componentClass||g(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==r[t]?r[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=m(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=m(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=m(this,t),i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=f.getComponent("Tech"),i=i&&i.isTech(e),s=f===e||f.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=g(t),f.components_||(f.components_={});s=f.getComponent("Player");if("Player"===t&&s&&s.players){const r=s.players;i=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return f.components_[t]=e,f.components_[Lt(t)]=e}static getComponent(e){if(e&&f.components_)return f.components_[e]}}function Mt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function Bt(e,t){return Array.isArray(e)?Ut(e):void 0===e||void 0===t?Ut():Ut([[e,t]])}f.registerComponent("Component",f);function Ft(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:K(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Kt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Yt=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Kt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(Kt))},Qt=function(e,i){return e.forEach(function(e){const t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Kt;const Jt="vjs-modal-dialog";class Zt extends f{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=o("div",{className:Jt+"-content"},{role:"document"}),this.descEl_=o("p",{className:Jt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),we(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Jt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Ve(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),je(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),r.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(r.isEventKey(e,"Tab")){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}Zt.prototype.options_={pauseOnOpen:!0,temporary:!0},f.registerComponent("ModalDialog",Zt);class ei extends _t{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},bt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class ri{constructor(e){ri.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Ai(e,s){var t={uri:e};(e=ci(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),Ti(t,m(this,function(e,t,i){if(e)return l.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Ii(i,s);l.error("vttjs failed to load, stopping trying to process "+s.src)}):Ii(i,s)}))}class Di extends di{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:oi[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=li[e.mode]||"disabled";const i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new ri(this.cues_)),n=new ri(this.activeCues_);let a=!1;this.timeupdateHandler=m(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){li[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Ai(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e=i&&s.push(r)}if(a=!1,s.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=Oi.LOADED,this.trigger({type:"load",target:this})})}}Oi.prototype.allowedEvents_={load:"load"},Oi.NONE=0,Oi.LOADING=1,Oi.LOADED=2,Oi.ERROR=3;const Ni={audio:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){ti(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&ti(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ti(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Li,capitalName:"Audio"},video:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){ii(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,ii(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Pi,capitalName:"Video"},text:{ListClass:si,TrackClass:Di,capitalName:"Text"}},Ri=(Object.keys(Ni).forEach(function(e){Ni[e].getterName=e+"Tracks",Ni[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:si,TrackClass:Di,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;ethis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(m(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Ni.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Bt(0,0):Bt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ni.names.forEach(e=>{var t=Ni[e];const i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Y(Mi)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=st++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return y.canPlayType(e.type)}static isTech(e){return e.prototype instanceof y||e instanceof y||e===y}static registerTech(e,t){if(y.techs_||(y.techs_={}),!y.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!y.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(y.canPlaySource)return e=g(e),y.techs_[e]=t,y.techs_[Lt(e)]=t,"Tech"!==e&&y.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return y.techs_&&y.techs_[e]?y.techs_[e]:(e=g(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){const t=a[e];y.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),y.prototype.featuresVolumeControl=!0,y.prototype.featuresMuteControl=!0,y.prototype.featuresFullscreenResize=!1,y.prototype.featuresPlaybackRate=!1,y.prototype.featuresProgressEvents=!1,y.prototype.featuresSourceset=!1,y.prototype.featuresTimeupdateEvents=!1,y.prototype.featuresNativeTextTracks=!1,y.prototype.featuresVideoFrameCallback=!1,y.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction i(s={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)i(s,Ui[t],r,n,a,o);else if(t){const d=Wi(n,t);if(!d.setSource)return a.push(d),i(s,l,r,n,a,o);d.setSource(Object.assign({},s),function(e,t){if(e)return i(s,l,r,n,a,o);a.push(d),i(t,s.type===t.type?l:Ui[t.type],r,n,a,o)})}else l.length?i(s,l,r,n,a,o):o?r(s,a):i(s,Ui["*"],r,n,a,!0)}(t,Ui[t.type],i,e),1)}function qi(e,t,i,s=null){var r="call"+g(i),r=e.reduce($i(r),s),s=r===Fi,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}const Hi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Vi={setCurrentTime:1,setMuted:1,setVolume:1},zi={play:1,pause:1};function $i(i){return(e,t)=>e===Fi?Fi:t[i]?t[i](e):e}function Wi(e,t){var i=Bi[e.id()];let s=null;if(null==i)s=t(e),Bi[e.id()]=[[t,s]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=o(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=o("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,we(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}f.registerComponent("ClickableComponent",Ji);class Zi extends Ji{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return o("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(o("picture",{className:"vjs-poster",tabIndex:-1},{},o("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xt(this.player_.play()):this.player_.pause())}}Zi.prototype.crossorigin=Zi.prototype.crossOrigin,f.registerComponent("PosterImage",Zi);const es={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function ts(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function is(e,t,i){try{e.style[t]=i}catch(e){}}function ss(e){return e?e+"px":""}class rs extends f{constructor(s,e,t){super(s,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(m(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);const e=window.screen.orientation||window,i=window.screen.orientation?"change":"orientationchange";e.addEventListener(i,r),s.on("dispose",()=>e.removeEventListener(i,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)Xt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const i=e&&e.getChild("playToggle");i?(e=()=>i.focus(),Gt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}as.prototype.controlText_="Play Video",f.registerComponent("BigPlayButton",as);s;f.registerComponent("CloseButton",class extends s{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){r.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class os extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Xt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}os.prototype.controlText_="Play",f.registerComponent("PlayToggle",os);class ls extends f{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=o("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=o("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Vt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}ls.prototype.labelText_="Time",ls.prototype.controlText_="Time",f.registerComponent("TimeDisplay",ls);class ds extends ls{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ds.prototype.labelText_="Current Time",ds.prototype.controlText_="Current Time",f.registerComponent("CurrentTimeDisplay",ds);class hs extends ls{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}hs.prototype.labelText_="Duration",hs.prototype.controlText_="Duration",f.registerComponent("DurationDisplay",hs);class us extends f{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}f.registerComponent("TimeDivider",us);class cs extends ls{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(o("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}cs.prototype.labelText_="Remaining Time",cs.prototype.controlText_="Remaining Time",f.registerComponent("RemainingTimeDisplay",cs);class ps extends f{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=o("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(o("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}f.registerComponent("LiveDisplay",ps);class ms extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=o("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function gs(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}ms.prototype.controlText_="Seek to live, currently playing live",f.registerComponent("SeekToLive",ms);Nt=Object.freeze({__proto__:null,clamp:gs});class fs extends f{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||oe||e.preventDefault(),Ne(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Re(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(gs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Be(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r.isEventKey(e,"Right")||r.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}f.registerComponent("Slider",fs);const ys=(e,t)=>gs(e/t*100,0,100).toFixed(2)+"%";class _s extends f{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=o("span",{className:"vjs-control-text"}),i=o("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=o("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=ys(s,e);this.percent_!==e&&(this.el_.style.width=e,we(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}f.registerComponent("LoadProgressBar",_s);class vs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,i,s){var r=Ue(this.el_),n=Me(this.player_.el()),i=t.width*i;if(n&&r){var a=t.left-n.left+i,i=t.width-i+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(s)}}write(e){we(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Vt(i,t):Vt(a,s),this.update(r,n,e),o&&o()})}}f.registerComponent("TimeTooltip",vs);class bs extends f{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}bs.prototype.options_={children:[]},c||ie||bs.prototype.options_.children.push("timeTooltip"),f.registerComponent("PlayProgressBar",bs);class Ts extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}Ts.prototype.options_={children:["timeTooltip"]},f.registerComponent("MouseTimeDisplay",Ts);class Ss extends fs{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=m(this,this.update),this.update=mt(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Vt(e,i),Vt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(Me(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ze(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(ze(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):r.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):r.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(r(e))?(e.preventDefault(),e.stopPropagation(),t=10*(r.codes[r(e)]-r.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):r.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):r.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ss.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},c||ie||Ss.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),f.registerComponent("SeekBar",Ss);class ws extends f{constructor(e,t){super(e,t),this.handleMouseMove=mt(m(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=mt(m(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=Ue(r=n.el()),r=gs(r=Be(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Xt(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}ws.prototype.options_={children:["seekBar"]},f.registerComponent("ProgressControl",ws);class Es extends s{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Es.prototype.controlText_="Picture-in-Picture",f.registerComponent("PictureInPictureToggle",Es);class ks extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ks.prototype.controlText_="Fullscreen",f.registerComponent("FullscreenToggle",ks);class Cs extends f{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}f.registerComponent("VolumeLevel",Cs);class xs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=Me(this.el_),r=Me(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){we(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}f.registerComponent("VolumeLevelTooltip",xs);class Is extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}Is.prototype.options_={children:["volumeLevelTooltip"]},f.registerComponent("MouseVolumeLevelDisplay",Is);class As extends fs{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ze(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Me(s=this.el()),i=this.vertical(),s=Be(s,e),s=gs(s=i?s.y:s.x,0,1),r.update(t,s,i)),ze(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}As.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},c||ie||As.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),As.prototype.playerEvent="volumechange",f.registerComponent("VolumeBar",As);class Ds extends f{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Y(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=mt(m(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Ds.prototype.options_={children:["volumeBar"]},f.registerComponent("VolumeControl",Ds);class Ls extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),c&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),xe(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Ls.prototype.controlText_="Mute",f.registerComponent("MuteToggle",Ls);class Ps extends f{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Y(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){r.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),dt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){r.isEventKey(e,"Esc")&&this.handleMouseOut()}}Ps.prototype.options_={children:["muteToggle","volumeControl"]},f.registerComponent("VolumePanel",Ps);s;f.registerComponent("SkipForward",class extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class Os extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Os.prototype.controlText_="Skip Backward",f.registerComponent("SkipBackward",Os);class Ns extends f{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof f&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof f&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=o(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),dt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(r.isEventKey(e,"Right")||r.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}f.registerComponent("Menu",Ns);class Rs extends f{constructor(e,t={}){super(e,t),this.menuButton_=new s(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=s.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),dt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new Ns(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=o("li",{className:"vjs-menu-title",textContent:g(this.options_.title),tabIndex:-1}),e=new f(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;er.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}f.registerComponent("MenuItem",Bs);class Fs extends Bs{constructor(e,t){var i=t.track;const s=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(g(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Js.prototype.contentElType="button",f.registerComponent("PlaybackRateMenuItem",Js);class Zs extends Rs{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=o("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new Js(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}ir.prototype.options_=Object.assign({},Zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),f.registerComponent("ErrorDisplay",ir);const sr="vjs-text-track-settings";var rr=["#000","Black"],nr=["#00F","Blue"],ar=["#0FF","Cyan"],or=["#0F0","Green"],t=["#F0F","Magenta"],lr=["#F00","Red"],dr=["#FFF","White"],n=["#FF0","Yellow"],hr=["1","Opaque"],ur=["0.5","Semi-Transparent"],cr=["0","Transparent"];const pr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rr,dr,lr,or,nr,n,t,ar]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[hr,ur,cr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[dr,rr,lr,or,nr,n,t,ar]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[hr,ur]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[cr,ur,hr]}};function mr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}pr.windowColor.options=pr.backgroundColor.options;class gr extends Zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=o("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),G(pr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){e=pr[e];const s=e.id.replace("%s",this.id_),r=[t,s].join(" ").trim();return[`<${i} id="${s}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return o("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return o("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return o("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(pr,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=mr(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){G(pr,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(sr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(sr,JSON.stringify(e)):window.localStorage.removeItem(sr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}f.registerComponent("TextTrackSettings",gr);class fr extends f{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=gt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){p(this,"resize",t),p(this,"unload",e),e=null};dt(this.el_.contentWindow,"unload",e),dt(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}f.registerComponent("ResizeManager",fr);const yr={trackingThreshold:20,liveTolerance:15};class _r extends f{constructor(e,t){super(e,d(yr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:o("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+st++}),description:o("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+st++})},o("div",{className:"vjs-title-bar"},{},Q(this.els))}updateDom_(){var e=this.player_.tech_;const s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];je(i),t&&we(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}f.registerComponent("TitleBar",vr);function br(i){const s=i.el();if(!s.resetSourceWatch_){const t={},e=kr(i),r=t=>(...e)=>{e=t.apply(s,e);return Sr(i),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{s[e]&&(t[e]=s[e],s[e]=r(t[e]))}),Object.defineProperty(s,"innerHTML",d(e,{set:r(e.set)})),s.resetSourceWatch_=()=>{s.resetSourceWatch_=null,Object.keys(t).forEach(e=>{s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},i.one("sourceset",s.resetSourceWatch_)}}function Tr(i){if(i.featuresSourceset){const s=i.el();if(!s.resetSourceset_){e=i;const t=Er([e.el(),window.HTMLMediaElement.prototype,Cr],"src");var e;const r=s.setAttribute,n=s.load;Object.defineProperty(s,"src",d(t,{set:e=>{e=t.set.call(s,e);return i.triggerSourceset(s.src),e}})),s.setAttribute=(e,t)=>{t=r.call(s,e,t);return/src/i.test(e)&&i.triggerSourceset(s.src),t},s.load=()=>{var e=n.call(s);return Sr(i)||(i.triggerSourceset(""),br(i)),e},s.currentSrc?i.triggerSourceset(s.currentSrc):Sr(i)||br(i),s.resetSourceset_=()=>{s.resetSourceset_=null,s.load=n,s.setAttribute=r,Object.defineProperty(s,"src",t),s.resetSourceWatch_&&s.resetSourceWatch_()}}}}const Sr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;eEr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,wr],"innerHTML"),Cr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ui(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class _ extends y{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!ci(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var e=Ni[i];const s=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&s&&s.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===i&&this[Ri.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{const i=n[t];s.addEventListener(t,i),this.on("dispose",e=>s.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Ni.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),_.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&De(this.options_.tag)),ge&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ae(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){_.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}J(_,"TEST_VID",function(){var e,t;if(ve())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),_.isSupported=function(){try{_.TEST_VID.volume=.5}catch(e){return!1}return!(!_.TEST_VID||!_.TEST_VID.canPlayType)},_.canPlayType=function(e){return _.TEST_VID.canPlayType(e)},_.canPlaySource=function(e,t){return _.canPlayType(e.type)},_.canControlVolume=function(){try{const t=_.TEST_VID.volume;_.TEST_VID.volume=t/2+.1;var e=t!==_.TEST_VID.volume;return e&&c?(window.setTimeout(()=>{_&&_.prototype&&(_.prototype.featuresVolumeControl=t!==_.TEST_VID.volume)}),!1):e}catch(e){return!1}},_.canMuteVolume=function(){try{var e=_.TEST_VID.muted;return _.TEST_VID.muted=!e,_.TEST_VID.muted?Pe(_.TEST_VID,"muted","muted"):Oe(_.TEST_VID,"muted"),e!==_.TEST_VID.muted}catch(e){return!1}},_.canControlPlaybackRate=function(){if(ie&&oe&&de<58)return!1;try{var e=_.TEST_VID.playbackRate;return _.TEST_VID.playbackRate=e/2+.1,e!==_.TEST_VID.playbackRate}catch(e){return!1}},_.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},_.supportsNativeTextTracks=function(){return ye||c&&oe},_.supportsNativeVideoTracks=function(){return!(!_.TEST_VID||!_.TEST_VID.videoTracks)},_.supportsNativeAudioTracks=function(){return!(!_.TEST_VID||!_.TEST_VID.audioTracks)},_.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){J(_.prototype,e,()=>_[t](),!0)}),_.prototype.featuresVolumeControl=_.canControlVolume(),_.prototype.movingMediaElementInDOM=!c,_.prototype.featuresFullscreenResize=!0,_.prototype.featuresProgressEvents=!0,_.prototype.featuresTimeupdateEvents=!0,_.prototype.featuresVideoFrameCallback=!(!_.TEST_VID||!_.TEST_VID.requestVideoFrameCallback),_.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},_.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){_.prototype["set"+g(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){_.prototype["set"+g(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){_.prototype[e]=function(){return this.el_[e]()}}),y.withSourceHandlers(_),_.nativeSourceHandler={},_.nativeSourceHandler.canPlayType=function(e){try{return _.TEST_VID.canPlayType(e)}catch(e){return""}},_.nativeSourceHandler.canHandleSource=function(e,t){return e.type?_.nativeSourceHandler.canPlayType(e.type):e.src?(e=pi(e.src),_.nativeSourceHandler.canPlayType("video/"+e)):""},_.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},_.nativeSourceHandler.dispose=function(){},_.registerSourceHandler(_.nativeSourceHandler),y.registerTech("Html5",_);const xr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ir={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ar=["tiny","xsmall","small","medium","large","xlarge","huge"],Dr={},Lr=(Ar.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Dr[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class v extends f{constructor(e,t,i){if(e.id=e.id||t.id||"vjs_video_"+st++,(t=Object.assign(v.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(s=e.closest("[lang]"))&&(t.language=s.getAttribute("lang")),super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=j,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&De(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=v.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),It(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(dt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),i=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((i=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=i.documentElement).style.display="none",this.el_.appendChild(s),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ge&&this.addClass("vjs-touch-enabled"),c||this.addClass("vjs-workinghover"),v.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+i),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),p(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),p(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),v.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,Bi[e.id()]=null,a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),De(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);ke(i,"video-js")||Ce(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",oe&&ce&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=tt("vjs-styles-dimensions"),n=$e(".vjs-styles-defaults"),(a=$e("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},bt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(Ir).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Ir[t]}_`].bind(this),event:e}):this[`handleTech${Ir[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Yt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Gt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Gt(e=this.play())&&(e=e.catch(i)),Gt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Xt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Xt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(ye||c);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Bt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Xt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,dt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){r.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,p(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,xe(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(o("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Xe(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_["userActions"];s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>r.isEventKey(e,"f"),muteKey:i=e=>r.isEventKey(e,"m"),playPauseKey:s=e=>r.isEventKey(e,"k")||r.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=f.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),f.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),f.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,y.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Gi(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),ji(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},i=()=>{this.off("error",t)};this.one("error",t),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",i)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Pt(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Xt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),bt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);K(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,i,s;const r=m(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||c||ie||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),bt(this))&&this.trigger("languagechange")}languages(){return d(v.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ki(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},s=De(e),r=s["data-setup"];if(ke(e,"vjs-fill")&&(s.fill=!0),ke(e,"vjs-fluid")&&(s.fluid=!0),null!==r&&([r,t]=Wt(r||"{}"),r&&l.error(r),Object.assign(s,t)),Object.assign(i,s),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){const t=a[e];v.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),v.prototype.crossorigin=v.prototype.crossOrigin,v.players={};dr=window.navigator;v.prototype.options_={techOrder:y.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:dr&&(dr.languages&&dr.languages[0]||dr.userLanguage||dr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){v.prototype[e]=function(){return this.techGet_(e)}}),xr.forEach(function(e){v.prototype[`handleTech${g(e)}_`]=function(){return this.trigger(e)}}),f.registerComponent("Player",v);function Pr(t,i){function s(){Fr(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return Br(this,t),Fr(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}const Or="plugin",Nr="activePlugins_",Rr={},Mr=e=>Rr.hasOwnProperty(e),Ur=e=>Mr(e)?Rr[e]:void 0,Br=(e,t)=>{e[Nr]=e[Nr]||{},e[Nr][t]=!0},Fr=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},jr=(i,s)=>(s.prototype.name=i,function(...e){Fr(this,{name:i,plugin:s,instance:null},!0);const t=new s(this,...e);return this[i]=()=>t,Fr(this,t.getEventHash()),t});class qr{constructor(e){if(this.constructor===qr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),It(this),delete this.trigger,Dt(this,this.constructor.defaultState),Br(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ht(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Nr][e]=!1,this.player=this.state=null,t[e]=jr(e,Rr[e])}static isBasic(e){e="string"==typeof e?Ur(e):e;return"function"==typeof e&&!qr.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Mr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(v.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Rr[e]=t,e!==Or&&(qr.isBasic(t)?v.prototype[e]=Pr(e,t):v.prototype[e]=jr(e,t)),t}static deregisterPlugin(e){if(e===Or)throw new Error("Cannot de-register base plugin.");Mr(e)&&(delete Rr[e],delete v.prototype[e])}static getPlugins(e=Object.keys(Rr)){let i;return e.forEach(e=>{var t=Ur(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=Ur(e);return e&&e.VERSION||""}}function Hr(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}qr.getPlugin=Ur,qr.BASE_PLUGIN_NAME=Or,qr.registerPlugin(Or,qr),v.prototype.usingPlugin=function(e){return!!this[Nr]&&!0===this[Nr][e]},v.prototype.hasPlugin=function(e){return!!Mr(e)};const Vr=e=>0===e.indexOf("#")?e.slice(1):e;function b(e,t,i){let s=b.getPlayer(e);if(s)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i);else{const r="string"==typeof e?$e("#"+Vr(e)):e;if(!be(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,d(t));!K(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=d(t,e)}),f.getComponent("Player"));s=new e(r,t,i),B("setup").forEach(e=>e(s))}return s}b.hooks_=U,b.hooks=B,b.hook=function(e,t){B(e,t)},b.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{const i=(...e)=>(F(s,i),t(...e));return i}))},b.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ve()&&!(rr=$e(".vjs-styles-defaults"))&&(rr=tt("vjs-styles-defaults"),(lr=$e("head"))&&lr.insertBefore(rr,lr.firstChild),it(rr,` + `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=g(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(y.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};a.names.forEach(e=>{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(Ir).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Ir[t]}_`].bind(this),event:e}):this[`handleTech${Ir[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Yt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Gt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Gt(e=this.play())&&(e=e.catch(i)),Gt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Xt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Xt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(ye||c);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Bt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Xt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,dt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){r.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,p(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,xe(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(o("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Xe(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_["userActions"];s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>r.isEventKey(e,"f"),muteKey:i=e=>r.isEventKey(e,"m"),playPauseKey:s=e=>r.isEventKey(e,"k")||r.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=f.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),f.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),f.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,y.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Gi(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),ji(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},i=()=>{this.off("error",t)};this.one("error",t),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",i)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Pt(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Xt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),bt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);K(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,i,s;const r=m(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||c||ie||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),bt(this))&&this.trigger("languagechange")}languages(){return d(v.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ki(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},s=De(e),r=s["data-setup"];if(ke(e,"vjs-fill")&&(s.fill=!0),ke(e,"vjs-fluid")&&(s.fluid=!0),null!==r&&([r,t]=Wt(r||"{}"),r&&l.error(r),Object.assign(s,t)),Object.assign(i,s),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){const t=a[e];v.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),v.prototype.crossorigin=v.prototype.crossOrigin,v.players={};dr=window.navigator;v.prototype.options_={techOrder:y.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:dr&&(dr.languages&&dr.languages[0]||dr.userLanguage||dr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){v.prototype[e]=function(){return this.techGet_(e)}}),xr.forEach(function(e){v.prototype[`handleTech${g(e)}_`]=function(){return this.trigger(e)}}),f.registerComponent("Player",v);function Pr(t,i){function s(){Fr(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return Br(this,t),Fr(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}const Or="plugin",Nr="activePlugins_",Rr={},Mr=e=>Rr.hasOwnProperty(e),Ur=e=>Mr(e)?Rr[e]:void 0,Br=(e,t)=>{e[Nr]=e[Nr]||{},e[Nr][t]=!0},Fr=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},jr=(i,s)=>(s.prototype.name=i,function(...e){Fr(this,{name:i,plugin:s,instance:null},!0);const t=new s(this,...e);return this[i]=()=>t,Fr(this,t.getEventHash()),t});class qr{constructor(e){if(this.constructor===qr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),It(this),delete this.trigger,Dt(this,this.constructor.defaultState),Br(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ht(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Nr][e]=!1,this.player=this.state=null,t[e]=jr(e,Rr[e])}static isBasic(e){e="string"==typeof e?Ur(e):e;return"function"==typeof e&&!qr.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Mr(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(v.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Rr[e]=t,e!==Or&&(qr.isBasic(t)?v.prototype[e]=Pr(e,t):v.prototype[e]=jr(e,t)),t}static deregisterPlugin(e){if(e===Or)throw new Error("Cannot de-register base plugin.");Mr(e)&&(delete Rr[e],delete v.prototype[e])}static getPlugins(e=Object.keys(Rr)){let i;return e.forEach(e=>{var t=Ur(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=Ur(e);return e&&e.VERSION||""}}function Hr(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}qr.getPlugin=Ur,qr.BASE_PLUGIN_NAME=Or,qr.registerPlugin(Or,qr),v.prototype.usingPlugin=function(e){return!!this[Nr]&&!0===this[Nr][e]},v.prototype.hasPlugin=function(e){return!!Mr(e)};const Vr=e=>0===e.indexOf("#")?e.slice(1):e;function b(e,t,i){let s=b.getPlayer(e);if(s)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i);else{const r="string"==typeof e?$e("#"+Vr(e)):e;if(!be(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,d(t));!K(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=d(t,e)}),f.getComponent("Player"));s=new e(r,t,i),B("setup").forEach(e=>e(s))}return s}b.hooks_=U,b.hooks=B,b.hook=function(e,t){B(e,t)},b.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{const i=(...e)=>(F(s,i),t(...e));return i}))},b.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ve()&&!(rr=$e(".vjs-styles-defaults"))&&(rr=tt("vjs-styles-defaults"),(lr=$e("head"))&&lr.insertBefore(rr,lr.firstChild),it(rr,` .video-js { width: 300px; height: 150px; @@ -33,9 +33,9 @@ e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e /*! @name m3u8-parser @version 7.1.0 @license Apache-2.0 */class Gr extends or{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;ee),this.customParsers.push(e=>{if(t.exec(e))return this.trigger("data",{type:"custom",data:s(e),customType:i,segment:r}),!0})}addTagMapper({expression:t,map:i}){this.tagMappers.push(e=>t.test(e)?i(e):e)}}function Jr(t){const i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=t[e]}),i}function Zr(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]{a.uri||!a.parts&&!a.preloadHints||(!a.map&&r&&(a.map=r),!a.key&&o&&(a.key=o),a.timeline||"number"!=typeof h||(a.timeline=h),this.manifest.preloadSegment=a)}),this.parseStream.on("data",function(n){let t,i;({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in n&&((a.byterange=e).length=n.length,"offset"in n||(n.offset=u)),"offset"in n&&((a.byterange=e).offset=n.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),n.title&&(a.title=n.title),0(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,Zr.call(this,this.manifest))},start(){!n.attributes||isNaN(n.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out"(){a.cueOut=n.data},"cue-out-cont"(){a.cueOutCont=n.data},"cue-in"(){a.cueIn=n.data},skip(){this.manifest.skip=Jr(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;var e=this.manifest.segments.length,t=Jr(n.attributes),t=(a.parts=a.parts||[],a.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=c),c=t.byterange.offset+t.byterange.length),a.parts.length-1);this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){var e=this.manifest.serverControl=Jr(n.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Zr.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){var t=this.manifest.segments.length,i=Jr(n.attributes),e=i.type&&"PART"===i.type,s=(a.preloadHints=a.preloadHints||[],a.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e?c:0,e&&(c=i.byterange.offset+i.byterange.length)),a.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #`+t,n.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===t.id);this.manifest.dateRanges[e]=yi(this.manifest.dateRanges[e],t),p[t.id]=yi(p[t.id],t),this.manifest.dateRanges.pop()}else p[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=Jr(n.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",n.attributes,["SERVER-URI"])}}[n.tagType]||function(){}).call(e)},uri(){a.uri=n.uri,s.push(a),!this.manifest.targetDuration||"duration"in a||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),o&&(a.key=o),a.timeline=h,r&&(a.map=r),c=0,null!==this.lastProgramDateTime&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*a.duration),a={}},comment(){},custom(){n.segment?(a.custom=a.custom||{},a.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(e)})}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach(function(e){t.hasOwnProperty(e)||s.push(e)}),s.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+s.join(", ")})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}function tn(e){return dn.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function sn(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(mn(e))||!1}function rn(e){return(e=void 0===e?"":e).toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t=e.length&&t.call(e,function(e,t){return e===(n[t]?n[t]&i[r+t]:i[r+t])})},Tn="http://example.com";function Sn(e){e=e;for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),s=0;s"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function zn(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(zn(e,t))return 1}while(e=e.nextSibling)}function $n(){this.ownerDocument=this}function Wn(e,t,i){e&&e._inc++,i.namespaceURI===In.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Gn(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function Xn(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Gn(e.ownerDocument,e),t}function Kn(e){return e&&e.nodeType===x.DOCUMENT_TYPE_NODE}function Yn(e){return e&&e.nodeType===x.ELEMENT_NODE}function Qn(e){return e&&e.nodeType===x.TEXT_NODE}function Jn(e,t){var i,e=e.childNodes||[];if(!xn(e,Yn)&&!Kn(t))return i=xn(e,Kn),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Zn(e,t){var i,e=e.childNodes||[];if(!xn(e,function(e){return Yn(e)&&e!==t}))return i=xn(e,Kn),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function ea(e,t,i){if(!(s=e)||s.nodeType!==x.DOCUMENT_NODE&&s.nodeType!==x.DOCUMENT_FRAGMENT_NODE&&s.nodeType!==x.ELEMENT_NODE)throw new C(On,"Unexpected parent node type "+e.nodeType);var s;if(i&&i.parentNode!==e)throw new C(Nn,"child not in parent");if(!(s=t)||!(Yn(s)||Qn(s)||Kn(s)||s.nodeType===x.DOCUMENT_FRAGMENT_NODE||s.nodeType===x.COMMENT_NODE||s.nodeType===x.PROCESSING_INSTRUCTION_NODE)||Kn(t)&&e.nodeType!==x.DOCUMENT_NODE)throw new C(On,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function ta(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===x.DOCUMENT_FRAGMENT_NODE){var n=r.filter(Yn);if(1"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):ba(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)ba(o,t,i,s,r.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case 9:case 11:for(o=e.firstChild;o;)ba(o,t,i,s,r.slice()),o=o.nextSibling;return;case 2:return va(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,Vn));case 4:return t.push("");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ta(e,t,i){e[t]=i}t.INVALID_STATE_ERR=(k[11]="Invalid state",11),t.SYNTAX_ERR=(k[12]="Syntax error",12),t.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),t.NAMESPACE_ERR=(k[14]="Invalid namespace",14),t.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),C.prototype=Error.prototype,Pn(t,C),Rn.prototype={length:0,item:function(e){return 0<=e&&e",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES}),wa=(Sa.XML_ENTITIES,Sa.HTML_ENTITIES,Sa.entityMap,Cn.NAMESPACE),cr=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ur=new RegExp("[\\-\\.0-9"+cr.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ea=new RegExp("^"+cr.source+ur.source+"*(?::"+cr.source+ur.source+"*)?$"),ka=0,Ca=1,xa=2,Ia=3,Aa=4,Da=5,La=6,Pa=7;function Oa(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Oa)}function Na(){}function Ra(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Ma(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value,o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&"");a.localName=u,!1!==o&&(null==r&&(r={},Ua(i,i={})),i[o]=r[o]=l,a.uri=wa.XMLNS,t.startPrefixMapping(o,l))}for(var d,n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=wa.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function Ua(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Ba(){this.attributeNames={}}(Oa.prototype=new Error).name=Oa.name,Na.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Ua(t,t={}),function(i,e,s,r,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(s,t)?s[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function t(e){var t;m",y+3),v=i.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=i.substring(y+2).replace(/[\s<].*/,""),n.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s",t);if(s){e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e)return e[0].length,i.processingInstruction(e[1],e[2]),s+2}return-1}(i,y,r);break;case"!":u&&o(y),_=function(e,t,i,s){{if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4),t",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),n=s.length;if(1":switch(d){case ka:s.setTagName(e.slice(t,l));case Da:case La:case Pa:break;case Aa:case Ca:"/"===(u=e.slice(t,l)).slice(-1)&&(s.closed=!0,u=u.slice(0,-1));case xa:d===xa&&(u=o),d==Aa?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(wa.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case Ia:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(d){case ka:s.setTagName(e.slice(t,l)),d=La;break;case Ca:o=e.slice(t,l),d=xa;break;case Aa:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case Da:d=La}else switch(d){case xa:s.tagName,wa.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=Ca;break;case Da:n.warning('attribute space is required"'+o+'"!!');case La:d=Ca,t=l;break;case Ia:d=Aa,t=l;break;case Pa:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(i,y,E,k,a,n),C=E.length;if(!E.closed&&function(e,t,i,s){var r=s[i];null==r&&((r=e.lastIndexOf(""))",t),e=e.substring(t+1,n);if(/[&<]/.test(e))return/^script$/i.test(i)?r.characters(e,0,e.length):(e=e.replace(/&#?\w+;/g,s),r.characters(e,0,e.length)),n}return t+1}(i,_,E.tagName,a,r):_++}}catch(e){if(e instanceof Oa)throw e;n.error("element parse error: "+e),_=-1}m<_?m=_:t(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},Ba.prototype={setTagName:function(e){if(!Ea.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ea.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var hr={XMLReader:Na,ParseError:Oa},Fa=ar.DOMImplementation,ja=Cn.NAMESPACE,qa=hr.ParseError,Ha=hr.XMLReader;function Va(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function za(e){this.options=e||{locator:{}}}function $a(){this.cdata=!1}function Wa(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ga(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Xa(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function Ka(e,t){(e.currentElement||e.doc).appendChild(t)}za.prototype.parseFromString=function(e,t){var i=this.options,s=new Ha,r=i.domBuilder||new $a,n=i.errorHandler,a=i.locator,o=i.xmlns||{},t=/\/x?html?$/.test(t),l=t?Sa.HTML_ENTITIES:Sa.XML_ENTITIES,n=(a&&r.setDocumentLocator(a),s.errorHandler=function(s,e,r){if(!s){if(e instanceof $a)return e;s=e}var n={},a=s instanceof Function;function t(t){var i=s[t];!i&&a&&(i=2==s.length?function(e){s(t,e)}:s),n[t]=i?function(e){i("[xmldom "+t+"]\t"+e+Ga(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),n}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=ja.HTML),o.xml=o.xml||ja.XML,i.normalizeLineEndings||Va);return e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},$a.prototype={startDocument:function(){this.doc=(new Fa).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;Ka(this,n),this.currentElement=n,this.locator&&Wa(this.locator,n);for(var o=0;o!!e&&"object"==typeof e,I=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):Qa(t[e])&&Qa(i[e])?t[e]=I(t[e],i[e]):t[e]=i[e]}),t),{}),Ja=t=>Object.keys(t).map(e=>t[e]),Za=e=>e.reduce((e,t)=>e.concat(t),[]),eo=t=>{if(!t.length)return[];var i=[];for(let e=0;e{s={uri:r,resolvedUri:ln(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),ro={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=so(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=so(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},no=e=>{var n,{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:a}=e,{start:o,end:l}=ro[t](e),o=((t,i)=>{var s=[];for(let e=t;e{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}}));return"static"===t&&(o[l=o.length-1].duration=("number"==typeof r?r:a)-i/s*l),o},ao=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=io({baseUrl:t,source:i.sourceURL,range:i.range}),(t=io({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=no(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(to.NO_BASE_URL)},oo=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;t{return e=e,i=({timeline:e})=>e,Ja(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{})).sort((e,t)=>e.timeline>t.timeline?1:-1);var i},uo=e=>{let r=[];var n,a;return n=e,e=lo,a=(e,t,i,s)=>{r=r.concat(e.playlists||[])},e.forEach(function(e){for(var t in n.mediaGroups[e])for(var i in n.mediaGroups[e][t]){var s=n.mediaGroups[e][t][i];a(s,e,t,i)}}),r},co=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},po=({oldManifest:e,newManifest:t})=>{var r,n,i=e.playlists.concat(uo(e)),s=t.playlists.concat(uo(t));return t.timelineStarts=ho([e.timelineStarts,t.timelineStarts]),{oldPlaylists:r,newPlaylists:e,timelineStarts:n}=[{oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}][0],e.forEach(t=>{t.discontinuitySequence=n.findIndex(function({timeline:e}){return e===t.timeline});var e=((t,i)=>{for(let e=0;ee.timeline||e.segments.length&&t.timeline>e.segments[e.segments.length-1].timeline)&&t.discontinuitySequence--):(e.segments[i].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),co({playlist:t,mediaSequence:e.segments[i].number}))}}),t},mo=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t})(e.byterange),go=e=>{e=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{});let t=[];return Object.values(e).forEach(e=>{e=Ja(e.reduce((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));t=t.concat(e)}),t.map(e=>{var t,s;return e.discontinuityStarts=(t=e.segments||[],s="discontinuity",t.reduce((e,t,i)=>(t[s]&&e.push(i),e),[])),e})},fo=(e,t)=>{var i=mo(e.sidx),t=i&&t[i]&&t[i].sidx;return t&&oo(e,t,e.sidx.resolvedUri),e},yo=(e,o={})=>e.reduce((e,t)=>{var i,s,r,n,a=t.attributes.label||t.attributes.lang||"text";return e[a]||(e[a]={language:a,default:!1,autoselect:!1,playlists:[],uri:""}),e[a].playlists.push(fo(({attributes:a,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r}=[t][0],"undefined"==typeof t&&(t=[{uri:a.baseUrl,timeline:a.periodStart,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}],a.duration=a.sourceDuration),n={NAME:a.id,BANDWIDTH:a.bandwidth,"PROGRAM-ID":1},a.codecs&&(n.CODECS=a.codecs),n={attributes:n,uri:"",endList:"static"===a.type,timeline:a.periodStart,resolvedUri:a.baseUrl||"",targetDuration:a.duration,timelineStarts:a.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t},a.serviceLocation&&(n.attributes.serviceLocation=a.serviceLocation),n),o)),e},{}),_o=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},vo=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,bo=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,To=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,So=i=>i?Object.keys(i).reduce((e,t)=>{t=i[t];return e.concat(t.playlists)},[]):[],wo=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a,o,l,d,h,u,c,p;return e.length?({sourceDuration:d,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=e[0].attributes,a=go(e.filter(vo)).map(_o),o=go(e.filter(bo)),l=go(e.filter(To)),e=e.map(e=>e.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:d,playlists:((e,t={})=>{if(Object.keys(t).length)for(const i in e)e[i]=fo(e[i],t);return e})(a,s)},0<=h&&(d.minimumUpdatePeriod=1e3*h),t&&(d.locations=t),i&&(d.contentSteering=i),"dynamic"===u&&(d.suggestedPresentationDelay=c),n&&0{let o;e=e.reduce((e,t)=>{var i=t.attributes.role&&t.attributes.role.value||"",s=t.attributes.lang||"";let r=t.attributes.label||"main";e[r=s&&!t.attributes.label?t.attributes.lang+(i?` (${i})`:""):r]||(e[r]={language:s,autoselect:!0,default:"main"===i,playlists:[],uri:""});s=fo((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r})(t,a),n);return e[r].playlists.push(s),"undefined"==typeof o&&"main"===i&&((o=t).default=!0),e},{});return o||(e[Object.keys(e)[0]].default=!0),e})(o,s,h):null,i=l.length?yo(l,s):null,c=(u=a.concat(So(t),So(i))).map(({timelineStarts:e})=>e),d.timelineStarts=ho(c),p=d.timelineStarts,u.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=p.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((e,t)=>{e.number=t})}),t&&(d.mediaGroups.AUDIO.audio=t),i&&(d.mediaGroups.SUBTITLES.subs=i),e.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=e.reduce((s,e)=>(e&&e.forEach(e=>{var{channel:t,language:i}=e;s[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(s[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(s[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(s[i]["3D"]=e["3D"])}),s),{})),r?po({oldManifest:r,newManifest:d}):d):{}},Eo=(s,r)=>{var{type:n,minimumUpdatePeriod:a=0,media:o="",sourceDuration:l,timescale:d=1,startNumber:h=1,periodStart:u}=s,c=[];let p=-1;for(let i=0;ip&&(p=m);let e;e=f<0?(m=i+1)===r.length?"dynamic"===n&&0{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)})(s,p,g):(l*d-p)/g:(r[m].t-p)/g:f+1;var y=h+c.length+e;let t=h+c.length;for(;t{return e.replace(ko,(r=t,(e,t,i,s)=>{return"$$"===e?"$":"undefined"==typeof r[t]?e:(e=""+r[t],"RepresentationID"===t||(s=i?parseInt(s,10):1)<=e.length?e:new Array(s-e.length+1).join("0")+e)}));var r},xo=(r,e)=>{const n={RepresentationID:r.id,Bandwidth:r.bandwidth||0};var{initialization:t={sourceURL:"",range:""}}=r;const a=io({baseUrl:r.baseUrl,source:Co(t.sourceURL,n),range:t.range});return t=e,((e=r).duration||t?e.duration?no(e):Eo(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]).map(e=>{n.Number=e.number,n.Time=e.time;var t=Co(r.media||"",n),i=r.timescale||1,s=r.presentationTimeOffset||0,s=r.periodStart+(e.time-s)/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:ln(r.baseUrl||"",t),map:a,number:e.number,presentationTime:s}})},Io=(r,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=r;if(!t&&!e||t&&e)throw new Error(to.SEGMENT_TIME_UNSPECIFIED);const a=i.map(e=>{var{baseUrl:t,initialization:i={}}=t=r,i=io({baseUrl:t,source:i.sourceURL,range:i.range});return(t=io({baseUrl:t,source:e.media,range:e.mediaRange})).map=i,t});let s;return t&&(s=no(r)),(s=e?Eo(r,e):s).map((e,t)=>{var i,s;if(a[t])return t=a[t],i=r.timescale||1,s=r.presentationTimeOffset||0,t.timeline=e.timeline,t.duration=e.duration,t.number=e.number,t.presentationTime=n+(e.time-s)/i,t}).filter(e=>e)},Ao=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=xo,i=I(e,t.template)):t.base?(s=ao,i=I(e,t.base)):t.list&&(s=Io,i=I(e,t.list));var r,n,a,e={attributes:e};return s&&(r=s(i,t.segmentTimeline),i.duration?({duration:n,timescale:a=1}=i,i.duration=n/a):r.length?i.duration=r.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},Do=e=>e.map(Ao),A=(e,t)=>eo(e.childNodes).filter(({tagName:e})=>e===t),Lo=e=>e.textContent.trim(),Po=e=>{var t,i,s,r,n,e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);return e?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},Oo={mediaPresentationDuration(e){return Po(e)},availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod(e){return Po(e)},suggestedPresentationDelay(e){return Po(e)},type(e){return e},timeShiftBufferDepth(e){return Po(e)},start(e){return Po(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return parseFloat(e.split("/").reduce((e,t)=>e/t))},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){var t=parseInt(e,10);return isNaN(t)?Po(e):t},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},DEFAULT(e){return e}},D=e=>e&&e.attributes?eo(e.attributes).reduce((e,t)=>{var i=Oo[t.name]||Oo.DEFAULT;return e[t.name]=i(t.value),e},{}):{},No={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Ro=(e,t)=>t.length?Za(e.map(function(s){return t.map(function(e){var t=Lo(e),i=ln(s.baseUrl,t),e=I(D(e),{baseUrl:i});return i!==t&&!e.serviceLocation&&s.serviceLocation&&(e.serviceLocation=s.serviceLocation),e})})):e,Mo=e=>{var t=A(e,"SegmentTemplate")[0],i=A(e,"SegmentList")[0],s=i&&A(i,"SegmentURL").map(e=>I({tag:"SegmentURL"},D(e))),e=A(e,"SegmentBase")[0],r=i||t,r=r&&A(r,"SegmentTimeline")[0],n=i||e||t,n=n&&A(n,"Initialization")[0],t=t&&D(t);t&&n?t.initialization=n&&D(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});const a={template:t,segmentTimeline:r&&A(r,"S").map(e=>D(e)),list:i&&I(D(i),{segmentUrls:s,initialization:D(n)}),base:e&&I(D(e),{initialization:D(n)})};return Object.keys(a).forEach(e=>{a[e]||delete a[e]}),a},Uo=o=>Za(A(o.node,"EventStream").map(e=>{const n=D(e),a=n.schemeIdUri;return A(e,"Event").map(e=>{var t=D(e),i=t.presentationTime||0,s=n.timescale||1,r=t.duration||0,i=i/s+o.attributes.start;return{schemeIdUri:a,value:n.value,id:t.id,start:i,end:i+r/s,messageData:Lo(e)||t.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})})),Bo=(l,d,h)=>e=>{var t=D(e),i=Ro(d,A(e,"BaseURL")),s=A(e,"Role")[0],s={role:D(s)};let r=I(l,t,s);var n,a,o,t=A(e,"Accessibility")[0],t="urn:scte:dash:cc:cea-608:2015"===(s=D(t)).schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===s.schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var t,s;return/=/.test(e)?([t,s=""]=e.split("="),i.channel=t,i.language=e,s.split(",").forEach(e=>{var[e,t]=e.split(":");"lang"===e?i.language=t:"er"===e?i.easyReader=Number(t):"war"===e?i.aspectRatio=Number(t):"3D"===e&&(i["3D"]=Number(t))})):i.language=e,i.channel&&(i.channel="SERVICE"+i.channel),i}):void 0,s=(t&&(r=I(r,{captionServices:t})),A(e,"Label")[0]),s=(s&&s.childNodes.length&&(t=s.childNodes[0].nodeValue.trim(),r=I(r,{label:t})),A(e,"ContentProtection").reduce((e,t)=>{var i=D(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),No[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=A(t,"cenc:pssh")[0])&&(t=Lo(i),e[s].pssh=t&&Sn(t)),e},{})),t=(Object.keys(s).length&&(r=I(r,{contentProtection:s})),Mo(e)),s=A(e,"Representation"),e=I(h,t);return Za(s.map((n=r,a=i,o=e,e=>{var t=A(e,"BaseURL"),t=Ro(a,t);const i=I(n,D(e)),s=Mo(e);return t.map(e=>({segmentInfo:I(o,s),attributes:I(i,e)}))})))},Fo=(e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=t,n=A(e,"Period");if(!n.length)throw new Error(to.INVALID_NUMBER_OF_PERIOD);var a=A(e,"Location");const o=D(e);var l,d,t=Ro([{baseUrl:t}],A(e,"BaseURL")),e=A(e,"ContentSteering");o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,a.length&&(o.locations=a.map(Lo));const h=[];return n.forEach((e,t)=>{var i,s,r=D(e),t=h[t-1];r.start=({attributes:t,priorPeriodAttributes:i,mpdType:s}=[{attributes:r,priorPeriodAttributes:t?t.attributes:null,mpdType:o.type}][0],"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==s?null:0),h.push({node:e,attributes:r})}),{locations:o.locations,contentSteeringInfo:(i=r,1<(s=e).length&&i({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),s.length?((i=I({serverURL:Lo(s[0])},D(s[0]))).queryBeforeStart="true"===i.queryBeforeStart,i):null),representationInfo:Za(h.map((l=o,d=t,(e,t)=>{var i=Ro(d,A(e.node,"BaseURL")),s=I(l,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration),A(e.node,"AdaptationSet")),e=Mo(e.node);return Za(r.map(Bo(s,i,e)))}))),eventStream:Za(h.map(Uo))}},jo=e=>{if(""===e)throw new Error(to.DASH_EMPTY_MANIFEST);var t,i=new Ya;let s;try{t=i.parseFromString(e,"application/xml"),s=t&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0{e=jo(e);if(!(e=A(e,"UTCTiming")[0]))return null;var t=D(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(to.UNSUPPORTED_UTC_TIMING_SCHEME)}return t};function Ho(e,t){var i,s,r;return void 0===t&&(t=0),(e=T(e)).length-t<10||!w(e,Jo,{offset:t})?t:(t+=(void 0===(s=t)&&(s=0),r=(i=T(i=e))[s+5],i=i[s+6]<<21|i[s+7]<<14|i[s+8]<<7|i[s+9],(16&r)>>4?20+i:10+i),Ho(e,t))}function Vo(e){return"string"==typeof e?on(e):e}function zo(e,t,i){void 0===i&&(i=!1),s=t,t=Array.isArray(s)?s.map(Vo):[Vo(s)],e=T(e);var s,r=[];if(t.length)for(var n=0;n>>0,o=e.subarray(n+4,n+8);if(0==a)break;a=n+a;if(a>e.length){if(i)break;a=e.length}var l=e.subarray(n+8,a);w(o,t[0])&&(1===t.length?r.push(l):r.push.apply(r,zo(l,t.slice(1),i))),n=a}return r}function $o(e,t,i){var s;return i>=t.length?t.length:(s=il(t,i,!1),w(e.bytes,s.bytes)?i:$o(e,t,i+(e=il(t,i+s.length)).length+e.value+s.length))}function Wo(e,t){i=t,t=Array.isArray(i)?i.map(function(e){return sl(e)}):[sl(i)],e=T(e);var i,s=[];if(t.length)for(var r=0;re.length?e.length:o+a.value),o=e.subarray(o,l);w(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(Wo(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function Go(e,t,i,s){void 0===s&&(s=1/0),e=T(e),i=[].concat(i);for(var r,n=0,a=0;n>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}function Xo(e){e=T(e);for(var t=0;t>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i},Jo=T([73,68,51]),Zo={EBML:T([26,69,223,163]),DocType:T([66,130]),Segment:T([24,83,128,103]),SegmentInfo:T([21,73,169,102]),Tracks:T([22,84,174,107]),Track:T([174]),TrackNumber:T([215]),DefaultDuration:T([35,227,131]),TrackEntry:T([174]),TrackType:T([131]),FlagDefault:T([136]),CodecID:T([134]),CodecPrivate:T([99,162]),VideoTrack:T([224]),AudioTrack:T([225]),Cluster:T([31,67,182,117]),Timestamp:T([231]),TimestampScale:T([42,215,177]),BlockGroup:T([160]),BlockDuration:T([155]),Block:T([161]),SimpleBlock:T([163])},el=[128,64,32,16,8,4,2,1],tl=function(e){for(var t=1,i=0;it&&t.responseURL&&e!==t.responseURL?t.responseURL:e,ml=e=>b.log.debug?b.log.debug.bind(b,"VHS:",e+" >"):function(){};function P(...e){var t=b.obj||b;return(t.merge||t.mergeOptions).apply(t,e)}function gl(...e){var t=b.time||b;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function fl(e,i){return El(e,function(e,t){return e-wl<=i&&t+wl>=i})}function yl(e,t){return El(e,function(e){return e-Sl>=t})}function _l(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function vl(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},Cl=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Il=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Al=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},Dl=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},Ll=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function Ul(e){return e.excludeUntil&&e.excludeUntil===1/0}function Bl(e){var t=Ml(e);return!e.disabled&&!t}function Fl(e,t){return t.attributes&&t.attributes[e]}function jl(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const ql=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!Bl(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),Vl=t=>{if(!t||!t.playlists||!t.playlists.length)return jl(t,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;etn(e))){i=jl(t,e=>Hl(s,e));if(!i)return!1}}return!0};var zl={liveEdgeDelay:Ll,duration:Rl,seekable:function(e,t,i){var s=t||0,e=Tl(e,t,!0,i);return null===e?gl():gl(s,e)},getMediaInfoForTime:function({playlist:t,currentTime:i,startingSegmentIndex:s,startingPartIndex:r,startTime:n,exactManifestTimings:a}){let o=i-n;var l=Il(t);let d=0;for(let e=0;ee+"-"+t,Gl=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(const i in r.mediaGroups[e])for(const s in r.mediaGroups[e][i]){var t=r.mediaGroups[e][i][s];n(t,e,i,s)}})},Xl=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Kl=(o,e,l=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{e.uri&&(e.resolvedUri=cl(n.uri,e.uri))})};class Yl{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,t)=>(e.set(t.id,t),e),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(const t of s){var e=i[t.class]||[];t.endDate?t.endTime=t.endDate.getTime()/1e3-this.offset_:t.endOnNext&&e[t.classListIndex+1]?t.endTime=e[t.classListIndex+1].startTime:t.duration?t.endTime=t.startTime+t.duration:t.plannedDuration?t.endTime=t.startTime+t.plannedDuration:t.endTime=t.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){if(!t)return i;var s=P(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=cl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=cl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=cl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=cl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=cl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=cl(t,e.uri))})},ed=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,td=(e,r,t=ed)=>{var i=P(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=Ql(r);const n=P(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{Zl(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)};class sd extends dr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=ml("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new Yl,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=cl(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,s=t["preloadSegment"];let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=Dl(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:t,manifestString:i}){{var[{onwarn:i,oninfo:e,manifestString:s,customTagParsers:r=[],customTagMappers:n=[],llhls:a}]=[{onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new en,l=(i&&o.on("warn",i),e&&o.on("info",e),r.forEach(e=>o.addParser(e)),n.forEach(e=>o.addTagMapper(e)),o.push(s),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){l.hasOwnProperty(e)&&delete l[e]}),l.segments&&l.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce((e,t)=>Math.max(e,t.duration),0)),i&&i("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(e=Al(l)).length&&!l.partTargetDuration&&(r=e.reduce((e,t)=>Math.max(e,t.duration),0),i&&(i("manifest has no partTargetDuration defaulting to "+r),$l.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";t=t||this.parseManifest_({url:i,manifestString:e}),t.lastRequest=Date.now(),Xl({playlist:t,uri:i,id:s}),e=td(this.main,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(id(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Yl,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(i,e){if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.main.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.main.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),e);else{const s=this.state;var e=!this.media_||i.id!==this.media_.id,t=this.main.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(id(i,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(i.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=i,this.request=this.vhs_.xhr({uri:i.resolvedUri,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(i.lastRequest=Date.now(),i.resolvedUri=pl(i.resolvedUri,t),e)return this.playlistRequestError(this.request,i,s);this.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=pl(this.src,t);e=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(e)}})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,Kl(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=Ql(t),t.segments.forEach(e=>{Zl(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=Wl(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function rd(e,t,i,s){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),s(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function nd(){function d(e,a){e=P({timeout:45e3},e);var t=d.beforeRequest||b.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||b.Vhs.xhr._requestCallbackSet||new Set;const o=d._responseCallbackSet||b.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(b.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=!0===b.Vhs.xhr.original?cd:b.Vhs.xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);const l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),rd(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestTime=Date.now(),l}return d.original=!0,d}function ad(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function od(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function ld(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function dd(i){const s={};return Object.keys(i).forEach(e=>{var t=i[e];_n(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s}function hd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function ud(e){return e.resolvedUri}const cd=b["xhr"],pd=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;epd(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,fd=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*md)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},yd=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:zl.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{yd({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},_d=(e,t)=>{if(4===e.readyState)return t()},vd=(e,t,r)=>{let s=[],n,a=!1;function o(e,t,i,s){return t.abort(),a=!0,r(e,t,i,s)}function i(e,t){var i;if(!a)return e?o(e,t,"",s):(i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length),s=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;no(e,t,"",s)):o(null,t,i,s))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return rd(e,null,{statusCode:e.status},i)})}},function(e,t){return rd(l,e,t,i)});return l};rr=b.EventTarget;function bd(t,i){if(!ed(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Sd=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=Fo(jo(e),i),s=Do(e.representationInfo);r=wo({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return Kl(r,t,Td),r},wd=(e,t,i)=>{let a=!0,o=P(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=td(o,e.playlists[0],bd))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,Gl(n,(e,t,i,s)=>{s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Ed=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},kd=(e,t)=>{var i={};for(const a in e){var s=e[a].sidx;if(s){var r=mo(s);if(!t[r])break;var n=t[r].sidxInfo;Ed(n,s)&&(i[r]=t[r])}}return i};class Cd extends rr{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=ml("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(a,s,r){const n=a.sidx&&mo(a.sidx);if(a.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const o=pl(a.sidx.resolvedUri),l=(t,i)=>{if(!this.requestErrored_(t,i,s)){t=this.mainPlaylistLoader_.sidxMapping_;let e;try{e=Qo(T(i.response).subarray(8))}catch(e){return void this.requestErrored_(e,i,s)}return t[n]={sidxInfo:a.sidx,sidx:e},oo(a,e,a.sidx.resolvedUri),r(!0)}};this.request=vd(o,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?l(e,t):i&&"mp4"===i?({offset:r,length:n}=a.sidx.byterange,s.length>=n+r?l(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:ad({byterange:a.sidx.byterange})},l))):l({status:t.status,message:`Unsupported ${i||"unknown"} container type for sidx segment at URL: `+o,response:"",playlist:a,internal:!0,playlistExclusionDuration:1/0,code:2},t)})}else this.mediaRequest_=window.setTimeout(()=>r(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(e,t)=>{if(this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const i=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=pl(this.mainPlaylistLoader_.srcUrl,t),!i)return s(t,i);this.handleMain_(),this.syncClientServerClock_(()=>s(t,i))}})}syncClientServerClock_(s){const r=qo(this.mainPlaylistLoader_.mainXml_);return null===r?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s()):"DIRECT"===r.method?(this.mainPlaylistLoader_.clientOffset_=r.value-Date.now(),s()):void(this.request=this.vhs_.xhr({uri:cl(this.mainPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},(t,i)=>{if(this.request){if(t)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s();let e;e="HEAD"===r.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),s()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=Sd({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=wd(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=kd(e.playlists,r);return Gl(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=P(n,kd(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},id(this.media(),Boolean(i))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]})),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}}var O={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function xd(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}const Id=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),j(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},ce=function(e){return l(d.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),U(e))},$=function(e){e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return l(d.tkhd,e)},J=function(e){var t,i=l(d.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/_e),r=Math.floor(e.baseMediaDecodeTime%_e),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),l(d.trex,t)},pe=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},me=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=pe(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=pe(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?ge:me)(e,t)};function ve(e,t){var i=xe();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function n(e){for(var t=[];e--;)t.push(0);return t}function a(e){e=e||{},a.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new g(0,0),new g(0,1),new g(1,0),new g(1,1)],this.parse708captions_&&(this.cc708Stream_=new m({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function be(e){return 32<=e&&e<=127||160<=e&&e<=255}function o(e){this.windowNum=e,this.reset()}function Te(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new o(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Se(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))}function h(){for(var e=[],t=je+1;t--;)e.push({text:"",indent:0,offset:0});return e}function we(e,t){var i=1;for(t$e;)e+=i*ze;return e}function Ee(e){var t,i;Ee.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=we(e.dts,i),e.pts=we(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var ke,Ce={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:q=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=q(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},xe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ie={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tRe.ONE_SECOND_IN_TS/2))){for(a=(a=Ne()[e.samplerate])||t[0].data,o=0;o=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){for(var t,i=[],s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},o.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},o.prototype.addText=function(e){this.rows[this.rowIdx]+=e},o.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new o(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},m.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),Fe=(m.prototype=new p,m.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},m.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},m.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},m.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},m.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},m.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},m.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},m.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},m.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},m.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),je=14,qe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],g=function(e,t){g.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=h()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=h():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=h()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=qe.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Se(t),s+=Se(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},p=(g.prototype=new p,g.prototype.flushDisplayed=function(e){const i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},g.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=h(),this.nonDisplayed_=h(),this.lastControlCode_=null,this.column_=0,this.row_=je,this.rollUpRows_=2,this.formatting_=[]},g.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},g.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},g.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},g.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},g.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},g.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},g.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},g.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},g.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},g.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,a=(a*=4)+(3&n[7]),o.timeStamp=a,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)),t.frames.push(o),(i=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=w.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=w.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new S,Ge.STREAM_TYPES={h264:27,adts:15},(Xe=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Xe.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case w.H264_STREAM_TYPE:e=n,t="video";break;case w.ADTS_STREAM_TYPE:e=a,t="audio";break;case w.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new S,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:st,TransportParseStream:Ge,ElementaryStream:Xe,TimestampRolloverStream:Ve,CaptionStream:it.CaptionStream,Cea608Stream:it.Cea608Stream,Cea708Stream:it.Cea708Stream,MetadataStream:b});for(Ke in w)w.hasOwnProperty(Ke)&&(rt[Ke]=w[Ke]);var nt,at,S=rt,Ve=i,ot=c.ONE_SECOND_IN_TS,lt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],dt=function(l){var d,h=0;dt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*ot/lt[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:lt[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},it=(dt.prototype=new Ve,dt),b=i,ht=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},ut=function(){var s,r,n=0;ut.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},gt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=mt(e,t),gt(e,t))},ft=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:mt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+ct(e.subarray(10,14)));do{if((t=ct(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=yt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;i=n.length-r,n=0i.pts?l++:(t++,n-=s.byteLength,a-=s.nalCount,o-=s.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=n,r.duration=o,r.nalCount=a,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,s,r,n=d.length-1,a=e.length-1,o=null,l=!1;0<=n&&0<=a;){if(t=d[n],i=e[a],t.pts===i.pts){l=!0;break}t.pts>i.pts?n--:(n===d.length-1&&(o=a),a--)}return l||null!==o?0===(s=l?a:o)?e:(r=(s=e.slice(s)).reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0}),s.byteLength=r.byteLength,s.duration=r.duration,s.nalCount=r.nalCount,s.pts=s[0].pts,s.dts=s[0].dts,s):null},this.alignGopsWith=function(e){d=e}}).prototype=new E,((k=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,k.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new E).flush=function(e){var t,i,s,r=0,n={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Pt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Lt.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=C.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},k.prototype.setRemux=function(e){this.remuxTracks=e},(wt=function(s){var r,n,a=this,i=!0;wt.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new A.MetadataStream,t.aacStream=new It,t.audioTimestampRolloverStream=new A.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new A.TimestampRolloverStream("timed-metadata"),t.adtsStream=new Ct,t.coalesceStream=new k(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Nt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new A.MetadataStream,i.packetStream=new A.TransportPacketStream,i.parseStream=new A.TransportParseStream,i.elementaryStream=new A.ElementaryStream,i.timestampRolloverStream=new A.TimestampRolloverStream,i.adtsStream=new Ct,i.h264Stream=new xt,i.captionStream=new A.CaptionStream(s),i.coalesceStream=new k(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new St(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Nt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,I.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,I.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=At(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new E;function Rt(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Mt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function Vt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}var zt=wt,i=function(e){return e>>>0},De=function(e){return("00"+e.toString(16)).slice(-2)},$t=i,Wt=Rt,Gt=i,Xt=s.getUint64,Kt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Le="undefined"!=typeof window?window:"undefined"!=typeof fe?fe:"undefined"!=typeof self?self:{},S=Le,Yt=Oe.discardEmulationPreventionBytes,Qt=p.CaptionStream,D=Mt,Jt=Ut,Zt=Bt,ei=Ft,ti=S,ii=function(e,h){var i=D(e,["moof","traf"]),e=D(e,["mdat"]),u={},s=[];return e.forEach(function(e,t){t=i[t];s.push({mdat:e,traf:t})}),s.forEach(function(e){var t,i,s,r,n,a=e.mdat,e=e.traf,o=D(e,["tfhd"]),o=ei(o[0]),l=o.trackId,d=D(e,["tfdt"]),d=0>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),P(e,["mdia","mdhd"])[0]);s&&(i.timescale=pi(s)),n.push(i)}),n},fi=function(e,i=0){return P(e,["emsg"]).map(e=>{var e=di.parseEmsgBox(new Uint8Array(e)),t=ci(e.message_data);return{cueTime:di.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:di.scaleTime(e.event_duration,e.timescale),frames:t}})},yi=He,_i=He,O=Ye,N={},R=(N.ts={parseType:function(e,t){e=jt(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=qt(e),i=4+Ht(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=qt(e),s=4+Ht(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ht(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=N.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=N.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=N.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=R/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in vi(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case _i.H264_STREAM_TYPE:s.video=[],Ti(e,i,s),0===s.video.length&&delete s.video;break;case _i.ADTS_STREAM_TYPE:s.audio=[],bi(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=O(e.dts,s),e.pts=O(e.pts,s),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=O(e.dts,r),e.pts=O(e.pts,r),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=O(t.dts,r),t.pts=O(t.pts,r),t.dtsTime=t.dts/R,t.ptsTime=t.pts/R),e):null};class wi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new zt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new si,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=mi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=gi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=fi(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*c.ONE_SECOND_IN_TS,t=Si(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(c.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new wi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new wi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));const Od=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},Nd=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},Rd=(e,t)=>{t.gopInfo=e.data.gopInfo},Md=t=>{const{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=t,_={buffer:[]};let v=y;var b,T;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&Od(e,_,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&Rd(e,_),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(v=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||v||(i.onmessage=null,Nd({transmuxedData:_,callback:m}),Ud(i))},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(b=e instanceof ArrayBuffer?e:e.buffer,T=e instanceof ArrayBuffer?0:e.byteOffset,i.postMessage({action:"push",data:b,byteOffset:T,byteLength:e.byteLength},[b])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},Ud=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Md(e.currentTransmux))},Bd=(e,t)=>{e.postMessage({action:t}),Ud(e)},Fd=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(Bd.bind(null,t,e)):(t.currentTransmux=e,Bd(t,e))};const jd=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,Md(e))};var qd=e=>{Fd("reset",e)},Hd=(jd,e=>{const t=new Pd,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function Vd(t){const i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=yi({},t,{endAction:null,transmuxer:null,callback:null});const a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)}function zd(e){let t=0;return e.audio&&t++,e.video&&t++,t}function $d(e,t){var i=t.attributes||{},s=lh(function(e){e=e.attributes||{};if(e.CODECS)return pn(e.CODECS)}(t)||[]);return!oh(e,t)||s.audio||((e,t)=>{if(!oh(e,t))return!0;var t=t.attributes||{},i=e.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1})(e,t)||(t=lh(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return pn(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function Wd(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Gd(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}const Xd={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Kd=e=>{e.forEach(e=>{e.abort()})},Yd=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),Qd=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Jd=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Xd.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Xd.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Xd.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Xd.FAILURE,xhr:t}:null,Zd=(r,n,a)=>(e,t)=>{var i=t.response,e=Jd(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:Xd.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=Xo(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: `+e,code:Xd.FAILURE});Vd({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},th=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{var p=i.map&&i.map.tracks||{};const m=Boolean(p.audio&&p.video);let g=e.bind(null,i,"audio","start");const f=e.bind(null,i,"audio","end");let y=e.bind(null,i,"video","start");const _=e.bind(null,i,"video","end");Vd({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:m}),s=null),jd({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:m,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(m&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{g&&"undefined"!=typeof e.start&&(g(e.start),g=null),f&&"undefined"!=typeof e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&"undefined"!=typeof e.start&&(y(e.start),y=null),_&&"undefined"!=typeof e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:e=>{u&&(e.type="combined"===e.type?"video":e.type,u(null,i,e))}})}})},ih=({segment:s,bytes:r,trackInfoFn:e,timingInfoFn:t,videoSegmentTimingInfoFn:i,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{let p=new Uint8Array(r);if(m=p,0{h(s,{data:p,type:f.hasAudio&&!f.isMuxed?"audio":"video"}),t&&t.length&&a(s,t),e&&e.length&&o(s,e),u(null,s,{})});void Vd({action:"probeMp4StartTime",timescales:s.map.timescales,data:p,transmuxer:s.transmuxer,callback:({data:i,startTime:e})=>{r=i.buffer,s.bytes=p=i,f.hasAudio&&!f.isMuxed&&t(s,"audio","start",e),f.hasVideo&&t(s,"video","start",e),Vd({action:"probeEmsgID3",data:p,transmuxer:s.transmuxer,offset:e,callback:({emsgData:e,id3Frames:t})=>{r=e.buffer,s.bytes=p=e,g.video&&i.byteLength&&s.transmuxer?Vd({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:p,timescales:s.map.timescales,trackIds:[g.video.id],callback:e=>{r=e.data.buffer,s.bytes=p=e.data,e.logs.forEach(function(e){c(P(e,{stream:"mp4CaptionParser"}))}),y(e.captions,t)}}):y(void 0,t)}})}})}else{var m;s.transmuxer?("undefined"==typeof s.container&&(s.container=Xo(p)),"ts"!==s.container&&"aac"!==s.container?(e(s,{hasAudio:!1,hasVideo:!1}),u(null,s,{})):th({segment:s,bytes:r,trackInfoFn:e,timingInfoFn:t,videoSegmentTimingInfoFn:i,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})):u(null,s,{})}},sh=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s},r){const n=e=>{e.data.source===t&&(s.removeEventListener("message",n),e=e.data.decrypted,r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.addEventListener("message",n);let a;a=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(dd({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},rh=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{sh({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,ih({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})})},nh=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[];var _,v,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})=>{let f=0,y=!1;return(e,t)=>{if(!y){if(e)return y=!0,Kd(s),m(e,t);if((f+=1)===s.length){const i=function(){if(t.encryptedBytes)return rh({decryptionWorker:r,segment:t,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g});ih({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})};if(t.endOfAllRequests=Date.now(),t.map&&t.map.encryptedBytes&&!t.map.bytes)return sh({decryptionWorker:r,id:t.requestId+"-init",encryptedBytes:t.map.encryptedBytes,key:t.map.key},e=>{t.map.bytes=e,eh(t,e=>{if(e)return Kd(s),m(e,t);i()})});i()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f}),u=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=e(P(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),Zd(s,a,i)),y.push(o)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(l=e(P(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),Zd(s,[s.map.key],i)),y.push(l)),d=P(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:ad(s.map)}),{segment:_,finishProcessingFn:v}=[{segment:s,finishProcessingFn:i}][0],h=e(d,(e,t)=>{var e=Jd(e,t);return e?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void eh(_,function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))}),y.push(h)),P(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:ad(s)}));({segment:b,finishProcessingFn:T,responseType:S}={segment:s,finishProcessingFn:i,responseType:u.responseType});var b,T,S,w,E,c=e(u,(e,t)=>{var e=Jd(e,t);return e?T(e,b):(e="arraybuffer"!==S&&t.responseText?Id(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=Yd(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b))});c.addEventListener("progress",({segment:w,progressFn:E}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return w.stats=P(w.stats,Qd(e)),!w.stats.firstBytesReceivedAt&&w.stats.bytesReceived&&(w.stats.firstBytesReceivedAt=Date.now()),E(e,w)})),y.push(c);const k={};return y.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:k,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>Kd(y)},ah=ml("CodecUtils"),oh=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},lh=function(e){const s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(cn(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),n=(uh(r,(e,t)=>e.bandwidth-t.bandwidth),(r=r.filter(e=>!zl.isIncompatible(e.playlist))).filter(e=>zl.isEnabled(e.playlist)));o=(n=n.length?n:r.filter(e=>!zl.isDisabled(e.playlist))).filter(e=>e.bandwidth*O.BANDWIDTH_VARIANCEe.bandwidth===a.bandwidth)[0];if(!1===h){const g=p||n[0]||r[0];if(g&&g.playlist){let e=p?"bandwidthBestRep":"sortedPlaylistReps";return n[0]&&(e="enabledPlaylistReps"),dh(`choosing ${hh(g)} using ${e} with options`,c),g.playlist}}else{var m,h=o.filter(e=>e.width&&e.height),o=(uh(h,(e,t)=>e.width-t.width),h.filter(e=>e.width===l&&e.height===d)),o=(a=o[o.length-1],o.filter(e=>e.bandwidth===a.bandwidth)[0]);let t,i;o||(m=(t=h.filter(e=>e.width>l||e.height>d)).filter(e=>e.width===t[0].width&&e.height===t[0].height),a=m[m.length-1],i=m.filter(e=>e.bandwidth===a.bandwidth)[0]);let s;u.leastPixelDiffSelector&&(m=h.map(e=>(e.pixelDiff=Math.abs(e.width-l)+Math.abs(e.height-d),e)),uh(m,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=m[0]);const g=s||i||o||p||n[0]||r[0];if(g&&g.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":o?e="resolutionBestRep":p?e="bandwidthBestRep":n[0]&&(e="enabledPlaylistReps"),dh(`choosing ${hh(g)} using ${e} with options`,c),g.playlist}}return dh("could not choose a playlist with options",c),null}}function ph(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return ch(this.playlists.main,this.systemBandwidth,parseInt(Wd(this.tech_.el(),"width"),10)*e,parseInt(Wd(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function mh(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const gh=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:r})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach(e=>{const s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new a(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return b.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return b.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return b.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),o.addCue(i)})}),o.cues)&&o.cues.length){var s=o.cues,n=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),d=Object.keys(l).sort((e,t)=>Number(e)-Number(t));d.forEach((e,t)=>{var e=l[e],i=isFinite(r)?r:0;const s=Number(d[t+1])||i;e.forEach(e=>{e.endTime=s})})}}},fh={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},yh=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),_h=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,b.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},vh=e=>"number"==typeof e&&isFinite(e),bh=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?Dl({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Th=e=>e+"TimingInfo",Sh=(e,t)=>e.length?e.end(e.length-1):t,wh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Eh=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Sl,kh=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&sthis.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=ml(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return Hd({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&qd(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return gl();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=hd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=ud(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&qd(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n=()=>{0===--e&&s()};!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,n)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*ul),n=Math.ceil((e-s)*ul),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,n));for(const a in this.inbandTextTracks_)mh(t,i,this.inbandTextTracks_[a]);mh(t,i,this.segmentMetadataTrack_),n()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),t=_l(e)||0,e=vl(e,this.currentTime_()),i=!this.hasPlayed_()&&1<=e,s=e>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},i.isSyncRequest?i.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,r,t):null!==this.mediaIndex?(s=r[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1,i.startOfSegment=s.end||t,s.parts&&s.parts[a+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=a+1):i.mediaIndex=this.mediaIndex+1):({segmentIndex:s,startTime:a,partIndex:o}=zl.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),i.mediaIndex=s,i.startOfSegment=a,i.partIndex=o),t=r[i.mediaIndex];let n=t&&"number"==typeof i.partIndex&&t.parts&&t.parts[i.partIndex];if(!t||"number"==typeof i.partIndex&&!n)return null;"number"!=typeof i.partIndex&&t.parts&&(i.partIndex=0,n=t.parts[0]);var a,o,s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e=(e||!n||s||n.independent||(0===i.partIndex?(o=(a=r[i.mediaIndex-1]).parts&&a.parts.length&&a.parts[a.parts.length-1])&&o.independent&&(--i.mediaIndex,i.partIndex=a.parts.length-1,i.independent="previous segment"):t.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part")),this.mediaSource_&&"ended"===this.mediaSource_.readyState);return i.mediaIndex>=r.length-1&&e&&!this.seeking_()?null:this.generateSegmentInfo_(i)}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:n}),_l(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*ul);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,calculateTimestampOffsetForEachSegment:r,overrideCheck:n}=[e][0],r?Sh(s,i):n||e!==t?e!zl.isIncompatible(e));let d=e.filter(zl.isEnabled);var e=(d=d.length?d:e.filter(e=>!zl.isDisabled(e))).filter(zl.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:zl.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return uh(h,(e,t)=>Gd(t.playlist,e.playlist)),h.length?h[0]:(uh(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=Sl&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{p[e.stream]=p[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=p[e.stream];t.startTime=Math.min(t.startTime,e.startTime+c),t.endTime=Math.max(t.endTime,e.endTime+c),t.captions.push(e)}),Object.keys(p).forEach(e=>{var{startTime:t,endTime:i,captions:s}=p[e],r=this.inbandTextTracks_,n=(this.logger_(`adding cues from ${t} -> ${i} for `+e),r),a=this.vhs_.tech_,o=e;if(!n[o]){a.trigger({type:"usage",name:"vhs-608"});let s=o;/^cc708_/.test(o)&&(s="SERVICE"+o.split("_")[1]);var l=a.textTracks().getTrackById(s);if(l)n[o]=l;else{let e=o,t=o,i=!1;l=(a.options_.vhs&&a.options_.vhs.captionServices||{})[s];l&&(e=l.label,t=l.language,i=l.default),n[o]=a.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}mh(t,i,r[e]);var{inbandTextTracks:d,captionArray:l,timestampOffset:h}={captionArray:s,inbandTextTracks:r,timestampOffset:c};if(l){const u=window.WebKitDataCue||window.VTTCue;l.forEach(i=>{const s=i.stream;i.content?i.content.forEach(e=>{var t=new u(i.startTime+h,i.endTime+h,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",d[s].addCue(t)}):d[s].addCue(new u(i.startTime+h,i.endTime+h,i.text))})}}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&wh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||wh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Th(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,e)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=hd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):this.loadQueue_.push(()=>{var e=yi({},t,{forceTimestampOffset:!0});yi(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)})}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_(bh(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-O.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=kh(e,this.sourceType_))&&("warn"===t.severity?b.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+bh(e)):(this.logger_("Appended "+bh(e)),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+bh(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,vh(t))&&vh(i)&&(mh(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}set replaceSegmentsUntil(e){this.logger_("Replacing currently buffered segments until "+e),this.replaceSegmentsUntil_=e}}function xh(){}function Ih(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}const Ah=["video","audio"],Dh=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},Lh=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),Lh("audio",s),Lh("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!Dh(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=Ih(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},Oh=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Nh={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(Oh(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(Oh(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];Oh(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){b.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){b.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(Oh(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){b.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=Ih(s),i=mn(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(Ph(i,e),Oh(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){b.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:r=>(e,t)=>{var i=t[e+"Buffer"],s=mn(r);Oh(t.mediaSource,i)&&t.codecs[e]!==r&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to `+r),i.changeType(s),t.codecs[e]=r)}},Rh=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),Lh(e,t)},Mh=(i,s)=>e=>{var t=function(t){let i="";for(let e=0;e ${r})`}return i||"empty"}(s[i+"Buffered"]());s.logger_(i+` source buffer update end. Buffered: +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ +const cl=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,s=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||$r):/\/\//i.test(e)||(e=zr.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice($r.length):s?i.href.slice(i.protocol.length):i.href):zr.buildAbsoluteURL(e,t)},pl=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,ml=e=>b.log.debug?b.log.debug.bind(b,"VHS:",e+" >"):function(){};function P(...e){var t=b.obj||b;return(t.merge||t.mergeOptions).apply(t,e)}function gl(...e){var t=b.time||b;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function fl(e,i){return El(e,function(e,t){return e-wl<=i&&t+wl>=i})}function yl(e,t){return El(e,function(e){return e-Sl>=t})}function _l(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function vl(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},Cl=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Il=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Al=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},Dl=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},Ll=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function Ul(e){return e.excludeUntil&&e.excludeUntil===1/0}function Bl(e){var t=Ml(e);return!e.disabled&&!t}function Fl(e,t){return t.attributes&&t.attributes[e]}function jl(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const ql=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!Bl(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),Vl=t=>{if(!t||!t.playlists||!t.playlists.length)return jl(t,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;etn(e))){i=jl(t,e=>Hl(s,e));if(!i)return!1}}return!0};var zl={liveEdgeDelay:Ll,duration:Rl,seekable:function(e,t,i){var s=t||0;let r=Tl(e,t,!0,i);return null===r?gl():gl(s,r=re+"-"+t,Gl=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(const i in r.mediaGroups[e])for(const s in r.mediaGroups[e][i]){var t=r.mediaGroups[e][i][s];n(t,e,i,s)}})},Xl=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Kl=(o,e,l=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{e.uri&&(e.resolvedUri=cl(n.uri,e.uri))})};class Yl{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,t)=>(e.set(t.id,t),e),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(const t of s){var e=i[t.class]||[];t.endDate?t.endTime=t.endDate.getTime()/1e3-this.offset_:t.endOnNext&&e[t.classListIndex+1]?t.endTime=e[t.classListIndex+1].startTime:t.duration?t.endTime=t.startTime+t.duration:t.plannedDuration?t.endTime=t.startTime+t.plannedDuration:t.endTime=t.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){if(!t)return i;var s=P(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=cl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=cl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=cl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=cl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=cl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=cl(t,e.uri))})},ed=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,td=(e,r,t=ed)=>{var i=P(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=Ql(r);const n=P(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{Zl(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)};class sd extends dr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=ml("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new Yl,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=cl(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,s=t["preloadSegment"];let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=Dl(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:t,manifestString:i}){{var[{onwarn:i,oninfo:e,manifestString:s,customTagParsers:r=[],customTagMappers:n=[],llhls:a}]=[{onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new en,l=(i&&o.on("warn",i),e&&o.on("info",e),r.forEach(e=>o.addParser(e)),n.forEach(e=>o.addTagMapper(e)),o.push(s),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){l.hasOwnProperty(e)&&delete l[e]}),l.segments&&l.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce((e,t)=>Math.max(e,t.duration),0)),i&&i("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(e=Al(l)).length&&!l.partTargetDuration&&(r=e.reduce((e,t)=>Math.max(e,t.duration),0),i&&(i("manifest has no partTargetDuration defaulting to "+r),$l.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";t=t||this.parseManifest_({url:i,manifestString:e}),t.lastRequest=Date.now(),Xl({playlist:t,uri:i,id:s}),e=td(this.main,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(id(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Yl,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(i,e){if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.main.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.main.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),e);else{const s=this.state;var e=!this.media_||i.id!==this.media_.id,t=this.main.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(id(i,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(i.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=i,this.request=this.vhs_.xhr({uri:i.resolvedUri,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(i.lastRequest=Date.now(),i.resolvedUri=pl(i.resolvedUri,t),e)return this.playlistRequestError(this.request,i,s);this.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=pl(this.src,t);e=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(e)}})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,Kl(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=Ql(t),t.segments.forEach(e=>{Zl(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=Wl(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function rd(e,t,i,s){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),s(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function nd(){function d(e,a){e=P({timeout:45e3},e);var t=d.beforeRequest||b.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||b.Vhs.xhr._requestCallbackSet||new Set;const o=d._responseCallbackSet||b.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(b.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=!0===b.Vhs.xhr.original?cd:b.Vhs.xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);const l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),rd(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestTime=Date.now(),l}return d.original=!0,d}function ad(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function od(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function ld(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function dd(i){const s={};return Object.keys(i).forEach(e=>{var t=i[e];_n(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s}function hd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function ud(e){return e.resolvedUri}const cd=b["xhr"],pd=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;epd(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,fd=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*md)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},yd=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:zl.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{yd({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},_d=(e,t)=>{if(4===e.readyState)return t()},vd=(e,t,r)=>{let s=[],n,a=!1;function o(e,t,i,s){return t.abort(),a=!0,r(e,t,i,s)}function i(e,t){var i;if(!a)return e?o(e,t,"",s):(i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length),s=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;no(e,t,"",s)):o(null,t,i,s))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return rd(e,null,{statusCode:e.status},i)})}},function(e,t){return rd(l,e,t,i)});return l};rr=b.EventTarget;function bd(t,i){if(!ed(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Sd=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=Fo(jo(e),i),s=Do(e.representationInfo);r=wo({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return Kl(r,t,Td),r},wd=(e,t,i)=>{let a=!0,o=P(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=td(o,e.playlists[0],bd))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,Gl(n,(e,t,i,s)=>{s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Ed=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},kd=(e,t)=>{var i={};for(const a in e){var s=e[a].sidx;if(s){var r=mo(s);if(!t[r])break;var n=t[r].sidxInfo;Ed(n,s)&&(i[r]=t[r])}}return i};class Cd extends rr{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.media().attributes.serviceLocation||this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=ml("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(a,s,r){const n=a.sidx&&mo(a.sidx);if(a.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const o=pl(a.sidx.resolvedUri),l=(t,i)=>{if(!this.requestErrored_(t,i,s)){t=this.mainPlaylistLoader_.sidxMapping_;let e;try{e=Qo(T(i.response).subarray(8))}catch(e){return void this.requestErrored_(e,i,s)}return t[n]={sidxInfo:a.sidx,sidx:e},oo(a,e,a.sidx.resolvedUri),r(!0)}};this.request=vd(o,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?l(e,t):i&&"mp4"===i?({offset:r,length:n}=a.sidx.byterange,s.length>=n+r?l(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:ad({byterange:a.sidx.byterange})},l))):l({status:t.status,message:`Unsupported ${i||"unknown"} container type for sidx segment at URL: `+o,response:"",playlist:a,internal:!0,playlistExclusionDuration:1/0,code:2},t)})}else this.mediaRequest_=window.setTimeout(()=>r(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(e,t)=>{if(this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const i=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=pl(this.mainPlaylistLoader_.srcUrl,t),!i)return s(t,i);this.handleMain_(),this.syncClientServerClock_(()=>s(t,i))}})}syncClientServerClock_(s){const r=qo(this.mainPlaylistLoader_.mainXml_);return null===r?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s()):"DIRECT"===r.method?(this.mainPlaylistLoader_.clientOffset_=r.value-Date.now(),s()):void(this.request=this.vhs_.xhr({uri:cl(this.mainPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},(t,i)=>{if(this.request){if(t)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s();let e;e="HEAD"===r.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),s()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=Sd({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=wd(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=kd(e.playlists,r);return Gl(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=P(n,kd(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},id(this.media(),Boolean(i))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]})),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}}var O={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function xd(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}const Id=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),j(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},ce=function(e){return l(d.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),U(e))},$=function(e){e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return l(d.tkhd,e)},J=function(e){var t,i=l(d.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/_e),r=Math.floor(e.baseMediaDecodeTime%_e),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),l(d.trex,t)},pe=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},me=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=pe(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=pe(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?ge:me)(e,t)};function ve(e,t){var i=xe();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function n(e){for(var t=[];e--;)t.push(0);return t}function a(e){e=e||{},a.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new g(0,0),new g(0,1),new g(1,0),new g(1,1)],this.parse708captions_&&(this.cc708Stream_=new m({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function be(e){return 32<=e&&e<=127||160<=e&&e<=255}function o(e){this.windowNum=e,this.reset()}function Te(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new o(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Se(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))}function h(){for(var e=[],t=je+1;t--;)e.push({text:"",indent:0,offset:0});return e}function we(e,t){var i=1;for(t$e;)e+=i*ze;return e}function Ee(e){var t,i;Ee.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=we(e.dts,i),e.pts=we(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var ke,Ce={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:q=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=q(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},xe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ie={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tRe.ONE_SECOND_IN_TS/2))){for(a=(a=Ne()[e.samplerate])||t[0].data,o=0;o=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){for(var t,i=[],s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},o.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},o.prototype.addText=function(e){this.rows[this.rowIdx]+=e},o.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new o(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},m.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),Fe=(m.prototype=new p,m.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},m.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},m.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0("0"+(255&e).toString(16)).slice(-2)).join(""),String.fromCharCode(parseInt(n,16))):(t=Be[r=a|o]||r,4096&r&&r===t?"":String.fromCharCode(t)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(i),e},m.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],i=i[e+2];return e=be(s)&&be(i)?this.handleText(++e,t,{isMultiByte:!0}):e},m.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},m.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],t=(t.setCurrentWindow(7&s),t.currentWindow),s=i[++e];return t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},m.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},m.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},m.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},m.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},m.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},m.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},m.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),je=14,qe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],g=function(e,t){g.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=h()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=h():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=h()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=qe.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Se(t),s+=Se(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},p=(g.prototype=new p,g.prototype.flushDisplayed=function(e){const i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},g.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=h(),this.nonDisplayed_=h(),this.lastControlCode_=null,this.column_=0,this.row_=je,this.rollUpRows_=2,this.formatting_=[]},g.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},g.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},g.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},g.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},g.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},g.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},g.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},g.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},g.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},g.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,a=(a*=4)+(3&n[7]),o.timeStamp=a,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)),t.frames.push(o),(i=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=w.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=w.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new S,Ge.STREAM_TYPES={h264:27,adts:15},(Xe=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Xe.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case w.H264_STREAM_TYPE:e=n,t="video";break;case w.ADTS_STREAM_TYPE:e=a,t="audio";break;case w.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new S,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:st,TransportParseStream:Ge,ElementaryStream:Xe,TimestampRolloverStream:Ve,CaptionStream:it.CaptionStream,Cea608Stream:it.Cea608Stream,Cea708Stream:it.Cea708Stream,MetadataStream:b});for(Ke in w)w.hasOwnProperty(Ke)&&(rt[Ke]=w[Ke]);var nt,at,S=rt,Ve=i,ot=c.ONE_SECOND_IN_TS,lt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],dt=function(l){var d,h=0;dt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*ot/lt[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:lt[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},it=(dt.prototype=new Ve,dt),b=i,ht=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},ut=function(){var s,r,n=0;ut.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},gt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=mt(e,t),gt(e,t))},ft=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:mt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+ct(e.subarray(10,14)));do{if((t=ct(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=yt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;i=n.length-r,n=0i.pts?l++:(t++,n-=s.byteLength,a-=s.nalCount,o-=s.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=n,r.duration=o,r.nalCount=a,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,s,r,n=d.length-1,a=e.length-1,o=null,l=!1;0<=n&&0<=a;){if(t=d[n],i=e[a],t.pts===i.pts){l=!0;break}t.pts>i.pts?n--:(n===d.length-1&&(o=a),a--)}return l||null!==o?0===(s=l?a:o)?e:(r=(s=e.slice(s)).reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0}),s.byteLength=r.byteLength,s.duration=r.duration,s.nalCount=r.nalCount,s.pts=s[0].pts,s.dts=s[0].dts,s):null},this.alignGopsWith=function(e){d=e}}).prototype=new E,((k=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,k.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new E).flush=function(e){var t,i,s,r=0,n={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Pt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Lt.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=C.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},k.prototype.setRemux=function(e){this.remuxTracks=e},(wt=function(s){var r,n,a=this,i=!0;wt.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new A.MetadataStream,t.aacStream=new It,t.audioTimestampRolloverStream=new A.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new A.TimestampRolloverStream("timed-metadata"),t.adtsStream=new Ct,t.coalesceStream=new k(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Nt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new A.MetadataStream,i.packetStream=new A.TransportPacketStream,i.parseStream=new A.TransportParseStream,i.elementaryStream=new A.ElementaryStream,i.timestampRolloverStream=new A.TimestampRolloverStream,i.adtsStream=new Ct,i.h264Stream=new xt,i.captionStream=new A.CaptionStream(s),i.coalesceStream=new k(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new St(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Nt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,I.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,I.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=At(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new E;function Rt(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Mt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function Vt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}var zt=wt,i=function(e){return e>>>0},De=function(e){return("00"+e.toString(16)).slice(-2)},$t=i,Wt=Rt,Gt=i,Xt=s.getUint64,Kt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Le="undefined"!=typeof window?window:"undefined"!=typeof fe?fe:"undefined"!=typeof self?self:{},S=Le,Yt=Oe.discardEmulationPreventionBytes,Qt=p.CaptionStream,D=Mt,Jt=Ut,Zt=Bt,ei=Ft,ti=S,ii=function(e,h){var i=D(e,["moof","traf"]),e=D(e,["mdat"]),u={},s=[];return e.forEach(function(e,t){t=i[t];s.push({mdat:e,traf:t})}),s.forEach(function(e){var t,i,s,r,n,a=e.mdat,e=e.traf,o=D(e,["tfhd"]),o=ei(o[0]),l=o.trackId,d=D(e,["tfdt"]),d=0>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),P(e,["mdia","mdhd"])[0]);s&&(i.timescale=pi(s)),n.push(i)}),n},fi=function(e,i=0){return P(e,["emsg"]).map(e=>{var e=di.parseEmsgBox(new Uint8Array(e)),t=ci(e.message_data);return{cueTime:di.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:di.scaleTime(e.event_duration,e.timescale),frames:t}})},yi=He,_i=He,O=Ye,N={},R=(N.ts={parseType:function(e,t){e=jt(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=qt(e),i=4+Ht(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=qt(e),s=4+Ht(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ht(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=N.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=N.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=N.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=R/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in vi(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case _i.H264_STREAM_TYPE:s.video=[],Ti(e,i,s),0===s.video.length&&delete s.video;break;case _i.ADTS_STREAM_TYPE:s.audio=[],bi(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=O(e.dts,s),e.pts=O(e.pts,s),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=O(e.dts,r),e.pts=O(e.pts,r),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=O(t.dts,r),t.pts=O(t.pts,r),t.dtsTime=t.dts/R,t.ptsTime=t.pts/R),e):null};class wi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new zt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new si,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=mi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=gi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=fi(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*c.ONE_SECOND_IN_TS,t=Si(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(c.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new wi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new wi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));const Od=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},Nd=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},Rd=(e,t)=>{t.gopInfo=e.data.gopInfo},Md=t=>{const{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=t,_={buffer:[]};let v=y;var b,T;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&Od(e,_,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&Rd(e,_),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(v=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||v||(i.onmessage=null,Nd({transmuxedData:_,callback:m}),Ud(i))},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(b=e instanceof ArrayBuffer?e:e.buffer,T=e instanceof ArrayBuffer?0:e.byteOffset,i.postMessage({action:"push",data:b,byteOffset:T,byteLength:e.byteLength},[b])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},Ud=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Md(e.currentTransmux))},Bd=(e,t)=>{e.postMessage({action:t}),Ud(e)},Fd=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(Bd.bind(null,t,e)):(t.currentTransmux=e,Bd(t,e))};const jd=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,Md(e))};var qd=e=>{Fd("reset",e)},Hd=(jd,e=>{const t=new Pd,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function Vd(t){const i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=yi({},t,{endAction:null,transmuxer:null,callback:null});const a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)}function zd(e){let t=0;return e.audio&&t++,e.video&&t++,t}function $d(e,t){var i=t.attributes||{},s=lh(function(e){e=e.attributes||{};if(e.CODECS)return pn(e.CODECS)}(t)||[]);return!oh(e,t)||s.audio||((e,t)=>{if(!oh(e,t))return!0;var t=t.attributes||{},i=e.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1})(e,t)||(t=lh(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return pn(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function Wd(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Gd(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}const Xd={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Kd=e=>{e.forEach(e=>{e.abort()})},Yd=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),Qd=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Jd=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Xd.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Xd.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Xd.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Xd.FAILURE,xhr:t}:null,Zd=(r,n,a)=>(e,t)=>{var i=t.response,e=Jd(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:Xd.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=Xo(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: `+e,code:Xd.FAILURE});Vd({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},th=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{var p=i.map&&i.map.tracks||{};const m=Boolean(p.audio&&p.video);let g=e.bind(null,i,"audio","start");const f=e.bind(null,i,"audio","end");let y=e.bind(null,i,"video","start");const _=e.bind(null,i,"video","end");Vd({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:m}),s=null),jd({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:m,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(m&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{g&&"undefined"!=typeof e.start&&(g(e.start),g=null),f&&"undefined"!=typeof e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&"undefined"!=typeof e.start&&(y(e.start),y=null),_&&"undefined"!=typeof e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:e=>{u&&(e.type="combined"===e.type?"video":e.type,u(null,i,e))}})}})},ih=({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{let p=new Uint8Array(s);if(m=p,0{h(i,{data:p,type:f.hasAudio&&!f.isMuxed?"audio":"video"}),t&&t.length&&a(i,t),e&&e.length&&o(i,e),u(null,i,{})});void Vd({action:"probeMp4StartTime",timescales:i.map.timescales,data:p,transmuxer:i.transmuxer,callback:({data:e,startTime:t})=>{s=e.buffer,i.bytes=p=e,f.hasAudio&&!f.isMuxed&&r(i,"audio","start",t),f.hasVideo&&r(i,"video","start",t),Vd({action:"probeEmsgID3",data:p,transmuxer:i.transmuxer,offset:t,callback:({emsgData:e,id3Frames:t})=>{s=e.buffer,i.bytes=p=e,g.video&&e.byteLength&&i.transmuxer?Vd({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:p,timescales:i.map.timescales,trackIds:[g.video.id],callback:e=>{s=e.data.buffer,i.bytes=p=e.data,e.logs.forEach(function(e){c(P(e,{stream:"mp4CaptionParser"}))}),y(e.captions,t)}}):y(void 0,t)}})}})}else{var m;i.transmuxer?("undefined"==typeof i.container&&(i.container=Xo(p)),"ts"!==i.container&&"aac"!==i.container?(e(i,{hasAudio:!1,hasVideo:!1}),u(null,i,{})):th({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})):u(null,i,{})}},sh=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s},r){const n=e=>{e.data.source===t&&(s.removeEventListener("message",n),e=e.data.decrypted,r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.addEventListener("message",n);let a;a=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(dd({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},rh=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{sh({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,ih({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})})},nh=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[];var _,v,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})=>{let f=0,y=!1;return(e,t)=>{if(!y){if(e)return y=!0,Kd(s),m(e,t);if((f+=1)===s.length){const i=function(){if(t.encryptedBytes)return rh({decryptionWorker:r,segment:t,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g});ih({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})};if(t.endOfAllRequests=Date.now(),t.map&&t.map.encryptedBytes&&!t.map.bytes)return sh({decryptionWorker:r,id:t.requestId+"-init",encryptedBytes:t.map.encryptedBytes,key:t.map.key},e=>{t.map.bytes=e,eh(t,e=>{if(e)return Kd(s),m(e,t);i()})});i()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f}),u=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=e(P(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),Zd(s,a,i)),y.push(o)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(l=e(P(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),Zd(s,[s.map.key],i)),y.push(l)),d=P(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:ad(s.map)}),{segment:_,finishProcessingFn:v}=[{segment:s,finishProcessingFn:i}][0],h=e(d,(e,t)=>{var e=Jd(e,t);return e?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void eh(_,function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))}),y.push(h)),P(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:ad(s)}));({segment:b,finishProcessingFn:T,responseType:S}={segment:s,finishProcessingFn:i,responseType:u.responseType});var b,T,S,w,E,c=e(u,(e,t)=>{var e=Jd(e,t);return e?T(e,b):(e="arraybuffer"!==S&&t.responseText?Id(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=Yd(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b))});c.addEventListener("progress",({segment:w,progressFn:E}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return w.stats=P(w.stats,Qd(e)),!w.stats.firstBytesReceivedAt&&w.stats.bytesReceived&&(w.stats.firstBytesReceivedAt=Date.now()),E(e,w)})),y.push(c);const k={};return y.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:k,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>Kd(y)},ah=ml("CodecUtils"),oh=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},lh=function(e){const s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(cn(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),n=(uh(r,(e,t)=>e.bandwidth-t.bandwidth),(r=r.filter(e=>!zl.isIncompatible(e.playlist))).filter(e=>zl.isEnabled(e.playlist)));o=(n=n.length?n:r.filter(e=>!zl.isDisabled(e.playlist))).filter(e=>e.bandwidth*O.BANDWIDTH_VARIANCEe.bandwidth===a.bandwidth)[0];if(!1===h){const g=p||n[0]||r[0];if(g&&g.playlist){let e=p?"bandwidthBestRep":"sortedPlaylistReps";return n[0]&&(e="enabledPlaylistReps"),dh(`choosing ${hh(g)} using ${e} with options`,c),g.playlist}}else{var m,h=o.filter(e=>e.width&&e.height),o=(uh(h,(e,t)=>e.width-t.width),h.filter(e=>e.width===l&&e.height===d)),o=(a=o[o.length-1],o.filter(e=>e.bandwidth===a.bandwidth)[0]);let t,i;o||(m=(t=h.filter(e=>e.width>l||e.height>d)).filter(e=>e.width===t[0].width&&e.height===t[0].height),a=m[m.length-1],i=m.filter(e=>e.bandwidth===a.bandwidth)[0]);let s;u.leastPixelDiffSelector&&(m=h.map(e=>(e.pixelDiff=Math.abs(e.width-l)+Math.abs(e.height-d),e)),uh(m,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=m[0]);const g=s||i||o||p||n[0]||r[0];if(g&&g.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":o?e="resolutionBestRep":p?e="bandwidthBestRep":n[0]&&(e="enabledPlaylistReps"),dh(`choosing ${hh(g)} using ${e} with options`,c),g.playlist}}return dh("could not choose a playlist with options",c),null}}function ph(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return ch(this.playlists.main,this.systemBandwidth,parseInt(Wd(this.tech_.el(),"width"),10)*e,parseInt(Wd(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function mh(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const gh=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:r})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach(e=>{const s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new a(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return b.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return b.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return b.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),o.addCue(i)})}),o.cues)&&o.cues.length){var s=o.cues,n=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),d=Object.keys(l).sort((e,t)=>Number(e)-Number(t));d.forEach((e,t)=>{var e=l[e],i=isFinite(r)?r:0;const s=Number(d[t+1])||i;e.forEach(e=>{e.endTime=s})})}}},fh={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},yh=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),_h=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,b.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},vh=e=>"number"==typeof e&&isFinite(e),bh=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?Dl({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Th=e=>e+"TimingInfo",Sh=(e,t)=>e.length?e.end(e.length-1):t,wh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Eh=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Sl,kh=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&sthis.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=ml(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return Hd({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&qd(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return gl();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=hd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=ud(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&qd(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n=()=>{0===--e&&s()};!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,n)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*ul),n=Math.ceil((e-s)*ul),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,n));for(const a in this.inbandTextTracks_)mh(t,i,this.inbandTextTracks_[a]);mh(t,i,this.segmentMetadataTrack_),n()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),t=_l(e)||0,e=vl(e,this.currentTime_()),i=!this.hasPlayed_()&&1<=e,s=e>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},i.isSyncRequest?i.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,r,t):null!==this.mediaIndex?(s=r[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1,i.startOfSegment=s.end||t,s.parts&&s.parts[a+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=a+1):i.mediaIndex=this.mediaIndex+1):({segmentIndex:s,startTime:a,partIndex:o}=zl.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),i.mediaIndex=s,i.startOfSegment=a,i.partIndex=o),t=r[i.mediaIndex];let n=t&&"number"==typeof i.partIndex&&t.parts&&t.parts[i.partIndex];if(!t||"number"==typeof i.partIndex&&!n)return null;"number"!=typeof i.partIndex&&t.parts&&(i.partIndex=0,n=t.parts[0]);var a,o,s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e=(e||!n||s||n.independent||(0===i.partIndex?(o=(a=r[i.mediaIndex-1]).parts&&a.parts.length&&a.parts[a.parts.length-1])&&o.independent&&(--i.mediaIndex,i.partIndex=a.parts.length-1,i.independent="previous segment"):t.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part")),this.mediaSource_&&"ended"===this.mediaSource_.readyState);return i.mediaIndex>=r.length-1&&e&&!this.seeking_()?null:this.generateSegmentInfo_(i)}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:n}),_l(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*ul);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,calculateTimestampOffsetForEachSegment:r,overrideCheck:n}=[e][0],r?Sh(s,i):n||e!==t?e!zl.isIncompatible(e));let d=e.filter(zl.isEnabled);var e=(d=d.length?d:e.filter(e=>!zl.isDisabled(e))).filter(zl.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:zl.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return uh(h,(e,t)=>Gd(t.playlist,e.playlist)),h.length?h[0]:(uh(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=Sl&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{p[e.stream]=p[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=p[e.stream];t.startTime=Math.min(t.startTime,e.startTime+c),t.endTime=Math.max(t.endTime,e.endTime+c),t.captions.push(e)}),Object.keys(p).forEach(e=>{var{startTime:t,endTime:i,captions:s}=p[e],r=this.inbandTextTracks_,n=(this.logger_(`adding cues from ${t} -> ${i} for `+e),r),a=this.vhs_.tech_,o=e;if(!n[o]){a.trigger({type:"usage",name:"vhs-608"});let s=o;/^cc708_/.test(o)&&(s="SERVICE"+o.split("_")[1]);var l=a.textTracks().getTrackById(s);if(l)n[o]=l;else{let e=o,t=o,i=!1;l=(a.options_.vhs&&a.options_.vhs.captionServices||{})[s];l&&(e=l.label,t=l.language,i=l.default),n[o]=a.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}mh(t,i,r[e]);var{inbandTextTracks:d,captionArray:l,timestampOffset:h}={captionArray:s,inbandTextTracks:r,timestampOffset:c};if(l){const u=window.WebKitDataCue||window.VTTCue;l.forEach(i=>{const s=i.stream;i.content?i.content.forEach(e=>{var t=new u(i.startTime+h,i.endTime+h,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",d[s].addCue(t)}):d[s].addCue(new u(i.startTime+h,i.endTime+h,i.text))})}}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&wh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||wh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Th(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,e)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=hd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):this.loadQueue_.push(()=>{var e=yi({},t,{forceTimestampOffset:!0});yi(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)})}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_(bh(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-O.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=kh(e,this.sourceType_))&&("warn"===t.severity?b.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+bh(e)):(this.logger_("Appended "+bh(e)),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+bh(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,vh(t))&&vh(i)&&(mh(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}set replaceSegmentsUntil(e){this.logger_("Replacing currently buffered segments until "+e),this.replaceSegmentsUntil_=e}}function xh(){}function Ih(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}const Ah=["video","audio"],Dh=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},Lh=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),Lh("audio",s),Lh("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!Dh(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=Ih(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},Oh=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Nh={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(Oh(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(Oh(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];Oh(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){b.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){b.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(Oh(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){b.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=Ih(s),i=mn(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(Ph(i,e),Oh(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){b.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:r=>(e,t)=>{var i=t[e+"Buffer"],s=mn(r);Oh(t.mediaSource,i)&&t.codecs[e]!==r&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to `+r),i.changeType(s),t.codecs[e]=r)}},Rh=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),Lh(e,t)},Mh=(i,s)=>e=>{var t=function(t){let i="";for(let e=0;e ${r})`}return i||"empty"}(s[i+"Buffered"]());s.logger_(i+` source buffer update end. Buffered: `,t),s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),Lh(i,s)};class Uh extends b.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Lh("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=ml("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Mh("video",this),this.onAudioUpdateEnd_=Mh("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Rh({type:"mediaSource",sourceUpdater:this,action:Nh.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Rh({type:e,sourceUpdater:this,action:Nh.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?Rh({type:"mediaSource",sourceUpdater:this,action:Nh.removeSourceBuffer(e),name:"removeSourceBuffer"}):b.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!b.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?Rh({type:e,sourceUpdater:this,action:Nh.changeType(t),name:"changeType"}):b.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(e=t,Rh({type:s,sourceUpdater:this,action:Nh.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return Oh(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||gl()}videoBuffered(){return Oh(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||gl()}buffered(){var e=Oh(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Oh(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(t&&!e)return this.audioBuffered();if(e&&!t)return this.videoBuffered();{var r=this.audioBuffered();var n=this.videoBuffered();let e=null,t=null,i=0;var a=[],o=[];if(!(r&&r.length&&n&&n.length))return gl();let s=r.length;for(;s--;)a.push({time:r.start(s),type:"start"}),a.push({time:r.end(s),type:"end"});for(s=n.length;s--;)a.push({time:n.start(s),type:"start"}),a.push({time:n.end(s),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),s=0;s{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"](()=>Ph(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Bh=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Fh=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class jh extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qh extends Ch{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?gl([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):gl()}initSegmentForMap(e,t=!1){if(!e)return null;var i=hd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=Fh.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(Fh,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return"undefined"!=typeof e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){mh(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE"):this.loadSegment_(e))}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(this.subtitlesTrack_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===Xd.TIMEOUT&&this.handleTimeout_(),e.code===Xd.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));else{r.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest)this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";else{s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)});var n=this.subtitlesTrack_,a=n.cues;if(a){var o={};for(let e=a.length-1;0<=e;e--){var l=a[e],d=`${l.startTime}-${l.endTime}-`+l.text;o[d]?n.removeCue(l):o[d]=l}}this.handleAppendsDone_()}}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(t){let e,i=!1;if("function"!=typeof window.WebVTT)throw new jh;"function"==typeof window.TextDecoder?e=new window.TextDecoder("utf8"):(e=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,e);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=t.cues.push.bind(t.cues),s.ontimestampmap=e=>{t.timestampmap=e},s.onparsingerror=e=>{b.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){let e=t.segment.map.bytes;i&&(e=Bh(e)),s.parse(e)}let r=t.bytes;i&&(r=Bh(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){var s=e.segment;if(t)if(e.cues.length){var r=e.timestampmap;const n=r.MPEGTS/ul-r.LOCAL+t.mapping;e.cues.forEach(e=>{e.startTime+=n,e.endTime+=n}),i.syncInfo||(r=e.cues[0].startTime,t=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,t-s.duration)})}else s.empty=!0}}const Hh=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Il(i);r=r||0;for(let e=0;e{let n=null,a=null;r=r||0;var o=Il(t);for(let e=0;e=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class Vh extends b.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=ml("SyncController")}getSyncPoint(e,t,i,s){e=this.runStrategies_(e,t,i,s);return e.length?this.selectSyncPoint_(e,{key:"time",value:s}):null}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+bl({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(t,i,s,r){var n=[];for(let e=0;eo){let e;e=a<0?s.start-bl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+bl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class zh extends b.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var $h=Ad(Dd(Ld(function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);const a=new Uint8Array(e.byteLength);let o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const Wh=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Gh=(e,t)=>{(t.activePlaylistLoader=e).load()},Xh={AUDIO:(a,o)=>()=>{var{segmentLoaders:{[a]:e},mediaTypes:{[a]:t},excludePlaylist:i}=o,e=(Wh(e,t),t.activeTrack()),s=t.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=t.tracks[s];if(e===r)i({error:{message:"Problem encountered loading the default audio track."}});else{b.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in t.tracks)t.tracks[n].enabled=t.tracks[n]===r;t.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s,e=(b.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Wh(e,t),t.activeTrack());e&&(e.mode="disabled"),t.onTrackChanged()}},Kh={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Xh[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Xh[e](e,i))}},Yh={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=Vl(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new sd(e.playlists[0],n,o):e.resolvedUri?new sd(e.resolvedUri,n,o):e.playlists&&"dash"===a?new Cd(e.playlists[0],n,o,c):null,e=P({id:g,playlistLoader:t},e),Kh[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new b.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),h[g]=r)}}e.on("error",Xh[i](i,s))},SUBTITLES:(i,s)=>{var r,{tech:n,vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u}},mainPlaylistLoader:c}=s;for(const p in d[i]){h[p]||(h[p]=[]);for(const m in d[i][p])if(a.options_.useForcedSubtitles||!d[i][p][m].forced){let e=d[i][p][m],t;if("hls"===o)t=new sd(e.resolvedUri,a,l);else if("dash"===o){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new Cd(e.playlists[0],a,l,c)}else"vhs-json"===o&&(t=new sd(e.playlists?e.playlists[0]:e.resolvedUri,a,l));e=P({id:m,playlistLoader:t},e),Kh[i](i,e.playlistLoader,s),h[p].push(e),"undefined"==typeof u[m]&&(r=n.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,u[m]=r)}}e.on("error",Xh[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const l in s[e]){r[l]||(r[l]=[]);for(const d in s[e][l]){var a=s[e][l][d];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:d,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?P(e,o[e.instreamId]):e).default&&delete e.default,r[l].push(P({id:d},a)),"undefined"==typeof n[d]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,n[d]=o)}}}}},Qh=(t,i)=>{for(let e=0;e()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if(e[t].enabled)return e[t];return null},SUBTITLES:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if("showing"===e[t].mode||"hidden"===e[t].mode)return e[t];return null}},Zh=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{Yh[e](e,n)});const{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=Jh[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,Wh(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),Gh(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Wh(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),Gh(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n["mediaTypes"]],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o=a.AUDIO.activeGroup();o&&(o=(o.filter(e=>e.default)[0]||o[0]).id,a.AUDIO.tracks[o].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});const l=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};t.audioTracks().addEventListener("change",l),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",l),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio");for(const d in a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[d])};let eu;const tu=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class iu extends b.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e["maxPlaylistRetries"];null!==m&&"undefined"!=typeof m||(m=1/0),eu=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:xh,activeTrack:xh,getActiveGroup:xh,onGroupChanged:xh,onTrackChanged:xh,lastTrack_:null,logger_:ml(`MediaGroups[${e}]`)}}),t})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=gl(),this.hasPlayed_=!1,this.syncController_=new Vh(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new $h,this.sourceUpdater_=new Uh(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new zh;var g={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},g=(this.mainPlaylistLoader_="dash"===this.sourceType_?new Cd(t,this.vhs_,P(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sd(t,this.vhs_,P(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ch(P(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ch(P(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qh(P(g,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),tu.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=ml("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(g,()=>{const e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e.id||e.uri;s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n=i.main||s.length&&i[s[0]];for(const d in n)if(n[d].default){r={label:d};break}}if(!r)return e;var a=[];for(const h in i)if(i[h][r.label]){var o=i[h][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Zh({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;e=Object.keys(i.AUDIO);for(const r in i.AUDIO)for(const n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),eu.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!i)return l(d+" as current playlist is not set"),!0;if(s.id!==i.id){var h=Boolean(fl(e,t).length);if(!i.endList)return h||"number"!=typeof i.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=vl(e,t),e=o?O.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:O.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${t} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else b.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments())}resetMainLoaderReplaceSegments(){var e=this.tech_.buffered(),e=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=e,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=eu.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=wl&&e-i<=wl:e-t<=wl)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(Bl),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return b.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(b.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});var a,r=this.selectPlaylist();if(r)return i=t.internal?this.logger_:b.log.warn,a=t.message?" "+t.message:"",i(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+a+` Switching to playlist ${r.id}.`),r.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),r.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),i=r.targetDuration/2*1e3||5e3,a="number"==typeof r.lastRequest&&Date.now()-r.lastRequest<=i,this.switchMedia_(r,"exclude",n||a);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){const s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=fl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:eu.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=eu.Playlist.seekable(s,r,eu.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=eu.Playlist.seekable(s,r,eu.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=gl([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){const r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=$d(this.main(),t);const n={};var i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(n.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(n.video+=","+(e.audio||r.main.audioCodec||gn)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(n.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||gn,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),n.audio||n.video){const a={};let s;if(["video","audio"].forEach(function(e){var t,i;n.hasOwnProperty(e)&&(t=r[e].isFmp4,i=n[e],!(t?sn:rn)(i))&&(t=r[e].isFmp4?"browser":"muxer",a[t]=a[t]||[],a[t].push(n[e]),"audio"===e&&(s=t))}),i&&s&&t.attributes.AUDIO){const o=t.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===o&&e!==t&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${o} as ${s} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const l=[];if(["video","audio"].forEach(e=>{var t=(pn(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(pn(n[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push(`"${this.sourceUpdater_.codecs[e]}" -> "${n[e]}"`)}),l.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${l.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}e=Object.keys(a).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=$d(this.main,e)).audio||rn(t.audio)||sn(t.audio)||i.push("audio codec "+t.audio),!t.video||rn(t.video)||sn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){const r=[],n=this.main().playlists;e=lh(pn(e));const a=zd(e),o=e.video&&pn(e.video)[0]||null,l=e.audio&&pn(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=$d(this.mainPlaylistLoader_.main,e),i=zd(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&pn(s.video)[0]||null,s=s.audio&&pn(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var s=this.seekable(),[r,n,s=0]=(s.length&&(t=s.start(0)),[e,this.cueTagsTrack_,t]);if(r.segments){let t=s,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(n,t+l.duration/2)){if("cueIn"in l){i.endTime=t,i.adEndTime=t,t+=l.duration,i=null;continue}if(t{for(const i of Object.keys(e)){var t;yh.has(i)||((t=new r(e.startTime,e.endTime,"")).id=e.id,t.type="com.apple.quicktime.HLS",t.value={key:fh[i],data:e[i]},"scte35Out"!==i&&"scte35In"!==i||(t.value.data=new Uint8Array(t.value.data.match(/[\da-f]{2}/gi)).buffer),s.addCue(t))}e.processDateRange()})}}}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();_h(this.inbandTextTracks_,e,this.tech_),gh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}}class su{constructor(e,t,i){var s,r,n,a,o=e["playlistController_"],l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=$d(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=Ul(t),s=Bl(t);return"undefined"==typeof e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const ru=["seeking","seeked","pause","playing","error"];class nu{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=ml("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(ru,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(ru,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:wl)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${kl(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-Sl),o=[r,s];for(let e=0;e ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=yl(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+wl;var n=!i.endList,a="number"==typeof i.partTargetDuration;return t>(r=n&&(a||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){s&&t.currentTime(s)});t.on("error",n),t.on("dispose",a),t.reloadSourceOnError=function(e){a(),ou(t,e)}};function lu(t,e){var i=e.media();let s=-1;for(let e=0;eGd(e,t)),e.filter(e=>!!$d(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:ph,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return b.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),O[t]},set(e){b.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?b.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):O[t]=e}})}),"videojs-vhs"),hu=(N.canPlaySource=function(){return b.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));const n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),uu=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=lh(pn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r=mn(s.video),n=mn(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return P(e,a)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(b.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},cu=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(du);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},pu=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},mu=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},gu=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},fu=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const t=document.createElement("video");return!!b.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&b.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return b.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){pu(N.xhr,e)},N.xhr.onResponse=function(e){mu(N.xhr,e)},N.xhr.offRequest=function(e){gu(N.xhr,e)},N.xhr.offResponse=function(e){fu(N.xhr,e)};class yu extends b.getComponent("Component"){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=ml("VhsHandler"),t.options_&&t.options_.playerId&&(i=b.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=cu())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=O.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===O.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=nn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new iu(this.options_),e=P({liveRangeSafeTimeDelta:wl},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new nu(e),this.playlistController_.on("error",()=>{var e=b.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Cl(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Cl(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=cu())?P(t,e):e;try{window.localStorage.setItem(du,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=Vl(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!Ul(e)).map((e,t)=>new su(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),hu({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=uu({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{if("output-restricted"===e.status){e=this.playlistController_.main();if(e&&e.playlists){const t=[];e.playlists.forEach(e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))}),t.length&&(b.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=b.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),lu(t,e.playlists)}),this.playlists.on("mediachange",()=>{lu(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.6.0","mux.js":"7.0.0","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return Uh.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return fd({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return yd({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{pu(this.xhr,e)},this.xhr.onResponse=e=>{mu(this.xhr,e)},this.xhr.offRequest=e=>{gu(this.xhr,e)},this.xhr.offResponse=e=>{fu(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const _u={name:"videojs-http-streaming",VERSION:"3.6.0",canHandleSource(e,t={}){t=P(b.options,t);return _u.canPlayType(e.type,t)},handleSource(e,t,i={}){i=P(b.options,i);return t.vhs=new yu(e,t,i),t.vhs.xhr=nd(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=nn(e);return e&&(t=_u.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(b.browser.IS_ANY_SAFARI||b.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return sn("avc1.4d400d,mp4a.40.2")&&b.getTech("Html5").registerSourceHandler(_u,0),b.VhsHandler=yu,b.VhsSourceHandler=_u,b.Vhs=N,b.use||b.registerComponent("Vhs",N),b.options.vhs=b.options.vhs||{},b.getPlugin&&b.getPlugin("reloadSourceOnError")||b.registerPlugin("reloadSourceOnError",function(e){ou(this,e)}),b}); \ No newline at end of file +/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */s(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))})}static get STEP(){return 32e3}decryptChunk_(t,i,s,r){return function(){var e=function(e,t,i){var s,r,n,a,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const Wh=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Gh=(e,t)=>{(t.activePlaylistLoader=e).load()},Xh={AUDIO:(a,o)=>()=>{var{mediaTypes:{[a]:e},excludePlaylist:t}=o,i=e.activeTrack(),s=e.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=e.tracks[s];if(i===r)t({error:{message:"Problem encountered loading the default audio track."}});else{b.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in e.tracks)e.tracks[n].enabled=e.tracks[n]===r;e.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{[i]:e}=s["mediaTypes"],t=(b.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),e.activeTrack());t&&(t.mode="disabled"),e.onTrackChanged()}},Kh={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Xh[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Xh[e](e,i))}},Yh={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=Vl(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new sd(e.playlists[0],n,o):e.resolvedUri?new sd(e.resolvedUri,n,o):e.playlists&&"dash"===a?new Cd(e.playlists[0],n,o,c):null,e=P({id:g,playlistLoader:t},e),Kh[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new b.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),h[g]=r)}}e.on("error",Xh[i](i,s))},SUBTITLES:(i,s)=>{var r,{tech:n,vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u}},mainPlaylistLoader:c}=s;for(const p in d[i]){h[p]||(h[p]=[]);for(const m in d[i][p])if(a.options_.useForcedSubtitles||!d[i][p][m].forced){let e=d[i][p][m],t;if("hls"===o)t=new sd(e.resolvedUri,a,l);else if("dash"===o){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new Cd(e.playlists[0],a,l,c)}else"vhs-json"===o&&(t=new sd(e.playlists?e.playlists[0]:e.resolvedUri,a,l));e=P({id:m,playlistLoader:t},e),Kh[i](i,e.playlistLoader,s),h[p].push(e),"undefined"==typeof u[m]&&(r=n.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,u[m]=r)}}e.on("error",Xh[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const l in s[e]){r[l]||(r[l]=[]);for(const d in s[e][l]){var a=s[e][l][d];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:d,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?P(e,o[e.instreamId]):e).default&&delete e.default,r[l].push(P({id:d},a)),"undefined"==typeof n[d]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,n[d]=o)}}}}},Qh=(t,i)=>{for(let e=0;e()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if(e[t].enabled)return e[t];return null},SUBTITLES:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if("showing"===e[t].mode||"hidden"===e[t].mode)return e[t];return null}},Zh=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{Yh[e](e,n)});const{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=Jh[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,Wh(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),Gh(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Wh(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),Gh(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n["mediaTypes"]],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o=a.AUDIO.activeGroup();o&&(o=(o.filter(e=>e.default)[0]||o[0]).id,a.AUDIO.tracks[o].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});const l=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};t.audioTracks().addEventListener("change",l),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",l),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio");for(const d in a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[d])};class eu{constructor(){this.priority_=[]}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=cl(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}}class tu extends b.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new eu,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.logger_=ml("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var i=t.serverUri||t.serverURL;i?i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=this.queryBeforeStart?i:cl(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart||!1,this.proxyServerUrl_=t.proxyServerURL||null,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"),this.queryBeforeStart&&this.requestSteeringManifest(this.steeringManifest.reloadUri)):(this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error"))}requestSteeringManifest(e){var t=this.steeringManifest.reloadUri;if(e||t){const i=e||this.getRequestURI(t);i?this.request_=this.xhr_({uri:i},(e,t)=>{if(e)return 410===t.status?(this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i)):429===t.status?(t=t.responseHeaders["retry-after"],this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${t} seconds.`),void this.startTTLTimeout_(parseInt(t,10))):(this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_());t=JSON.parse(this.request_.responseText);this.startTTLTimeout_(),this.assignSteeringProperties_(t)}):(this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose())}}setProxyServerUrl_(e){var e=new window.URL(e),t=new window.URL(this.proxyServerUrl_);return t.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(t.toString())}decodeDataUriManifest_(e){e=JSON.parse(window.atob(e));this.assignSteeringProperties_(e)}setSteeringParams_(e){var t,e=new window.URL(e),i=this.getPathway(),s=this.getBandwidth_();return i&&(t=`_${this.manifestType_}_pathway`,e.searchParams.set(t,i)),s&&(t=`_${this.manifestType_}_throughput`,e.searchParams.set(t,s)),e.toString()}assignSteeringProperties_(e){var t;this.steeringManifest.version=e.VERSION,this.steeringManifest.version?(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose()),t=(e=>{for(const t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority),this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))):(this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;var t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!t(i))return i}i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=window.setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){window.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new eu}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}}let iu;const su=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class ru extends b.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e["maxPlaylistRetries"];null!==m&&"undefined"!=typeof m||(m=1/0),iu=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:xh,activeTrack:xh,getActiveGroup:xh,onGroupChanged:xh,onTrackChanged:xh,lastTrack_:null,logger_:ml(`MediaGroups[${e}]`)}}),t})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=gl(),this.hasPlayed_=!1,this.syncController_=new Vh(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new $h,this.sourceUpdater_=new Uh(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new zh;var g={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},g=(this.mainPlaylistLoader_="dash"===this.sourceType_?new Cd(t,this.vhs_,P(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sd(t,this.vhs_,P(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ch(P(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ch(P(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qh(P(g,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new tu(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),su.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=ml("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(g,()=>{const e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e.id||e.uri;s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{var t=this.mediaTypes_[e],t=t?t.activeGroup():null;const i=this.contentSteeringController_.getPathway();t&&i&&(t=(t.length?t[0]:t).playlists.filter(e=>e.attributes.serviceLocation===i)).length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n=i.main||s.length&&i[s[0]];for(const d in n)if(n[d].default){r={label:d};break}}if(!r)return e;var a=[];for(const h in i)if(i[h][r.label]){var o=i[h][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Zh({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;e=Object.keys(i.AUDIO);for(const r in i.AUDIO)for(const n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),iu.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!i)return l(d+" as current playlist is not set"),!0;if(s.id!==i.id){var h=Boolean(fl(e,t).length);if(!i.endList)return h||"number"!=typeof i.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=vl(e,t),e=o?O.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:O.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${t} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else b.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments())}resetMainLoaderReplaceSegments(){var e=this.tech_.buffered(),e=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=e,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=iu.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=wl&&e-i<=wl:e-t<=wl)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(Bl),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return b.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){const o=this.pathwayAttribute_(s);var a=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(o),this.excludeThenChangePathway_(),void setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(o)},a)}let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(b.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});a=this.selectPlaylist();if(a)return r=t.internal?this.logger_:b.log.warn,i=t.message?" "+t.message:"",r(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+i+` Switching to playlist ${a.id}.`),a.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),a.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),r=a.targetDuration/2*1e3||5e3,i="number"==typeof a.lastRequest&&Date.now()-a.lastRequest<=r,this.switchMedia_(a,"exclude",n||i);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){const s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=fl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:iu.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=iu.Playlist.seekable(s,r,iu.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=iu.Playlist.seekable(s,r,iu.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=gl([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){const r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=$d(this.main(),t);const n={};var i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(n.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(n.video+=","+(e.audio||r.main.audioCodec||gn)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(n.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||gn,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),n.audio||n.video){const a={};let s;if(["video","audio"].forEach(function(e){var t,i;n.hasOwnProperty(e)&&(t=r[e].isFmp4,i=n[e],!(t?sn:rn)(i))&&(t=r[e].isFmp4?"browser":"muxer",a[t]=a[t]||[],a[t].push(n[e]),"audio"===e&&(s=t))}),i&&s&&t.attributes.AUDIO){const o=t.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===o&&e!==t&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${o} as ${s} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const l=[];if(["video","audio"].forEach(e=>{var t=(pn(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(pn(n[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push(`"${this.sourceUpdater_.codecs[e]}" -> "${n[e]}"`)}),l.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${l.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}e=Object.keys(a).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=$d(this.main,e)).audio||rn(t.audio)||sn(t.audio)||i.push("audio codec "+t.audio),!t.video||rn(t.video)||sn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){const r=[],n=this.main().playlists;e=lh(pn(e));const a=zd(e),o=e.video&&pn(e.video)[0]||null,l=e.audio&&pn(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=$d(this.mainPlaylistLoader_.main,e),i=zd(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&pn(s.video)[0]||null,s=s.audio&&pn(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var s=this.seekable(),[r,n,s=0]=(s.length&&(t=s.start(0)),[e,this.cueTagsTrack_,t]);if(r.segments){let t=s,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(n,t+l.duration/2)){if("cueIn"in l){i.endTime=t,i.adEndTime=t,t+=l.duration,i=null;continue}if(t{for(const i of Object.keys(e)){var t;yh.has(i)||((t=new r(e.startTime,e.endTime,"")).id=e.id,t.type="com.apple.quicktime.HLS",t.value={key:fh[i],data:e[i]},"scte35Out"!==i&&"scte35In"!==i||(t.value.data=new Uint8Array(t.value.data.match(/[\da-f]{2}/gi)).buffer),s.addCue(t))}e.processDateRange()})}}}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();_h(this.inbandTextTracks_,e,this.tech_),gh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){var e=this.main();if(e.contentSteering){const t=e=>{for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering)};t(e),this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("mediaupdatetimeout",()=>{this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id),this.contentSteeringController_.abort(),this.contentSteeringController_.clearTTLTimeout_(),this.contentSteeringController_.clearAvailablePathways(),t(this.main())}),this.contentSteeringController_.queryBeforeStart||this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}excludeThenChangePathway_(){const r=this.contentSteeringController_.getPathway();if(r){const n=this.main().playlists,a=new Set;let s=!1;Object.keys(n).forEach(e=>{var e=n[e],t=this.pathwayAttribute_(e),t=t&&r!==t,i=(e.excludeUntil===1/0&&"content-steering"===e.lastExcludeReason_&&!t&&(delete e.excludeUntil,delete e.lastExcludeReason_,s=!0),!e.excludeUntil&&e.excludeUntil!==1/0);!a.has(e.id)&&t&&i&&(a.add(e.id),e.excludeUntil=1/0,e.lastExcludeReason_="content-steering",this.logger_(`excluding ${e.id} for `+e.lastExcludeReason_))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(e=>{var e=this.mediaTypes_[e];e.activePlaylistLoader&&(e=e.activePlaylistLoader.media_)&&e.attributes.serviceLocation!==r&&(s=!0)}),s&&this.changeSegmentPathway_()}}changeSegmentPathway_(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}}class nu{constructor(e,t,i){var s,r,n,a,o=e["playlistController_"],l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=$d(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=Ul(t),s=Bl(t);return"undefined"==typeof e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const au=["seeking","seeked","pause","playing","error"];class ou{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=ml("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(au,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(au,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:wl)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${kl(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-Sl),o=[r,s];for(let e=0;e ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=yl(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+wl;var n=!i.endList,a="number"==typeof i.partTargetDuration;return t>(r=n&&(a||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){s&&t.currentTime(s)});t.on("error",n),t.on("dispose",a),t.reloadSourceOnError=function(e){a(),du(t,e)}};function hu(t,e){var i=e.media();let s=-1;for(let e=0;eGd(e,t)),e.filter(e=>!!$d(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:ph,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return b.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),O[t]},set(e){b.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?b.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):O[t]=e}})}),"videojs-vhs"),cu=(N.canPlaySource=function(){return b.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));const n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),pu=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=lh(pn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r=mn(s.video),n=mn(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return P(e,a)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(b.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},mu=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(uu);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},gu=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},fu=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},yu=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},_u=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const t=document.createElement("video");return!!b.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&b.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return b.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){gu(N.xhr,e)},N.xhr.onResponse=function(e){fu(N.xhr,e)},N.xhr.offRequest=function(e){yu(N.xhr,e)},N.xhr.offResponse=function(e){_u(N.xhr,e)};class vu extends b.getComponent("Component"){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=ml("VhsHandler"),t.options_&&t.options_.playerId&&(i=b.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=mu())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=O.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===O.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=nn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new ru(this.options_),e=P({liveRangeSafeTimeDelta:wl},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new ou(e),this.playlistController_.on("error",()=>{var e=b.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Cl(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Cl(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=mu())?P(t,e):e;try{window.localStorage.setItem(uu,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=Vl(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!Ul(e)).map((e,t)=>new nu(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),cu({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=pu({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{if("output-restricted"===e.status){e=this.playlistController_.main();if(e&&e.playlists){const t=[];e.playlists.forEach(e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))}),t.length&&(b.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=b.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),hu(t,e.playlists)}),this.playlists.on("mediachange",()=>{hu(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.7.0","mux.js":"7.0.1","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return Uh.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return fd({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return yd({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{gu(this.xhr,e)},this.xhr.onResponse=e=>{fu(this.xhr,e)},this.xhr.offRequest=e=>{yu(this.xhr,e)},this.xhr.offResponse=e=>{_u(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const bu={name:"videojs-http-streaming",VERSION:"3.7.0",canHandleSource(e,t={}){t=P(b.options,t);return bu.canPlayType(e.type,t)},handleSource(e,t,i={}){i=P(b.options,i);return t.vhs=new vu(e,t,i),t.vhs.xhr=nd(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=nn(e);return e&&(t=bu.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(b.browser.IS_ANY_SAFARI||b.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return sn("avc1.4d400d,mp4a.40.2")&&b.getTech("Html5").registerSourceHandler(bu,0),b.VhsHandler=vu,b.VhsSourceHandler=bu,b.Vhs=N,b.use||b.registerComponent("Vhs",N),b.options.vhs=b.options.vhs||{},b.getPlugin&&b.getPlugin("reloadSourceOnError")||b.registerPlugin("reloadSourceOnError",function(e){du(this,e)}),b}); \ No newline at end of file diff --git a/node_modules/video.js/dist/lang/ca.js b/node_modules/video.js/dist/lang/ca.js index 0d2fee84ab..8b0764559b 100644 --- a/node_modules/video.js/dist/lang/ca.js +++ b/node_modules/video.js/dist/lang/ca.js @@ -1,26 +1,97 @@ videojs.addLanguage('ca', { - "Play": "Reproducció", + "Audio Player": "Reproductor d'àudio", + "Video Player": "Reproductor de vídeo", + "Play": "Reproduir", "Pause": "Pausa", - "Current Time": "Temps reproduït", - "Duration": "Durada total", + "Replay": "Repetir", + "Current Time": "Temps actual", + "Duration": "Durada", "Remaining Time": "Temps restant", - "Stream Type": "Tipus de seqüència", + "Stream Type": "Tipus d'emissió", "LIVE": "EN DIRECTE", + "Seek to live, currently behind live": "Anar en directe, actualment darrere de la retransmissió en directe", + "Seek to live, currently playing live": "Anar en directe, actualment en directe", "Loaded": "Carregat", "Progress": "Progrés", + "Progress Bar": "Barra de progrés", + "progress bar timing: currentTime={1} duration={2}": "{1} de {2}", "Fullscreen": "Pantalla completa", - "Exit Fullscreen": "Pantalla no completa", - "Mute": "Silencia", - "Unmute": "Amb so", + "Exit Fullscreen": "Sortir de pantalla completa", + "Mute": "Silenciar", + "Unmute": "Activar el so", "Playback Rate": "Velocitat de reproducció", "Subtitles": "Subtítols", - "subtitles off": "Subtítols desactivats", + "subtitles off": "Desactivar subtítols", "Captions": "Llegendes", - "captions off": "Llegendes desactivades", + "captions off": "Desactivar llegendes", "Chapters": "Capítols", - "You aborted the media playback": "Heu interromput la reproducció del vídeo.", - "A network error caused the media download to fail part-way.": "Un error de la xarxa ha interromput la baixada del vídeo.", - "The media could not be loaded, either because the server or network failed or because the format is not supported.": "No s'ha pogut carregar el vídeo perquè el servidor o la xarxa han fallat, o bé perquè el seu format no és compatible.", - "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "La reproducció de vídeo s'ha interrumput per un problema de corrupció de dades o bé perquè el vídeo demanava funcions que el vostre navegador no ofereix.", - "No compatible source was found for this media.": "No s'ha trobat cap font compatible amb el vídeo." + "Descriptions": "Descripcions", + "descriptions off": "Desactivar descripcions", + "Audio Track": "Pista d'àudio", + "Volume Level": "Nivell de volum", + "You aborted the media playback": "Has interromput la reproducció del contingut", + "A network error caused the media download to fail part-way.": "Un error de xarxa ha interromput la descàrrega del contingut.", + "The media could not be loaded, either because the server or network failed or because the format is not supported.": "No s'ha pogut carregar el contingut, ja sigui perquè el servidor o la xarxa han fallat o perquè el format no està suportat.", + "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "La reproducció del contingut s'ha interromput a causa d'un problema de corrupció o perquè el contingut fa servir funcions que el teu navegador no suporta.", + "No compatible source was found for this media.": "No s'ha trobat una font compatible per a aquest contingut.", + "The media is encrypted and we do not have the keys to decrypt it.": "El contingut està xifrat i no disposem de les claus per desxifrar-lo.", + "Play Video": "Reproduir vídeo", + "Close": "Tancar", + "Close Modal Dialog": "Tancar el diàleg modal", + "Modal Window": "Finestra modal", + "This is a modal window": "Aquesta és una finestra modal", + "This modal can be closed by pressing the Escape key or activating the close button.": "Aquesta finestra es pot tancar prement la tecla Escape o activant el botó de tancar.", + ", opens captions settings dialog": ", obre el diàleg de configuració de subtítols", + ", opens subtitles settings dialog": ", obre el diàleg de configuració de subtítols", + ", opens descriptions settings dialog": ", obre el diàleg de configuració de descripcions", + ", selected": ", seleccionat", + "captions settings": "configuració de subtítols", + "subtitles settings": "configuració de subtítols", + "descriptions settings": "configuració de descripcions", + "Text": "Text", + "White": "Blanc", + "Black": "Negre", + "Red": "Vermell", + "Green": "Verd", + "Blue": "Blau", + "Yellow": "Groc", + "Magenta": "Magenta", + "Cyan": "Cian", + "Background": "Fons", + "Window": "Finestra", + "Transparent": "Transparent", + "Semi-Transparent": "Semi-transparent", + "Opaque": "Opac", + "Font Size": "Mida de la lletra", + "Text Edge Style": "Estil de la vora del text", + "None": "Cap", + "Raised": "Rellevat", + "Depressed": "Premut", + "Uniform": "Uniforme", + "Drop shadow": "Ombra", + "Font Family": "Família tipogràfica", + "Proportional Sans-Serif": "Sense serif proporcional", + "Monospace Sans-Serif": "Monoespaiada sense serif", + "Proportional Serif": "Serif proporcional", + "Monospace Serif": "Monoespaiada amb serif", + "Casual": "Desenfadada", + "Script": "Script", + "Small Caps": "Minúscules", + "Reset": "Restablir", + "restore all settings to the default values": "restaurar totes les configuracions als valors predeterminats", + "Done": "Fet", + "Caption Settings Dialog": "Diàleg de configuració de subtítols", + "Beginning of dialog window. Escape will cancel and close the window.": "Inici del diàleg. L'Escape cancel·larà i tancarà la finestra.", + "End of dialog window.": "Fi del diàleg.", + "{1} is loading.": "S'està carregant {1}.", + "Exit Picture-in-Picture": "Sortir de la imatge en imatge", + "Picture-in-Picture": "Imatge en imatge", + "No content": "Sense contingut", + "Color": "Color", + "Opacity": "Opacitat", + "Text Background": "Fons del text", + "Caption Area Background": "Fons de l'àrea de subtítols", + "Playing in Picture-in-Picture": "Reproduint en imatge en imatge", + "Skip backward {1} seconds": "Salta enrere {1} segons", + "Skip forward {1} seconds": "Salta endavant {1} segons" }); \ No newline at end of file diff --git a/node_modules/video.js/dist/lang/ca.json b/node_modules/video.js/dist/lang/ca.json index 6e53eea1df..7a118e5dc3 100644 --- a/node_modules/video.js/dist/lang/ca.json +++ b/node_modules/video.js/dist/lang/ca.json @@ -1,26 +1,97 @@ { - "Play": "Reproducció", + "Audio Player": "Reproductor d'àudio", + "Video Player": "Reproductor de vídeo", + "Play": "Reproduir", "Pause": "Pausa", - "Current Time": "Temps reproduït", - "Duration": "Durada total", + "Replay": "Repetir", + "Current Time": "Temps actual", + "Duration": "Durada", "Remaining Time": "Temps restant", - "Stream Type": "Tipus de seqüència", + "Stream Type": "Tipus d'emissió", "LIVE": "EN DIRECTE", + "Seek to live, currently behind live": "Anar en directe, actualment darrere de la retransmissió en directe", + "Seek to live, currently playing live": "Anar en directe, actualment en directe", "Loaded": "Carregat", "Progress": "Progrés", + "Progress Bar": "Barra de progrés", + "progress bar timing: currentTime={1} duration={2}": "{1} de {2}", "Fullscreen": "Pantalla completa", - "Exit Fullscreen": "Pantalla no completa", - "Mute": "Silencia", - "Unmute": "Amb so", + "Exit Fullscreen": "Sortir de pantalla completa", + "Mute": "Silenciar", + "Unmute": "Activar el so", "Playback Rate": "Velocitat de reproducció", "Subtitles": "Subtítols", - "subtitles off": "Subtítols desactivats", + "subtitles off": "Desactivar subtítols", "Captions": "Llegendes", - "captions off": "Llegendes desactivades", + "captions off": "Desactivar llegendes", "Chapters": "Capítols", - "You aborted the media playback": "Heu interromput la reproducció del vídeo.", - "A network error caused the media download to fail part-way.": "Un error de la xarxa ha interromput la baixada del vídeo.", - "The media could not be loaded, either because the server or network failed or because the format is not supported.": "No s'ha pogut carregar el vídeo perquè el servidor o la xarxa han fallat, o bé perquè el seu format no és compatible.", - "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "La reproducció de vídeo s'ha interrumput per un problema de corrupció de dades o bé perquè el vídeo demanava funcions que el vostre navegador no ofereix.", - "No compatible source was found for this media.": "No s'ha trobat cap font compatible amb el vídeo." + "Descriptions": "Descripcions", + "descriptions off": "Desactivar descripcions", + "Audio Track": "Pista d'àudio", + "Volume Level": "Nivell de volum", + "You aborted the media playback": "Has interromput la reproducció del contingut", + "A network error caused the media download to fail part-way.": "Un error de xarxa ha interromput la descàrrega del contingut.", + "The media could not be loaded, either because the server or network failed or because the format is not supported.": "No s'ha pogut carregar el contingut, ja sigui perquè el servidor o la xarxa han fallat o perquè el format no està suportat.", + "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "La reproducció del contingut s'ha interromput a causa d'un problema de corrupció o perquè el contingut fa servir funcions que el teu navegador no suporta.", + "No compatible source was found for this media.": "No s'ha trobat una font compatible per a aquest contingut.", + "The media is encrypted and we do not have the keys to decrypt it.": "El contingut està xifrat i no disposem de les claus per desxifrar-lo.", + "Play Video": "Reproduir vídeo", + "Close": "Tancar", + "Close Modal Dialog": "Tancar el diàleg modal", + "Modal Window": "Finestra modal", + "This is a modal window": "Aquesta és una finestra modal", + "This modal can be closed by pressing the Escape key or activating the close button.": "Aquesta finestra es pot tancar prement la tecla Escape o activant el botó de tancar.", + ", opens captions settings dialog": ", obre el diàleg de configuració de subtítols", + ", opens subtitles settings dialog": ", obre el diàleg de configuració de subtítols", + ", opens descriptions settings dialog": ", obre el diàleg de configuració de descripcions", + ", selected": ", seleccionat", + "captions settings": "configuració de subtítols", + "subtitles settings": "configuració de subtítols", + "descriptions settings": "configuració de descripcions", + "Text": "Text", + "White": "Blanc", + "Black": "Negre", + "Red": "Vermell", + "Green": "Verd", + "Blue": "Blau", + "Yellow": "Groc", + "Magenta": "Magenta", + "Cyan": "Cian", + "Background": "Fons", + "Window": "Finestra", + "Transparent": "Transparent", + "Semi-Transparent": "Semi-transparent", + "Opaque": "Opac", + "Font Size": "Mida de la lletra", + "Text Edge Style": "Estil de la vora del text", + "None": "Cap", + "Raised": "Rellevat", + "Depressed": "Premut", + "Uniform": "Uniforme", + "Drop shadow": "Ombra", + "Font Family": "Família tipogràfica", + "Proportional Sans-Serif": "Sense serif proporcional", + "Monospace Sans-Serif": "Monoespaiada sense serif", + "Proportional Serif": "Serif proporcional", + "Monospace Serif": "Monoespaiada amb serif", + "Casual": "Desenfadada", + "Script": "Script", + "Small Caps": "Minúscules", + "Reset": "Restablir", + "restore all settings to the default values": "restaurar totes les configuracions als valors predeterminats", + "Done": "Fet", + "Caption Settings Dialog": "Diàleg de configuració de subtítols", + "Beginning of dialog window. Escape will cancel and close the window.": "Inici del diàleg. L'Escape cancel·larà i tancarà la finestra.", + "End of dialog window.": "Fi del diàleg.", + "{1} is loading.": "S'està carregant {1}.", + "Exit Picture-in-Picture": "Sortir de la imatge en imatge", + "Picture-in-Picture": "Imatge en imatge", + "No content": "Sense contingut", + "Color": "Color", + "Opacity": "Opacitat", + "Text Background": "Fons del text", + "Caption Area Background": "Fons de l'àrea de subtítols", + "Playing in Picture-in-Picture": "Reproduint en imatge en imatge", + "Skip backward {1} seconds": "Salta enrere {1} segons", + "Skip forward {1} seconds": "Salta endavant {1} segons" } diff --git a/node_modules/video.js/dist/types/big-play-button.d.ts b/node_modules/video.js/dist/types/big-play-button.d.ts index a5fd36b09a..45f7ffa7db 100644 --- a/node_modules/video.js/dist/types/big-play-button.d.ts +++ b/node_modules/video.js/dist/types/big-play-button.d.ts @@ -12,16 +12,23 @@ declare class BigPlayButton extends Button { * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * * @listens tap * @listens click */ - handleClick(event: KeyboardEvent): void; - handleKeyDown(event: any): void; - handleMouseDown(event: any): void; + handleClick(event: KeyboardEvent | MouseEvent | TouchEvent): void; + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ + handleMouseDown(event: MouseEvent): void; } import Button from "./button.js"; //# sourceMappingURL=big-play-button.d.ts.map \ No newline at end of file diff --git a/node_modules/video.js/dist/types/big-play-button.d.ts.map b/node_modules/video.js/dist/types/big-play-button.d.ts.map index e71864280d..415d89e6fd 100644 --- a/node_modules/video.js/dist/types/big-play-button.d.ts.map +++ b/node_modules/video.js/dist/types/big-play-button.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"big-play-button.d.ts","sourceRoot":"","sources":["../../src/js/big-play-button.js"],"names":[],"mappings":";AAOA;;;;;GAKG;AACH;IACE,uCAQC;IALC,oBAAuB;IAiBzB;;;;;;;;;;OAUG;IACH,mBAPW,aAAa,QAoCvB;IAED,gCAIC;IAED,kCAEC;CACF"} \ No newline at end of file +{"version":3,"file":"big-play-button.d.ts","sourceRoot":"","sources":["../../src/js/big-play-button.js"],"names":[],"mappings":";AAOA;;;;;GAKG;AACH;IACE,uCAQC;IALC,oBAAuB;IAiBzB;;;;;;;;;;OAUG;IACH,mBAPW,aAAa,GAAC,UAAU,GAAC,UAAU,QAoC7C;IAiBD;;;;;;;OAOG;IACH,uBALW,UAAU,QAOpB;CACF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/clickable-component.d.ts b/node_modules/video.js/dist/types/clickable-component.d.ts index 483107fe72..e5f56af109 100644 --- a/node_modules/video.js/dist/types/clickable-component.d.ts +++ b/node_modules/video.js/dist/types/clickable-component.d.ts @@ -83,18 +83,6 @@ declare class ClickableComponent extends Component { * @abstract */ handleClick(event: Event, ...args: any[]): void; - /** - * Event handler that is called when a `ClickableComponent` receives a - * `keydown` event. - * - * By default, if the key is Space or Enter, it will trigger a `click` event. - * - * @param {Event} event - * The `keydown` event that caused this function to be called. - * - * @listens keydown - */ - handleKeyDown(event: Event): void; } import Component from "./component"; //# sourceMappingURL=clickable-component.d.ts.map \ No newline at end of file diff --git a/node_modules/video.js/dist/types/clickable-component.d.ts.map b/node_modules/video.js/dist/types/clickable-component.d.ts.map index c377c38875..1bbd2ef549 100644 --- a/node_modules/video.js/dist/types/clickable-component.d.ts.map +++ b/node_modules/video.js/dist/types/clickable-component.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"clickable-component.d.ts","sourceRoot":"","sources":["../../src/js/clickable-component.js"],"names":[],"mappings":";AAQA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAhBa,OAAO,UAAU,EAAE,OAAO;QAMR,YAAY;QAGd,WAAW,GAA5B,MAAM;QAGW,SAAS,GAA1B,MAAM;OAoBjB;IARC,kCAAsD;IACtD,iCAAoD;IACpD,+BAA8C;IAC9C,iCAAkD;IAqClD,eAA+B;IAiBjC,gBAKC;IAHC,wBAA0B;IAK5B;;;;;;;;OAQG;IACH,yBANW,OAAO,GAGN,OAAO,CAkBlB;IAED;;;;;;;;;;;OAWG;IACH,mBATW,MAAM,OAGN,OAAO,GAGN,MAAM,CAiBjB;IAPC,iBAAiB;IACjB,+BAAwB;IAkB1B;;OAEG;IACH,eAWC;IATG,kBAAoB;IAWxB;;OAEG;IACH,gBAWC;IAWD;;;;;;;;;;OAUG;IACH,mBAPW,KAAK,wBAWf;IAED;;;;;;;;;;OAUG;IACH,qBALW,KAAK,QAmBf;CACF"} \ No newline at end of file +{"version":3,"file":"clickable-component.d.ts","sourceRoot":"","sources":["../../src/js/clickable-component.js"],"names":[],"mappings":";AAQA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAhBa,OAAO,UAAU,EAAE,OAAO;QAMR,YAAY;QAGd,WAAW,GAA5B,MAAM;QAGW,SAAS,GAA1B,MAAM;OAoBjB;IARC,kCAAsD;IACtD,iCAAoD;IACpD,+BAA8C;IAC9C,iCAAkD;IAqClD,eAA+B;IAiBjC,gBAKC;IAHC,wBAA0B;IAK5B;;;;;;;;OAQG;IACH,yBANW,OAAO,GAGN,OAAO,CAkBlB;IAED;;;;;;;;;;;OAWG;IACH,mBATW,MAAM,OAGN,OAAO,GAGN,MAAM,CAiBjB;IAPC,iBAAiB;IACjB,+BAAwB;IAkB1B;;OAEG;IACH,eAWC;IATG,kBAAoB;IAWxB;;OAEG;IACH,gBAWC;IAWD;;;;;;;;;;OAUG;IACH,mBAPW,KAAK,wBAWf;CA4BF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/component.d.ts b/node_modules/video.js/dist/types/component.d.ts index 76294cdcb0..31240f9f1e 100644 --- a/node_modules/video.js/dist/types/component.d.ts +++ b/node_modules/video.js/dist/types/component.d.ts @@ -339,7 +339,6 @@ declare class Component { /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -350,6 +349,7 @@ declare class Component { * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -542,11 +542,10 @@ declare class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ - width(num?: number | string, skipListeners?: boolean): number | string; + width(num?: number | string, skipListeners?: boolean): number | undefined; /** * Get or set the height of the component based upon the CSS styles. * See {@link Component#dimension} for more detailed information. @@ -557,11 +556,10 @@ declare class Component { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ - height(num?: number | string, skipListeners?: boolean): number | string; + height(num?: number | string, skipListeners?: boolean): number | undefined; /** * Set both the width and height of the `Component` element at the same time. * @@ -597,10 +595,10 @@ declare class Component { * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ - dimension(widthOrHeight: string, num?: number | string, skipListeners?: boolean): number; + dimension(widthOrHeight: string, num?: number | string, skipListeners?: boolean): number | undefined; /** * Get the computed width or the height of the component's element. * @@ -676,16 +674,16 @@ declare class Component { * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ - handleKeyPress(event: Event): void; + handleKeyPress(event: KeyboardEvent): void; /** * Emit a 'tap' events when touch event support gets detected. This gets used to * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -694,7 +692,7 @@ declare class Component { * @listens Component#touchend */ - private emitTapEvents; + protected emitTapEvents(): void; /** * This function reports user activity whenever touch events happen. This can get * turned off by any sub-components that wants touch events to act another way. diff --git a/node_modules/video.js/dist/types/component.d.ts.map b/node_modules/video.js/dist/types/component.d.ts.map index 9560562618..581ad61f63 100644 --- a/node_modules/video.js/dist/types/component.d.ts.map +++ b/node_modules/video.js/dist/types/component.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/js/component.js"],"names":[],"mappings":";AAgBA;;;;;;;GAOG;AACH;IAitDE;;;;;;;;;;;;;;;;;;OAkBG;IACH,+BATW,MAAM,uBAGN,SAAS,GAGR,SAAS,CAsDpB;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,GAGL,SAAS,CASpB;IAtyDD;;;;;;OAMG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oBAjBY,OAAO,UAAU,EAAE,OAAO;QAMR,QAAQ,GAA3B,KAAQ;QAKU,SAAS,GAA1B,MAAM;0BAyFjB;IA/EG,aAA4B;IAK9B,qBAAwB;IAGxB,sBAA4B;IAG5B,cAAwC;IAMxC,SAAsD;IAUtD,WAAiC;IAI/B,SAAqB;IA2UzB;;;;OAIG;IACH,6BAAyB;IAvTvB,iBAAmB;IACnB,gBAAqB;IACrB,oBAAyB;IAEzB,yBAA+B;IAC/B,0BAAgC;IAChC,kBAAwB;IACxB,0BAA2B;IAC3B,kCAAqC;IAoBvC;;;;;;;;;OASG;IACH,SANW,MAAM,GAAC,MAAM,EAAE,sBAMX;IAEf;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;;OAWG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAPW,MAAM,GAAC,KAAK,MAAO,oBAOP;IAEvB;;;;;;;OAOG;IACH;QAF4B,UAAU,EAA3B,OAAO;aA0DjB;IAED;;;;;OAKG;IACH,cAHY,OAAO,CAKlB;IAED;;;;;OAKG;IACH,UAHa,OAAO,UAAU,EAAE,OAAO,CAKtC;IAED;;;;;;;;;;OAUG;IACH,uBAOC;IAED;;;;;OAKG;IACH,MAHY,OAAO,CAKlB;IAED;;;;;;;;;;;;;;OAcG;IACH,mBAZW,MAAM,uCASL,OAAO,CAKlB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,iBAXW,MAAM,WAEN,MAAM,EAAE,iBAER,MAAM,GAIL,MAAM,CAiCjB;IASD;;;;;;OAMG;IACH,aAHY,OAAO,CAKlB;IAED;;;;;OAKG;IACH,MAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,QAHY,MAAM,CAKjB;IAED;;;;;OAKG;IACH,kBAEC;IAED;;;;;;;;OAQG;IACH,iBANW,MAAM,GAGL,SAAS,GAAC,SAAS,CAK9B;IAED;;;;;;;;OAQG;IACH,eANW,MAAM,GAGL,SAAS,GAAC,SAAS,CAS9B;IAED;;;;;;;;;;;;;OAaG;IACH,gCAJY,SAAS,GAAC,SAAS,CAmB9B;IAED;;;;;;;;;;;OAWG;IACH,kBATW,MAAM,OAGN,OAAO,GAGN,OAAO,CAwClB;IAHC,oBAAsB;IAKxB;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAdW,MAAM,GAAC,SAAS,yBAOhB,MAAM,GAGL,SAAS,CA+EpB;IAED;;;;;;OAMG;IACH,uBAHW,SAAS,QAqCnB;IAED;;OAEG;IACH,qBA6FC;IAED;;;;;;;OAOG;IACH,iBALY,MAAM,CASjB;IAED;;;;;;;;;;OAUG;IACH,sCAHY,SAAS,CAoBpB;IAXG,iBAAyC;IAa7C;;;;OAIG;IACH,qBAyBC;IAxBC,kBAAoB;IA0BtB;;;;;;;;;;;;;;;;;OAiBG;IACH,YAdW,MAAM,YAGN,OAAO,GAAC,MAAM,GAMb,OAAO,GAAC,IAAI,CAOvB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,aAdW,MAAM,YAGN,OAAO,GAAC,MAAM,GAMb,QAAQ,CAOnB;IAED;;;;;;;;;OASG;IACH,uBAPW,MAAM,GAGL,OAAO,CAMlB;IAED;;;;;OAKG;IACH,0BAHc,MAAM,UAKnB;IAED;;;;;OAKG;IACH,gCAHc,MAAM,UAKnB;IAED;;;;;;;;;;OAUG;IACH,2BANY,MAAM,wBAQjB;IAED;;;OAGG;IACH,aAEC;IAED;;;OAGG;IACH,aAEC;IAED;;;;;OAKG;IACH,oBAEC;IAED;;;;;OAKG;IACH,sBAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,wBAZW,MAAM,GAGL,MAAM,GAAC,IAAI,CAWtB;IAED;;;;;;;;;;OAUG;IACH,wBARW,MAAM,SAGN,MAAM,QAOhB;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,QAOhB;IAED;;;;;;;;;;;;;OAaG;IACH,YAVW,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGN,MAAM,GAAC,MAAM,CAMxB;IAED;;;;;;;;;;;;;OAaG;IACH,aAVW,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGN,MAAM,GAAC,MAAM,CAMxB;IAED;;;;;;;;OAQG;IACH,kBANY,MAAM,GAAC,MAAM,UAGb,MAAM,GAAC,MAAM,QAOxB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,yBAZW,MAAM,QAGL,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGP,MAAM,CAoDjB;IAED;;;;;;;;;;;OAWG;IACH,gCAPW,MAAM,GAGL,MAAM,CA0BjB;IAED;;;;;;;;;;;OAWG;IAEH;;;;;;;;OAQG;IACH,qBAHY,SAAS,CAQpB;IAED;;;;;;;OAOG;IACH,gBAHY,MAAM,CAKjB;IAED;;;;;;;OAOG;IACH,iBAHY,MAAM,CAKjB;IAED;;OAEG;IACH,cAEC;IAED;;OAEG;IACH,aAEC;IAED;;;;;;OAMG;IACH,qBAHW,aAAa,QAavB;IAED;;;;;;;;OAQG;IACH,sBAHW,KAAK,QAKf;IAED;;;;;;;;;;;;;OAaG;IACH,sBAiFC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,4BA8BC;IAED;;;;;OAKG;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,6BAXW,MAAM,GAGL,MAAM,CA2BjB;IAED;;;;;;;;;;;;;;OAcG;IACH,wBATW,MAAM,GAIL,MAAM,CAYjB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,+BAVW,MAAM,GAGL,MAAM,CAiBjB;IAED;;;;;;;;;;;;;;OAcG;IACH,0BATW,MAAM,GAIL,MAAM,CAYjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,gCARY,MAAM,CAyBjB;IAED;;;;;;;;;;;OAWG;IACH,iCAPW,MAAM,mBAyBhB;IAED;;;;;OAKG;IACH,gCAHW,MAAM,QAUhB;IAED;;;;;;;;;;;;;;;OAeG;IACH,yBARW,MAAM,GAGL,MAAM,CAajB;IAED;;;;;;;;;OASG;IACH,8BAqBC;CA0FF"} \ No newline at end of file +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/js/component.js"],"names":[],"mappings":";AAgBA;;;;;;;GAOG;AACH;IA+sDE;;;;;;;;;;;;;;;;;;OAkBG;IACH,+BATW,MAAM,uBAGN,SAAS,GAGR,SAAS,CAsDpB;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,GAGL,SAAS,CASpB;IApyDD;;;;;;OAMG;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;IACH,oBAjBY,OAAO,UAAU,EAAE,OAAO;QAMR,QAAQ,GAA3B,KAAQ;QAKU,SAAS,GAA1B,MAAM;0BAyFjB;IA/EG,aAA4B;IAK9B,qBAAwB;IAGxB,sBAA4B;IAG5B,cAAwC;IAMxC,SAAsD;IAUtD,WAAiC;IAI/B,SAAqB;IA2UzB;;;;OAIG;IACH,6BAAyB;IAvTvB,iBAAmB;IACnB,gBAAqB;IACrB,oBAAyB;IAEzB,yBAA+B;IAC/B,0BAAgC;IAChC,kBAAwB;IACxB,0BAA2B;IAC3B,kCAAqC;IAoBvC;;;;;;;;;OASG;IACH,SANW,MAAM,GAAC,MAAM,EAAE,sBAMX;IAEf;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;;OAWG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAMV;IAEhB;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAPW,MAAM,GAAC,KAAK,MAAO,oBAOP;IAEvB;;;;;;;OAOG;IACH;QAF4B,UAAU,EAA3B,OAAO;aA0DjB;IAED;;;;;OAKG;IACH,cAHY,OAAO,CAKlB;IAED;;;;;OAKG;IACH,UAHa,OAAO,UAAU,EAAE,OAAO,CAKtC;IAED;;;;;;;;;;OAUG;IACH,uBAOC;IAED;;;;;OAKG;IACH,MAHY,OAAO,CAKlB;IAED;;;;;;;;;;;;;;OAcG;IACH,mBAZW,MAAM,uCASL,OAAO,CAKlB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,iBAXW,MAAM,WAEN,MAAM,EAAE,iBAER,MAAM,GAIL,MAAM,CAiCjB;IASD;;;;;;OAMG;IACH,aAHY,OAAO,CAKlB;IAED;;;;;OAKG;IACH,MAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,QAHY,MAAM,CAKjB;IAED;;;;;OAKG;IACH,kBAEC;IAED;;;;;;;;OAQG;IACH,iBANW,MAAM,GAGL,SAAS,GAAC,SAAS,CAK9B;IAED;;;;;;;;OAQG;IACH,eANW,MAAM,GAGL,SAAS,GAAC,SAAS,CAS9B;IAED;;;;;;;;;;;;;OAaG;IACH,gCAJY,SAAS,GAAC,SAAS,CAmB9B;IAED;;;;;;;;;;;OAWG;IACH,kBATW,MAAM,OAGN,OAAO,GAGN,OAAO,CAwClB;IAHC,oBAAsB;IAKxB;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAfW,MAAM,GAAC,SAAS,yBAOhB,MAAM,GAIL,SAAS,CA+EpB;IAED;;;;;;OAMG;IACH,uBAHW,SAAS,QAqCnB;IAED;;OAEG;IACH,qBA6FC;IAED;;;;;;;OAOG;IACH,iBALY,MAAM,CASjB;IAED;;;;;;;;;;OAUG;IACH,sCAHY,SAAS,CAoBpB;IAXG,iBAAyC;IAa7C;;;;OAIG;IACH,qBAyBC;IAxBC,kBAAoB;IA0BtB;;;;;;;;;;;;;;;;;OAiBG;IACH,YAdW,MAAM,YAGN,OAAO,GAAC,MAAM,GAMb,OAAO,GAAC,IAAI,CAOvB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,aAdW,MAAM,YAGN,OAAO,GAAC,MAAM,GAMb,QAAQ,CAOnB;IAED;;;;;;;;;OASG;IACH,uBAPW,MAAM,GAGL,OAAO,CAMlB;IAED;;;;;OAKG;IACH,0BAHc,MAAM,UAKnB;IAED;;;;;OAKG;IACH,gCAHc,MAAM,UAKnB;IAED;;;;;;;;;;OAUG;IACH,2BANY,MAAM,wBAQjB;IAED;;;OAGG;IACH,aAEC;IAED;;;OAGG;IACH,aAEC;IAED;;;;;OAKG;IACH,oBAEC;IAED;;;;;OAKG;IACH,sBAEC;IAED;;;;;;;;;;;;;;OAcG;IACH,wBAZW,MAAM,GAGL,MAAM,GAAC,IAAI,CAWtB;IAED;;;;;;;;;;OAUG;IACH,wBARW,MAAM,SAGN,MAAM,QAOhB;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,QAOhB;IAED;;;;;;;;;;;;OAYG;IACH,YATW,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGN,MAAM,GAAC,SAAS,CAK3B;IAED;;;;;;;;;;;;OAYG;IACH,aATW,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGN,MAAM,GAAC,SAAS,CAK3B;IAED;;;;;;;;OAQG;IACH,kBANY,MAAM,GAAC,MAAM,UAGb,MAAM,GAAC,MAAM,QAOxB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,yBAZW,MAAM,QAGL,MAAM,GAAC,MAAM,kBAGb,OAAO,GAGP,MAAM,GAAC,SAAS,CAoD3B;IAED;;;;;;;;;;;OAWG;IACH,gCAPW,MAAM,GAGL,MAAM,CA0BjB;IAED;;;;;;;;;;;OAWG;IAEH;;;;;;;;OAQG;IACH,qBAHY,SAAS,CAQpB;IAED;;;;;;;OAOG;IACH,gBAHY,MAAM,CAKjB;IAED;;;;;;;OAOG;IACH,iBAHY,MAAM,CAKjB;IAED;;OAEG;IACH,cAEC;IAED;;OAEG;IACH,aAEC;IAED;;;;;;OAMG;IACH,qBAHW,aAAa,QAavB;IAED;;;;;;;;OAQG;IACH,sBAHW,aAAa,QAKvB;IAED;;;;;;;;;;;;;OAaG;IACH,gCAiFC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,4BA8BC;IAED;;;;;OAKG;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,6BAXW,MAAM,GAGL,MAAM,CA2BjB;IAED;;;;;;;;;;;;;;OAcG;IACH,wBATW,MAAM,GAIL,MAAM,CAYjB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,+BAVW,MAAM,GAGL,MAAM,CAiBjB;IAED;;;;;;;;;;;;;;OAcG;IACH,0BATW,MAAM,GAIL,MAAM,CAYjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,gCARY,MAAM,CAyBjB;IAED;;;;;;;;;;;OAWG;IACH,iCAPW,MAAM,mBAyBhB;IAED;;;;;OAKG;IACH,gCAHW,MAAM,QAUhB;IAED;;;;;;;;;;;;;;;OAeG;IACH,yBARW,MAAM,GAGL,MAAM,CAajB;IAED;;;;;;;;;OASG;IACH,8BAqBC;CA0FF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts b/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts index 3b8d81f37c..3ea22b8f63 100644 --- a/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts +++ b/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts @@ -82,6 +82,16 @@ declare class VolumePanel extends Component { * @listens mouseout */ handleMouseOut(event: Event): void; + /** + * Handles `keyup` event on the document or `keydown` event on the `VolumePanel`, + * looking for ESC, which hides the `VolumeControl`. + * + * @param {Event} event + * The keypress that triggered this event. + * + * @listens keydown | keyup + */ + handleKeyPress(event: Event): void; } import Component from "../component.js"; //# sourceMappingURL=volume-panel.d.ts.map \ No newline at end of file diff --git a/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts.map b/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts.map index 18ca879914..0c8e0c5175 100644 --- a/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts.map +++ b/node_modules/video.js/dist/types/control-bar/volume-panel.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"volume-panel.d.ts","sourceRoot":"","sources":["../../../src/js/control-bar/volume-panel.js"],"names":[],"mappings":";AAaA;;;;;GAKG;AACH;IAEE;;;;;;;;OAQG;IACH,wCA+BC;IAdC,yCAA2D;IAgB7D;;;;;OAKG;IACH,sBAEC;IAED;;;;;OAKG;IACH,wBAEC;IAED;;;;;;OAMG;IACH,0BAYC;IAED;;;;;OAKG;IACH,YAHY,OAAO,CAalB;IAED;;OAEG;IACH,gBAGC;IAED;;;;;;;;OAQG;IACH,gCALW,KAAK,QASf;IAED;;;;;;;;;OASG;IACH,uBALW,KAAK,QAQf;IAED;;;;;;;;;OASG;IACH,sBALW,KAAK,QAQf;CAgBF"} \ No newline at end of file +{"version":3,"file":"volume-panel.d.ts","sourceRoot":"","sources":["../../../src/js/control-bar/volume-panel.js"],"names":[],"mappings":";AAaA;;;;;GAKG;AACH;IAEE;;;;;;;;OAQG;IACH,wCA+BC;IAdC,yCAA2D;IAgB7D;;;;;OAKG;IACH,sBAEC;IAED;;;;;OAKG;IACH,wBAEC;IAED;;;;;;OAMG;IACH,0BAYC;IAED;;;;;OAKG;IACH,YAHY,OAAO,CAalB;IAED;;OAEG;IACH,gBAGC;IAED;;;;;;;;OAQG;IACH,gCALW,KAAK,QASf;IAED;;;;;;;;;OASG;IACH,uBALW,KAAK,QAQf;IAED;;;;;;;;;OASG;IACH,sBALW,KAAK,QAQf;IAED;;;;;;;;OAQG;IACH,sBALW,KAAK,QASf;CACF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/event-target.d.ts b/node_modules/video.js/dist/types/event-target.d.ts index 28ae6e0f57..ab99296d9b 100644 --- a/node_modules/video.js/dist/types/event-target.d.ts +++ b/node_modules/video.js/dist/types/event-target.d.ts @@ -4,9 +4,9 @@ export default EventTarget; */ export type Event = CustomEvent; /** - * ~EventListener + * All event listeners should follow the following format. */ -export type EventTarget = () => any; +export type EventListener = () => any; /** * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It * adds shorthand functions that wrap around lengthy functions. For example: @@ -92,7 +92,7 @@ declare class EventTarget { /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -108,9 +108,9 @@ declare class EventTarget { * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ - private allowedEvents_; + protected allowedEvents_: {}; /** * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic * the standard DOM API. diff --git a/node_modules/video.js/dist/types/event-target.d.ts.map b/node_modules/video.js/dist/types/event-target.d.ts.map index f69eb34d87..40c9429274 100644 --- a/node_modules/video.js/dist/types/event-target.d.ts.map +++ b/node_modules/video.js/dist/types/event-target.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"event-target.d.ts","sourceRoot":"","sources":["../../src/js/event-target.js"],"names":[],"mappings":";;;;oBAmKa,WAAW;;;;;AA3JxB;;;;;;;GAOG;AACH;IACE;;;;;;;;;OASG;IACH,SANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IAHC,sBAAiC;IAInC;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAQzB;IACD;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IACD;;;;;;;;;;;OAWG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IACD;;;;;;;;;;;;;;;OAeG;IACH,0BAkBC;IACD,+BA+BC;IAGH;;;;;OAKG;IAEH;;;;;;;;;;;OAWG;IAEH;;;;;;;;OAQG;IACH,uBAAoC;IAWpC;;;;;;OAMG;IACH,4BAtKa,MAAM,GAAC,MAAM,EAAE,wBAsKa;IAEzC;;;;;;OAMG;IACH,oCAAmC;CA1DlC"} \ No newline at end of file +{"version":3,"file":"event-target.d.ts","sourceRoot":"","sources":["../../src/js/event-target.js"],"names":[],"mappings":";;;;oBAmKa,WAAW;;;;;AA3JxB;;;;;;;GAOG;AACH;IACE;;;;;;;;;OASG;IACH,SANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IAHC,sBAAiC;IAInC;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAQzB;IACD;;;;;;;;;;OAUG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IACD;;;;;;;;;;;OAWG;IACH,UANW,MAAM,GAAC,MAAM,EAAE,sBAczB;IACD;;;;;;;;;;;;;;;OAeG;IACH,0BAkBC;IACD,+BA+BC;IAGH;;;;;OAKG;IAEH;;;;;;;;;;;OAWG;IAEH;;;;;;;;OAQG;IACH,6BAAoC;IAWpC;;;;;;OAMG;IACH,4BAtKa,MAAM,GAAC,MAAM,EAAE,wBAsKa;IAEzC;;;;;;OAMG;IACH,oCAAmC;CA1DlC"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/menu/menu.d.ts b/node_modules/video.js/dist/types/menu/menu.d.ts index 2b2b2d8ad1..cd9331d6ef 100644 --- a/node_modules/video.js/dist/types/menu/menu.d.ts +++ b/node_modules/video.js/dist/types/menu/menu.d.ts @@ -82,15 +82,6 @@ declare class Menu extends Component { * @listens click,tap */ handleTapClick(event: Event): void; - /** - * Handle a `keydown` event on this menu. This listener is added in the constructor. - * - * @param {Event} event - * A `keydown` event that happened on the menu. - * - * @listens keydown - */ - handleKeyDown(event: Event): void; /** * Move to next (lower) menu item for keyboard users. */ diff --git a/node_modules/video.js/dist/types/menu/menu.d.ts.map b/node_modules/video.js/dist/types/menu/menu.d.ts.map index ccd2c6db5d..97e1eabb05 100644 --- a/node_modules/video.js/dist/types/menu/menu.d.ts.map +++ b/node_modules/video.js/dist/types/menu/menu.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/js/menu/menu.js"],"names":[],"mappings":";AASA;;;;;GAKG;AACH;IAEE;;;;;;;;;OASG;IACH,oBAPY,OAAO,WAAW,EAAE,OAAO,iBAqBtC;IAVG,iBAAqC;IAGvC,sBAAuB;IAKvB,mCAAiD;IACjD,uCAAyD;IAG3D;;;;;;OAMG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iDAOC;IAED;;;;;;;;OAQG;IACH,kCAOC;IAED;;;;;;OAMG;IACH,mBAJW,MAAO,MAAM,QAUvB;IAED;;;;;OAKG;IACH,YAHY,OAAO,CA2BlB;IArBC,oBAEE;IAqBJ,gBAMC;IAED;;;;;;;OAOG;IACH,kBALW,KAAK,QAkBf;IAED;;;;;;;OAOG;IACH,sBALW,KAAK,QA4Bf;IAED;;;;;;;OAOG;IACH,qBALW,KAAK,QAmBf;IAED;;OAEG;IACH,oBAOC;IAED;;OAEG;IACH,iBAOC;IAED;;;;;OAKG;IACH,aAHW,MAAO,MAAM,QAsBvB;CACF"} \ No newline at end of file +{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/js/menu/menu.js"],"names":[],"mappings":";AASA;;;;;GAKG;AACH;IAEE;;;;;;;;;OASG;IACH,oBAPY,OAAO,WAAW,EAAE,OAAO,iBAqBtC;IAVG,iBAAqC;IAGvC,sBAAuB;IAKvB,mCAAiD;IACjD,uCAAyD;IAG3D;;;;;;OAMG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iDAOC;IAED;;;;;;;;OAQG;IACH,kCAOC;IAED;;;;;;OAMG;IACH,mBAJW,MAAO,MAAM,QAUvB;IAED;;;;;OAKG;IACH,YAHY,OAAO,CA2BlB;IArBC,oBAEE;IAqBJ,gBAMC;IAED;;;;;;;OAOG;IACH,kBALW,KAAK,QAkBf;IAED;;;;;;;OAOG;IACH,sBALW,KAAK,QA4Bf;IA0BD;;OAEG;IACH,oBAOC;IAED;;OAEG;IACH,iBAOC;IAED;;;;;OAKG;IACH,aAHW,MAAO,MAAM,QAsBvB;CACF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/player.d.ts b/node_modules/video.js/dist/types/player.d.ts index 0e0f9a6378..de9a2bdb9c 100644 --- a/node_modules/video.js/dist/types/player.d.ts +++ b/node_modules/video.js/dist/types/player.d.ts @@ -5,8 +5,8 @@ export default Player; * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -964,18 +964,6 @@ declare class Player extends Component { * A promise. */ exitPictureInPicture(): Promise; - /** - * Called when this Player has focus and a key gets pressed down, or when - * any Component of this player receives a key press that it doesn't handle. - * This allows player-wide hotkeys (either as defined below, or optionally - * by an external function). - * - * @param {Event} event - * The `keydown` event that caused this function to be called. - * - * @listens keydown - */ - handleKeyDown(event: Event): void; /** * Called when this Player receives a hotkey keydown event. * Supported player-wide hotkeys are: diff --git a/node_modules/video.js/dist/types/player.d.ts.map b/node_modules/video.js/dist/types/player.d.ts.map index b8ae564dac..c98fbc73ba 100644 --- a/node_modules/video.js/dist/types/player.d.ts.map +++ b/node_modules/video.js/dist/types/player.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../src/js/player.js"],"names":[],"mappings":";AA0RA;;;;;;;;;;;GAWG;AACH;IAmoJE;;;;;;;;;OASG;IACH,2BAPW,OAAO,OAuDjB;IA3rJD;;;;;;;;;;;OAWG;IACH,iBATW,OAAO,mCAkTjB;IAlQC,iDAA8E;IAC9E,2CAAiE;IAEjE,sCAAwD;IACxD,sCAAwD;IACxD,gDAA4E;IAE5E,wCAA4D;IAC5D,8CAAwE;IACxE,6CAAsE;IACtE,4CAAoE;IACpE,2CAAkE;IAClE,sCAAwD;IAGxD,uBAA0B;IAG1B,SAAiC;IAGjC,YAA2B;IAG3B,2BAA8B;IAI9B,wBAA0B;IAM1B,qBAAwB;IAGxB,qBAAwB;IAGxB,uBAA0B;IAG1B,wBAA2B;IAG3B,0BAA6B;IAG7B;;;MAGC;IAaD,aAAc;IAGd,mBAAkD;IAahD,eAAkC;IAQpC,mBAAmB;IACnB,SADU,MAAM,CACmB;IAGnC,sBAAsB;IACtB,WADW,OAAO,CACiB;IAQnC,sBAAyB;IACzB,sBAAwB;IACxB,4BAA8B;IA0B9B,oBAAuB;IAEvB,aAA0B;IAqC1B,mBAAqB;IA2FvB;;;;;;;OAOG;IACH,gBA+DC;IA9CG,kBAAoB;IAqBpB,qBAA2B;IA2B/B;;;;;OAKG;IACH,YAHY,OAAO,CA2JlB;IAjDC,eAAkB;IAClB,gBAAmB;IAkDrB;;;;;;;;;;;;;;OAcG;IACH,oBARW,MAAM,GAAC,IAAI,GAIV,MAAM,GAAC,IAAI,GAAC,SAAS,CAqBhC;IAED;;;;;;;;;;OAUG;IACH,cAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;OAUG;IACH,eAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;;;;OAaG;IACH,qBAXW,MAAM,UAKN,MAAM,GAAC,MAAM,GAGZ,MAAM,CA0BjB;IAED;;;;;;;;;;;;;OAaG;IACH,aATW,OAAO,GAKN,OAAO,GAAC,SAAS,CAyB5B;IAED;;;;;;;;;;;;;OAaG;IACH,YATW,OAAO,GAKN,OAAO,GAAC,SAAS,CAiB5B;IAED;;;;;;;;OAQG;IAEH;;;;;;;;;OASG;IACH,oBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAoB3B;IAPC,qBAAyB;IAS3B;;;;;OAKG;IACH,uBA8EC;IAED;;;;;;;;;;;OAWG;IACH,kBAuIC;IAtHC,kBAA8B;IA0D9B,WAAuC;IA8DzC;;;;OAIG;IACH,oBAqBC;IAdC,uBAAsE;IAgBxE;;;;;;;;;;OAUG;IACH,oBAHY,IAAI,CAUf;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kCAiBC;IAED;;;;;OAKG;IACH,qCASC;IAED;;;;OAIG;IACH,yBAaC;IAED;;;;;;OAMG;IACH,6BA4BC;IAED;;;;;OAKG;IACH,0CAwDC;IAED;;;;;;;;;;OAUG;IACH,2CAkDC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH;;;;;;OAMG;IACH,6BA+CC;IANC;;;MAAsE;IAQxE;;;;;;;;;;OAUG;IACH,oBAPW,OAAO,GAIN,OAAO,CAoBlB;IAED;;;;;;;OAOG;IACH,wBAcC;IAED;;;;;;;;;;OAUG;IACH,8BAaC;IAED;;;;;;OAMG;IACH,2BAqBC;IAED;;;;;;;OAOG;IACH,2BASC;IAED;;;;;;OAMG;IACH,kCAUC;IAED;;;;;;OAMG;IACH,2BASC;IAED;;;;;;OAMG;IACH,2BASC;IAED;;;;;;OAMG;IACH,0BASC;IAED;;;;;;OAMG;IACH,yBAUC;IAED;;;;;;OAMG;IACH,yBAiBC;IAED;;;;;OAKG;IACH,kCAEC;IAED;;;;;;;;OAQG;IACH,yBA4BC;IAED;;;;;;;;OAQG;IACH,+BA0CC;IAED;;;;;;OAMG;IACH,uBAEC;IAED;;;;;OAKG;IACH,8BAEC;IADC,uBAAsC;IAGxC;;;;;OAKG;IACH,6BAIC;IAED;;;;;;;;;OASG;IACH,4BAKC;IAED;;OAEG;IACH,+BAMC;IAED;;OAEG;IACH,wCAiBC;IAED;;;;;;;;;;;;OAYG;IACH,oCAUC;IAED,uDAEC;IAED;;OAEG;IACH,qCAMC;IAED;;;;;;;;OAQG;IACH,yCAEC;IAED;;;;;;;;OAQG;IACH,yCAEC;IAED;;;;;OAKG;IACH,yBAIC;IAED;;;;;;OAMG;IACH,4BAcC;IAED;;;;;OAKG;IACH,gBAEC;IAED;;;;;;;OAOG;IACH,oBAoBC;IAnBC;;;;;;;;;;;;;MAkBC;IAGH;;;;;;;;;;OAUG;IACH,kBAoBC;IAED;;;;;;;;;;;;OAYG;IACH,iBAmCC;IAED;;;;;;;;;OASG;IACH,QAPY,eAAQ,SAAS,CAW5B;IAED;;;;;;;;OAQG;IACH,cA2CC;IAlCG,8BAAuB;IAoC3B;;;;OAIG;IACH,gCAQC;IAED;;;;;;;;OAQG;IACH,uBAHW,SAAS,eAAQ,QAa3B;IAED;;OAEG;IACH,cAEC;IAED;;;;;;OAMG;IACH,UAJY,OAAO,CAOlB;IAED;;;;;;;OAOG;IACH,UAJa,OAAO,cAAc,EAAE,SAAS,CAM5C;IAED;;;;;;;;;;;OAWG;IACH,wBAPW,OAAO,GAGN,OAAO,GAAC,SAAS,CAgB5B;IAED;;;;;;;;;OASG;IACH,sBAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAiC3B;IAED;;;;OAIG;IACH,uBAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAqC3B;IAED;;;;;;OAMG;IACH,iBAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,wBAHY,MAAM,CAKjB;IAKD;;;;;;;;;OASG;IACH,YAHa,OAAO,cAAc,EAAE,SAAS,CAW5C;IAED;;;;;;;OAOG;IACH,mBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,eAHY,MAAM,CAajB;IAED;;;;;;;;;;;OAWG;IACH,0BATY,MAAM,GAMN,MAAM,GAAC,SAAS,CAsB3B;IAED;;;;;;;;;;;OAWG;IACH,cATW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,4BATW,OAAO,GAIN,OAAO,GAAC,SAAS,CAU5B;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAMC;IAED;;;;;;OAMG;IACH,sBAHY,OAAO,CAKlB;IAED;;;;;;;;;;;;;;;OAeG;IACH,oBARY,OAAO,GAGP,OAAO,GAAC,SAAS,CA0B5B;IAED;;;;;;;;;;;;;OAaG;IACH,yDA+BC;IAED,sDAqCC;IAED;;;;OAIG;IACH,+BA4BC;IAED,6BAiBC;IAED;;;;;OAKG;IACH,wBAqBC;IAnBC,sBAAwB;IAGxB,qBAA8D;IAkBhE;;;;;;OAMG;IACH,0BAHW,MAAM,QAahB;IAED;;;;OAIG;IACH,uBAkBC;IAED;;;;;;OAMG;IACH,gCAJW,OAAO,OAWjB;IAED;;;;;;;;;;;OAWG;IACH,6BARY,OAAO,GAGP,OAAO,GAAC,SAAS,CAY5B;IALG,+BAAoC;IAOxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,wCAkDC;IAED;;;;;;;;;OASG;IACH,qCAgBC;IAED;;;;;;;;;;OAUG;IACH,qBALW,KAAK,QAsDf;IAED;;;;;;;;;;OAUG;IACH,qBAHW,KAAK,QAuCf;IAED;;;;;;;;;;OAUG;IACH,kBANW,MAAM,GAGL,MAAM,CAkCjB;IAED;;;;;;;;;;OAUG;IACH,8BAHY,MAAO,OAAO,CA4DzB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,kCAPW,OAAO,GAGN,MAAM,GAAC,SAAS,CAgG3B;IALG,+BAGC;IAIL;;;;;;;;;;;;;;OAcG;IACH,kBAJY,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;;;OAYG;IACH,aAmCC;IAED;;OAEG;IACH,aAUC;IAED;;;;OAIG;IACH,cAQC;IAED,iBAYC;IAED;;;OAGG;IACH,2BAIC;IAED;;OAEG;IACH,0BA8BC;IAED;;OAEG;IACH,2BAGC;IAED;;OAEG;IACH,wBAGC;IAED;;;;;OAKG;IACH,kBAHY,IAAI,CAaf;IAED;;;;;OAKG;IACH,iBAHY,IAAI,CAKf;IAED;;;;;;OAMG;IACH,cAHY,MAAM,CAKjB;IAED;;;;;;;OAOG;IACH,eAHY,MAAM,CAKjB;IAED;;;;;;;;;OASG;IACH,gBAPW,MAAM,GAAC,MAAM,GAAC,UAAU,GAGvB,MAAM,GAAC,SAAS,CAW3B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,iBAZW,OAAO,GAAC,MAAM,GAAC,OAAO,GAAC,KAAK,GAQ3B,OAAO,GAAC,MAAM,GAAC,SAAS,CAqCnC;IAED;;;;;;;;;;;;;;;OAeG;IACH,oBAZW,OAAO,GAMN,MAAM,GAAC,SAAS,CAY3B;IAED;;;;;;;;;;OAUG;IACH,aARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IAED;;;;;;;;;;;OAWG;IACH,aAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAmC3B;IAED;;;;;;;;;;;OAWG;IACH,gCAYC;IAED;;;;;;;;;;;;OAYG;IACH,gBARW,OAAO,GAIN,OAAO,GAAC,SAAS,CA6C5B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,2BARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAuC5B;IAvBC,0BAAgC;IAyBlC;;;;;;;;;;;;OAYG;IACH,YARY,UAAU,GAAC,MAAM,GAAC,MAAM,GAIxB,UAAU,GAAC,IAAI,GAAC,SAAS,CAwEpC;IA3BG,mBAAkB;IA6BtB;;;;;OAKG;IACH,qCAEC;IADC,uBAAyB;IAG3B;;;;;;;;;;;;;OAaG;IACH,kBARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAoD5B;IAED;;;;OAIG;IACH,+BA2GC;IAED;;;;;;;;;;;;;OAaG;IACH,oBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAgB3B;IAED;;;;;;;;;;;;;;OAcG;IACH,2BAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAa3B;IAED;;;;;;;;;;OAUG;IACH,eARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IALG,kBAAsB;IAO1B,2BA2BC;IAED,4BASC;IAED;;;;;;;;;;;;OAYG;IACH,sBAPW,OAAO,GAGN,eAAQ,OAAO,CAiC1B;IAED,4BAOC;IAED,6BAOC;IAED;;;;;;;;;OASG;IACH,wBAPW,OAAO,GAGN,eAAQ,OAAO,CAiC1B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oBAbW,MAAM,UAGN,MAAM,aAGN,MAAM,GAGL,SAAS,GAAC,SAAS,CAQ9B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,iDAVW,OAAO,GAIL,OAAO,6BAA6B,EAAE,OAAO,CAUzD;IAED;;;;;;;;;OASG;IACH,iCAHY,SAAS,CAgBpB;IAED;;;;;;;;;OASG;IACH,2BAJY,MAAO,SAAS,CAM3B;IAED;;;;;OAKG;IACH,cAHY,MAAM,CAKjB;IAED;;;;;OAKG;IACH,eAHY,MAAM,CAKjB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAuB3B;IAbG,kBAA2C;IAe/C;;;;;;;OAOG;IACH,mBAEC;IAED;;;;;;OAMG;IACH,cAgBC;IAED;;;;;;;;;;;;;;;OAeG;IACH,qBAXW,MAAM,cAAU,OAAO,WAAO,IAAI,kBAQjC,WAAW,CAgBtB;IAED;;;;OAIG;IACH,iCA6BC;IAJK,oBAAsC;IAM5C;;;;OAIG;IACH,iCAQC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,0BA9BY,MAAO,OAAO,OA8CzB;IARC,kBAAuE;IAUzE;;;;;;;;;;;;OAYG;IACH,mBATY,OAAO,GAIP,OAAO,GAAC,SAAS,CAoC5B;IAfC,iBAAwB;IAiB1B;;;;;;OAMG;IACH,qBAJY,MAAM,CAMjB;IAED;;;;;;;OAOG;IACH,0BALY,MAAM,CAOjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IAEH;;;;;;;;OAQG;IACH,6CA8CC;IAED;;;;;;;OAOG;IACH,YAFY,MAAM,CA2BjB;IA8DD;;;;;;;OAOG;IACH,eALW,OAAO,GAGN,OAAO,GAAC,SAAS,CAkB5B;IAVG,uBAAuC;IAY3C;;;;;;;;;;;OAWG;IACH,wBALW,MAAM,EAAE,GAGP,MAAM,EAAE,CA0BnB;IAqEH;;;;;;;;;;;;;;OAcG;IACH,sBAxyIa,MAAM,GAAC,IAAI,KAIV,MAAM,GAAC,IAAI,GAAC,SAAS,CAoyIP;IAsB5B;;;;;;;;;;;;;;;;;;;;;MAAyB;CAzGxB"} \ No newline at end of file +{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../src/js/player.js"],"names":[],"mappings":";AA0RA;;;;;;;;;;;GAWG;AACH;IAqoJE;;;;;;;;;OASG;IACH,2BAPW,OAAO,OAuDjB;IA7rJD;;;;;;;;;;;OAWG;IACH,iBATW,OAAO,mCAkTjB;IAlQC,iDAA8E;IAC9E,2CAAiE;IAEjE,sCAAwD;IACxD,sCAAwD;IACxD,gDAA4E;IAE5E,wCAA4D;IAC5D,8CAAwE;IACxE,6CAAsE;IACtE,4CAAoE;IACpE,2CAAkE;IAClE,sCAAwD;IAGxD,uBAA0B;IAG1B,SAAiC;IAGjC,YAA2B;IAG3B,2BAA8B;IAI9B,wBAA0B;IAM1B,qBAAwB;IAGxB,qBAAwB;IAGxB,uBAA0B;IAG1B,wBAA2B;IAG3B,0BAA6B;IAG7B;;;MAGC;IAaD,aAAc;IAGd,mBAAkD;IAahD,eAAkC;IAQpC,mBAAmB;IACnB,SADU,MAAM,CACmB;IAGnC,sBAAsB;IACtB,WADW,OAAO,CACiB;IAQnC,sBAAyB;IACzB,sBAAwB;IACxB,4BAA8B;IA0B9B,oBAAuB;IAEvB,aAA0B;IAqC1B,mBAAqB;IA2FvB;;;;;;;OAOG;IACH,gBA+DC;IA9CG,kBAAoB;IAqBpB,qBAA2B;IA2B/B;;;;;OAKG;IACH,YAHY,OAAO,CA2JlB;IAjDC,eAAkB;IAClB,gBAAmB;IAkDrB;;;;;;;;;;;;;;OAcG;IACH,oBARW,MAAM,GAAC,IAAI,GAIV,MAAM,GAAC,IAAI,GAAC,SAAS,CAqBhC;IAED;;;;;;;;;;OAUG;IACH,cAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;OAUG;IACH,eAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;;;;OAaG;IACH,qBAXW,MAAM,UAKN,MAAM,GAAC,MAAM,GAGZ,MAAM,CA0BjB;IAED;;;;;;;;;;;;;OAaG;IACH,aATW,OAAO,GAKN,OAAO,GAAC,SAAS,CAyB5B;IAED;;;;;;;;;;;;;OAaG;IACH,YATW,OAAO,GAKN,OAAO,GAAC,SAAS,CAiB5B;IAED;;;;;;;;OAQG;IAEH;;;;;;;;;OASG;IACH,oBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAoB3B;IAPC,qBAAyB;IAS3B;;;;;OAKG;IACH,uBA8EC;IAED;;;;;;;;;;;OAWG;IACH,kBAuIC;IAtHC,kBAA8B;IA0D9B,WAAuC;IA8DzC;;;;OAIG;IACH,oBAqBC;IAdC,uBAAsE;IAgBxE;;;;;;;;;;OAUG;IACH,oBAHY,IAAI,CAUf;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kCAiBC;IAED;;;;;OAKG;IACH,qCASC;IAED;;;;OAIG;IACH,yBAaC;IAED;;;;;;OAMG;IACH,6BA4BC;IAED;;;;;OAKG;IACH,0CAwDC;IAED;;;;;;;;;;OAUG;IACH,2CAkDC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH;;;;;;OAMG;IACH,6BA+CC;IANC;;;MAAsE;IAQxE;;;;;;;;;;OAUG;IACH,oBAPW,OAAO,GAIN,OAAO,CAoBlB;IAED;;;;;;;OAOG;IACH,wBAcC;IAED;;;;;;;;;;OAUG;IACH,8BAaC;IAED;;;;;;OAMG;IACH,2BAqBC;IAED;;;;;;;OAOG;IACH,2BASC;IAED;;;;;;OAMG;IACH,kCAUC;IAED;;;;;;OAMG;IACH,2BASC;IAED;;;;;;OAMG;IACH,2BASC;IAED;;;;;;OAMG;IACH,0BASC;IAED;;;;;;OAMG;IACH,yBAUC;IAED;;;;;;OAMG;IACH,yBAiBC;IAED;;;;;OAKG;IACH,kCAEC;IAED;;;;;;;;OAQG;IACH,yBA4BC;IAED;;;;;;;;OAQG;IACH,+BA0CC;IAED;;;;;;OAMG;IACH,uBAEC;IAED;;;;;OAKG;IACH,8BAEC;IADC,uBAAsC;IAGxC;;;;;OAKG;IACH,6BAIC;IAED;;;;;;;;;OASG;IACH,4BAKC;IAED;;OAEG;IACH,+BAMC;IAED;;OAEG;IACH,wCAiBC;IAED;;;;;;;;;;;;OAYG;IACH,oCAUC;IAED,uDAEC;IAED;;OAEG;IACH,qCAMC;IAED;;;;;;;;OAQG;IACH,yCAEC;IAED;;;;;;;;OAQG;IACH,yCAEC;IAED;;;;;OAKG;IACH,yBAMC;IAED;;;;;;OAMG;IACH,4BAcC;IAED;;;;;OAKG;IACH,gBAEC;IAED;;;;;;;OAOG;IACH,oBAoBC;IAnBC;;;;;;;;;;;;;MAkBC;IAGH;;;;;;;;;;OAUG;IACH,kBAoBC;IAED;;;;;;;;;;;;OAYG;IACH,iBAmCC;IAED;;;;;;;;;OASG;IACH,QAPY,eAAQ,SAAS,CAW5B;IAED;;;;;;;;OAQG;IACH,cA2CC;IAlCG,8BAAuB;IAoC3B;;;;OAIG;IACH,gCAQC;IAED;;;;;;;;OAQG;IACH,uBAHW,SAAS,eAAQ,QAa3B;IAED;;OAEG;IACH,cAEC;IAED;;;;;;OAMG;IACH,UAJY,OAAO,CAOlB;IAED;;;;;;;OAOG;IACH,UAJa,OAAO,cAAc,EAAE,SAAS,CAM5C;IAED;;;;;;;;;;;OAWG;IACH,wBAPW,OAAO,GAGN,OAAO,GAAC,SAAS,CAgB5B;IAED;;;;;;;;;OASG;IACH,sBAPW,MAAM,GAAC,MAAM,GAGZ,MAAM,GAAC,SAAS,CAiC3B;IAED;;;;OAIG;IACH,uBAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAqC3B;IAED;;;;;;OAMG;IACH,iBAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,wBAHY,MAAM,CAKjB;IAKD;;;;;;;;;OASG;IACH,YAHa,OAAO,cAAc,EAAE,SAAS,CAW5C;IAED;;;;;;;OAOG;IACH,mBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,eAHY,MAAM,CAajB;IAED;;;;;;;;;;;OAWG;IACH,0BATY,MAAM,GAMN,MAAM,GAAC,SAAS,CAsB3B;IAED;;;;;;;;;;;OAWG;IACH,cATW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,4BATW,OAAO,GAIN,OAAO,GAAC,SAAS,CAU5B;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAMC;IAED;;;;;;OAMG;IACH,sBAHY,OAAO,CAKlB;IAED;;;;;;;;;;;;;;;OAeG;IACH,oBARY,OAAO,GAGP,OAAO,GAAC,SAAS,CA0B5B;IAED;;;;;;;;;;;;;OAaG;IACH,yDA+BC;IAED,sDAqCC;IAED;;;;OAIG;IACH,+BA4BC;IAED,6BAiBC;IAED;;;;;OAKG;IACH,wBAqBC;IAnBC,sBAAwB;IAGxB,qBAA8D;IAkBhE;;;;;;OAMG;IACH,0BAHW,MAAM,QAahB;IAED;;;;OAIG;IACH,uBAkBC;IAED;;;;;;OAMG;IACH,gCAJW,OAAO,OAWjB;IAED;;;;;;;;;;;OAWG;IACH,6BARY,OAAO,GAGP,OAAO,GAAC,SAAS,CAY5B;IALG,+BAAoC;IAOxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,wCAkDC;IAED;;;;;;;;;OASG;IACH,qCAgBC;IAgED;;;;;;;;;;OAUG;IACH,qBAHW,KAAK,QAuCf;IAED;;;;;;;;;;OAUG;IACH,kBANW,MAAM,GAGL,MAAM,CAkCjB;IAED;;;;;;;;;;OAUG;IACH,8BAHY,MAAO,OAAO,CA4DzB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,kCAPW,OAAO,GAGN,MAAM,GAAC,SAAS,CAgG3B;IALG,+BAGC;IAIL;;;;;;;;;;;;;;OAcG;IACH,kBAJY,MAAM,GAAC,SAAS,CAM3B;IAED;;;;;;;;;;;;OAYG;IACH,aAmCC;IAED;;OAEG;IACH,aAUC;IAED;;;;OAIG;IACH,cAQC;IAED,iBAYC;IAED;;;OAGG;IACH,2BAIC;IAED;;OAEG;IACH,0BA8BC;IAED;;OAEG;IACH,2BAGC;IAED;;OAEG;IACH,wBAGC;IAED;;;;;OAKG;IACH,kBAHY,IAAI,CAaf;IAED;;;;;OAKG;IACH,iBAHY,IAAI,CAKf;IAED;;;;;;OAMG;IACH,cAHY,MAAM,CAKjB;IAED;;;;;;;OAOG;IACH,eAHY,MAAM,CAKjB;IAED;;;;;;;;;OASG;IACH,gBAPW,MAAM,GAAC,MAAM,GAAC,UAAU,GAGvB,MAAM,GAAC,SAAS,CAW3B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,iBAZW,OAAO,GAAC,MAAM,GAAC,OAAO,GAAC,KAAK,GAQ3B,OAAO,GAAC,MAAM,GAAC,SAAS,CAqCnC;IAED;;;;;;;;;;;;;;;OAeG;IACH,oBAZW,OAAO,GAMN,MAAM,GAAC,SAAS,CAY3B;IAED;;;;;;;;;;OAUG;IACH,aARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IAED;;;;;;;;;;;OAWG;IACH,aAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAmC3B;IAED;;;;;;;;;;;OAWG;IACH,gCAYC;IAED;;;;;;;;;;;;OAYG;IACH,gBARW,OAAO,GAIN,OAAO,GAAC,SAAS,CA6C5B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,2BARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAuC5B;IAvBC,0BAAgC;IAyBlC;;;;;;;;;;;;OAYG;IACH,YARY,UAAU,GAAC,MAAM,GAAC,MAAM,GAIxB,UAAU,GAAC,IAAI,GAAC,SAAS,CAwEpC;IA3BG,mBAAkB;IA6BtB;;;;;OAKG;IACH,qCAEC;IADC,uBAAyB;IAG3B;;;;;;;;;;;;;OAaG;IACH,kBARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAoD5B;IAED;;;;OAIG;IACH,+BA2GC;IAED;;;;;;;;;;;;;OAaG;IACH,oBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAgB3B;IAED;;;;;;;;;;;;;;OAcG;IACH,2BAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAa3B;IAED;;;;;;;;;;OAUG;IACH,eARW,OAAO,GAIN,OAAO,GAAC,SAAS,CAW5B;IALG,kBAAsB;IAO1B,2BA2BC;IAED,4BASC;IAED;;;;;;;;;;;;OAYG;IACH,sBAPW,OAAO,GAGN,eAAQ,OAAO,CAiC1B;IAED,4BAOC;IAED,6BAOC;IAED;;;;;;;;;OASG;IACH,wBAPW,OAAO,GAGN,eAAQ,OAAO,CAiC1B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oBAbW,MAAM,UAGN,MAAM,aAGN,MAAM,GAGL,SAAS,GAAC,SAAS,CAQ9B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,iDAVW,OAAO,GAIL,OAAO,6BAA6B,EAAE,OAAO,CAUzD;IAED;;;;;;;;;OASG;IACH,iCAHY,SAAS,CAgBpB;IAED;;;;;;;;;OASG;IACH,2BAJY,MAAO,SAAS,CAM3B;IAED;;;;;OAKG;IACH,cAHY,MAAM,CAKjB;IAED;;;;;OAKG;IACH,eAHY,MAAM,CAKjB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAPW,MAAM,GAGL,MAAM,GAAC,SAAS,CAuB3B;IAbG,kBAA2C;IAe/C;;;;;;;OAOG;IACH,mBAEC;IAED;;;;;;OAMG;IACH,cAgBC;IAED;;;;;;;;;;;;;;;OAeG;IACH,qBAXW,MAAM,cAAU,OAAO,WAAO,IAAI,kBAQjC,WAAW,CAgBtB;IAED;;;;OAIG;IACH,iCA6BC;IAJK,oBAAsC;IAM5C;;;;OAIG;IACH,iCAQC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,0BA9BY,MAAO,OAAO,OA8CzB;IARC,kBAAuE;IAUzE;;;;;;;;;;;;OAYG;IACH,mBATY,OAAO,GAIP,OAAO,GAAC,SAAS,CAoC5B;IAfC,iBAAwB;IAiB1B;;;;;;OAMG;IACH,qBAJY,MAAM,CAMjB;IAED;;;;;;;OAOG;IACH,0BALY,MAAM,CAOjB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IAEH;;;;;;;;OAQG;IACH,6CA8CC;IAED;;;;;;;OAOG;IACH,YAFY,MAAM,CA2BjB;IA8DD;;;;;;;OAOG;IACH,eALW,OAAO,GAGN,OAAO,GAAC,SAAS,CAkB5B;IAVG,uBAAuC;IAY3C;;;;;;;;;;;OAWG;IACH,wBALW,MAAM,EAAE,GAGP,MAAM,EAAE,CA0BnB;IAqEH;;;;;;;;;;;;;;OAcG;IACH,sBA1yIa,MAAM,GAAC,IAAI,KAIV,MAAM,GAAC,IAAI,GAAC,SAAS,CAsyIP;IAsB5B;;;;;;;;;;;;;;;;;;;;;MAAyB;CAzGxB"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/plugin.d.ts b/node_modules/video.js/dist/types/plugin.d.ts index 8868537be6..451a4ebfb4 100644 --- a/node_modules/video.js/dist/types/plugin.d.ts +++ b/node_modules/video.js/dist/types/plugin.d.ts @@ -1,8 +1,5 @@ export default Plugin; -/** - * ~PluginEventHash - */ -export type Plugin = { +export type PluginEventHash = { /** * For basic plugins, the return value of the plugin function. For * advanced plugins, the plugin instance on which the event is fired. @@ -126,10 +123,10 @@ declare class Plugin { * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ - getEventHash(hash?: any): Plugin; + getEventHash(hash?: any): PluginEventHash; /** * Triggers an event on the plugin object and overrides * {@link module:evented~EventedMixin.trigger|EventedMixin.trigger}. @@ -139,7 +136,7 @@ declare class Plugin { * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. diff --git a/node_modules/video.js/dist/types/plugin.d.ts.map b/node_modules/video.js/dist/types/plugin.d.ts.map index 2efcd4f84f..4c5f2c2adb 100644 --- a/node_modules/video.js/dist/types/plugin.d.ts.map +++ b/node_modules/video.js/dist/types/plugin.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/js/plugin.js"],"names":[],"mappings":";;;;;;;;;cAigBc,MAAM;;;;UAIN,MAAM;;;;;YAGN,MAAM;;AA3VpB;;;;;;;;;;;;;GAaG;AACH;IA+HE;;;;;;;;;OASG;IACH,uBAPa,MAAM,WAAS,GAIhB,OAAO,CAOlB;IAED;;;;;;;;;;;;;;OAcG;IACH,4BAZa,MAAM,UAKN,aAAa,WAAS,GAGvB,aAAa,WAAS,CAgCjC;IAED;;;;;;;;;OASG;IACH,8BAPY,MAAM,QAejB;IAED;;;;;;;;;;OAUG;IACH,kCAJY,MAAO,SAAS,CAiB3B;IAED;;;;;;;;OAQG;IACH,8BANa,MAAM,GAGP,MAAM,CAOjB;IArPD;;;;;;;OAOG;IACH,oBAHW,MAAM,EA4BhB;IApBC,eAAoB;IAGlB,SAAkD;IA6EtD;;;;;;;OAOG;IACH,gBAsBC;IAxFD;;OAEG;IACH,eAEC;IAED;;;;;;;;;;;OAWG;IACH,0BAHY,MAAM,CAQjB;IAED;;;;;;;;;;;;;OAaG;IACH,eAVa,MAAM,MAAO,eAOd,OAAO,CAKlB;IAED;;;;;;;;;;;OAWG;IACH,sBAPc,KAAK,QAOK;IA2BR,WAAiB;CAgIlC;;;;;;AApYD;;;;;;;;;GASG;AACH,iCANa,MAAM,GAGP,aAAa,cAAU,SAAS,CAGoC;AAhDhF;;;;;;GAMG;AACH,gCAFU,MAAM,CAEkB"} \ No newline at end of file +{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/js/plugin.js"],"names":[],"mappings":";;;;;;cAigBc,MAAM;;;;UAIN,MAAM;;;;;YAGN,MAAM;;AA3VpB;;;;;;;;;;;;;GAaG;AACH;IA+HE;;;;;;;;;OASG;IACH,uBAPa,MAAM,WAAS,GAIhB,OAAO,CAOlB;IAED;;;;;;;;;;;;;;OAcG;IACH,4BAZa,MAAM,UAKN,aAAa,WAAS,GAGvB,aAAa,WAAS,CAgCjC;IAED;;;;;;;;;OASG;IACH,8BAPY,MAAM,QAejB;IAED;;;;;;;;;;OAUG;IACH,kCAJY,MAAO,SAAS,CAiB3B;IAED;;;;;;;;OAQG;IACH,8BANa,MAAM,GAGP,MAAM,CAOjB;IArPD;;;;;;;OAOG;IACH,oBAHW,MAAM,EA4BhB;IApBC,eAAoB;IAGlB,SAAkD;IA6EtD;;;;;;;OAOG;IACH,gBAsBC;IAxFD;;OAEG;IACH,eAEC;IAED;;;;;;;;;;;OAWG;IACH,0BAHY,eAAe,CAQ1B;IAED;;;;;;;;;;;;;OAaG;IACH,eAVa,MAAM,MAAO,eAOd,OAAO,CAKlB;IAED;;;;;;;;;;;OAWG;IACH,sBAPc,KAAK,QAOK;IA2BR,WAAiB;CAgIlC;;;;;;AApYD;;;;;;;;;GASG;AACH,iCANa,MAAM,GAGP,aAAa,cAAU,SAAS,CAGoC;AAhDhF;;;;;;GAMG;AACH,gCAFU,MAAM,CAEkB"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tech/tech.d.ts b/node_modules/video.js/dist/types/tech/tech.d.ts index f9be7c6e93..3f50aa4414 100644 --- a/node_modules/video.js/dist/types/tech/tech.d.ts +++ b/node_modules/video.js/dist/types/tech/tech.d.ts @@ -1,8 +1,11 @@ export default Tech; /** - * ~SourceObject + * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string + * that just contains the src url alone. + * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` + * `var SourceString = 'http://example.com/some-video.mp4';` */ -export type Tech = any | string; +export type SourceObject = any | string; /** * This is the base class for media playback technology controllers, such as * {@link HTML5} @@ -232,11 +235,11 @@ declare class Tech extends Component { * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ - played(): TimeRange; + played(): import('../utils/time').TimeRange; /** * Start playback * diff --git a/node_modules/video.js/dist/types/tech/tech.d.ts.map b/node_modules/video.js/dist/types/tech/tech.d.ts.map index 0e01991bb2..31ad842312 100644 --- a/node_modules/video.js/dist/types/tech/tech.d.ts.map +++ b/node_modules/video.js/dist/types/tech/tech.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"tech.d.ts","sourceRoot":"","sources":["../../../src/js/tech/tech.js"],"names":[],"mappings":";;;;mBAwBa,MAAO,MAAM;AAoD1B;;;;;GAKG;AACH;IAy2BE;;;;;;;;;OASG;IACH,0BAJW,MAAM,GAEL,MAAM,CAIjB;IAED;;;;;;;;OAQG;IACH,iDAFY,MAAM,CAIjB;IAcD,uCAIC;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,kBA+BhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,GAGL,IAAI,GAAC,SAAS,CAkBzB;IAh9BD;;;;;;;;MAQE;IACF,6CAwEC;IAlEC,oCAAwD;IACxD,iCAAkD;IAClD,oCAAwD;IACxD,2CAAsE;IACtE,uCAAgE;IAEhE,yBAA+B;IAI/B,qBAAwB;IAiCtB,0BAmiCI,OAAO,CAniC0B;IASvC,2BAA4D;IAE5D,mEAAiE;IAcnE;;;;;;OAMG;IACH,sBAFW,MAAM,QAqBhB;IAKD;;;;OAIG;IACH,yBAOC;IAJC,wBAA0B;IAM5B;;;OAGG;IACH,0BAKC;IAED;;;;;;;;;;;;OAYG;IACH,qBANW,KAAK,QA6Bf;IArBC,yBAoBQ;IAGV;;;;;;;;OAQG;IACH,wBALW,KAAK,QAOf;IADC,eAAgC;IAGlC;;;;;OAKG;IACH,YAHa,OAAO,eAAe,EAAE,SAAS,CAK7C;IAED;;;;;;;OAOG;IACH,mBALY,MAAM,CAOjB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;OAIG;IACH,4BAKC;IAJC,2BAA6B;IAM/B;;;OAGG;IACH,6BAKC;IAED;;;;;;OAMG;IACH,yBAeC;IAXC,4BAUO;IAGT;;;;;OAKG;IACH,gCAMC;IAED;;;;;OAKG;IACH,gBAeC;IAED;;;;;;;;;OASG;IACH,mBAJW,MAAM,EAAE,GAAC,MAAM,QAoBzB;IAED;;;OAGG;IACH,8BASC;IAED;;;;OAIG;IACH,cAAU;IAEV;;;;;;OAMG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,uBAAmB;IAEnB;;;;;;;;OAQG;IACH,YANW,UAAU,GAGT,UAAU,GAAC,IAAI,CAS1B;IAJG,mBAAiC;IAMrC;;;;;;;;;OASG;IACH,oBAKC;IAED;;;;;;OAMG;IACH,aAAS;IAET;;;;;;;;;OASG;IACH,2BANW,OAAO,QAMW;IAE7B;;;;;;OAMG;IACH,kBAAc;IAEd;;;;;;;OAOG;IACH,yBAJW,MAAM,QAehB;IAED;;;;;;;;;OASG;IACH,2BAqCC;IAED;;;;;OAKG;IACH,yBAqDC;IAED;;;OAGG;IACH,0BA4CC;IAED;;;;;;;;;;;;;;OAcG;IACH,mBAZW,MAAM,UAGN,MAAM,aAGN,MAAM,GAGL,SAAS,CASpB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;eAZW,MAAM;gBAGN,MAAM;mBAGN,MAAM;QAGL,gBAAgB,CAS3B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,kDATW,OAAO,GAKN,gBAAgB,CAqB3B;IAED;;;;;OAKG;IACH,6BAHW,SAAS,QAUnB;IAED;;;;;;;;;;OAUG;IACH,+BAEC;IAED;;;;;;;;;;;;;OAaG;IACH,2BAPY,eAAQ,SAAS,CAS5B;IAED;;;;;OAKG;IACH,mCAEC;IAED;;;;OAIG;IACH,mCAA+B;IAE/B;;;;;OAKG;IACH,yCAFY,MAAM,CAkBjB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,kBAAc;IAEd;;;;OAIG;IACH,oBAAgB;IAEhB;;;;OAIG;IACH,uBAAmB;IAEnB;;;;;;;OAOG;IACH,oCALW,OAAO,QAKoB;IAEtC;;;;;;;OAOG;IACH,oCALW,OAAO,QAKoB;IAEtC;;;;;;;;;;;;;;;OAeG;IACH,mBAVY,MAAM,GAGN,MAAM,CASjB;IA0JH;;;;;;OAMG;IAEH;;;;;;OAMG;IAEH;;;;;;OAMG;IAEH;;;;;OAKG;IACH,uBAHU,OAAO,CAGmB;IAEpC;;;;;OAKG;IACH,qBAHU,OAAO,CAGiB;IAElC;;;;;;OAMG;IACH,0BAHU,OAAO,CAGsB;IAEvC;;;;;;;;OAQG;IACH,sBAHU,OAAO,CAGkB;IAEnC;;;;;;OAMG;IACH,wBAHU,OAAO,CAGoB;IAErC;;;;;;;;;OASG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;;OAMG;IACH,0BAHU,OAAO,CAGsB;IAWvC;;;;;OAKG;IACH,4BAHU,OAAO,CAGwB;CAvJxC;;IAyJD;;;;;;;;;;;OAWG;IACH,+CA0MC"} \ No newline at end of file +{"version":3,"file":"tech.d.ts","sourceRoot":"","sources":["../../../src/js/tech/tech.js"],"names":[],"mappings":";;;;;;;2BAwBa,MAAO,MAAM;AAoD1B;;;;;GAKG;AACH;IAy2BE;;;;;;;;;OASG;IACH,0BAJW,MAAM,GAEL,MAAM,CAIjB;IAED;;;;;;;;OAQG;IACH,iDAFY,MAAM,CAIjB;IAcD,uCAIC;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,kBA+BhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,GAGL,IAAI,GAAC,SAAS,CAkBzB;IAh9BD;;;;;;;;MAQE;IACF,6CAwEC;IAlEC,oCAAwD;IACxD,iCAAkD;IAClD,oCAAwD;IACxD,2CAAsE;IACtE,uCAAgE;IAEhE,yBAA+B;IAI/B,qBAAwB;IAiCtB,0BAmiCI,OAAO,CAniC0B;IASvC,2BAA4D;IAE5D,mEAAiE;IAcnE;;;;;;OAMG;IACH,sBAFW,MAAM,QAqBhB;IAKD;;;;OAIG;IACH,yBAOC;IAJC,wBAA0B;IAM5B;;;OAGG;IACH,0BAKC;IAED;;;;;;;;;;;;OAYG;IACH,qBANW,KAAK,QA6Bf;IArBC,yBAoBQ;IAGV;;;;;;;;OAQG;IACH,wBALW,KAAK,QAOf;IADC,eAAgC;IAGlC;;;;;OAKG;IACH,YAHa,OAAO,eAAe,EAAE,SAAS,CAK7C;IAED;;;;;;;OAOG;IACH,mBALY,MAAM,CAOjB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;OAIG;IACH,4BAKC;IAJC,2BAA6B;IAM/B;;;OAGG;IACH,6BAKC;IAED;;;;;;OAMG;IACH,yBAeC;IAXC,4BAUO;IAGT;;;;;OAKG;IACH,gCAMC;IAED;;;;;OAKG;IACH,gBAeC;IAED;;;;;;;;;OASG;IACH,mBAJW,MAAM,EAAE,GAAC,MAAM,QAoBzB;IAED;;;OAGG;IACH,8BASC;IAED;;;;OAIG;IACH,cAAU;IAEV;;;;;;OAMG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,uBAAmB;IAEnB;;;;;;;;OAQG;IACH,YANW,UAAU,GAGT,UAAU,GAAC,IAAI,CAS1B;IAJG,mBAAiC;IAMrC;;;;;;;;;OASG;IACH,UAJa,OAAO,eAAe,EAAE,SAAS,CAS7C;IAED;;;;;;OAMG;IACH,aAAS;IAET;;;;;;;;;OASG;IACH,2BANW,OAAO,QAMW;IAE7B;;;;;;OAMG;IACH,kBAAc;IAEd;;;;;;;OAOG;IACH,yBAJW,MAAM,QAehB;IAED;;;;;;;;;OASG;IACH,2BAqCC;IAED;;;;;OAKG;IACH,yBAqDC;IAED;;;OAGG;IACH,0BA4CC;IAED;;;;;;;;;;;;;;OAcG;IACH,mBAZW,MAAM,UAGN,MAAM,aAGN,MAAM,GAGL,SAAS,CASpB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;eAZW,MAAM;gBAGN,MAAM;mBAGN,MAAM;QAGL,gBAAgB,CAS3B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,kDATW,OAAO,GAKN,gBAAgB,CAqB3B;IAED;;;;;OAKG;IACH,6BAHW,SAAS,QAUnB;IAED;;;;;;;;;;OAUG;IACH,+BAEC;IAED;;;;;;;;;;;;;OAaG;IACH,2BAPY,eAAQ,SAAS,CAS5B;IAED;;;;;OAKG;IACH,mCAEC;IAED;;;;OAIG;IACH,mCAA+B;IAE/B;;;;;OAKG;IACH,yCAFY,MAAM,CAkBjB;IAED;;;;OAIG;IACH,6BAFW,MAAM,QAQhB;IAED;;;;OAIG;IACH,kBAAc;IAEd;;;;OAIG;IACH,oBAAgB;IAEhB;;;;OAIG;IACH,uBAAmB;IAEnB;;;;;;;OAOG;IACH,oCALW,OAAO,QAKoB;IAEtC;;;;;;;OAOG;IACH,oCALW,OAAO,QAKoB;IAEtC;;;;;;;;;;;;;;;OAeG;IACH,mBAVY,MAAM,GAGN,MAAM,CASjB;IA0JH;;;;;;OAMG;IAEH;;;;;;OAMG;IAEH;;;;;;OAMG;IAEH;;;;;OAKG;IACH,uBAHU,OAAO,CAGmB;IAEpC;;;;;OAKG;IACH,qBAHU,OAAO,CAGiB;IAElC;;;;;;OAMG;IACH,0BAHU,OAAO,CAGsB;IAEvC;;;;;;;;OAQG;IACH,sBAHU,OAAO,CAGkB;IAEnC;;;;;;OAMG;IACH,wBAHU,OAAO,CAGoB;IAErC;;;;;;;;;OASG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;;OAMG;IACH,0BAHU,OAAO,CAGsB;IAWvC;;;;;OAKG;IACH,4BAHU,OAAO,CAGwB;CAvJxC;;IAyJD;;;;;;;;;;;OAWG;IACH,+CA0MC"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts b/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts index ba68869be1..b4c827ab33 100644 --- a/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts +++ b/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts @@ -9,10 +9,10 @@ declare class AudioTrackList extends TrackList { /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ - constructor(tracks?: AudioTrack[]); + constructor(tracks?: import('./audio-track').default[]); changing_: boolean; /** * Add an {@link AudioTrack} to the `AudioTrackList`. diff --git a/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts.map b/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts.map index 57c935c70b..190948bb10 100644 --- a/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts.map +++ b/node_modules/video.js/dist/types/tracks/audio-track-list.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"audio-track-list.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/audio-track-list.js"],"names":[],"mappings":";AA2BA;;;;;GAKG;AACH;IAEE;;;;;OAKG;IACH,qBAHW,YAAY,EAetB;IADC,mBAAsB;IAGxB;;;;;;;OAOG;IACH,gBALY,OAAO,eAAe,EAAE,OAAO,QAkC1C;IAED,+BAOC;CACF"} \ No newline at end of file +{"version":3,"file":"audio-track-list.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/audio-track-list.js"],"names":[],"mappings":";AA2BA;;;;;GAKG;AACH;IAEE;;;;;OAKG;IACH,qBAHY,OAAO,eAAe,EAAE,OAAO,EAAE,EAe5C;IADC,mBAAsB;IAGxB;;;;;;;OAOG;IACH,gBALY,OAAO,eAAe,EAAE,OAAO,QAkC1C;IAED,+BAOC;CACF"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tracks/html-track-element.d.ts b/node_modules/video.js/dist/types/tracks/html-track-element.d.ts index 9412c407d6..556dd34be3 100644 --- a/node_modules/video.js/dist/types/tracks/html-track-element.d.ts +++ b/node_modules/video.js/dist/types/tracks/html-track-element.d.ts @@ -48,7 +48,10 @@ declare class HTMLTrackElement extends EventTarget { srclang: any; label: any; default: any; - allowedEvents_: { + /** + * @protected + */ + protected allowedEvents_: { load: string; }; } diff --git a/node_modules/video.js/dist/types/tracks/html-track-element.d.ts.map b/node_modules/video.js/dist/types/tracks/html-track-element.d.ts.map index a16815c812..0115f13dc9 100644 --- a/node_modules/video.js/dist/types/tracks/html-track-element.d.ts.map +++ b/node_modules/video.js/dist/types/tracks/html-track-element.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"html-track-element.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/html-track-element.js"],"names":[],"mappings":";AAOA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH;QA5BqD,IAAI,EAA7C,OAAO,cAAc,EAAE,OAAO;OAmFzC;IAhDC,UAAsB;IACtB,SAAoB;IACpB,aAA6B;IAC7B,WAAwB;IACxB,aAA4B;IA+ChC;;MAAyC;CAFxC;;gBASS,MAAM;mBAQN,MAAM;kBAQN,MAAM;iBAQN,MAAM"} \ No newline at end of file +{"version":3,"file":"html-track-element.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/html-track-element.js"],"names":[],"mappings":";AAOA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH;QA5BqD,IAAI,EAA7C,OAAO,cAAc,EAAE,OAAO;OAmFzC;IAhDC,UAAsB;IACtB,SAAoB;IACpB,aAA6B;IAC7B,WAAwB;IACxB,aAA4B;IA+ChC;;OAEG;IACH;;MAAyC;CALxC;;gBAYS,MAAM;mBAQN,MAAM;kBAQN,MAAM;iBAQN,MAAM"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tracks/text-track.d.ts b/node_modules/video.js/dist/types/tracks/text-track.d.ts index ddacd19fb4..f418054318 100644 --- a/node_modules/video.js/dist/types/tracks/text-track.d.ts +++ b/node_modules/video.js/dist/types/tracks/text-track.d.ts @@ -69,8 +69,9 @@ declare class TextTrack extends Track { removeCue(removeCue: any): void; /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ - allowedEvents_: { + protected allowedEvents_: { cuechange: string; }; } diff --git a/node_modules/video.js/dist/types/tracks/text-track.d.ts.map b/node_modules/video.js/dist/types/tracks/text-track.d.ts.map index e00d7ed69d..a67d15fbd6 100644 --- a/node_modules/video.js/dist/types/tracks/text-track.d.ts.map +++ b/node_modules/video.js/dist/types/tracks/text-track.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"text-track.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/text-track.js"],"names":[],"mappings":";AAoHA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH;QA5BqD,IAAI,EAA7C,OAAO,cAAc,EAAE,OAAO;OA6OzC;IAhMC,WAA0B;IAE1B,aAAe;IACf,mBAAqB;IAErB,kBAAsD;IAMtD,4BA2BE;IA8IA,SAAuB;IAIrB,iBAAmB;IAUzB,sBAKC;IAHC,UAAwE;IAK1E,qBAMC;IAED;;;;;OAKG;IACH,+BA2BC;IAED;;;;;OAKG;IACH,gCAYC;IAGH;;OAEG;IACH;;MAAkC;CALjC"} \ No newline at end of file +{"version":3,"file":"text-track.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/text-track.js"],"names":[],"mappings":";AAoHA;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH;QA5BqD,IAAI,EAA7C,OAAO,cAAc,EAAE,OAAO;OA6OzC;IAhMC,WAA0B;IAE1B,aAAe;IACf,mBAAqB;IAErB,kBAAsD;IAMtD,4BA2BE;IA8IA,SAAuB;IAIrB,iBAAmB;IAUzB,sBAKC;IAHC,UAAwE;IAK1E,qBAMC;IAED;;;;;OAKG;IACH,+BA4BC;IAED;;;;;OAKG;IACH,gCAYC;IAGH;;;OAGG;IACH;;MAAkC;CANjC"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tracks/track-list.d.ts b/node_modules/video.js/dist/types/tracks/track-list.d.ts index b0633471e4..18e9d1cc12 100644 --- a/node_modules/video.js/dist/types/tracks/track-list.d.ts +++ b/node_modules/video.js/dist/types/tracks/track-list.d.ts @@ -53,9 +53,14 @@ declare class TrackList extends EventTarget { * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ - private allowedEvents_; + protected allowedEvents_: { + change: string; + addtrack: string; + removetrack: string; + labelchange: string; + }; } import EventTarget from "../event-target"; //# sourceMappingURL=track-list.d.ts.map \ No newline at end of file diff --git a/node_modules/video.js/dist/types/tracks/track-list.d.ts.map b/node_modules/video.js/dist/types/tracks/track-list.d.ts.map index 15625fb087..bf34d596f5 100644 --- a/node_modules/video.js/dist/types/tracks/track-list.d.ts.map +++ b/node_modules/video.js/dist/types/tracks/track-list.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"track-list.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/track-list.js"],"names":[],"mappings":";AAMA;;;;;GAKG;AACH;IACE;;;;;;;OAOG;IACH,qBALY,OAAO,SAAS,EAAE,OAAO,EAAE,EAyBtC;IAjBC,eAAiB;IAmBnB;;;;;;;OAOG;IACH,gBALY,OAAO,SAAS,EAAE,OAAO,QAqDpC;IAED;;;;;;;OAOG;IACH,oBALY,OAAO,SAAS,EAAE,OAAO,QAsCpC;IAED;;;;;;;OAOG;IACH,qBAaC;IAGH;;;;;OAKG;IAEH;;;;;OAKG;IACH,uBAAkC;CAfjC"} \ No newline at end of file +{"version":3,"file":"track-list.d.ts","sourceRoot":"","sources":["../../../src/js/tracks/track-list.js"],"names":[],"mappings":";AAMA;;;;;GAKG;AACH;IACE;;;;;;;OAOG;IACH,qBALY,OAAO,SAAS,EAAE,OAAO,EAAE,EAyBtC;IAjBC,eAAiB;IAmBnB;;;;;;;OAOG;IACH,gBALY,OAAO,SAAS,EAAE,OAAO,QAqDpC;IAED;;;;;;;OAOG;IACH,oBALY,OAAO,SAAS,EAAE,OAAO,QAsCpC;IAED;;;;;;;OAOG;IACH,qBAaC;IAGH;;;;;OAKG;IAEH;;;;;OAKG;IACH;;;;;MAAkC;CAfjC"} \ No newline at end of file diff --git a/node_modules/video.js/dist/types/video.d.ts b/node_modules/video.js/dist/types/video.d.ts index a5f0d4989e..da3002935c 100644 --- a/node_modules/video.js/dist/types/video.d.ts +++ b/node_modules/video.js/dist/types/video.d.ts @@ -4,6 +4,7 @@ export default videojs; * parameters and any callback value will be ignored. See: {@link Component ~ReadyCallback} */ export type ReadyCallback = () => any; +export type version = string; /** * A callback that is called when a component is ready. Does not have any * parameters and any callback value will be ignored. See: {@link Component~ReadyCallback} @@ -132,13 +133,13 @@ declare namespace videojs { * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ - export function registerComponent(name: string, comp: Component): Component; + export function registerComponent(name: string, comp: typeof Component): typeof Component; export const getTech: typeof Tech.getTech; export const registerTech: typeof Tech.registerTech; export { middlewareUse as use }; @@ -159,11 +160,13 @@ declare namespace videojs { * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ - export function plugin(name: string, plugin: Function | Plugin): Function | typeof Plugin; + export function plugin(name: string, plugin: Function | typeof Plugin): Function | typeof Plugin; export const getPlugins: typeof Plugin.getPlugins; export const getPlugin: (name: string) => Function | typeof Plugin; export const getPluginVersion: typeof Plugin.getPluginVersion; diff --git a/node_modules/video.js/dist/types/video.d.ts.map b/node_modules/video.js/dist/types/video.d.ts.map index a4c85f3e14..4d1d30236a 100644 --- a/node_modules/video.js/dist/types/video.d.ts.map +++ b/node_modules/video.js/dist/types/video.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/js/video.js"],"names":[],"mappings":";;;;;;AAmDA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,6BAdY,MAAM,GAAC,OAAO,yBAOd,aAAa,GAIb,MAAM,CAiEjB;;;;;;;;;IAoDD;;;;;OAKG;IACH,kCAAyC;IAEzC;;;;;;;;;;;;;OAaG;IACH,wDA0BC;IAED;;;;;;;;OAQG;IACH,uCAIyE;;;IAKzE;;;;;;;;;;;;;;;;OAgBG;IACH,4EAMC;;;;;;;;;;;;;;IAuED;;;;;;;;;;OAUG;IACH,0FAGC;;;;IAMD;;;;;;;;;;;;OAYG;IACH,0DASC"} \ No newline at end of file +{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/js/video.js"],"names":[],"mappings":";;;;;;sBAKc,MAAM;AAiDpB;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,6BAdY,MAAM,GAAC,OAAO,yBAOd,aAAa,GAIb,MAAM,CAiEjB;;;;;;;;;IAoDD;;;;;OAKG;IACH,kCAAyC;IAEzC;;;;;;;;;;;;;OAaG;IACH,wDA0BC;IAED;;;;;;;;OAQG;IACH,uCAIyE;;;IAKzE;;;;;;;;;;;;;;;;OAgBG;IACH,0FAMC;;;;;;;;;;;;;;IAuED;;;;;;;;;;;;OAYG;IACH,iGAGC;;;;IAMD;;;;;;;;;;;;OAYG;IACH,0DASC"} \ No newline at end of file diff --git a/node_modules/video.js/dist/video-js.css b/node_modules/video.js/dist/video-js.css index 83ce07f73c..b3d4b98b0f 100644 --- a/node_modules/video.js/dist/video-js.css +++ b/node_modules/video.js/dist/video-js.css @@ -911,6 +911,10 @@ body.vjs-pip-window .video-js { background-color: rgba(43, 51, 63, 0.7); } +.video-js:not(.vjs-controls-disabled, .vjs-using-native-controls, .vjs-error) .vjs-control-bar.vjs-lock-showing { + display: flex !important; +} + .vjs-has-started .vjs-control-bar, .vjs-audio-only-mode .vjs-control-bar { display: flex; diff --git a/node_modules/video.js/dist/video-js.min.css b/node_modules/video.js/dist/video-js.min.css index 09c1ae64f8..0de9c2456a 100644 --- a/node_modules/video.js/dist/video-js.min.css +++ b/node_modules/video.js/dist/video-js.min.css @@ -1 +1 @@ -.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABUgAAsAAAAAItAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV33Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADwwAABdk9R/WHmhlYWQAABGcAAAAKwAAADYn8kSnaGhlYQAAEcgAAAAdAAAAJA+RCL1obXR4AAAR6AAAABMAAAC8Q44AAGxvY2EAABH8AAAAYAAAAGB7SIHGbWF4cAAAElwAAAAfAAAAIAFAAI9uYW1lAAASfAAAASUAAAIK1cf1oHBvc3QAABOkAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7xDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADbZCycAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1gUV5auc6urCmxEGrq6VRD6ATQP5dHPKK8GRIyoKApoEBUDAiGzGmdUfKNRM4qLZrUZdGKcGN/GZJKd0SyOWTbfbmZ2NxqzM5IxRtNZd78vwYlJdtREoO7sudVNq6PmmxmKqrqPU+eee173P80Bh39Cu9DOEY4DHZBK3i20D/QRLcfxbE5sEVtwLpZzclw4ibFIkSCJUcZ4MBpMnnzwuKNsGWBL5i3qy6kO2dVpvUpKbkAP9fq62rdeGJ+TM/7C1nbIutfuWrWk5ci4zMxxR1qW/N+9JsmCGXj9VKWhFx/6tr/nz78INDm2C9yPF/fDcxLuyKxLBZ1ZBz2QTi+RSkiH5RrDQJ/GgGQadX9m0YSURs7GpSG905Zsk41uj14yul1OtieZ7QUk5GRG/YiS7PYYPSAZNRed9sq3+bOpz00rKb7pe/ZEZvbALxZAHT3AFoH8GXP3rt67QFn40kt8W13FjLTDb48c+fSi5/7h0P4dL5yz7DPtbmgmYxfQA9RL2+EOfTcvdp+1vmuBpvOll1As1S6ak0IvJzC7sKWJFtJgBd2uWcg+0Zyg7dzQfhcjXRgXGZRf5/a4A58IDU777Nl252AUk4m2ByRRjqTNqIDCEJeAnU3iCFwrkrNwXEzg4yFevBwypzxkcX+AIfk3VEKl3XmWbT8788SzvpvFJaiOezL6QyuSr9VNf97csNu0z3LuhR0wATUxZAfVBwVOy+nQFhxYdWaXlXe4HC4zWGWzzsrLDtmhI9pOWOHv7PTT7XybH1Z0+v2d5Abd3kmG+TsH23CS/KwTxx/JkzEwx6jcQOUc42LLwHJ/J93uZ9ygh3HuZGwqsY9dWDHQ58dxNqyqKRQTYdxwTubiOSs3FiMDkq0WSZQgCT0GBDOg2lxOAd1FlPVGs4AKBAcYHHaP2wPkHaivmLF5zYqnIZrvcHx5gN4k/6tchNW1DtdgNL2KrxEkS/kfnIHoVnp1VjmjpTf5r0lTzLj0mdS28tX+XGorU364eMPmnWVl8J36nlKGw3CZhjEiuMw8h8mKvhGD+4/lElBWjAhLJMg6fTw4zPZ8cOmcGQBm2Qxml1nAm13CpYGq1JKUlJJUzQn1PTAO0mgv6VMMpA/DuRfSWEu4lDIxdbAtdWIKvnn2Vk766CWfz9fpY0sH/UpdP50rfszaVpdVRmvIejEdLMk45s4Bu0EWHjeOySmFyZSiMahvZdNSn29peoI/YexYfKQTLeurTXXwEVLeSfInTWHkkMaeUx7sBvOCSTSj3AlcKjfueyS36tCrXDlgRtF0etFq9jhc1kfKuBT/OwMr0F4UUTTh1AN0g20+H/ScPcsIEsYu9d/zN5PmjprPtNwI1ZZcDK6iC97Mcjp2y2aX36f+QbpGHrgRuHlXJ+Zf6PFRL2uQSp8vxHeF2IoRb8Rd2rhMzsNxSRmEuKK4JFnkojhMcx6jzqHzGMGFcW+MhBj0bhf6cowN+45I4LHvwT6fteu7M42wGRI/pxcg6/MZdEvt1U1XaulHFXuLmqov/MukvRVL35/b3ODM1+4aPjtzeK7zmUkV2h3DN54HaQ9GzJvxHRb6Ks2gB81fwqraT+A7GvZJrRLRofU6G0urNL+zFw3v0FaVDFxsKEZW56F31r6ip6vOL+FCObBPuIMRiXld9RaMdLzRIOGhPey2T9vA/35DmZPK9IWaT9d/WgOGMieYqJ/dzjLIhZU118gbysxrNUGefxD6UO/hyNNllpFTOIbx32kSFQctnweV5PxTMHLjRqiAN+fQE9gL+Xy5WB6MOS4GJJuYbDUHhcKDhHGRbLzOpjsjdM1+iwAZLGeieehACX2hhI7SjK/ZUTNrvVje31TxJiFBGYViWFkCn9PMeX9fS6qVbzfCj4fOCTzDnuWy2c4xA7mdNkA3RS9FH2VeqzdCBlixxbzXjvkHU1I8BOYFb1pZvPIHSSIj4svT8xpzcxtXN+ZKyjdDvbz08niiF3PqV9Tn5NST8vg48MTaY8E5xqSSIsWoWHo+LtAzxdH/GDUyp37CBEYfso04F/NlMTcDJUTpECLY0HFGQHImE8xsEUdgnrQlixIvGhJA1BvxpDHGxEMBYFeNOHcBJlSjwe2JcSfbBEsGOPPBHg/6SBBOCsLLw0SpUxod0Z1bFMfLkbQ3UiZxEyd0Dx8t+SRBu18Q9msFbI4e3p1THEfkSEh7kEJ5orR10qTWDvbgPWn5aWvCYyOAjwgXyjJi34uMjo58L25cmRAeQZWI2PA1QQLsPESAH8WGFwZZ4SPoR73BHPzIPMJj9AreBzKUmrH4todT18ANvi1oc3YGjUT/0j+ExUwq8PI9BLaCQIpvewwYu2evAG/Vo/5avPdY7o+BemLLXw3y+AdkzP9bpIxB1wm5EYq8fesHbPEPtm6HrHvtx4jcGPR8fDDpkZBefIjB46QnlUNRltv4Z/pO/J6dxEjhYAtmoMeq+GozvUVvNYOW3m6GCIhoprcfr97B8AcIQYsfD8ljUvGNjvkrpj0ETA48ZMIxCeqsRIsQALE0gi2GB+glSOfbOjW3GSBM9yPq8/rpJXrJDz0BPxV6xdN4uiCGDQed3WhgFkBUZEFsmeyyBpzXrm7UGTBZG8Lh5aubFufk5eUsbrrFGr7McYdbltxa0nKYqRKbQjvikXYkTGM0f2xuyM3Ly21oXnWfvf6I1BmZwfh7EWWIYsg2nHhsDhOnczhJcmI6eBAmy3jZ3RiJmKQR/JA99FcwsfaVbNDDyi1rL9NPj9hfo61wjM6BjzOLijLpeTgk/pL+ip6tfYWupzeOgPny2tcUu9J/9mhxJlgyi985NFRbvCVewXUNXLJaW0RxZqtRYtnfYdcYomXQWdnJHQA3jiEEkeTQWcWxdDP9IvvVWvo2TK553XEMEq+s69/QDU1Q7p0zxwsm9qS379whr8NI2PJqLUyGyfNeX3eFfnJU2U+uHR9cVV1IqgurqwuV44XVp0h2qN55X5XJwtk59yP0IZuHrqBOBIuIYhkcoT6Kx79Pu2HS/IPZIMOqLWs/pteOOk4NPgEb6QAIdAPsyZk5Mwd+wVaHMexJv719W7xCu2l37UG6lvYdBcvHa08p89741zd63phTRGqL5ggo6SlvdbWXzCqsPq78NnSu7wnKy2HNZbVoRCI7UJEOyRj+sPE002tOOY7Qa5fXboFWkLNeqYUSZRocp9XwSUZxcQZ9Hw6LV2pOoVmvHQEDbGIENEG5i6bLgMSM4n8+FNLTtAds99DaWEvgcf4o5SyYe9x+kF6/tGoTPAdRmS/XQIEy//QxKC2oqioAI3tS5auvxCtzT6y6RK8fhChYcwCJaMJhxc0vqSxQ/qmgsrKAlBZUHlauheTpvd9uj5DnLzJct6qfq5fXbYHVIGcfrIVJihbaVLu1wW7Vbs8zK0A8e9Jvb91S9cVMjPrazD6gpfeZTXzYbCFMcppVRsGMpp55OWgx1/3JeAxW1Y7AORgM/m3rWrsdLkQVmEVSU16cX/e7uvkvpqRiQsG06XJ0t64Tf+l0nG1dt025gyOIZlvq5u9KSU1N2TW/rsWnnMRPyTDkctbhvIcNvYIXWyLzdwYLoYesUbaQG4iK2cWO2gdpeUYLqDD0MUTOPhDIGnZEs58yArR86FznuWEsU4YDi2x26dA4klkn8Qa6vhk2QUfX4Jxm/ngX9r7ogn1dmlmwqZmuhxtdg9XN/DEcUgqb+9hMyNansfaQET2mcROCmGEMVqxm5u+h6kN2MOwgqykV2wH9yQG9DvVFU38Pogaf4FVuE62KI/oJ02RDdWW2w5dqQwU/8+N1q1DlvsL863u61KLE7x/o8w0VJQM/Y/SQ3unIrqxueEa1BqT5VFNsO7p39/UC771a77RowpaKe9nvJQIT1Pog5LGx8XblBKmCNGTf3xMogAQvPnz9PYKX/08sVDTG1OKUlOLUgS/UaZtm1NAaYTsl7i9ZQ+L6O4Rl0OGa577LuWvc+C+x96/vYh0lLBuM+7XwI/dTLtdT7v4d6rRTWDnku0IBrqFnZ5bVIqKP8lasJlithWnaLhTsr8qFJBulF/70p4undou36HeTJ5+jv1fCybeQ8nH3+Xv6aENczmOFlab+hqMDg1rLOt12A+tiUFrYDwQ6c3RUJp601nzegTNX6WlYAI2zSUV945F6zU56ZmZVQaWspWcIADxJ9GmljQUnL2p2Dpr5T8H+5KJFu+vqBq8qvyHRzStLHPEO5SPYCV9nZe0yZT2RcH0oHvegSzNEJ0oGWU8iQWM12dgPEugngVceGIwZgPFp0BiT1a0a3R5Rcot7ihfA1J/20v96jX7zmTX9s583H0kwx6WnLd09cXrR9LGroOa9sHNbdyz8wcKk5lqhaVFJZNwmqtw884MXNdvJujpBa3xzuSaZH9sxa06Z7x+HJSduPbdYHv/DgmEhfbehvlmGN7JUkcG78GDM12CeyFFTPNqVeNxC1gzjz+c2nVo63Xxs8rKJWXoBJM0tmEbfGm4qzpoOH3xpzQfyxLzW1gnE9NHo6tol1eMEic4ZVPrjnVi0kqAe2sQ2bgqupScaq8WGlUWgWHI51SKJl/UYT6zccNsCSkBtiVZLsiefuFSDYT3Fi8Zk7EUnmjTRYtsFeuDDJS05MW79M3mr3mla+d8dzac31KTPmBYfFiYSUef48PhPjm9ryZsSGZZkdNvzq0Y9rdNcwDq5Dg5C3QW+7UN64IKptvS3tvHbvu5c9pv1Exau21rc9LIpwpQwUjTq8576yeVDz5+4WZ1nXT43wV60rPLJbDp/UksNrP3iQ2SA63Pst058gOYDbhRnRUw8l/sRt4HbxPzO4WYpInCpuVgSbVh6JXuwnnJngKTTCwaPWmG5Xbhpm1U0Yt3FyBGpGYemPM77p2TD904JjgJ2QFpFLeYpGx8X15Qx1Zk31p5ki9ZLUuXE0lmuJlcakJMVLeFS1iIvrB8drY0aloilakqCZwzwRORtxlgwxS4IThggJd4TDxoiaAIT80fFPGrCPPru+puFn504P/ybr4ihA/6dKASLshEJic7xE8tmzu3KzA7TABBe8y5fNbWo3ilQn/SuFKM16b2l5bOeayqfGhYmhIulU+fVNDdWVv4NMzX10MBHyPR5uhWUu8D9P1VnIMt4nGNgZGBgAOJ/1bf64vltvjJwszOAwAOlmqvINEc/WJyDgQlEAQA+dgnjAHicY2BkYGBnAAGOPgaG//85+hkYGVCBPgBGJwNkAAAAeJxjYGBgYB/EmKMPtxwAhg4B0gAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAe4CLgKKAtAC/ANiA4wDqAPgBDAEsATaBQgFWgXABggGLgZwBqwG9gdOB4oH0ggqCHAIhgicCMgJJAlWCYgJrAnyCkAKdgrkC7J4nGNgZGBg0GdoZmBnAAEmIOYCQgaG/2A+AwAaqwHQAHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkXlT2zAQxf1C4thJAwRajt4HRy8VMwwfSJHXsQZZcnUQ+PYoTtwpM+wf2t9brWZ2n5JBsol58nJcYYAdDDFCijEy5JhgileYYRd72MccBzjEa7zBEY5xglO8xTu8xwd8xCd8xhd8xTec4RwXuMR3/MBP/MJvMPzBFYpk2Cr+OF0fTEgrFI1aHhxN740KDbEmeJpsWZlVj40s+45aLuv9KijlhCXSjLQnu/d/4UH6sWul1mRzFxZeekUuE7z10mg3qMtM1FGQddPSrLQyvJR6OaukItYXDp6pCJrmz0umqkau5pZ2hFmm7m+ImG5W2t0kZoJXUtPhVnYTbbdOBdeCVGqpJe7XKTqSbRK7zbdwXfR0U+SVsStuS3Y76em6+Ic3xYiHUppc04Nn0lMzay3dSxNcp8auDlWlaCi48yetFD7Y9USsx87G45cuop1ZxQUtjLnL4j53FO0a+5X08UXqQ7NQNo92R0XOz7sxWEnxN2TneJI8Acttu4Q=) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;margin:-.6em;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file +.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABUgAAsAAAAAItAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV33Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADwwAABdk9R/WHmhlYWQAABGcAAAAKwAAADYn8kSnaGhlYQAAEcgAAAAdAAAAJA+RCL1obXR4AAAR6AAAABMAAAC8Q44AAGxvY2EAABH8AAAAYAAAAGB7SIHGbWF4cAAAElwAAAAfAAAAIAFAAI9uYW1lAAASfAAAASUAAAIK1cf1oHBvc3QAABOkAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7xDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADbZCycAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1gUV5auc6urCmxEGrq6VRD6ATQP5dHPKK8GRIyoKApoEBUDAiGzGmdUfKNRM4qLZrUZdGKcGN/GZJKd0SyOWTbfbmZ2NxqzM5IxRtNZd78vwYlJdtREoO7sudVNq6PmmxmKqrqPU+eee173P80Bh39Cu9DOEY4DHZBK3i20D/QRLcfxbE5sEVtwLpZzclw4ibFIkSCJUcZ4MBpMnnzwuKNsGWBL5i3qy6kO2dVpvUpKbkAP9fq62rdeGJ+TM/7C1nbIutfuWrWk5ci4zMxxR1qW/N+9JsmCGXj9VKWhFx/6tr/nz78INDm2C9yPF/fDcxLuyKxLBZ1ZBz2QTi+RSkiH5RrDQJ/GgGQadX9m0YSURs7GpSG905Zsk41uj14yul1OtieZ7QUk5GRG/YiS7PYYPSAZNRed9sq3+bOpz00rKb7pe/ZEZvbALxZAHT3AFoH8GXP3rt67QFn40kt8W13FjLTDb48c+fSi5/7h0P4dL5yz7DPtbmgmYxfQA9RL2+EOfTcvdp+1vmuBpvOll1As1S6ak0IvJzC7sKWJFtJgBd2uWcg+0Zyg7dzQfhcjXRgXGZRf5/a4A58IDU777Nl252AUk4m2ByRRjqTNqIDCEJeAnU3iCFwrkrNwXEzg4yFevBwypzxkcX+AIfk3VEKl3XmWbT8788SzvpvFJaiOezL6QyuSr9VNf97csNu0z3LuhR0wATUxZAfVBwVOy+nQFhxYdWaXlXe4HC4zWGWzzsrLDtmhI9pOWOHv7PTT7XybH1Z0+v2d5Abd3kmG+TsH23CS/KwTxx/JkzEwx6jcQOUc42LLwHJ/J93uZ9ygh3HuZGwqsY9dWDHQ58dxNqyqKRQTYdxwTubiOSs3FiMDkq0WSZQgCT0GBDOg2lxOAd1FlPVGs4AKBAcYHHaP2wPkHaivmLF5zYqnIZrvcHx5gN4k/6tchNW1DtdgNL2KrxEkS/kfnIHoVnp1VjmjpTf5r0lTzLj0mdS28tX+XGorU364eMPmnWVl8J36nlKGw3CZhjEiuMw8h8mKvhGD+4/lElBWjAhLJMg6fTw4zPZ8cOmcGQBm2Qxml1nAm13CpYGq1JKUlJJUzQn1PTAO0mgv6VMMpA/DuRfSWEu4lDIxdbAtdWIKvnn2Vk766CWfz9fpY0sH/UpdP50rfszaVpdVRmvIejEdLMk45s4Bu0EWHjeOySmFyZSiMahvZdNSn29peoI/YexYfKQTLeurTXXwEVLeSfInTWHkkMaeUx7sBvOCSTSj3AlcKjfueyS36tCrXDlgRtF0etFq9jhc1kfKuBT/OwMr0F4UUTTh1AN0g20+H/ScPcsIEsYu9d/zN5PmjprPtNwI1ZZcDK6iC97Mcjp2y2aX36f+QbpGHrgRuHlXJ+Zf6PFRL2uQSp8vxHeF2IoRb8Rd2rhMzsNxSRmEuKK4JFnkojhMcx6jzqHzGMGFcW+MhBj0bhf6cowN+45I4LHvwT6fteu7M42wGRI/pxcg6/MZdEvt1U1XaulHFXuLmqov/MukvRVL35/b3ODM1+4aPjtzeK7zmUkV2h3DN54HaQ9GzJvxHRb6Ks2gB81fwqraT+A7GvZJrRLRofU6G0urNL+zFw3v0FaVDFxsKEZW56F31r6ip6vOL+FCObBPuIMRiXld9RaMdLzRIOGhPey2T9vA/35DmZPK9IWaT9d/WgOGMieYqJ/dzjLIhZU118gbysxrNUGefxD6UO/hyNNllpFTOIbx32kSFQctnweV5PxTMHLjRqiAN+fQE9gL+Xy5WB6MOS4GJJuYbDUHhcKDhHGRbLzOpjsjdM1+iwAZLGeieehACX2hhI7SjK/ZUTNrvVje31TxJiFBGYViWFkCn9PMeX9fS6qVbzfCj4fOCTzDnuWy2c4xA7mdNkA3RS9FH2VeqzdCBlixxbzXjvkHU1I8BOYFb1pZvPIHSSIj4svT8xpzcxtXN+ZKyjdDvbz08niiF3PqV9Tn5NST8vg48MTaY8E5xqSSIsWoWHo+LtAzxdH/GDUyp37CBEYfso04F/NlMTcDJUTpECLY0HFGQHImE8xsEUdgnrQlixIvGhJA1BvxpDHGxEMBYFeNOHcBJlSjwe2JcSfbBEsGOPPBHg/6SBBOCsLLw0SpUxod0Z1bFMfLkbQ3UiZxEyd0Dx8t+SRBu18Q9msFbI4e3p1THEfkSEh7kEJ5orR10qTWDvbgPWn5aWvCYyOAjwgXyjJi34uMjo58L25cmRAeQZWI2PA1QQLsPESAH8WGFwZZ4SPoR73BHPzIPMJj9AreBzKUmrH4todT18ANvi1oc3YGjUT/0j+ExUwq8PI9BLaCQIpvewwYu2evAG/Vo/5avPdY7o+BemLLXw3y+AdkzP9bpIxB1wm5EYq8fesHbPEPtm6HrHvtx4jcGPR8fDDpkZBefIjB46QnlUNRltv4Z/pO/J6dxEjhYAtmoMeq+GozvUVvNYOW3m6GCIhoprcfr97B8AcIQYsfD8ljUvGNjvkrpj0ETA48ZMIxCeqsRIsQALE0gi2GB+glSOfbOjW3GSBM9yPq8/rpJXrJDz0BPxV6xdN4uiCGDQed3WhgFkBUZEFsmeyyBpzXrm7UGTBZG8Lh5aubFufk5eUsbrrFGr7McYdbltxa0nKYqRKbQjvikXYkTGM0f2xuyM3Ly21oXnWfvf6I1BmZwfh7EWWIYsg2nHhsDhOnczhJcmI6eBAmy3jZ3RiJmKQR/JA99FcwsfaVbNDDyi1rL9NPj9hfo61wjM6BjzOLijLpeTgk/pL+ip6tfYWupzeOgPny2tcUu9J/9mhxJlgyi985NFRbvCVewXUNXLJaW0RxZqtRYtnfYdcYomXQWdnJHQA3jiEEkeTQWcWxdDP9IvvVWvo2TK553XEMEq+s69/QDU1Q7p0zxwsm9qS379whr8NI2PJqLUyGyfNeX3eFfnJU2U+uHR9cVV1IqgurqwuV44XVp0h2qN55X5XJwtk59yP0IZuHrqBOBIuIYhkcoT6Kx79Pu2HS/IPZIMOqLWs/pteOOk4NPgEb6QAIdAPsyZk5Mwd+wVaHMexJv719W7xCu2l37UG6lvYdBcvHa08p89741zd63phTRGqL5ggo6SlvdbWXzCqsPq78NnSu7wnKy2HNZbVoRCI7UJEOyRj+sPE002tOOY7Qa5fXboFWkLNeqYUSZRocp9XwSUZxcQZ9Hw6LV2pOoVmvHQEDbGIENEG5i6bLgMSM4n8+FNLTtAds99DaWEvgcf4o5SyYe9x+kF6/tGoTPAdRmS/XQIEy//QxKC2oqioAI3tS5auvxCtzT6y6RK8fhChYcwCJaMJhxc0vqSxQ/qmgsrKAlBZUHlauheTpvd9uj5DnLzJct6qfq5fXbYHVIGcfrIVJihbaVLu1wW7Vbs8zK0A8e9Jvb91S9cVMjPrazD6gpfeZTXzYbCFMcppVRsGMpp55OWgx1/3JeAxW1Y7AORgM/m3rWrsdLkQVmEVSU16cX/e7uvkvpqRiQsG06XJ0t64Tf+l0nG1dt025gyOIZlvq5u9KSU1N2TW/rsWnnMRPyTDkctbhvIcNvYIXWyLzdwYLoYesUbaQG4iK2cWO2gdpeUYLqDD0MUTOPhDIGnZEs58yArR86FznuWEsU4YDi2x26dA4klkn8Qa6vhk2QUfX4Jxm/ngX9r7ogn1dmlmwqZmuhxtdg9XN/DEcUgqb+9hMyNansfaQET2mcROCmGEMVqxm5u+h6kN2MOwgqykV2wH9yQG9DvVFU38Pogaf4FVuE62KI/oJ02RDdWW2w5dqQwU/8+N1q1DlvsL863u61KLE7x/o8w0VJQM/Y/SQ3unIrqxueEa1BqT5VFNsO7p39/UC771a77RowpaKe9nvJQIT1Pog5LGx8XblBKmCNGTf3xMogAQvPnz9PYKX/08sVDTG1OKUlOLUgS/UaZtm1NAaYTsl7i9ZQ+L6O4Rl0OGa577LuWvc+C+x96/vYh0lLBuM+7XwI/dTLtdT7v4d6rRTWDnku0IBrqFnZ5bVIqKP8lasJlithWnaLhTsr8qFJBulF/70p4undou36HeTJ5+jv1fCybeQ8nH3+Xv6aENczmOFlab+hqMDg1rLOt12A+tiUFrYDwQ6c3RUJp601nzegTNX6WlYAI2zSUV945F6zU56ZmZVQaWspWcIADxJ9GmljQUnL2p2Dpr5T8H+5KJFu+vqBq8qvyHRzStLHPEO5SPYCV9nZe0yZT2RcH0oHvegSzNEJ0oGWU8iQWM12dgPEugngVceGIwZgPFp0BiT1a0a3R5Rcot7ihfA1J/20v96jX7zmTX9s583H0kwx6WnLd09cXrR9LGroOa9sHNbdyz8wcKk5lqhaVFJZNwmqtw884MXNdvJujpBa3xzuSaZH9sxa06Z7x+HJSduPbdYHv/DgmEhfbehvlmGN7JUkcG78GDM12CeyFFTPNqVeNxC1gzjz+c2nVo63Xxs8rKJWXoBJM0tmEbfGm4qzpoOH3xpzQfyxLzW1gnE9NHo6tol1eMEic4ZVPrjnVi0kqAe2sQ2bgqupScaq8WGlUWgWHI51SKJl/UYT6zccNsCSkBtiVZLsiefuFSDYT3Fi8Zk7EUnmjTRYtsFeuDDJS05MW79M3mr3mla+d8dzac31KTPmBYfFiYSUef48PhPjm9ryZsSGZZkdNvzq0Y9rdNcwDq5Dg5C3QW+7UN64IKptvS3tvHbvu5c9pv1Exau21rc9LIpwpQwUjTq8576yeVDz5+4WZ1nXT43wV60rPLJbDp/UksNrP3iQ2SA63Pst058gOYDbhRnRUw8l/sRt4HbxPzO4WYpInCpuVgSbVh6JXuwnnJngKTTCwaPWmG5Xbhpm1U0Yt3FyBGpGYemPM77p2TD904JjgJ2QFpFLeYpGx8X15Qx1Zk31p5ki9ZLUuXE0lmuJlcakJMVLeFS1iIvrB8drY0aloilakqCZwzwRORtxlgwxS4IThggJd4TDxoiaAIT80fFPGrCPPru+puFn504P/ybr4ihA/6dKASLshEJic7xE8tmzu3KzA7TABBe8y5fNbWo3ilQn/SuFKM16b2l5bOeayqfGhYmhIulU+fVNDdWVv4NMzX10MBHyPR5uhWUu8D9P1VnIMt4nGNgZGBgAOJ/1bf64vltvjJwszOAwAOlmqvINEc/WJyDgQlEAQA+dgnjAHicY2BkYGBnAAGOPgaG//85+hkYGVCBPgBGJwNkAAAAeJxjYGBgYB/EmKMPtxwAhg4B0gAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAe4CLgKKAtAC/ANiA4wDqAPgBDAEsATaBQgFWgXABggGLgZwBqwG9gdOB4oH0ggqCHAIhgicCMgJJAlWCYgJrAnyCkAKdgrkC7J4nGNgZGBg0GdoZmBnAAEmIOYCQgaG/2A+AwAaqwHQAHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkXlT2zAQxf1C4thJAwRajt4HRy8VMwwfSJHXsQZZcnUQ+PYoTtwpM+wf2t9brWZ2n5JBsol58nJcYYAdDDFCijEy5JhgileYYRd72MccBzjEa7zBEY5xglO8xTu8xwd8xCd8xhd8xTec4RwXuMR3/MBP/MJvMPzBFYpk2Cr+OF0fTEgrFI1aHhxN740KDbEmeJpsWZlVj40s+45aLuv9KijlhCXSjLQnu/d/4UH6sWul1mRzFxZeekUuE7z10mg3qMtM1FGQddPSrLQyvJR6OaukItYXDp6pCJrmz0umqkau5pZ2hFmm7m+ImG5W2t0kZoJXUtPhVnYTbbdOBdeCVGqpJe7XKTqSbRK7zbdwXfR0U+SVsStuS3Y76em6+Ic3xYiHUppc04Nn0lMzay3dSxNcp8auDlWlaCi48yetFD7Y9USsx87G45cuop1ZxQUtjLnL4j53FO0a+5X08UXqQ7NQNo92R0XOz7sxWEnxN2TneJI8Acttu4Q=) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;margin:-.6em;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file diff --git a/node_modules/video.js/dist/video.cjs.js b/node_modules/video.js/dist/video.cjs.js index b054074d12..b8aae1f97e 100644 --- a/node_modules/video.js/dist/video.cjs.js +++ b/node_modules/video.js/dist/video.cjs.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -42,7 +42,7 @@ var _resolveUrl__default = /*#__PURE__*/_interopDefaultLegacy(_resolveUrl); var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); var parseSidx__default = /*#__PURE__*/_interopDefaultLegacy(parseSidx); -var version$6 = "8.6.0"; +var version$6 = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -2022,7 +2022,7 @@ function _cleanUpEvents(elem, type) { * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2745,7 +2745,7 @@ class EventTarget$2 { /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2762,7 +2762,7 @@ class EventTarget$2 { * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget$2.prototype.allowedEvents_ = {}; @@ -3998,7 +3998,6 @@ class Component$1 { /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4009,6 +4008,7 @@ class Component$1 { * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4463,9 +4463,8 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4481,9 +4480,8 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4529,7 +4527,7 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4704,7 +4702,7 @@ class Component$1 { * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4716,7 +4714,7 @@ class Component$1 { * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6341,7 +6339,7 @@ class TrackList extends EventTarget$2 { * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6391,7 +6389,7 @@ class AudioTrackList extends TrackList { /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -7494,7 +7492,9 @@ class TextTrack extends Track { */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window__default["default"].vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -7537,6 +7537,7 @@ class TextTrack extends Track { /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -7795,6 +7796,10 @@ class HTMLTrackElement extends EventTarget$2 { }); } } + +/** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -7888,7 +7893,7 @@ ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8324,7 +8329,7 @@ class Tech extends Component$1 { * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9088,7 +9093,7 @@ Tech.withSourceHandlers = function (_Tech) { * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9113,7 +9118,7 @@ Tech.withSourceHandlers = function (_Tech) { /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9168,7 +9173,7 @@ Tech.withSourceHandlers = function (_Tech) { * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -9947,7 +9952,7 @@ class ClickableComponent extends Component$1 { * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -10703,7 +10708,7 @@ class Button extends ClickableComponent { * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -10757,7 +10762,7 @@ class BigPlayButton extends Button { * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -10768,7 +10773,7 @@ class BigPlayButton extends Button { const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -10788,10 +10793,29 @@ class BigPlayButton extends Button { this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -10877,7 +10901,7 @@ class CloseButton extends Button { * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -14504,7 +14528,7 @@ class Menu extends Component$1 { /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15101,7 +15125,7 @@ class MenuItem extends ClickableComponent { * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20160,8 +20184,8 @@ const DEFAULT_BREAKPOINTS = { * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -21900,7 +21924,9 @@ class Player extends Component$1 { */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -22856,7 +22882,7 @@ class Player extends Component$1 { * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25060,7 +25086,7 @@ const markPluginAsActive = (player, name) => { * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25213,7 +25239,7 @@ class Plugin { * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25232,7 +25258,7 @@ class Plugin { * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25448,7 +25474,7 @@ Player.prototype.hasPlugin = function (name) { * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25456,14 +25482,14 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25471,11 +25497,11 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -25802,10 +25828,10 @@ videojs.getComponent = Component$1.getComponent; * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -25888,9 +25914,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin; * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin +* + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); @@ -26341,7 +26369,7 @@ videojs.registerPlugin('qualityLevels', qualityLevels); // Include the version n qualityLevels.VERSION = version$5; -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ /** * @file resolve-url.js - Handling how URLs are resolved and manipulated @@ -27075,9 +27103,13 @@ const playlistEnd = function (playlist, expired, useSafeLiveEnd, liveEdgePadding const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); }; @@ -29515,7 +29547,10 @@ class DashPlaylistLoader extends EventTarget { }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -32345,18 +32380,31 @@ const workerCode$1 = transform(getWorkerString(function () { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { win.newLine(this.getPts(i)); @@ -39353,7 +39401,7 @@ const handleSegmentBytes = ({ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -46344,15 +46392,11 @@ const onError = { */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -46388,15 +46432,11 @@ const onError = { */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { track.mode = 'disabled'; @@ -46983,6 +47023,388 @@ const createMediaTypes = () => { return mediaTypes; }; +/** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + +class SteeringManifest { + constructor() { + this.priority_ = []; + } + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + get version() { + return this.version_; + } + get ttl() { + return this.ttl_; + } + get reloadUri() { + return this.reloadUri_; + } + get priority() { + return this.priority_; + } +} +/** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + +class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window__default["default"].URL(steeringUrl); + const proxyServerUrlObject = new window__default["default"].URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window__default["default"].atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + setSteeringParams_(url) { + const urlObject = new window__default["default"].URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + return [...this.availablePathways_][0]; + }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + const steeringURI = this.setSteeringParams_(reloadUri); + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window__default["default"].setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + clearTTLTimeout_() { + window__default["default"].clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + abort() { + if (this.request_) { + this.request_.abort(); + } + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } +} + /** * @file playlist-controller.js */ @@ -47210,6 +47632,10 @@ class PlaylistController extends videojs.EventTarget { tech.addWebVttScript_(); }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_()); @@ -47295,6 +47721,32 @@ class PlaylistController extends videojs.EventTarget { } this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -47443,8 +47895,9 @@ class PlaylistController extends videojs.EventTarget { } let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; if (this.enableLowInitialPlaylist) { @@ -48025,10 +48478,22 @@ class PlaylistController extends videojs.EventTarget { return this.mainPlaylistLoader_.load(isFinalRendition); } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -48366,6 +48831,7 @@ class PlaylistController extends videojs.EventTarget { this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); } @@ -48706,6 +49172,110 @@ class PlaylistController extends videojs.EventTarget { videoDuration }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + initContentSteeringController_() { + const initialMain = this.main(); + if (!initialMain.contentSteering) { + return; + } + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + this.switchMedia_(nextPlaylist, 'content-steering'); + } } /** @@ -49454,8 +50024,8 @@ const initPlugin = function (player, options) { const reloadSourceOnError = function (options) { initPlugin(this, options); }; -var version$4 = "3.6.0"; -var version$3 = "7.0.0"; +var version$4 = "3.7.0"; +var version$3 = "7.0.1"; var version$2 = "1.2.2"; var version$1 = "7.1.0"; var version = "4.0.1"; diff --git a/node_modules/video.js/dist/video.es.js b/node_modules/video.js/dist/video.es.js index 2ab36345e3..296da645b6 100644 --- a/node_modules/video.js/dist/video.es.js +++ b/node_modules/video.js/dist/video.es.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -28,7 +28,7 @@ import { getId3Offset } from '@videojs/vhs-utils/es/id3-helpers'; import { detectContainerForBytes, isLikelyFmp4MediaSegment } from '@videojs/vhs-utils/es/containers'; import { ONE_SECOND_IN_TS } from 'mux.js/lib/utils/clock'; -var version$6 = "8.6.0"; +var version$6 = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -2008,7 +2008,7 @@ function _cleanUpEvents(elem, type) { * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2731,7 +2731,7 @@ class EventTarget$2 { /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2748,7 +2748,7 @@ class EventTarget$2 { * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget$2.prototype.allowedEvents_ = {}; @@ -3984,7 +3984,6 @@ class Component$1 { /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -3995,6 +3994,7 @@ class Component$1 { * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4449,9 +4449,8 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4467,9 +4466,8 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4515,7 +4513,7 @@ class Component$1 { * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4690,7 +4688,7 @@ class Component$1 { * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4702,7 +4700,7 @@ class Component$1 { * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6327,7 +6325,7 @@ class TrackList extends EventTarget$2 { * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6377,7 +6375,7 @@ class AudioTrackList extends TrackList { /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -7480,7 +7478,9 @@ class TextTrack extends Track { */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window$1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -7523,6 +7523,7 @@ class TextTrack extends Track { /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -7781,6 +7782,10 @@ class HTMLTrackElement extends EventTarget$2 { }); } } + +/** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -7874,7 +7879,7 @@ ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -8310,7 +8315,7 @@ class Tech extends Component$1 { * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -9074,7 +9079,7 @@ Tech.withSourceHandlers = function (_Tech) { * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -9099,7 +9104,7 @@ Tech.withSourceHandlers = function (_Tech) { /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -9154,7 +9159,7 @@ Tech.withSourceHandlers = function (_Tech) { * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -9933,7 +9938,7 @@ class ClickableComponent extends Component$1 { * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -10689,7 +10694,7 @@ class Button extends ClickableComponent { * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -10743,7 +10748,7 @@ class BigPlayButton extends Button { * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -10754,7 +10759,7 @@ class BigPlayButton extends Button { const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -10774,10 +10779,29 @@ class BigPlayButton extends Button { this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -10863,7 +10887,7 @@ class CloseButton extends Button { * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -14490,7 +14514,7 @@ class Menu extends Component$1 { /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -15087,7 +15111,7 @@ class MenuItem extends ClickableComponent { * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -20146,8 +20170,8 @@ const DEFAULT_BREAKPOINTS = { * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -21886,7 +21910,9 @@ class Player extends Component$1 { */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -22842,7 +22868,7 @@ class Player extends Component$1 { * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -25046,7 +25072,7 @@ const markPluginAsActive = (player, name) => { * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -25199,7 +25225,7 @@ class Plugin { * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -25218,7 +25244,7 @@ class Plugin { * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -25434,7 +25460,7 @@ Player.prototype.hasPlugin = function (name) { * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25442,14 +25468,14 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -25457,11 +25483,11 @@ Player.prototype.hasPlugin = function (name) { * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -25788,10 +25814,10 @@ videojs.getComponent = Component$1.getComponent; * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -25874,9 +25900,11 @@ videojs.deregisterPlugin = Plugin.deregisterPlugin; * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin +* + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); @@ -26327,7 +26355,7 @@ videojs.registerPlugin('qualityLevels', qualityLevels); // Include the version n qualityLevels.VERSION = version$5; -/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ /** * @file resolve-url.js - Handling how URLs are resolved and manipulated @@ -27061,9 +27089,13 @@ const playlistEnd = function (playlist, expired, useSafeLiveEnd, liveEdgePadding const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); }; @@ -29501,7 +29533,10 @@ class DashPlaylistLoader extends EventTarget { }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -32331,18 +32366,31 @@ const workerCode$1 = transform(getWorkerString(function () { var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { win.newLine(this.getPts(i)); @@ -39339,7 +39387,7 @@ const handleSegmentBytes = ({ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -46330,15 +46378,11 @@ const onError = { */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -46374,15 +46418,11 @@ const onError = { */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { track.mode = 'disabled'; @@ -46969,6 +47009,388 @@ const createMediaTypes = () => { return mediaTypes; }; +/** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + +class SteeringManifest { + constructor() { + this.priority_ = []; + } + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + get version() { + return this.version_; + } + get ttl() { + return this.ttl_; + } + get reloadUri() { + return this.reloadUri_; + } + get priority() { + return this.priority_; + } +} +/** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + +class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window$1.URL(steeringUrl); + const proxyServerUrlObject = new window$1.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window$1.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + setSteeringParams_(url) { + const urlObject = new window$1.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + return [...this.availablePathways_][0]; + }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + const steeringURI = this.setSteeringParams_(reloadUri); + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window$1.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + clearTTLTimeout_() { + window$1.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + abort() { + if (this.request_) { + this.request_.abort(); + } + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } +} + /** * @file playlist-controller.js */ @@ -47196,6 +47618,10 @@ class PlaylistController extends videojs.EventTarget { tech.addWebVttScript_(); }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_()); @@ -47281,6 +47707,32 @@ class PlaylistController extends videojs.EventTarget { } this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -47429,8 +47881,9 @@ class PlaylistController extends videojs.EventTarget { } let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; if (this.enableLowInitialPlaylist) { @@ -48011,10 +48464,22 @@ class PlaylistController extends videojs.EventTarget { return this.mainPlaylistLoader_.load(isFinalRendition); } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -48352,6 +48817,7 @@ class PlaylistController extends videojs.EventTarget { this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); } @@ -48692,6 +49158,110 @@ class PlaylistController extends videojs.EventTarget { videoDuration }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + initContentSteeringController_() { + const initialMain = this.main(); + if (!initialMain.contentSteering) { + return; + } + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + this.switchMedia_(nextPlaylist, 'content-steering'); + } } /** @@ -49440,8 +50010,8 @@ const initPlugin = function (player, options) { const reloadSourceOnError = function (options) { initPlugin(this, options); }; -var version$4 = "3.6.0"; -var version$3 = "7.0.0"; +var version$4 = "3.7.0"; +var version$3 = "7.0.1"; var version$2 = "1.2.2"; var version$1 = "7.1.0"; var version = "4.0.1"; diff --git a/node_modules/video.js/dist/video.js b/node_modules/video.js/dist/video.js index 555ee9550b..3bb04a74da 100644 --- a/node_modules/video.js/dist/video.js +++ b/node_modules/video.js/dist/video.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -16,7 +16,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojs = factory()); })(this, (function () { 'use strict'; - var version$5 = "8.6.0"; + var version$5 = "8.6.1"; /** * An Object that contains lifecycle hooks as keys which point to an array @@ -1996,7 +1996,7 @@ * @param {Element|Object} elem * Element or object to bind listeners to * - * @param {string} type + * @param {string[]} types * Type of event to bind to. * * @param {Function} callback @@ -2719,7 +2719,7 @@ /** * All event listeners should follow the following format. * - * @callback EventTarget~EventListener + * @callback EventListener * @this {EventTarget} * * @param {Event} event @@ -2736,7 +2736,7 @@ * will have extra functionality. See that function for more information. * * @property EventTarget.prototype.allowedEvents_ - * @private + * @protected */ EventTarget$2.prototype.allowedEvents_ = {}; @@ -4169,7 +4169,6 @@ /** * Add a child `Component` inside the current `Component`. * - * * @param {string|Component} child * The name or instance of a child to add. * @@ -4180,6 +4179,7 @@ * @param {number} [index=this.children_.length] * The index to attempt to add a child into. * + * * @return {Component} * The `Component` that gets added as a child. When using a string the * `Component` will get created by this process. @@ -4634,9 +4634,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The width when getting, zero if there is no width */ width(num, skipListeners) { return this.dimension('width', num, skipListeners); @@ -4652,9 +4651,8 @@ * @param {boolean} [skipListeners] * Skip the componentresize event trigger * - * @return {number|string} - * The width when getting, zero if there is no width. Can be a string - * postpixed with '%' or 'px'. + * @return {number|undefined} + * The height when getting, zero if there is no height */ height(num, skipListeners) { return this.dimension('height', num, skipListeners); @@ -4700,7 +4698,7 @@ * @param {boolean} [skipListeners] * Skip componentresize event trigger * - * @return {number} + * @return {number|undefined} * The dimension when getting or 0 if unset */ dimension(widthOrHeight, num, skipListeners) { @@ -4875,7 +4873,7 @@ * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress` * will not see their method calls stop working. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to be called. */ handleKeyPress(event) { @@ -4887,7 +4885,7 @@ * support toggling the controls through a tap on the video. They get enabled * because every sub-component would have extra overhead otherwise. * - * @private + * @protected * @fires Component#tap * @listens Component#touchstart * @listens Component#touchmove @@ -6524,7 +6522,7 @@ * Events that can be called with on + eventName. See {@link EventHandler}. * * @property {Object} TrackList#allowedEvents_ - * @private + * @protected */ TrackList.prototype.allowedEvents_ = { change: 'change', @@ -6574,7 +6572,7 @@ /** * Create an instance of this class. * - * @param {AudioTrack[]} [tracks=[]] + * @param { import('./audio-track').default[] } [tracks=[]] * A list of `AudioTrack` to instantiate the list with. */ constructor(tracks = []) { @@ -8012,7 +8010,9 @@ */ addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { if (!(prop in cue)) { @@ -8055,6 +8055,7 @@ /** * cuechange - One or more cues in the track have become active or stopped being active. + * @protected */ TextTrack.prototype.allowedEvents_ = { cuechange: 'cuechange' @@ -8313,6 +8314,10 @@ }); } } + + /** + * @protected + */ HTMLTrackElement.prototype.allowedEvents_ = { load: 'load' }; @@ -10110,7 +10115,7 @@ * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};` * `var SourceString = 'http://example.com/some-video.mp4';` * - * @typedef {Object|string} Tech~SourceObject + * @typedef {Object|string} SourceObject * * @property {string} src * The url to the source @@ -10546,7 +10551,7 @@ * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`. * It only checks whether the source has played at all or not. * - * @return {TimeRange} + * @return { import('../utils/time').TimeRange } * - A single time range if this video has played * - An empty set of ranges if not. */ @@ -11310,7 +11315,7 @@ * * TODO: Answer question: should 'probably' be prioritized over 'maybe' * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * The source object * * @param {Object} options @@ -11335,7 +11340,7 @@ /** * Check if the tech can support the given source. * - * @param {Tech~SourceObject} srcObj + * @param {SourceObject} srcObj * The source object * * @param {Object} options @@ -11390,7 +11395,7 @@ * and source handlers. * Should never be called unless a source handler was found. * - * @param {Tech~SourceObject} source + * @param {SourceObject} source * A source object with src and type keys */ _Tech.prototype.setSource = function (source) { @@ -12169,7 +12174,7 @@ * * By default, if the key is Space or Enter, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -12925,7 +12930,7 @@ * This gets called when a `Button` has focus and `keydown` is triggered via a key * press. * - * @param {Event} event + * @param {KeyboardEvent} event * The event that caused this function to get called. * * @listens keydown @@ -12979,7 +12984,7 @@ * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent} * for more detailed information on what a click can be. * - * @param {KeyboardEvent} event + * @param {KeyboardEvent|MouseEvent|TouchEvent} event * The `keydown`, `tap`, or `click` event that caused this function to be * called. * @@ -12990,7 +12995,7 @@ const playPromise = this.player_.play(); // exit early if clicked via the mouse - if (this.mouseused_ && event.clientX && event.clientY) { + if (this.mouseused_ && 'clientX' in event && 'clientY' in event) { silencePromise(playPromise); if (this.player_.tech(true)) { this.player_.tech(true).focus(); @@ -13010,10 +13015,29 @@ this.setTimeout(playFocus, 1); } } + + /** + * Event handler that is called when a `BigPlayButton` receives a + * `keydown` event. + * + * @param {KeyboardEvent} event + * The `keydown` event that caused this function to be called. + * + * @listens keydown + */ handleKeyDown(event) { this.mouseused_ = false; super.handleKeyDown(event); } + + /** + * Handle `mousedown` events on the `BigPlayButton`. + * + * @param {MouseEvent} event + * `mousedown` or `touchstart` event that triggered this function + * + * @listens mousedown + */ handleMouseDown(event) { this.mouseused_ = true; } @@ -13099,7 +13123,7 @@ * * By default, if the key is Esc, it will trigger a `click` event. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -16726,7 +16750,7 @@ /** * Handle a `keydown` event on this menu. This listener is added in the constructor. * - * @param {Event} event + * @param {KeyboardEvent} event * A `keydown` event that happened on the menu. * * @listens keydown @@ -17323,7 +17347,7 @@ * Ignore keys which are used by the menu, but pass any other ones up. See * {@link ClickableComponent#handleKeyDown} for instances where this is called. * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -22382,8 +22406,8 @@ * * After an instance has been created it can be accessed globally in three ways: * 1. By calling `videojs.getPlayer('example_video_1');` - * 2. By calling `videojs('example_video_1');` (not recomended) - * 2. By using it directly via `videojs.players.example_video_1;` + * 2. By calling `videojs('example_video_1');` (not recommended) + * 2. By using it directly via `videojs.players.example_video_1;` * * @extends Component * @global @@ -24122,7 +24146,9 @@ */ handleTechError_() { const error = this.tech_.error(); - this.error(error); + if (error) { + this.error(error); + } } /** @@ -25078,7 +25104,7 @@ * This allows player-wide hotkeys (either as defined below, or optionally * by an external function). * - * @param {Event} event + * @param {KeyboardEvent} event * The `keydown` event that caused this function to be called. * * @listens keydown @@ -27282,7 +27308,7 @@ * @param {Player} player * A Video.js player instance. * - * @param {Plugin~PluginEventHash} hash + * @param {PluginEventHash} hash * A plugin event hash. * * @param {boolean} [before] @@ -27435,7 +27461,7 @@ * @param {Object} [hash={}] * An object to be used as event an event hash. * - * @return {Plugin~PluginEventHash} + * @return {PluginEventHash} * An event hash object with provided properties mixed-in. */ getEventHash(hash = {}) { @@ -27454,7 +27480,7 @@ * * @param {Object} [hash={}] * Additional data hash to merge with a - * {@link Plugin~PluginEventHash|PluginEventHash}. + * {@link PluginEventHash|PluginEventHash}. * * @return {boolean} * Whether or not default was prevented. @@ -27670,7 +27696,7 @@ * Signals that a plugin is about to be set up on a player. * * @event Player#beforepluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27678,14 +27704,14 @@ * is the name of the plugin. * * @event Player#beforepluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** * Signals that a plugin has just been set up on a player. * * @event Player#pluginsetup - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** @@ -27693,11 +27719,11 @@ * is the name of the plugin. * * @event Player#pluginsetup:$name - * @type {Plugin~PluginEventHash} + * @type {PluginEventHash} */ /** - * @typedef {Object} Plugin~PluginEventHash + * @typedef {Object} PluginEventHash * * @property {string} instance * For basic plugins, the return value of the plugin function. For @@ -28024,10 +28050,10 @@ * @param {string} name * The class name of the component * - * @param {Component} comp + * @param {typeof Component} comp * The component class * - * @return {Component} + * @return {typeof Component} * The newly registered component */ videojs.registerComponent = (name, comp) => { @@ -28110,9 +28136,11 @@ * * @param {string} name * The plugin name - * - * @param {Plugin|Function} plugin + * + * @param {typeof Plugin|Function} plugin * The plugin sub-class or function + * + * @return {typeof Plugin|Function} */ videojs.plugin = (name, plugin) => { log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead'); @@ -39079,7 +39107,7 @@ }; var clock_1 = clock.ONE_SECOND_IN_TS; - /*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */ + /*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ /** * @file resolve-url.js - Handling how URLs are resolved and manipulated @@ -39813,9 +39841,13 @@ const seekable = function (playlist, expired, liveEdgePadding) { const useSafeLiveEnd = true; const seekableStart = expired || 0; - const seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); + let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding); if (seekableEnd === null) { return createTimeRanges(); + } // Clamp seekable end since it can not be less than the seekable start + + if (seekableEnd < seekableStart) { + seekableEnd = seekableStart; } return createTimeRanges(seekableStart, seekableEnd); }; @@ -42253,7 +42285,10 @@ }); // live playlist staleness timeout this.on('mediaupdatetimeout', () => { - this.refreshMedia_(this.media().id); + // We handle live content steering in the playlist controller + if (!this.media().attributes.serviceLocation) { + this.refreshMedia_(this.media().id); + } }); this.state = 'HAVE_NOTHING'; this.loadedPlaylists_ = {}; @@ -45083,18 +45118,31 @@ var nextByte = packetData[i + 1]; var win = service.currentWindow; var char; - var charCodeArray; // Use the TextDecoder if one was created for this service + var charCodeArray; // Converts an array of bytes to a unicode hex string. + + function toHexString(byteArray) { + return byteArray.map(byte => { + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); + } + if (isMultiByte) { + charCodeArray = [currentByte, nextByte]; + i++; + } else { + charCodeArray = [currentByte]; + } // Use the TextDecoder if one was created for this service if (service.textDecoder_ && !isExtended) { - if (isMultiByte) { - charCodeArray = [currentByte, nextByte]; - i++; - } else { - charCodeArray = [currentByte]; - } char = service.textDecoder_.decode(new Uint8Array(charCodeArray)); } else { - char = get708CharFromCode(extended | currentByte); + // We assume any multi-byte char without a decoder is unicode. + if (isMultiByte) { + const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character. + + char = String.fromCharCode(parseInt(unicode, 16)); + } else { + char = get708CharFromCode(extended | currentByte); + } } if (win.pendingNewLine && !win.isEmpty()) { win.newLine(this.getPts(i)); @@ -52091,7 +52139,7 @@ segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions. // Initialize CaptionParser if it hasn't been yet - if (!tracks.video || !data.byteLength || !segment.transmuxer) { + if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) { finishLoading(undefined, id3Frames); return; } @@ -59082,15 +59130,11 @@ */ AUDIO: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType }, excludePlaylist - } = settings; - stopLoaders(segmentLoader, mediaType); // switch back to default audio track + } = settings; // switch back to default audio track const activeTrack = mediaType.activeTrack(); const activeGroup = mediaType.activeGroup(); @@ -59126,15 +59170,11 @@ */ SUBTITLES: (type, settings) => () => { const { - segmentLoaders: { - [type]: segmentLoader - }, mediaTypes: { [type]: mediaType } } = settings; videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.'); - stopLoaders(segmentLoader, mediaType); const track = mediaType.activeTrack(); if (track) { track.mode = 'disabled'; @@ -59721,6 +59761,388 @@ return mediaTypes; }; + /** + * A utility class for setting properties and maintaining the state of the content steering manifest. + * + * Content Steering manifest format: + * VERSION: number (required) currently only version 1 is supported. + * TTL: number in seconds (optional) until the next content steering manifest reload. + * RELOAD-URI: string (optional) uri to fetch the next content steering manifest. + * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values. + */ + + class SteeringManifest { + constructor() { + this.priority_ = []; + } + set version(number) { + // Only version 1 is currently supported for both DASH and HLS. + if (number === 1) { + this.version_ = number; + } + } + set ttl(seconds) { + // TTL = time-to-live, default = 300 seconds. + this.ttl_ = seconds || 300; + } + set reloadUri(uri) { + if (uri) { + // reload URI can be relative to the previous reloadUri. + this.reloadUri_ = resolveUrl(this.reloadUri_, uri); + } + } + set priority(array) { + // priority must be non-empty and unique values. + if (array && array.length) { + this.priority_ = array; + } + } + get version() { + return this.version_; + } + get ttl() { + return this.ttl_; + } + get reloadUri() { + return this.reloadUri_; + } + get priority() { + return this.priority_; + } + } + /** + * This class represents a content steering manifest and associated state. See both HLS and DASH specifications. + * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and + * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6. + * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf + * + * @param {function} xhr for making a network request from the browser. + * @param {function} bandwidth for fetching the current bandwidth from the main segment loader. + */ + + class ContentSteeringController extends videojs.EventTarget { + constructor(xhr, bandwidth) { + super(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.logger_ = logger('Content Steering'); + this.xhr_ = xhr; + this.getBandwidth_ = bandwidth; + } + /** + * Assigns the content steering tag properties to the steering controller + * + * @param {string} baseUrl the baseURL from the manifest for resolving the steering manifest url + * @param {Object} steeringTag the content steering tag from the main manifest + */ + + assignTagProperties(baseUrl, steeringTag) { + this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH + + const steeringUri = steeringTag.serverUri || steeringTag.serverURL; + if (!steeringUri) { + this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`); + this.trigger('error'); + return; + } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case. + + if (steeringUri.startsWith('data:')) { + this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1)); + return; + } // With DASH queryBeforeStart, we want to use the steeringUri as soon as possible for the request. + + this.steeringManifest.reloadUri = this.queryBeforeStart ? steeringUri : resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH + + this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on tags. + + this.queryBeforeStart = steeringTag.queryBeforeStart || false; + this.proxyServerUrl_ = steeringTag.proxyServerURL || null; // trigger a steering event if we have a pathway from the content steering tag. + // this tells VHS which segment pathway to start with. + // If queryBeforeStart is true we need to wait for the steering manifest response. + + if (this.defaultPathway && !this.queryBeforeStart) { + this.trigger('content-steering'); + } + if (this.queryBeforeStart) { + this.requestSteeringManifest(this.steeringManifest.reloadUri); + } + } + /** + * Requests the content steering manifest and parse the response. This should only be called after + * assignTagProperties was called with a content steering tag. + * + * @param {string} initialUri The optional uri to make the request with. + * If set, the request should be made with exactly what is passed in this variable. + * This scenario is specific to DASH when the queryBeforeStart parameter is true. + * This scenario should only happen once on initalization. + */ + + requestSteeringManifest(initialUri) { + const reloadUri = this.steeringManifest.reloadUri; + if (!initialUri && !reloadUri) { + return; + } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires + // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1. + // This request URI accounts for manifest URIs that have been excluded. + + const uri = initialUri || this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering. + + if (!uri) { + this.logger_('No valid content steering manifest URIs. Stopping content steering.'); + this.trigger('error'); + this.dispose(); + return; + } + this.request_ = this.xhr_({ + uri + }, (error, errorInfo) => { + if (error) { + // If the client receives HTTP 410 Gone in response to a manifest request, + // it MUST NOT issue another request for that URI for the remainder of the + // playback session. It MAY continue to use the most-recently obtained set + // of Pathways. + if (errorInfo.status === 410) { + this.logger_(`manifest request 410 ${error}.`); + this.logger_(`There will be no more content steering requests to ${uri} this session.`); + this.excludedSteeringManifestURLs.add(uri); + return; + } // If the client receives HTTP 429 Too Many Requests with a Retry-After + // header in response to a manifest request, it SHOULD wait until the time + // specified by the Retry-After header to reissue the request. + + if (errorInfo.status === 429) { + const retrySeconds = errorInfo.responseHeaders['retry-after']; + this.logger_(`manifest request 429 ${error}.`); + this.logger_(`content steering will retry in ${retrySeconds} seconds.`); + this.startTTLTimeout_(parseInt(retrySeconds, 10)); + return; + } // If the Steering Manifest cannot be loaded and parsed correctly, the + // client SHOULD continue to use the previous values and attempt to reload + // it after waiting for the previously-specified TTL (or 5 minutes if + // none). + + this.logger_(`manifest failed to load ${error}.`); + this.startTTLTimeout_(); + return; + } + const steeringManifestJson = JSON.parse(this.request_.responseText); + this.startTTLTimeout_(); + this.assignSteeringProperties_(steeringManifestJson); + }); + } + /** + * Set the proxy server URL and add the steering manifest url as a URI encoded parameter. + * + * @param {string} steeringUrl the steering manifest url + * @return the steering manifest url to a proxy server with all parameters set + */ + + setProxyServerUrl_(steeringUrl) { + const steeringUrlObject = new window.URL(steeringUrl); + const proxyServerUrlObject = new window.URL(this.proxyServerUrl_); + proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString())); + return this.setSteeringParams_(proxyServerUrlObject.toString()); + } + /** + * Decodes and parses the data uri encoded steering manifest + * + * @param {string} dataUri the data uri to be decoded and parsed. + */ + + decodeDataUriManifest_(dataUri) { + const steeringManifestJson = JSON.parse(window.atob(dataUri)); + this.assignSteeringProperties_(steeringManifestJson); + } + /** + * Set the HLS or DASH content steering manifest request query parameters. For example: + * _HLS_pathway="" and _HLS_throughput= + * _DASH_pathway and _DASH_throughput + * + * @param {string} uri to add content steering server parameters to. + * @return a new uri as a string with the added steering query parameters. + */ + + setSteeringParams_(url) { + const urlObject = new window.URL(url); + const path = this.getPathway(); + const networkThroughput = this.getBandwidth_(); + if (path) { + const pathwayKey = `_${this.manifestType_}_pathway`; + urlObject.searchParams.set(pathwayKey, path); + } + if (networkThroughput) { + const throughputKey = `_${this.manifestType_}_throughput`; + urlObject.searchParams.set(throughputKey, networkThroughput); + } + return urlObject.toString(); + } + /** + * Assigns the current steering manifest properties and to the SteeringManifest object + * + * @param {Object} steeringJson the raw JSON steering manifest + */ + + assignSteeringProperties_(steeringJson) { + this.steeringManifest.version = steeringJson.VERSION; + if (!this.steeringManifest.version) { + this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`); + this.trigger('error'); + return; + } + this.steeringManifest.ttl = steeringJson.TTL; + this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional + + this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // TODO: HLS handle PATHWAY-CLONES. See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ + // 1. apply first pathway from the array. + // 2. if first pathway doesn't exist in manifest, try next pathway. + // a. if all pathways are exhausted, ignore the steering manifest priority. + // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway. + // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response, + // the excluded pathway will be ignored. + // See excludePathway usage in excludePlaylist(). + // If there are no available pathways, we need to stop content steering. + + if (!this.availablePathways_.size) { + this.logger_('There are no available pathways for content steering. Ending content steering.'); + this.trigger('error'); + this.dispose(); + } + const chooseNextPathway = pathwaysByPriority => { + for (const path of pathwaysByPriority) { + if (this.availablePathways_.has(path)) { + return path; + } + } // If no pathway matches, ignore the manifest and choose the first available. + + return [...this.availablePathways_][0]; + }; + const nextPathway = chooseNextPathway(this.steeringManifest.priority); + if (this.currentPathway !== nextPathway) { + this.currentPathway = nextPathway; + this.trigger('content-steering'); + } + } + /** + * Returns the pathway to use for steering decisions + * + * @return {string} returns the current pathway or the default + */ + + getPathway() { + return this.currentPathway || this.defaultPathway; + } + /** + * Chooses the manifest request URI based on proxy URIs and server URLs. + * Also accounts for exclusion on certain manifest URIs. + * + * @param {string} reloadUri the base uri before parameters + * + * @return {string} the final URI for the request to the manifest server. + */ + + getRequestURI(reloadUri) { + if (!reloadUri) { + return null; + } + const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri); + if (this.proxyServerUrl_) { + const proxyURI = this.setProxyServerUrl_(reloadUri); + if (!isExcluded(proxyURI)) { + return proxyURI; + } + } + const steeringURI = this.setSteeringParams_(reloadUri); + if (!isExcluded(steeringURI)) { + return steeringURI; + } // Return nothing if all valid manifest URIs are excluded. + + return null; + } + /** + * Start the timeout for re-requesting the steering manifest at the TTL interval. + * + * @param {number} ttl time in seconds of the timeout. Defaults to the + * ttl interval in the steering manifest + */ + + startTTLTimeout_(ttl = this.steeringManifest.ttl) { + // 300 (5 minutes) is the default value. + const ttlMS = ttl * 1000; + this.ttlTimeout_ = window.setTimeout(() => { + this.requestSteeringManifest(); + }, ttlMS); + } + /** + * Clear the TTL timeout if necessary. + */ + + clearTTLTimeout_() { + window.clearTimeout(this.ttlTimeout_); + this.ttlTimeout_ = null; + } + /** + * aborts any current steering xhr and sets the current request object to null + */ + + abort() { + if (this.request_) { + this.request_.abort(); + } + this.request_ = null; + } + /** + * aborts steering requests clears the ttl timeout and resets all properties. + */ + + dispose() { + this.off('content-steering'); + this.off('error'); + this.abort(); + this.clearTTLTimeout_(); + this.currentPathway = null; + this.defaultPathway = null; + this.queryBeforeStart = null; + this.proxyServerUrl_ = null; + this.manifestType_ = null; + this.ttlTimeout_ = null; + this.request_ = null; + this.excludedSteeringManifestURLs = new Set(); + this.availablePathways_ = new Set(); + this.excludedPathways_ = new Set(); + this.steeringManifest = new SteeringManifest(); + } + /** + * adds a pathway to the available pathways set + * + * @param {string} pathway the pathway string to add + */ + + addAvailablePathway(pathway) { + if (pathway) { + this.availablePathways_.add(pathway); + } + } + /** + * clears all pathways from the available pathways set + */ + + clearAvailablePathways() { + this.availablePathways_.clear(); + } + excludePathway(pathway) { + return this.availablePathways_.delete(pathway); + } + } + /** * @file playlist-controller.js */ @@ -59948,6 +60370,10 @@ tech.addWebVttScript_(); }) }), options); + const getBandwidth = () => { + return this.mainSegmentLoader_.bandwidth; + }; + this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth); this.setupSegmentLoaderListeners_(); if (this.bufferBasedABR) { this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_()); @@ -60033,6 +60459,32 @@ } this.mainPlaylistLoader_.media(playlist, delay); } + /** + * A function that ensures we switch our playlists inside of `mediaTypes` + * to match the current `serviceLocation` provided by the contentSteering controller. + * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`. + * + * This should only be called on a DASH playback scenario while using content steering. + * This is necessary due to differences in how media in HLS manifests are generally tied to + * a video playlist, where in DASH that is not always the case. + */ + + switchMediaForDASHContentSteering_() { + ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => { + const mediaType = this.mediaTypes_[type]; + const activeGroup = mediaType ? mediaType.activeGroup() : null; + const pathway = this.contentSteeringController_.getPathway(); + if (activeGroup && pathway) { + // activeGroup can be an array or a single group + const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists; + const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN + + if (dashMediaPlaylists.length) { + this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]); + } + } + }); + } /** * Start a timer that periodically calls checkABR_ * @@ -60181,8 +60633,9 @@ } let updatedPlaylist = this.mainPlaylistLoader_.media(); if (!updatedPlaylist) { - // exclude any variants that are not supported by the browser before selecting + this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting // an initial media as the playlist selectors do not consider browser support + this.excludeUnsupportedVariants_(); let selectedMedia; if (this.enableLowInitialPlaylist) { @@ -60763,10 +61216,22 @@ return this.mainPlaylistLoader_.load(isFinalRendition); } if (isFinalRendition) { - // Since we're on the final non-excluded playlist, and we're about to exclude + // If we're content steering, try other pathways. + if (this.main().contentSteering) { + const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh. + + const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000; + this.contentSteeringController_.excludePathway(pathway); + this.excludeThenChangePathway_(); + setTimeout(() => { + this.contentSteeringController_.addAvailablePathway(pathway); + }, reIncludeDelay); + return; + } // Since we're on the final non-excluded playlist, and we're about to exclude // it, instead of erring the player or retrying this playlist, clear out the current // exclusion list. This allows other playlists to be attempted in case any have been // fixed. + let reincluded = false; playlists.forEach(playlist => { // skip current playlist which is about to be excluded @@ -61104,6 +61569,7 @@ this.decrypter_.terminate(); this.mainPlaylistLoader_.dispose(); this.mainSegmentLoader_.dispose(); + this.contentSteeringController_.dispose(); if (this.loadOnPlay_) { this.tech_.off('play', this.loadOnPlay_); } @@ -61444,6 +61910,110 @@ videoDuration }); } + pathwayAttribute_(playlist) { + return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation; + } + /** + * Initialize content steering listeners and apply the tag properties. + */ + + initContentSteeringController_() { + const initialMain = this.main(); + if (!initialMain.contentSteering) { + return; + } + const updateSteeringValues = main => { + for (const playlist of main.playlists) { + this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist)); + } + this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); + }; + updateSteeringValues(initialMain); + this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this)); // We need to ensure we update the content steering values when a new + // manifest is loaded in live DASH with content steering. + + if (this.sourceType_ === 'dash') { + this.mainPlaylistLoader_.on('mediaupdatetimeout', () => { + this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id); // clear past values + + this.contentSteeringController_.abort(); + this.contentSteeringController_.clearTTLTimeout_(); + this.contentSteeringController_.clearAvailablePathways(); + updateSteeringValues(this.main()); + }); + } // Do this at startup only, after that the steering requests are managed by the Content Steering class. + // DASH queryBeforeStart scenarios will be handled by the Content Steering class. + + if (!this.contentSteeringController_.queryBeforeStart) { + this.tech_.one('canplay', () => { + this.contentSteeringController_.requestSteeringManifest(); + }); + } + } + /** + * Simple exclude and change playlist logic for content steering. + */ + + excludeThenChangePathway_() { + const currentPathway = this.contentSteeringController_.getPathway(); + if (!currentPathway) { + return; + } + const main = this.main(); + const playlists = main.playlists; + const ids = new Set(); + let didEnablePlaylists = false; + Object.keys(playlists).forEach(key => { + const variant = playlists[key]; + const pathwayId = this.pathwayAttribute_(variant); + const differentPathwayId = pathwayId && currentPathway !== pathwayId; + const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering'; + if (steeringExclusion && !differentPathwayId) { + delete variant.excludeUntil; + delete variant.lastExcludeReason_; + didEnablePlaylists = true; + } + const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity; + const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil; + if (!shouldExclude) { + return; + } + ids.add(variant.id); + variant.excludeUntil = Infinity; + variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this. + + this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`); + }); + if (this.contentSteeringController_.manifestType_ === 'DASH') { + Object.keys(this.mediaTypes_).forEach(key => { + const type = this.mediaTypes_[key]; + if (type.activePlaylistLoader) { + const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN + + if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) { + didEnablePlaylists = true; + } + } + }); + } + if (didEnablePlaylists) { + this.changeSegmentPathway_(); + } + } + /** + * Changes the current playlists for audio, video and subtitles after a new pathway + * is chosen from content steering. + */ + + changeSegmentPathway_() { + const nextPlaylist = this.selectPlaylist(); + this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH + + if (this.contentSteeringController_.manifestType_ === 'DASH') { + this.switchMediaForDASHContentSteering_(); + } + this.switchMedia_(nextPlaylist, 'content-steering'); + } } /** @@ -62192,8 +62762,8 @@ const reloadSourceOnError = function (options) { initPlugin(this, options); }; - var version$4 = "3.6.0"; - var version$3 = "7.0.0"; + var version$4 = "3.7.0"; + var version$3 = "7.0.1"; var version$2 = "1.2.2"; var version$1 = "7.1.0"; var version = "4.0.1"; diff --git a/node_modules/video.js/dist/video.min.js b/node_modules/video.js/dist/video.min.js index c76d267602..5ec964df87 100644 --- a/node_modules/video.js/dist/video.min.js +++ b/node_modules/video.js/dist/video.min.js @@ -1,6 +1,6 @@ /** * @license - * Video.js 8.6.0 + * Video.js 8.6.1 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * @@ -9,7 +9,7 @@ * Available under Apache License Version 2.0 * */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){"use strict";var M="8.6.0";const U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}const j={prefixed:!0};var q=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=q[0];let V;for(let e=0;e{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),u&&(u.push([].concat(s)),e=u.length-1e3,u.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>u?[].concat(u):[],o.history.filter=t=>(u||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{u&&(u.length=0)},o.history.disable=()=>{null!==u&&(u.length=0,u=null)},o.history.enable=()=>{null===u&&(u=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),$=l.createLogger,W=Object.prototype.toString;function G(t,i){z(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return z(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===W.call(e)&&e.constructor===Object}function d(...e){const i={};return e.forEach(e=>{e&&G(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function Q(e={}){var t,i=[];for(const s in e)e.hasOwnProperty(s)&&(t=e[s],i.push(t));return i}function J(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var Z=Object.freeze({__proto__:null,each:G,reduce:X,isObject:K,isPlain:Y,merge:d,values:Q,defineLazyProperty:J});let ee=!1,te=null,ie=!1,se,re=!1,ne=!1,ae=!1,oe=!1,le=null,de=null,he=null,ue=!1,ce=!1,pe=!1,me=!1;const ge=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var fe,e=window.navigator&&window.navigator.userAgentData;if(e&&(ie="Android"===e.platform,ne=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ae=Boolean(e.brands.find(e=>"Chromium"===e.brand)),oe=!ne&&ae,le=de=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ce="Windows"===e.platform),!ae){const R=window.navigator&&window.navigator.userAgent||"";ee=/iPod/i.test(R),te=(e=R.match(/OS (\d+)_/i))&&e[1]?e[1]:null,ie=/Android/i.test(R),se=(e=R.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ft=e[1]&&parseFloat(e[1]),fe=e[2]&&parseFloat(e[2]),ft&&fe?parseFloat(e[1]+"."+e[2]):ft||null):null,re=/Firefox/i.test(R),ne=/Edg/i.test(R),ae=/Chrome/i.test(R)||/CriOS/i.test(R),oe=!ne&&ae,le=de=(fe=R.match(/(Chrome|CriOS)\/(\d+)/))&&fe[2]?parseFloat(fe[2]):null,he=function(){var e=/MSIE\s(\d+)\.\d/.exec(R);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(R)&&/rv:11.0/.test(R)?11:t}(),ue=/Safari/i.test(R)&&!oe&&!ie&&!ne,ce=/Windows/i.test(R),pe=/iPad/i.test(R)||ue&&ge&&!/iPhone/i.test(R),me=/iPhone/i.test(R)&&!pe}const c=me||pe||ee,ye=(ue||c)&&!oe;e=Object.freeze({__proto__:null,get IS_IPOD(){return ee},get IOS_VERSION(){return te},get IS_ANDROID(){return ie},get ANDROID_VERSION(){return se},get IS_FIREFOX(){return re},get IS_EDGE(){return ne},get IS_CHROMIUM(){return ae},get IS_CHROME(){return oe},get CHROMIUM_VERSION(){return le},get CHROME_VERSION(){return de},get IE_VERSION(){return he},get IS_SAFARI(){return ue},get IS_WINDOWS(){return ce},get IS_IPAD(){return pe},get IS_IPHONE(){return me},TOUCH_ENABLED:ge,IS_IOS:c,IS_ANY_SAFARI:ye});function _e(e){return"string"==typeof e&&Boolean(e.trim())}function ve(){return document===window.document}function be(e){return K(e)&&1===e.nodeType}function Te(){try{return window.parent!==window.self}catch(e){return!0}}function we(i){return function(e,t){return _e(e)?(t=be(t=_e(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function o(e="div",i={},t={},s){const r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?Se(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&He(r,s),r}function Se(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ee(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function xe(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ie(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Ae(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function De(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Ge(e,"height"))),i.width||(i.width=parseFloat(Ge(e,"width"))),i}}function Ue(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[j.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Be(t,e){var i={x:0,y:0};if(c){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Ge(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e=e.parentNode}}var n={},a=Ue(e.target),t=Ue(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,c)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function Fe(e){return K(e)&&3===e.nodeType}function je(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function qe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>be(e="function"==typeof e?e():e)||Fe(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return qe(e).forEach(e=>t.appendChild(e)),t}function Ve(e,t){return He(je(e),t)}function ze(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const $e=we("querySelector"),We=we("querySelectorAll");function Ge(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Xe(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var Ke=Object.freeze({__proto__:null,isReal:ve,isEl:be,isInFrame:Te,createEl:o,textContent:Se,prependTo:Ee,hasClass:ke,addClass:Ce,removeClass:xe,toggleClass:Ie,setAttributes:Ae,getAttributes:De,getAttribute:Le,setAttribute:Pe,removeAttribute:Oe,blockTextSelection:Ne,unblockTextSelection:Re,getBoundingClientRect:Me,findPosition:Ue,getPointerPosition:Be,isTextNode:Fe,emptyEl:je,normalizeContent:qe,appendContent:He,insertContent:Ve,isSingleLeftClick:ze,$:$e,$$:We,computedStyle:Ge,copyStyleSheetsToWindow:Xe});let Ye=!1,Qe;function Je(){if(!1!==Qe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function gt(s,r,n,a=window){let o;function e(){const e=this,t=arguments;let i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ft=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:m,throttle:mt,debounce:gt});let yt;class _t{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},dt(this,e,t),this.addEventListener=i}off(e,t){p(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ut(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ct(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=at(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ht(this,e)}queueTrigger(e){yt=yt||new Map;const t=e.type||e;let i=yt.get(this);i||(i=new Map,yt.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,yt.delete(this)),this.trigger(e)},0));i.set(t,s)}}_t.prototype.allowedEvents_={},_t.prototype.addEventListener=_t.prototype.on,_t.prototype.removeEventListener=_t.prototype.off,_t.prototype.dispatchEvent=_t.prototype.trigger;const vt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),bt=t=>t instanceof _t||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),Tt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,wt=(e,t,i)=>{if(!e||!e.nodeName&&!bt(e))throw new Error(`Invalid target for ${vt(t)}#${i}; must be a DOM node or evented object.`)},St=(e,t,i)=>{if(!Tt(e))throw new Error(`Invalid event type for ${vt(t)}#${i}; must be a non-empty string or array.`)},Et=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${vt(t)}#${i}; must be a function.`)},kt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,wt(r,e,i),St(n,e,i),Et(a,e,i),a=m(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Ct=(e,t,i,s)=>{wt(e,e,t),e.nodeName?pt[t](e,i,s):e[t](i,s)},xt={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"on");if(Ct(i,"on",s,r),!t){const n=()=>this.off(i,s,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,Ct(this,"on","dispose",n),Ct(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"one");if(t)Ct(i,"one",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"one",s,n)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"any");if(t)Ct(i,"any",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"any",s,n)}},off(e,t,i){!e||Tt(e)?p(this.eventBusEl_,e,t):(e=e,t=t,wt(e,this,"off"),St(t,this,"off"),Et(i,this,"off"),i=m(this,i),this.off("dispose",i),e.nodeName?(p(e,t,i),p(e,"dispose",i)):bt(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){wt(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(Tt(i))return ht(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${vt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function It(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=o("span",{className:"vjs-event-bus"});Object.assign(e,xt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const At={state:{},setState(e){"function"==typeof e&&(e=e());let i;return G(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&bt(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Dt(e,t){Object.assign(e,At),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&bt(e)&&e.on("statechanged",e.handleStateChanged)}function Lt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function g(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Pt(e,t){return g(e)===g(t)}var Ot=Object.freeze({__proto__:null,toLowerCase:Lt,toTitleCase:g,titleCaseEquals:Pt}),Nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rt(e,t){return e(t={exports:{}},t.exports),t.exports}var r=Rt(function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),s[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var i=s[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in s)o[s[n]]=n;for(a in r)s[a]=r[a]});r.code,r.codes,r.aliases,r.names,r.title;class f{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+st++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(It(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Dt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return o(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,s[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=f.getComponent(e.opts.componentClass||g(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==r[t]?r[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=m(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=m(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=m(this,t),i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=f.getComponent("Tech"),i=i&&i.isTech(e),s=f===e||f.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=g(t),f.components_||(f.components_={});s=f.getComponent("Player");if("Player"===t&&s&&s.players){const r=s.players;i=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return f.components_[t]=e,f.components_[Lt(t)]=e}static getComponent(e){if(e&&f.components_)return f.components_[e]}}function Mt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function Bt(e,t){return Array.isArray(e)?Ut(e):void 0===e||void 0===t?Ut():Ut([[e,t]])}f.registerComponent("Component",f);function Ft(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:K(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Kt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Yt=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Kt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(Kt))},Qt=function(e,i){return e.forEach(function(e){const t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Kt;const Jt="vjs-modal-dialog";class Zt extends f{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=o("div",{className:Jt+"-content"},{role:"document"}),this.descEl_=o("p",{className:Jt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),Se(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Jt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Ve(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),je(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),r.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(r.isEventKey(e,"Tab")){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}Zt.prototype.options_={pauseOnOpen:!0,temporary:!0},f.registerComponent("ModalDialog",Zt);class ei extends _t{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},bt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class ri{constructor(e){ri.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Di(e,s){var t={uri:e};(e=ci(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),wi(t,m(this,function(e,t,i){if(e)return l.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Ai(i,s);l.error("vttjs failed to load, stopping trying to process "+s.src)}):Ai(i,s)}))}class Li extends di{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:oi[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=li[e.mode]||"disabled";const i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new ri(this.cues_)),n=new ri(this.activeCues_);let a=!1;this.timeupdateHandler=m(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){li[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Di(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e=i&&s.push(r)}if(a=!1,s.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=Ni.LOADED,this.trigger({type:"load",target:this})})}}Ni.prototype.allowedEvents_={load:"load"},Ni.NONE=0,Ni.LOADING=1,Ni.LOADED=2,Ni.ERROR=3;const Ri={audio:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){ti(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&ti(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ti(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Pi,capitalName:"Audio"},video:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){ii(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,ii(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Oi,capitalName:"Video"},text:{ListClass:si,TrackClass:Li,capitalName:"Text"}},Mi=(Object.keys(Ri).forEach(function(e){Ri[e].getterName=e+"Tracks",Ri[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:si,TrackClass:Li,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=qi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,a=$i[r],i=a?(a=e.document.createElement(a),(r=Gi[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,Xi[(n=i).localName]&&Xi[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;Wi.hasOwnProperty(e)&&(e=Wi[e],i.style[t?"background-color":"color"]=e)}),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,zi.innerHTML=n,n=zi.textContent,zi.textContent="",n)));return l}var Yi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Qi(e){var t=[],i="";if(e&&e.childNodes)for(n(t,e);i=function e(t){var i,s,r;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(r=s.match(/^.*(\n|\r)/))?r[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0:null}(t);)for(var s=0;s=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function Ji(){}function Zi(e,t,i){Ji.call(this),this.cue=t,this.cueDiv=Ki(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:Qi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function y(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function es(e,t,o,l){var i,s=new y(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;ru&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),n<0&&(h+=""===r.vertical?o.height:o.width,a=a.reverse()),s.move(c,h)}else{var p=s.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new y(t)}u=function(e,t){for(var i,s=new y(e),r=1,n=0;ne.left&&this.tope.top},y.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},y.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},y.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},y.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},y.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},ts.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},ts.convertCueToDOMTree=function(e,t){return e&&t?Ki(e,t):null};ts.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(m(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Ri.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Bt(0,0):Bt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ri.names.forEach(e=>{var t=Ri[e];const i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Y(us)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=st++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return _.canPlayType(e.type)}static isTech(e){return e.prototype instanceof _||e instanceof _||e===_}static registerTech(e,t){if(_.techs_||(_.techs_={}),!_.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!_.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(_.canPlaySource)return e=g(e),_.techs_[e]=t,_.techs_[Lt(e)]=t,"Tech"!==e&&_.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return _.techs_&&_.techs_[e]?_.techs_[e]:(e=g(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){const t=a[e];_.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),_.prototype.featuresVolumeControl=!0,_.prototype.featuresMuteControl=!0,_.prototype.featuresFullscreenResize=!1,_.prototype.featuresPlaybackRate=!1,_.prototype.featuresProgressEvents=!1,_.prototype.featuresSourceset=!1,_.prototype.featuresTimeupdateEvents=!1,_.prototype.featuresNativeTextTracks=!1,_.prototype.featuresVideoFrameCallback=!1,_.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction i(s={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)i(s,cs[t],r,n,a,o);else if(t){const d=Ts(n,t);if(!d.setSource)return a.push(d),i(s,l,r,n,a,o);d.setSource(Object.assign({},s),function(e,t){if(e)return i(s,l,r,n,a,o);a.push(d),i(t,s.type===t.type?l:cs[t.type],r,n,a,o)})}else l.length?i(s,l,r,n,a,o):o?r(s,a):i(s,cs["*"],r,n,a,!0)}(t,cs[t.type],i,e),1)}function fs(e,t,i,s=null){var r="call"+g(i),r=e.reduce(bs(r),s),s=r===ms,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}const ys={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},_s={setCurrentTime:1,setMuted:1,setVolume:1},vs={play:1,pause:1};function bs(i){return(e,t)=>e===ms?ms:t[i]?t[i](e):e}function Ts(e,t){var i=ps[e.id()];let s=null;if(null==i)s=t(e),ps[e.id()]=[[t,s]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=o(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=o("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Se(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}f.registerComponent("ClickableComponent",xs);class Is extends xs{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return o("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(o("picture",{className:"vjs-poster",tabIndex:-1},{},o("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xt(this.player_.play()):this.player_.pause())}}Is.prototype.crossorigin=Is.prototype.crossOrigin,f.registerComponent("PosterImage",Is);const As={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ds(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Ls(e,t,i){try{e.style[t]=i}catch(e){}}function Ps(e){return e?e+"px":""}class Os extends f{constructor(s,e,t){super(s,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(m(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);const e=window.screen.orientation||window,i=window.screen.orientation?"change":"orientationchange";e.addEventListener(i,r),s.on("dispose",()=>e.removeEventListener(i,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)Xt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const i=e&&e.getChild("playToggle");i?(e=()=>i.focus(),Gt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Rs.prototype.controlText_="Play Video",f.registerComponent("BigPlayButton",Rs);s;f.registerComponent("CloseButton",class extends s{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){r.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class Ms extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Xt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Ms.prototype.controlText_="Play",f.registerComponent("PlayToggle",Ms);class Us extends f{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=o("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=o("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Vt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Us.prototype.labelText_="Time",Us.prototype.controlText_="Time",f.registerComponent("TimeDisplay",Us);class Bs extends Us{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Bs.prototype.labelText_="Current Time",Bs.prototype.controlText_="Current Time",f.registerComponent("CurrentTimeDisplay",Bs);class Fs extends Us{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Fs.prototype.labelText_="Duration",Fs.prototype.controlText_="Duration",f.registerComponent("DurationDisplay",Fs);class js extends f{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}f.registerComponent("TimeDivider",js);class qs extends Us{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(o("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}qs.prototype.labelText_="Remaining Time",qs.prototype.controlText_="Remaining Time",f.registerComponent("RemainingTimeDisplay",qs);class Hs extends f{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=o("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(o("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}f.registerComponent("LiveDisplay",Hs);class Vs extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=o("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function zs(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}Vs.prototype.controlText_="Seek to live, currently playing live",f.registerComponent("SeekToLive",Vs);gi=Object.freeze({__proto__:null,clamp:zs});class $s extends f{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||oe||e.preventDefault(),Ne(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Re(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(zs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Be(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r.isEventKey(e,"Right")||r.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}f.registerComponent("Slider",$s);const Ws=(e,t)=>zs(e/t*100,0,100).toFixed(2)+"%";class Gs extends f{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=o("span",{className:"vjs-control-text"}),i=o("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=o("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=Ws(s,e);this.percent_!==e&&(this.el_.style.width=e,Se(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}f.registerComponent("LoadProgressBar",Gs);class Xs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,i,s){var r=Ue(this.el_),n=Me(this.player_.el()),i=t.width*i;if(n&&r){var a=t.left-n.left+i,i=t.width-i+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(s)}}write(e){Se(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Vt(i,t):Vt(a,s),this.update(r,n,e),o&&o()})}}f.registerComponent("TimeTooltip",Xs);class Ks extends f{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}Ks.prototype.options_={children:[]},c||ie||Ks.prototype.options_.children.push("timeTooltip"),f.registerComponent("PlayProgressBar",Ks);class Ys extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}Ys.prototype.options_={children:["timeTooltip"]},f.registerComponent("MouseTimeDisplay",Ys);class Qs extends $s{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=m(this,this.update),this.update=mt(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Vt(e,i),Vt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(Me(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ze(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(ze(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):r.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):r.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(r(e))?(e.preventDefault(),e.stopPropagation(),t=10*(r.codes[r(e)]-r.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):r.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):r.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Qs.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},c||ie||Qs.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),f.registerComponent("SeekBar",Qs);class Js extends f{constructor(e,t){super(e,t),this.handleMouseMove=mt(m(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=mt(m(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=Ue(r=n.el()),r=zs(r=Be(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Xt(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Js.prototype.options_={children:["seekBar"]},f.registerComponent("ProgressControl",Js);class Zs extends s{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Zs.prototype.controlText_="Picture-in-Picture",f.registerComponent("PictureInPictureToggle",Zs);class er extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}er.prototype.controlText_="Fullscreen",f.registerComponent("FullscreenToggle",er);class tr extends f{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}f.registerComponent("VolumeLevel",tr);class ir extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=Me(this.el_),r=Me(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){Se(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}f.registerComponent("VolumeLevelTooltip",ir);class sr extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}sr.prototype.options_={children:["volumeLevelTooltip"]},f.registerComponent("MouseVolumeLevelDisplay",sr);class rr extends $s{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ze(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Me(s=this.el()),i=this.vertical(),s=Be(s,e),s=zs(s=i?s.y:s.x,0,1),r.update(t,s,i)),ze(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}rr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},c||ie||rr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),rr.prototype.playerEvent="volumechange",f.registerComponent("VolumeBar",rr);class nr extends f{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Y(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=mt(m(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}nr.prototype.options_={children:["volumeBar"]},f.registerComponent("VolumeControl",nr);class ar extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),c&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),xe(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}ar.prototype.controlText_="Mute",f.registerComponent("MuteToggle",ar);class or extends f{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Y(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){r.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),dt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){r.isEventKey(e,"Esc")&&this.handleMouseOut()}}or.prototype.options_={children:["muteToggle","volumeControl"]},f.registerComponent("VolumePanel",or);s;f.registerComponent("SkipForward",class extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class lr extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}lr.prototype.controlText_="Skip Backward",f.registerComponent("SkipBackward",lr);class dr extends f{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof f&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof f&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=o(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),dt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(r.isEventKey(e,"Right")||r.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}f.registerComponent("Menu",dr);class hr extends f{constructor(e,t={}){super(e,t),this.menuButton_=new s(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=s.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),dt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new dr(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=o("li",{className:"vjs-menu-title",textContent:g(this.options_.title),tabIndex:-1}),e=new f(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;er.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}f.registerComponent("MenuItem",pr);class mr extends pr{constructor(e,t){var i=t.track;const s=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(g(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}xr.prototype.contentElType="button",f.registerComponent("PlaybackRateMenuItem",xr);class Ir extends hr{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=o("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new xr(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}Lr.prototype.options_=Object.assign({},Zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),f.registerComponent("ErrorDisplay",Lr);const Pr="vjs-text-track-settings";var Ui=["#000","Black"],Nt=["#00F","Blue"],Or=["#0FF","Cyan"],Nr=["#0F0","Green"],t=["#F0F","Magenta"],Rr=["#F00","Red"],Mr=["#FFF","White"],n=["#FF0","Yellow"],Ur=["1","Opaque"],Br=["0.5","Semi-Transparent"],Fr=["0","Transparent"];const jr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ui,Mr,Rr,Nr,Nt,n,t,Or]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Ur,Br,Fr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Mr,Ui,Rr,Nr,Nt,n,t,Or]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Ur,Br]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Fr,Br,Ur]}};function qr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}jr.windowColor.options=jr.backgroundColor.options;class Hr extends Zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=o("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),G(jr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){e=jr[e];const s=e.id.replace("%s",this.id_),r=[t,s].join(" ").trim();return[`<${i} id="${s}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return o("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return o("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return o("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(jr,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=qr(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){G(jr,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Pr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Pr,JSON.stringify(e)):window.localStorage.removeItem(Pr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}f.registerComponent("TextTrackSettings",Hr);class Vr extends f{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=gt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){p(this,"resize",t),p(this,"unload",e),e=null};dt(this.el_.contentWindow,"unload",e),dt(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}f.registerComponent("ResizeManager",Vr);const zr={trackingThreshold:20,liveTolerance:15};class $r extends f{constructor(e,t){super(e,d(zr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:o("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+st++}),description:o("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+st++})},o("div",{className:"vjs-title-bar"},{},Q(this.els))}updateDom_(){var e=this.player_.tech_;const s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];je(i),t&&Se(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}f.registerComponent("TitleBar",Wr);function Gr(i){const s=i.el();if(!s.resetSourceWatch_){const t={},e=Jr(i),r=t=>(...e)=>{e=t.apply(s,e);return Kr(i),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{s[e]&&(t[e]=s[e],s[e]=r(t[e]))}),Object.defineProperty(s,"innerHTML",d(e,{set:r(e.set)})),s.resetSourceWatch_=()=>{s.resetSourceWatch_=null,Object.keys(t).forEach(e=>{s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},i.one("sourceset",s.resetSourceWatch_)}}function Xr(i){if(i.featuresSourceset){const s=i.el();if(!s.resetSourceset_){e=i;const t=Qr([e.el(),window.HTMLMediaElement.prototype,Zr],"src");var e;const r=s.setAttribute,n=s.load;Object.defineProperty(s,"src",d(t,{set:e=>{e=t.set.call(s,e);return i.triggerSourceset(s.src),e}})),s.setAttribute=(e,t)=>{t=r.call(s,e,t);return/src/i.test(e)&&i.triggerSourceset(s.src),t},s.load=()=>{var e=n.call(s);return Kr(i)||(i.triggerSourceset(""),Gr(i)),e},s.currentSrc?i.triggerSourceset(s.currentSrc):Kr(i)||Gr(i),s.resetSourceset_=()=>{s.resetSourceset_=null,s.load=n,s.setAttribute=r,Object.defineProperty(s,"src",t),s.resetSourceWatch_&&s.resetSourceWatch_()}}}}const Kr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;eQr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,Yr],"innerHTML"),Zr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ui(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class v extends _{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!ci(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var e=Ri[i];const s=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&s&&s.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===i&&this[Mi.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{const i=n[t];s.addEventListener(t,i),this.on("dispose",e=>s.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Ri.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),v.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&De(this.options_.tag)),ge&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ae(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){v.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}J(v,"TEST_VID",function(){var e,t;if(ve())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),v.isSupported=function(){try{v.TEST_VID.volume=.5}catch(e){return!1}return!(!v.TEST_VID||!v.TEST_VID.canPlayType)},v.canPlayType=function(e){return v.TEST_VID.canPlayType(e)},v.canPlaySource=function(e,t){return v.canPlayType(e.type)},v.canControlVolume=function(){try{const t=v.TEST_VID.volume;v.TEST_VID.volume=t/2+.1;var e=t!==v.TEST_VID.volume;return e&&c?(window.setTimeout(()=>{v&&v.prototype&&(v.prototype.featuresVolumeControl=t!==v.TEST_VID.volume)}),!1):e}catch(e){return!1}},v.canMuteVolume=function(){try{var e=v.TEST_VID.muted;return v.TEST_VID.muted=!e,v.TEST_VID.muted?Pe(v.TEST_VID,"muted","muted"):Oe(v.TEST_VID,"muted"),e!==v.TEST_VID.muted}catch(e){return!1}},v.canControlPlaybackRate=function(){if(ie&&oe&&de<58)return!1;try{var e=v.TEST_VID.playbackRate;return v.TEST_VID.playbackRate=e/2+.1,e!==v.TEST_VID.playbackRate}catch(e){return!1}},v.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},v.supportsNativeTextTracks=function(){return ye||c&&oe},v.supportsNativeVideoTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.videoTracks)},v.supportsNativeAudioTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.audioTracks)},v.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){J(v.prototype,e,()=>v[t](),!0)}),v.prototype.featuresVolumeControl=v.canControlVolume(),v.prototype.movingMediaElementInDOM=!c,v.prototype.featuresFullscreenResize=!0,v.prototype.featuresProgressEvents=!0,v.prototype.featuresTimeupdateEvents=!0,v.prototype.featuresVideoFrameCallback=!(!v.TEST_VID||!v.TEST_VID.requestVideoFrameCallback),v.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},v.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){v.prototype["set"+g(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){v.prototype["set"+g(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]()}}),_.withSourceHandlers(v),v.nativeSourceHandler={},v.nativeSourceHandler.canPlayType=function(e){try{return v.TEST_VID.canPlayType(e)}catch(e){return""}},v.nativeSourceHandler.canHandleSource=function(e,t){return e.type?v.nativeSourceHandler.canPlayType(e.type):e.src?(e=pi(e.src),v.nativeSourceHandler.canPlayType("video/"+e)):""},v.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},v.nativeSourceHandler.dispose=function(){},v.registerSourceHandler(v.nativeSourceHandler),_.registerTech("Html5",v);const en=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],tn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},sn=["tiny","xsmall","small","medium","large","xlarge","huge"],rn={},nn=(sn.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;rn[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class b extends f{constructor(e,t,i){if(e.id=e.id||t.id||"vjs_video_"+st++,(t=Object.assign(b.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(s=e.closest("[lang]"))&&(t.language=s.getAttribute("lang")),super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=j,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&De(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=b.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),It(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(dt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),i=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((i=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=i.documentElement).style.display="none",this.el_.appendChild(s),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ge&&this.addClass("vjs-touch-enabled"),c||this.addClass("vjs-workinghover"),b.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+i),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),p(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),p(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),b.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,ps[e.id()]=null,a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),De(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);ke(i,"video-js")||Ce(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",oe&&ce&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=tt("vjs-styles-dimensions"),n=$e(".vjs-styles-defaults"),(a=$e("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},bt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),u&&(u.push([].concat(s)),e=u.length-1e3,u.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},o.history=()=>u?[].concat(u):[],o.history.filter=t=>(u||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{u&&(u.length=0)},o.history.disable=()=>{null!==u&&(u.length=0,u=null)},o.history.enable=()=>{null===u&&(u=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),$=l.createLogger,W=Object.prototype.toString;function G(t,i){z(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return z(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===W.call(e)&&e.constructor===Object}function d(...e){const i={};return e.forEach(e=>{e&&G(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function Q(e={}){var t,i=[];for(const s in e)e.hasOwnProperty(s)&&(t=e[s],i.push(t));return i}function J(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var Z=Object.freeze({__proto__:null,each:G,reduce:X,isObject:K,isPlain:Y,merge:d,values:Q,defineLazyProperty:J});let ee=!1,te=null,ie=!1,se,re=!1,ne=!1,ae=!1,oe=!1,le=null,de=null,he=null,ue=!1,ce=!1,pe=!1,me=!1;const ge=Boolean(ve()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var fe,e=window.navigator&&window.navigator.userAgentData;if(e&&(ie="Android"===e.platform,ne=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ae=Boolean(e.brands.find(e=>"Chromium"===e.brand)),oe=!ne&&ae,le=de=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ce="Windows"===e.platform),!ae){const R=window.navigator&&window.navigator.userAgent||"";ee=/iPod/i.test(R),te=(e=R.match(/OS (\d+)_/i))&&e[1]?e[1]:null,ie=/Android/i.test(R),se=(e=R.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(ft=e[1]&&parseFloat(e[1]),fe=e[2]&&parseFloat(e[2]),ft&&fe?parseFloat(e[1]+"."+e[2]):ft||null):null,re=/Firefox/i.test(R),ne=/Edg/i.test(R),ae=/Chrome/i.test(R)||/CriOS/i.test(R),oe=!ne&&ae,le=de=(fe=R.match(/(Chrome|CriOS)\/(\d+)/))&&fe[2]?parseFloat(fe[2]):null,he=function(){var e=/MSIE\s(\d+)\.\d/.exec(R);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(R)&&/rv:11.0/.test(R)?11:t}(),ue=/Safari/i.test(R)&&!oe&&!ie&&!ne,ce=/Windows/i.test(R),pe=/iPad/i.test(R)||ue&&ge&&!/iPhone/i.test(R),me=/iPhone/i.test(R)&&!pe}const c=me||pe||ee,ye=(ue||c)&&!oe;e=Object.freeze({__proto__:null,get IS_IPOD(){return ee},get IOS_VERSION(){return te},get IS_ANDROID(){return ie},get ANDROID_VERSION(){return se},get IS_FIREFOX(){return re},get IS_EDGE(){return ne},get IS_CHROMIUM(){return ae},get IS_CHROME(){return oe},get CHROMIUM_VERSION(){return le},get CHROME_VERSION(){return de},get IE_VERSION(){return he},get IS_SAFARI(){return ue},get IS_WINDOWS(){return ce},get IS_IPAD(){return pe},get IS_IPHONE(){return me},TOUCH_ENABLED:ge,IS_IOS:c,IS_ANY_SAFARI:ye});function _e(e){return"string"==typeof e&&Boolean(e.trim())}function ve(){return document===window.document}function be(e){return K(e)&&1===e.nodeType}function Te(){try{return window.parent!==window.self}catch(e){return!0}}function we(i){return function(e,t){return _e(e)?(t=be(t=_e(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function o(e="div",i={},t={},s){const r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?Se(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&He(r,s),r}function Se(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ee(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ke(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Ce(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function xe(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(l.warn("removeClass was called with an element that doesn't exist"),null)}function Ie(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Ae(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function De(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Ge(e,"height"))),i.width||(i.width=parseFloat(Ge(e,"width"))),i}}function Ue(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[j.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Be(t,e){var i={x:0,y:0};if(c){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Ge(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e=e.parentNode}}var n={},a=Ue(e.target),t=Ue(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,c)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function Fe(e){return K(e)&&3===e.nodeType}function je(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function qe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>be(e="function"==typeof e?e():e)||Fe(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return qe(e).forEach(e=>t.appendChild(e)),t}function Ve(e,t){return He(je(e),t)}function ze(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const $e=we("querySelector"),We=we("querySelectorAll");function Ge(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Xe(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var Ke=Object.freeze({__proto__:null,isReal:ve,isEl:be,isInFrame:Te,createEl:o,textContent:Se,prependTo:Ee,hasClass:ke,addClass:Ce,removeClass:xe,toggleClass:Ie,setAttributes:Ae,getAttributes:De,getAttribute:Le,setAttribute:Pe,removeAttribute:Oe,blockTextSelection:Ne,unblockTextSelection:Re,getBoundingClientRect:Me,findPosition:Ue,getPointerPosition:Be,isTextNode:Fe,emptyEl:je,normalizeContent:qe,appendContent:He,insertContent:Ve,isSingleLeftClick:ze,$:$e,$$:We,computedStyle:Ge,copyStyleSheetsToWindow:Xe});let Ye=!1,Qe;function Je(){if(!1!==Qe.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function gt(s,r,n,a=window){let o;function e(){const e=this,t=arguments;let i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var ft=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:m,throttle:mt,debounce:gt});let yt;class _t{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},dt(this,e,t),this.addEventListener=i}off(e,t){p(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ut(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ct(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=at(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ht(this,e)}queueTrigger(e){yt=yt||new Map;const t=e.type||e;let i=yt.get(this);i||(i=new Map,yt.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,yt.delete(this)),this.trigger(e)},0));i.set(t,s)}}_t.prototype.allowedEvents_={},_t.prototype.addEventListener=_t.prototype.on,_t.prototype.removeEventListener=_t.prototype.off,_t.prototype.dispatchEvent=_t.prototype.trigger;const vt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),bt=t=>t instanceof _t||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),Tt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,wt=(e,t,i)=>{if(!e||!e.nodeName&&!bt(e))throw new Error(`Invalid target for ${vt(t)}#${i}; must be a DOM node or evented object.`)},St=(e,t,i)=>{if(!Tt(e))throw new Error(`Invalid event type for ${vt(t)}#${i}; must be a non-empty string or array.`)},Et=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${vt(t)}#${i}; must be a function.`)},kt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,wt(r,e,i),St(n,e,i),Et(a,e,i),a=m(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Ct=(e,t,i,s)=>{wt(e,e,t),e.nodeName?pt[t](e,i,s):e[t](i,s)},xt={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"on");if(Ct(i,"on",s,r),!t){const n=()=>this.off(i,s,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,Ct(this,"on","dispose",n),Ct(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"one");if(t)Ct(i,"one",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"one",s,n)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=kt(this,e,"any");if(t)Ct(i,"any",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Ct(i,"any",s,n)}},off(e,t,i){!e||Tt(e)?p(this.eventBusEl_,e,t):(e=e,t=t,wt(e,this,"off"),St(t,this,"off"),Et(i,this,"off"),i=m(this,i),this.off("dispose",i),e.nodeName?(p(e,t,i),p(e,"dispose",i)):bt(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){wt(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(Tt(i))return ht(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${vt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function It(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=o("span",{className:"vjs-event-bus"});Object.assign(e,xt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const At={state:{},setState(e){"function"==typeof e&&(e=e());let i;return G(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&bt(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Dt(e,t){Object.assign(e,At),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&bt(e)&&e.on("statechanged",e.handleStateChanged)}function Lt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function g(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Pt(e,t){return g(e)===g(t)}var Ot=Object.freeze({__proto__:null,toLowerCase:Lt,toTitleCase:g,titleCaseEquals:Pt}),Nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rt(e,t){return e(t={exports:{}},t.exports),t.exports}var r=Rt(function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),s[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var i=s[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in s)o[s[n]]=n;for(a in r)s[a]=r[a]});r.code,r.codes,r.aliases,r.names,r.title;class f{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+st++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(It(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Dt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return o(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,s[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=f.getComponent(e.opts.componentClass||g(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==r[t]?r[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=m(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=m(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=m(this,t),i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=f.getComponent("Tech"),i=i&&i.isTech(e),s=f===e||f.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=g(t),f.components_||(f.components_={});s=f.getComponent("Player");if("Player"===t&&s&&s.players){const r=s.players;i=Object.keys(r);if(r&&0r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return f.components_[t]=e,f.components_[Lt(t)]=e}static getComponent(e){if(e&&f.components_)return f.components_[e]}}function Mt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function Bt(e,t){return Array.isArray(e)?Ut(e):void 0===e||void 0===t?Ut():Ut([[e,t]])}f.registerComponent("Component",f);function Ft(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:K(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e{})}function Kt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Yt=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Kt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(Kt))},Qt=function(e,i){return e.forEach(function(e){const t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Kt;const Jt="vjs-modal-dialog";class Zt extends f{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=o("div",{className:Jt+"-content"},{role:"document"}),this.descEl_=o("p",{className:Jt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),Se(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Jt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Ve(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),je(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),r.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(r.isEventKey(e,"Tab")){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}Zt.prototype.options_={pauseOnOpen:!0,temporary:!0},f.registerComponent("ModalDialog",Zt);class ei extends _t{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},bt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;ethis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class ri{constructor(e){ri.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(tl.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Di(e,s){var t={uri:e};(e=ci(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),wi(t,m(this,function(e,t,i){if(e)return l.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Ai(i,s);l.error("vttjs failed to load, stopping trying to process "+s.src)}):Ai(i,s)}))}class Li extends di{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:oi[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=li[e.mode]||"disabled";const i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new ri(this.cues_)),n=new ri(this.activeCues_);let a=!1;this.timeupdateHandler=m(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){li[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Di(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e=i&&s.push(r)}if(a=!1,s.length!==this.activeCues_.length)a=!0;else for(let e=0;e{t=Ni.LOADED,this.trigger({type:"load",target:this})})}}Ni.prototype.allowedEvents_={load:"load"},Ni.NONE=0,Ni.LOADING=1,Ni.LOADED=2,Ni.ERROR=3;const Ri={audio:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){ti(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&ti(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ti(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Pi,capitalName:"Audio"},video:{ListClass:class extends ei{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){ii(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,ii(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Oi,capitalName:"Video"},text:{ListClass:si,TrackClass:Li,capitalName:"Text"}},Mi=(Object.keys(Ri).forEach(function(e){Ri[e].getterName=e+"Tracks",Ri[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:si,TrackClass:Li,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=qi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,a=$i[r],i=a?(a=e.document.createElement(a),(r=Gi[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,Xi[(n=i).localName]&&Xi[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;Wi.hasOwnProperty(e)&&(e=Wi[e],i.style[t?"background-color":"color"]=e)}),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,zi.innerHTML=n,n=zi.textContent,zi.textContent="",n)));return l}var Yi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Qi(e){var t=[],i="";if(e&&e.childNodes)for(n(t,e);i=function e(t){var i,s,r;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(r=s.match(/^.*(\n|\r)/))?r[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0:null}(t);)for(var s=0;s=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function Ji(){}function Zi(e,t,i){Ji.call(this),this.cue=t,this.cueDiv=Ki(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:Qi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function y(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function es(e,t,o,l){var i,s=new y(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;ru&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),n<0&&(h+=""===r.vertical?o.height:o.width,a=a.reverse()),s.move(c,h)}else{var p=s.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new y(t)}u=function(e,t){for(var i,s=new y(e),r=1,n=0;ne.left&&this.tope.top},y.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},y.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},y.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},y.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},y.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},ts.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},ts.convertCueToDOMTree=function(e,t){return e&&t?Ki(e,t):null};ts.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(m(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Ri.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Bt(0,0):Bt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ri.names.forEach(e=>{var t=Ri[e];const i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Y(us)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=st++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return _.canPlayType(e.type)}static isTech(e){return e.prototype instanceof _||e instanceof _||e===_}static registerTech(e,t){if(_.techs_||(_.techs_={}),!_.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!_.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(_.canPlaySource)return e=g(e),_.techs_[e]=t,_.techs_[Lt(e)]=t,"Tech"!==e&&_.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return _.techs_&&_.techs_[e]?_.techs_[e]:(e=g(e),window&&window.videojs&&window.videojs[e]?(l.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){const t=a[e];_.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),_.prototype.featuresVolumeControl=!0,_.prototype.featuresMuteControl=!0,_.prototype.featuresFullscreenResize=!1,_.prototype.featuresPlaybackRate=!1,_.prototype.featuresProgressEvents=!1,_.prototype.featuresSourceset=!1,_.prototype.featuresTimeupdateEvents=!1,_.prototype.featuresNativeTextTracks=!1,_.prototype.featuresVideoFrameCallback=!1,_.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction i(s={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)i(s,cs[t],r,n,a,o);else if(t){const d=Ts(n,t);if(!d.setSource)return a.push(d),i(s,l,r,n,a,o);d.setSource(Object.assign({},s),function(e,t){if(e)return i(s,l,r,n,a,o);a.push(d),i(t,s.type===t.type?l:cs[t.type],r,n,a,o)})}else l.length?i(s,l,r,n,a,o):o?r(s,a):i(s,cs["*"],r,n,a,!0)}(t,cs[t.type],i,e),1)}function fs(e,t,i,s=null){var r="call"+g(i),r=e.reduce(bs(r),s),s=r===ms,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}const ys={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},_s={setCurrentTime:1,setMuted:1,setVolume:1},vs={play:1,pause:1};function bs(i){return(e,t)=>e===ms?ms:t[i]?t[i](e):e}function Ts(e,t){var i=ps[e.id()];let s=null;if(null==i)s=t(e),ps[e.id()]=[[t,s]];else{for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&l.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=o(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=o("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Se(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}f.registerComponent("ClickableComponent",xs);class Is extends xs{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return o("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(o("picture",{className:"vjs-poster",tabIndex:-1},{},o("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xt(this.player_.play()):this.player_.pause())}}Is.prototype.crossorigin=Is.prototype.crossOrigin,f.registerComponent("PosterImage",Is);const As={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ds(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Ls(e,t,i){try{e.style[t]=i}catch(e){}}function Ps(e){return e?e+"px":""}class Os extends f{constructor(s,e,t){super(s,e,t);const r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(m(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);const e=window.screen.orientation||window,i=window.screen.orientation?"change":"orientationchange";e.addEventListener(i,r),s.on("dispose",()=>e.removeEventListener(i,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)Xt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const i=e&&e.getChild("playToggle");i?(e=()=>i.focus(),Gt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Rs.prototype.controlText_="Play Video",f.registerComponent("BigPlayButton",Rs);s;f.registerComponent("CloseButton",class extends s{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){r.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class Ms extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Xt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Ms.prototype.controlText_="Play",f.registerComponent("PlayToggle",Ms);class Us extends f{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=o("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=o("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Vt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,l.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Us.prototype.labelText_="Time",Us.prototype.controlText_="Time",f.registerComponent("TimeDisplay",Us);class Bs extends Us{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Bs.prototype.labelText_="Current Time",Bs.prototype.controlText_="Current Time",f.registerComponent("CurrentTimeDisplay",Bs);class Fs extends Us{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Fs.prototype.labelText_="Duration",Fs.prototype.controlText_="Duration",f.registerComponent("DurationDisplay",Fs);class js extends f{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}f.registerComponent("TimeDivider",js);class qs extends Us{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(o("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}qs.prototype.labelText_="Remaining Time",qs.prototype.controlText_="Remaining Time",f.registerComponent("RemainingTimeDisplay",qs);class Hs extends f{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=o("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(o("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}f.registerComponent("LiveDisplay",Hs);class Vs extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=o("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function zs(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}Vs.prototype.controlText_="Seek to live, currently playing live",f.registerComponent("SeekToLive",Vs);gi=Object.freeze({__proto__:null,clamp:zs});class $s extends f{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||oe||e.preventDefault(),Ne(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Re(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(zs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Be(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r.isEventKey(e,"Right")||r.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}f.registerComponent("Slider",$s);const Ws=(e,t)=>zs(e/t*100,0,100).toFixed(2)+"%";class Gs extends f{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=o("span",{className:"vjs-control-text"}),i=o("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=o("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=Ws(s,e);this.percent_!==e&&(this.el_.style.width=e,Se(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}f.registerComponent("LoadProgressBar",Gs);class Xs extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,i,s){var r=Ue(this.el_),n=Me(this.player_.el()),i=t.width*i;if(n&&r){var a=t.left-n.left+i,i=t.width-i+(n.right-t.right);let e=r.width/2;ar.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(s)}}write(e){Se(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Vt(i,t):Vt(a,s),this.update(r,n,e),o&&o()})}}f.registerComponent("TimeTooltip",Xs);class Ks extends f{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}Ks.prototype.options_={children:[]},c||ie||Ks.prototype.options_.children.push("timeTooltip"),f.registerComponent("PlayProgressBar",Ks);class Ys extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}Ys.prototype.options_={children:["timeTooltip"]},f.registerComponent("MouseTimeDisplay",Ys);class Qs extends $s{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=m(this,this.update),this.update=mt(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Vt(e,i),Vt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(Me(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ze(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(ze(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):r.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):r.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(r(e))?(e.preventDefault(),e.stopPropagation(),t=10*(r.codes[r(e)]-r.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):r.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):r.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Qs.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},c||ie||Qs.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),f.registerComponent("SeekBar",Qs);class Js extends f{constructor(e,t){super(e,t),this.handleMouseMove=mt(m(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=mt(m(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=Ue(r=n.el()),r=zs(r=Be(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Xt(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Js.prototype.options_={children:["seekBar"]},f.registerComponent("ProgressControl",Js);class Zs extends s{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}Zs.prototype.controlText_="Picture-in-Picture",f.registerComponent("PictureInPictureToggle",Zs);class er extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}er.prototype.controlText_="Fullscreen",f.registerComponent("FullscreenToggle",er);class tr extends f{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}f.registerComponent("VolumeLevel",tr);class ir extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=Me(this.el_),r=Me(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){Se(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}f.registerComponent("VolumeLevelTooltip",ir);class sr extends f{constructor(e,t){super(e,t),this.update=mt(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}sr.prototype.options_={children:["volumeLevelTooltip"]},f.registerComponent("MouseVolumeLevelDisplay",sr);class rr extends $s{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ze(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Me(s=this.el()),i=this.vertical(),s=Be(s,e),s=zs(s=i?s.y:s.x,0,1),r.update(t,s,i)),ze(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}rr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},c||ie||rr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),rr.prototype.playerEvent="volumechange",f.registerComponent("VolumeBar",rr);class nr extends f{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Y(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=mt(m(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}nr.prototype.options_={children:["volumeBar"]},f.registerComponent("VolumeControl",nr);class ar extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),c&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),xe(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Ce(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}ar.prototype.controlText_="Mute",f.registerComponent("MuteToggle",ar);class or extends f{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Y(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){r.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),dt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){r.isEventKey(e,"Esc")&&this.handleMouseOut()}}or.prototype.options_={children:["muteToggle","volumeControl"]},f.registerComponent("VolumePanel",or);s;f.registerComponent("SkipForward",class extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class lr extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}lr.prototype.controlText_="Skip Backward",f.registerComponent("SkipBackward",lr);class dr extends f{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof f&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof f&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=o(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),dt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(r.isEventKey(e,"Right")||r.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}f.registerComponent("Menu",dr);class hr extends f{constructor(e,t={}){super(e,t),this.menuButton_=new s(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=s.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),dt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new dr(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=o("li",{className:"vjs-menu-title",textContent:g(this.options_.title),tabIndex:-1}),e=new f(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;er.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}f.registerComponent("MenuItem",pr);class mr extends pr{constructor(e,t){var i=t.track;const s=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(g(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","description"].indexOf(this.options_.track.kind)&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}xr.prototype.contentElType="button",f.registerComponent("PlaybackRateMenuItem",xr);class Ir extends hr{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=o("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new xr(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}Lr.prototype.options_=Object.assign({},Zt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),f.registerComponent("ErrorDisplay",Lr);const Pr="vjs-text-track-settings";var Ui=["#000","Black"],Nt=["#00F","Blue"],Or=["#0FF","Cyan"],Nr=["#0F0","Green"],t=["#F0F","Magenta"],Rr=["#F00","Red"],Mr=["#FFF","White"],n=["#FF0","Yellow"],Ur=["1","Opaque"],Br=["0.5","Semi-Transparent"],Fr=["0","Transparent"];const jr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ui,Mr,Rr,Nr,Nt,n,t,Or]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Ur,Br,Fr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Mr,Ui,Rr,Nr,Nt,n,t,Or]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Ur,Br]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Fr,Br,Ur]}};function qr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}jr.windowColor.options=jr.backgroundColor.options;class Hr extends Zt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=o("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),G(jr,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){e=jr[e];const s=e.id.replace("%s",this.id_),r=[t,s].join(" ").trim();return[`<${i} id="${s}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),``,`").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return o("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return o("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return o("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(jr,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=qr(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){G(jr,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Pr))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Pr,JSON.stringify(e)):window.localStorage.removeItem(Pr)}catch(e){l.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}f.registerComponent("TextTrackSettings",Hr);class Vr extends f{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=gt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){p(this,"resize",t),p(this,"unload",e),e=null};dt(this.el_.contentWindow,"unload",e),dt(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}f.registerComponent("ResizeManager",Vr);const zr={trackingThreshold:20,liveTolerance:15};class $r extends f{constructor(e,t){super(e,d(zr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:o("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+st++}),description:o("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+st++})},o("div",{className:"vjs-title-bar"},{},Q(this.els))}updateDom_(){var e=this.player_.tech_;const s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];je(i),t&&Se(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}f.registerComponent("TitleBar",Wr);function Gr(i){const s=i.el();if(!s.resetSourceWatch_){const t={},e=Jr(i),r=t=>(...e)=>{e=t.apply(s,e);return Kr(i),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{s[e]&&(t[e]=s[e],s[e]=r(t[e]))}),Object.defineProperty(s,"innerHTML",d(e,{set:r(e.set)})),s.resetSourceWatch_=()=>{s.resetSourceWatch_=null,Object.keys(t).forEach(e=>{s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},i.one("sourceset",s.resetSourceWatch_)}}function Xr(i){if(i.featuresSourceset){const s=i.el();if(!s.resetSourceset_){e=i;const t=Qr([e.el(),window.HTMLMediaElement.prototype,Zr],"src");var e;const r=s.setAttribute,n=s.load;Object.defineProperty(s,"src",d(t,{set:e=>{e=t.set.call(s,e);return i.triggerSourceset(s.src),e}})),s.setAttribute=(e,t)=>{t=r.call(s,e,t);return/src/i.test(e)&&i.triggerSourceset(s.src),t},s.load=()=>{var e=n.call(s);return Kr(i)||(i.triggerSourceset(""),Gr(i)),e},s.currentSrc?i.triggerSourceset(s.currentSrc):Kr(i)||Gr(i),s.resetSourceset_=()=>{s.resetSourceset_=null,s.load=n,s.setAttribute=r,Object.defineProperty(s,"src",t),s.resetSourceWatch_&&s.resetSourceWatch_()}}}}const Kr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;eQr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,Yr],"innerHTML"),Zr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ui(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class v extends _{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!ci(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var e=Ri[i];const s=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&s&&s.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===i&&this[Mi.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{const i=n[t];s.addEventListener(t,i),this.on("dispose",e=>s.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Ri.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),v.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&De(this.options_.tag)),ge&&!0===this.options_.nativeControlsForTouch||delete e.controls,Ae(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Pe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){v.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}J(v,"TEST_VID",function(){var e,t;if(ve())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),v.isSupported=function(){try{v.TEST_VID.volume=.5}catch(e){return!1}return!(!v.TEST_VID||!v.TEST_VID.canPlayType)},v.canPlayType=function(e){return v.TEST_VID.canPlayType(e)},v.canPlaySource=function(e,t){return v.canPlayType(e.type)},v.canControlVolume=function(){try{const t=v.TEST_VID.volume;v.TEST_VID.volume=t/2+.1;var e=t!==v.TEST_VID.volume;return e&&c?(window.setTimeout(()=>{v&&v.prototype&&(v.prototype.featuresVolumeControl=t!==v.TEST_VID.volume)}),!1):e}catch(e){return!1}},v.canMuteVolume=function(){try{var e=v.TEST_VID.muted;return v.TEST_VID.muted=!e,v.TEST_VID.muted?Pe(v.TEST_VID,"muted","muted"):Oe(v.TEST_VID,"muted"),e!==v.TEST_VID.muted}catch(e){return!1}},v.canControlPlaybackRate=function(){if(ie&&oe&&de<58)return!1;try{var e=v.TEST_VID.playbackRate;return v.TEST_VID.playbackRate=e/2+.1,e!==v.TEST_VID.playbackRate}catch(e){return!1}},v.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},v.supportsNativeTextTracks=function(){return ye||c&&oe},v.supportsNativeVideoTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.videoTracks)},v.supportsNativeAudioTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.audioTracks)},v.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){J(v.prototype,e,()=>v[t](),!0)}),v.prototype.featuresVolumeControl=v.canControlVolume(),v.prototype.movingMediaElementInDOM=!c,v.prototype.featuresFullscreenResize=!0,v.prototype.featuresProgressEvents=!0,v.prototype.featuresTimeupdateEvents=!0,v.prototype.featuresVideoFrameCallback=!(!v.TEST_VID||!v.TEST_VID.requestVideoFrameCallback),v.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},v.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){v.prototype["set"+g(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){v.prototype["set"+g(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]()}}),_.withSourceHandlers(v),v.nativeSourceHandler={},v.nativeSourceHandler.canPlayType=function(e){try{return v.TEST_VID.canPlayType(e)}catch(e){return""}},v.nativeSourceHandler.canHandleSource=function(e,t){return e.type?v.nativeSourceHandler.canPlayType(e.type):e.src?(e=pi(e.src),v.nativeSourceHandler.canPlayType("video/"+e)):""},v.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},v.nativeSourceHandler.dispose=function(){},v.registerSourceHandler(v.nativeSourceHandler),_.registerTech("Html5",v);const en=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],tn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},sn=["tiny","xsmall","small","medium","large","xlarge","huge"],rn={},nn=(sn.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;rn[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class b extends f{constructor(e,t,i){if(e.id=e.id||t.id||"vjs_video_"+st++,(t=Object.assign(b.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(s=e.closest("[lang]"))&&(t.language=s.getAttribute("lang")),super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=$(this.id_),this.fsApi_=j,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&De(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=b.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),It(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(dt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),i=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons&&((i=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(l.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=i.documentElement).style.display="none",this.el_.appendChild(s),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),ge&&this.addClass("vjs-touch-enabled"),c||this.addClass("vjs-workinghover"),b.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+i),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),p(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),p(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),b.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,ps[e.id()]=null,a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),De(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);ke(i,"video-js")||Ce(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",oe&&ce&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=tt("vjs-styles-dimensions"),n=$e(".vjs-styles-defaults"),(a=$e("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},bt(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(tn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${tn[t]}_`].bind(this),event:e}):this[`handleTech${tn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Yt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Gt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Gt(e=this.play())&&(e=e.catch(i)),Gt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Xt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Xt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(ye||c);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Bt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Xt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,dt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){r.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,p(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,xe(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(o("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Xe(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_["userActions"];s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>r.isEventKey(e,"f"),muteKey:i=e=>r.isEventKey(e,"m"),playPauseKey:s=e=>r.isEventKey(e,"k")||r.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=f.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),f.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),f.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,_.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=ws(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),gs(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},i=()=>{this.off("error",t)};this.one("error",t),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",i)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Pt(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Xt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),bt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);K(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,i,s;const r=m(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||c||ie||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),bt(this))&&this.trigger("languagechange")}languages(){return d(b.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Es(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},s=De(e),r=s["data-setup"];if(ke(e,"vjs-fill")&&(s.fill=!0),ke(e,"vjs-fluid")&&(s.fluid=!0),null!==r&&([r,t]=Wt(r||"{}"),r&&l.error(r),Object.assign(s,t)),Object.assign(i,s),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){const t=a[e];b.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),b.prototype.crossorigin=b.prototype.crossOrigin,b.players={};Mr=window.navigator;b.prototype.options_={techOrder:_.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Mr&&(Mr.languages&&Mr.languages[0]||Mr.userLanguage||Mr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){b.prototype[e]=function(){return this.techGet_(e)}}),en.forEach(function(e){b.prototype[`handleTech${g(e)}_`]=function(){return this.trigger(e)}}),f.registerComponent("Player",b);function an(t,i){function s(){pn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return cn(this,t),pn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}const on="plugin",ln="activePlugins_",dn={},hn=e=>dn.hasOwnProperty(e),un=e=>hn(e)?dn[e]:void 0,cn=(e,t)=>{e[ln]=e[ln]||{},e[ln][t]=!0},pn=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},mn=(i,s)=>(s.prototype.name=i,function(...e){pn(this,{name:i,plugin:s,instance:null},!0);const t=new s(this,...e);return this[i]=()=>t,pn(this,t.getEventHash()),t});class gn{constructor(e){if(this.constructor===gn)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),It(this),delete this.trigger,Dt(this,this.constructor.defaultState),cn(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ht(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[ln][e]=!1,this.player=this.state=null,t[e]=mn(e,dn[e])}static isBasic(e){e="string"==typeof e?un(e):e;return"function"==typeof e&&!gn.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(hn(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(b.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return dn[e]=t,e!==on&&(gn.isBasic(t)?b.prototype[e]=an(e,t):b.prototype[e]=mn(e,t)),t}static deregisterPlugin(e){if(e===on)throw new Error("Cannot de-register base plugin.");hn(e)&&(delete dn[e],delete b.prototype[e])}static getPlugins(e=Object.keys(dn)){let i;return e.forEach(e=>{var t=un(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=un(e);return e&&e.VERSION||""}}function fn(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}gn.getPlugin=un,gn.BASE_PLUGIN_NAME=on,gn.registerPlugin(on,gn),b.prototype.usingPlugin=function(e){return!!this[ln]&&!0===this[ln][e]},b.prototype.hasPlugin=function(e){return!!hn(e)};const yn=e=>0===e.indexOf("#")?e.slice(1):e;function T(e,t,i){let s=T.getPlayer(e);if(s)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i);else{const r="string"==typeof e?$e("#"+yn(e)):e;if(!be(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,d(t));!K(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=d(t,e)}),f.getComponent("Player"));s=new e(r,t,i),B("setup").forEach(e=>e(s))}return s}T.hooks_=U,T.hooks=B,T.hook=function(e,t){B(e,t)},T.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{const i=(...e)=>(F(s,i),t(...e));return i}))},T.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ve()&&!(Ui=$e(".vjs-styles-defaults"))&&(Ui=tt("vjs-styles-defaults"),(Rr=$e("head"))&&Rr.insertBefore(Ui,Rr.firstChild),it(Ui,` + `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=g(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(_.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};a.names.forEach(e=>{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(tn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${tn[t]}_`].bind(this),event:e}):this[`handleTech${tn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Ee(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Yt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&l.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Gt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Gt(e=this.play())&&(e=e.catch(i)),Gt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Xt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Xt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(ye||c);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Bt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:Bt(0,0)}bufferedPercent(){return $t(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Xt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,dt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Ce(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){r.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,p(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,xe(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(o("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Xe(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_["userActions"];s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>r.isEventKey(e,"f"),muteKey:i=e=>r.isEventKey(e,"m"),playPauseKey:s=e=>r.isEventKey(e,"k")||r.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=f.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),f.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),f.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,_.getTech(e)]).filter(([e,t])=>t?t.isSupported():(l.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=ws(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),gs(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},i=()=>{this.off("error",t)};this.one("error",t),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",i)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Pt(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Xt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),bt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);K(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),l.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,i,s;const r=m(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||c||ie||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),bt(this))&&this.trigger("languagechange")}languages(){return d(b.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Es(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},s=De(e),r=s["data-setup"];if(ke(e,"vjs-fill")&&(s.fill=!0),ke(e,"vjs-fluid")&&(s.fluid=!0),null!==r&&([r,t]=Wt(r||"{}"),r&&l.error(r),Object.assign(s,t)),Object.assign(i,s),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){const t=a[e];b.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),b.prototype.crossorigin=b.prototype.crossOrigin,b.players={};Mr=window.navigator;b.prototype.options_={techOrder:_.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Mr&&(Mr.languages&&Mr.languages[0]||Mr.userLanguage||Mr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){b.prototype[e]=function(){return this.techGet_(e)}}),en.forEach(function(e){b.prototype[`handleTech${g(e)}_`]=function(){return this.trigger(e)}}),f.registerComponent("Player",b);function an(t,i){function s(){pn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return cn(this,t),pn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}const on="plugin",ln="activePlugins_",dn={},hn=e=>dn.hasOwnProperty(e),un=e=>hn(e)?dn[e]:void 0,cn=(e,t)=>{e[ln]=e[ln]||{},e[ln][t]=!0},pn=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},mn=(i,s)=>(s.prototype.name=i,function(...e){pn(this,{name:i,plugin:s,instance:null},!0);const t=new s(this,...e);return this[i]=()=>t,pn(this,t.getEventHash()),t});class gn{constructor(e){if(this.constructor===gn)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),It(this),delete this.trigger,Dt(this,this.constructor.defaultState),cn(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ht(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[ln][e]=!1,this.player=this.state=null,t[e]=mn(e,dn[e])}static isBasic(e){e="string"==typeof e?un(e):e;return"function"==typeof e&&!gn.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(hn(e))l.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(b.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return dn[e]=t,e!==on&&(gn.isBasic(t)?b.prototype[e]=an(e,t):b.prototype[e]=mn(e,t)),t}static deregisterPlugin(e){if(e===on)throw new Error("Cannot de-register base plugin.");hn(e)&&(delete dn[e],delete b.prototype[e])}static getPlugins(e=Object.keys(dn)){let i;return e.forEach(e=>{var t=un(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=un(e);return e&&e.VERSION||""}}function fn(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||l.warn(n),t=!0,a.apply(this,e)}}}gn.getPlugin=un,gn.BASE_PLUGIN_NAME=on,gn.registerPlugin(on,gn),b.prototype.usingPlugin=function(e){return!!this[ln]&&!0===this[ln][e]},b.prototype.hasPlugin=function(e){return!!hn(e)};const yn=e=>0===e.indexOf("#")?e.slice(1):e;function T(e,t,i){let s=T.getPlayer(e);if(s)t&&l.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i);else{const r="string"==typeof e?$e("#"+yn(e)):e;if(!be(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in r&&r.getRootNode()instanceof window.ShadowRoot?r.getRootNode():r.ownerDocument.body,e=(r.ownerDocument.defaultView&&e.contains(r)||l.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,d(t));!K(e)||Array.isArray(e)?l.error("please return an object in beforesetup hooks"):t=d(t,e)}),f.getComponent("Player"));s=new e(r,t,i),B("setup").forEach(e=>e(s))}return s}T.hooks_=U,T.hooks=B,T.hook=function(e,t){B(e,t)},T.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{const i=(...e)=>(F(s,i),t(...e));return i}))},T.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&ve()&&!(Ui=$e(".vjs-styles-defaults"))&&(Ui=tt("vjs-styles-defaults"),(Rr=$e("head"))&&Rr.insertBefore(Ui,Rr.firstChild),it(Ui,` .video-js { width: 300px; height: 150px; @@ -33,9 +33,9 @@ e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e /*! @name m3u8-parser @version 7.1.0 @license Apache-2.0 */class Tn extends Nr{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;ee),this.customParsers.push(e=>{if(t.exec(e))return this.trigger("data",{type:"custom",data:s(e),customType:i,segment:r}),!0})}addTagMapper({expression:t,map:i}){this.tagMappers.push(e=>t.test(e)?i(e):e)}}function Cn(t){const i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=t[e]}),i}function xn(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]{a.uri||!a.parts&&!a.preloadHints||(!a.map&&r&&(a.map=r),!a.key&&o&&(a.key=o),a.timeline||"number"!=typeof h||(a.timeline=h),this.manifest.preloadSegment=a)}),this.parseStream.on("data",function(n){let t,i;({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in n&&((a.byterange=e).length=n.length,"offset"in n||(n.offset=u)),"offset"in n&&((a.byterange=e).offset=n.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),n.title&&(a.title=n.title),0(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,xn.call(this,this.manifest))},start(){!n.attributes||isNaN(n.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out"(){a.cueOut=n.data},"cue-out-cont"(){a.cueOutCont=n.data},"cue-in"(){a.cueIn=n.data},skip(){this.manifest.skip=Cn(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;var e=this.manifest.segments.length,t=Cn(n.attributes),t=(a.parts=a.parts||[],a.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=c),c=t.byterange.offset+t.byterange.length),a.parts.length-1);this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){var e=this.manifest.serverControl=Cn(n.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),xn.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){var t=this.manifest.segments.length,i=Cn(n.attributes),e=i.type&&"PART"===i.type,s=(a.preloadHints=a.preloadHints||[],a.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e?c:0,e&&(c=i.byterange.offset+i.byterange.length)),a.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #`+t,n.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===t.id);this.manifest.dateRanges[e]=_i(this.manifest.dateRanges[e],t),p[t.id]=_i(p[t.id],t),this.manifest.dateRanges.pop()}else p[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=Cn(n.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",n.attributes,["SERVER-URI"])}}[n.tagType]||function(){}).call(e)},uri(){a.uri=n.uri,s.push(a),!this.manifest.targetDuration||"duration"in a||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),o&&(a.key=o),a.timeline=h,r&&(a.map=r),c=0,null!==this.lastProgramDateTime&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*a.duration),a={}},comment(){},custom(){n.segment?(a.custom=a.custom||{},a.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(e)})}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach(function(e){t.hasOwnProperty(e)||s.push(e)}),s.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+s.join(", ")})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}function An(e){return Mn.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function Dn(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(qn(e))||!1}function Ln(e){return(e=void 0===e?"":e).toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t=e.length&&t.call(e,function(e,t){return e===(n[t]?n[t]&i[r+t]:i[r+t])})},Xn="http://example.com";function Kn(e){e=e;for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),s=0;s"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function _a(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(_a(e,t))return 1}while(e=e.nextSibling)}function va(){this.ownerDocument=this}function ba(e,t,i){e&&e._inc++,i.namespaceURI===ta.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Ta(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function wa(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ta(e.ownerDocument,e),t}function Sa(e){return e&&e.nodeType===x.DOCUMENT_TYPE_NODE}function Ea(e){return e&&e.nodeType===x.ELEMENT_NODE}function ka(e){return e&&e.nodeType===x.TEXT_NODE}function Ca(e,t){var i,e=e.childNodes||[];if(!ea(e,Ea)&&!Sa(t))return i=ea(e,Sa),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function xa(e,t){var i,e=e.childNodes||[];if(!ea(e,function(e){return Ea(e)&&e!==t}))return i=ea(e,Sa),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Ia(e,t,i){if(!(s=e)||s.nodeType!==x.DOCUMENT_NODE&&s.nodeType!==x.DOCUMENT_FRAGMENT_NODE&&s.nodeType!==x.ELEMENT_NODE)throw new C(oa,"Unexpected parent node type "+e.nodeType);var s;if(i&&i.parentNode!==e)throw new C(la,"child not in parent");if(!(s=t)||!(Ea(s)||ka(s)||Sa(s)||s.nodeType===x.DOCUMENT_FRAGMENT_NODE||s.nodeType===x.COMMENT_NODE||s.nodeType===x.PROCESSING_INSTRUCTION_NODE)||Sa(t)&&e.nodeType!==x.DOCUMENT_NODE)throw new C(oa,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Aa(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===x.DOCUMENT_FRAGMENT_NODE){var n=r.filter(Ea);if(1"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):Xa(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)Xa(o,t,i,s,r.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case 9:case 11:for(o=e.firstChild;o;)Xa(o,t,i,s,r.slice()),o=o.nextSibling;return;case 2:return Ga(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,ya));case 4:return t.push("");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ka(e,t,i){e[t]=i}t.INVALID_STATE_ERR=(k[11]="Invalid state",11),t.SYNTAX_ERR=(k[12]="Syntax error",12),t.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),t.NAMESPACE_ERR=(k[14]="Invalid namespace",14),t.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),C.prototype=Error.prototype,na(t,C),da.prototype={length:0,item:function(e){return 0<=e&&e",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES}),Qa=(Ya.XML_ENTITIES,Ya.HTML_ENTITIES,Ya.entityMap,Zn.NAMESPACE),Fr=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Br=new RegExp("[\\-\\.0-9"+Fr.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ja=new RegExp("^"+Fr.source+Br.source+"*(?::"+Fr.source+Br.source+"*)?$"),Za=0,eo=1,to=2,io=3,so=4,ro=5,no=6,ao=7;function oo(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,oo)}function lo(){}function ho(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function uo(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value,o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&"");a.localName=u,!1!==o&&(null==r&&(r={},co(i,i={})),i[o]=r[o]=l,a.uri=Qa.XMLNS,t.startPrefixMapping(o,l))}for(var d,n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=Qa.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function co(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function po(){this.attributeNames={}}(oo.prototype=new Error).name=oo.name,lo.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),co(t,t={}),function(i,e,s,r,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(s,t)?s[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function t(e){var t;m",y+3),v=i.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=i.substring(y+2).replace(/[\s<].*/,""),n.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s",t);if(s){e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e)return e[0].length,i.processingInstruction(e[1],e[2]),s+2}return-1}(i,y,r);break;case"!":u&&o(y),_=function(e,t,i,s){{if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4),t",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),n=s.length;if(1":switch(d){case Za:s.setTagName(e.slice(t,l));case ro:case no:case ao:break;case so:case eo:"/"===(u=e.slice(t,l)).slice(-1)&&(s.closed=!0,u=u.slice(0,-1));case to:d===to&&(u=o),d==so?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(Qa.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case io:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(d){case Za:s.setTagName(e.slice(t,l)),d=no;break;case eo:o=e.slice(t,l),d=to;break;case so:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case ro:d=no}else switch(d){case to:s.tagName,Qa.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=eo;break;case ro:n.warning('attribute space is required"'+o+'"!!');case no:d=eo,t=l;break;case io:d=so,t=l;break;case ao:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(i,y,E,k,a,n),C=E.length;if(!E.closed&&function(e,t,i,s){var r=s[i];null==r&&((r=e.lastIndexOf(""))",t),e=e.substring(t+1,n);if(/[&<]/.test(e))return/^script$/i.test(i)?r.characters(e,0,e.length):(e=e.replace(/&#?\w+;/g,s),r.characters(e,0,e.length)),n}return t+1}(i,_,E.tagName,a,r):_++}}catch(e){if(e instanceof oo)throw e;n.error("element parse error: "+e),_=-1}m<_?m=_:t(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},po.prototype={setTagName:function(e){if(!Ja.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ja.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Ur={XMLReader:lo,ParseError:oo},mo=Or.DOMImplementation,go=Zn.NAMESPACE,fo=Ur.ParseError,yo=Ur.XMLReader;function _o(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function vo(e){this.options=e||{locator:{}}}function bo(){this.cdata=!1}function To(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function wo(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function So(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function Eo(e,t){(e.currentElement||e.doc).appendChild(t)}vo.prototype.parseFromString=function(e,t){var i=this.options,s=new yo,r=i.domBuilder||new bo,n=i.errorHandler,a=i.locator,o=i.xmlns||{},t=/\/x?html?$/.test(t),l=t?Ya.HTML_ENTITIES:Ya.XML_ENTITIES,n=(a&&r.setDocumentLocator(a),s.errorHandler=function(s,e,r){if(!s){if(e instanceof bo)return e;s=e}var n={},a=s instanceof Function;function t(t){var i=s[t];!i&&a&&(i=2==s.length?function(e){s(t,e)}:s),n[t]=i?function(e){i("[xmldom "+t+"]\t"+e+wo(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),n}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=go.HTML),o.xml=o.xml||go.XML,i.normalizeLineEndings||_o);return e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},bo.prototype={startDocument:function(){this.doc=(new mo).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;Eo(this,n),this.currentElement=n,this.locator&&To(this.locator,n);for(var o=0;o!!e&&"object"==typeof e,I=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):Co(t[e])&&Co(i[e])?t[e]=I(t[e],i[e]):t[e]=i[e]}),t),{}),xo=t=>Object.keys(t).map(e=>t[e]),Io=e=>e.reduce((e,t)=>e.concat(t),[]),Ao=t=>{if(!t.length)return[];var i=[];for(let e=0;e{s={uri:r,resolvedUri:Rn(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),Oo={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=Po(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=Po(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},No=e=>{var n,{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:a}=e,{start:o,end:l}=Oo[t](e),o=((t,i)=>{var s=[];for(let e=t;e{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}}));return"static"===t&&(o[l=o.length-1].duration=("number"==typeof r?r:a)-i/s*l),o},Ro=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=Lo({baseUrl:t,source:i.sourceURL,range:i.range}),(t=Lo({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=No(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(Do.NO_BASE_URL)},Mo=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;t{return e=e,i=({timeline:e})=>e,xo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{})).sort((e,t)=>e.timeline>t.timeline?1:-1);var i},Fo=e=>{let r=[];var n,a;return n=e,e=Uo,a=(e,t,i,s)=>{r=r.concat(e.playlists||[])},e.forEach(function(e){for(var t in n.mediaGroups[e])for(var i in n.mediaGroups[e][t]){var s=n.mediaGroups[e][t][i];a(s,e,t,i)}}),r},jo=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},qo=({oldManifest:e,newManifest:t})=>{var r,n,i=e.playlists.concat(Fo(e)),s=t.playlists.concat(Fo(t));return t.timelineStarts=Bo([e.timelineStarts,t.timelineStarts]),{oldPlaylists:r,newPlaylists:e,timelineStarts:n}=[{oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}][0],e.forEach(t=>{t.discontinuitySequence=n.findIndex(function({timeline:e}){return e===t.timeline});var e=((t,i)=>{for(let e=0;ee.timeline||e.segments.length&&t.timeline>e.segments[e.segments.length-1].timeline)&&t.discontinuitySequence--):(e.segments[i].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),jo({playlist:t,mediaSequence:e.segments[i].number}))}}),t},Ho=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t})(e.byterange),Vo=e=>{e=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{});let t=[];return Object.values(e).forEach(e=>{e=xo(e.reduce((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));t=t.concat(e)}),t.map(e=>{var t,s;return e.discontinuityStarts=(t=e.segments||[],s="discontinuity",t.reduce((e,t,i)=>(t[s]&&e.push(i),e),[])),e})},zo=(e,t)=>{var i=Ho(e.sidx),t=i&&t[i]&&t[i].sidx;return t&&Mo(e,t,e.sidx.resolvedUri),e},$o=(e,o={})=>e.reduce((e,t)=>{var i,s,r,n,a=t.attributes.label||t.attributes.lang||"text";return e[a]||(e[a]={language:a,default:!1,autoselect:!1,playlists:[],uri:""}),e[a].playlists.push(zo(({attributes:a,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r}=[t][0],"undefined"==typeof t&&(t=[{uri:a.baseUrl,timeline:a.periodStart,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}],a.duration=a.sourceDuration),n={NAME:a.id,BANDWIDTH:a.bandwidth,"PROGRAM-ID":1},a.codecs&&(n.CODECS=a.codecs),n={attributes:n,uri:"",endList:"static"===a.type,timeline:a.periodStart,resolvedUri:a.baseUrl||"",targetDuration:a.duration,timelineStarts:a.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t},a.serviceLocation&&(n.attributes.serviceLocation=a.serviceLocation),n),o)),e},{}),Wo=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},Go=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,Xo=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Ko=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,Yo=i=>i?Object.keys(i).reduce((e,t)=>{t=i[t];return e.concat(t.playlists)},[]):[],Qo=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a,o,l,d,h,u,c,p;return e.length?({sourceDuration:d,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=e[0].attributes,a=Vo(e.filter(Go)).map(Wo),o=Vo(e.filter(Xo)),l=Vo(e.filter(Ko)),e=e.map(e=>e.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:d,playlists:((e,t={})=>{if(Object.keys(t).length)for(const i in e)e[i]=zo(e[i],t);return e})(a,s)},0<=h&&(d.minimumUpdatePeriod=1e3*h),t&&(d.locations=t),i&&(d.contentSteering=i),"dynamic"===u&&(d.suggestedPresentationDelay=c),n&&0{let o;e=e.reduce((e,t)=>{var i=t.attributes.role&&t.attributes.role.value||"",s=t.attributes.lang||"";let r=t.attributes.label||"main";e[r=s&&!t.attributes.label?t.attributes.lang+(i?` (${i})`:""):r]||(e[r]={language:s,autoselect:!0,default:"main"===i,playlists:[],uri:""});s=zo((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r})(t,a),n);return e[r].playlists.push(s),"undefined"==typeof o&&"main"===i&&((o=t).default=!0),e},{});return o||(e[Object.keys(e)[0]].default=!0),e})(o,s,h):null,i=l.length?$o(l,s):null,c=(u=a.concat(Yo(t),Yo(i))).map(({timelineStarts:e})=>e),d.timelineStarts=Bo(c),p=d.timelineStarts,u.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=p.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((e,t)=>{e.number=t})}),t&&(d.mediaGroups.AUDIO.audio=t),i&&(d.mediaGroups.SUBTITLES.subs=i),e.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=e.reduce((s,e)=>(e&&e.forEach(e=>{var{channel:t,language:i}=e;s[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(s[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(s[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(s[i]["3D"]=e["3D"])}),s),{})),r?qo({oldManifest:r,newManifest:d}):d):{}},Jo=(s,r)=>{var{type:n,minimumUpdatePeriod:a=0,media:o="",sourceDuration:l,timescale:d=1,startNumber:h=1,periodStart:u}=s,c=[];let p=-1;for(let i=0;ip&&(p=m);let e;e=f<0?(m=i+1)===r.length?"dynamic"===n&&0{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)})(s,p,g):(l*d-p)/g:(r[m].t-p)/g:f+1;var y=h+c.length+e;let t=h+c.length;for(;t{return e.replace(Zo,(r=t,(e,t,i,s)=>{return"$$"===e?"$":"undefined"==typeof r[t]?e:(e=""+r[t],"RepresentationID"===t||(s=i?parseInt(s,10):1)<=e.length?e:new Array(s-e.length+1).join("0")+e)}));var r},tl=(r,e)=>{const n={RepresentationID:r.id,Bandwidth:r.bandwidth||0};var{initialization:t={sourceURL:"",range:""}}=r;const a=Lo({baseUrl:r.baseUrl,source:el(t.sourceURL,n),range:t.range});return t=e,((e=r).duration||t?e.duration?No(e):Jo(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]).map(e=>{n.Number=e.number,n.Time=e.time;var t=el(r.media||"",n),i=r.timescale||1,s=r.presentationTimeOffset||0,s=r.periodStart+(e.time-s)/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:Rn(r.baseUrl||"",t),map:a,number:e.number,presentationTime:s}})},il=(r,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=r;if(!t&&!e||t&&e)throw new Error(Do.SEGMENT_TIME_UNSPECIFIED);const a=i.map(e=>{var{baseUrl:t,initialization:i={}}=t=r,i=Lo({baseUrl:t,source:i.sourceURL,range:i.range});return(t=Lo({baseUrl:t,source:e.media,range:e.mediaRange})).map=i,t});let s;return t&&(s=No(r)),(s=e?Jo(r,e):s).map((e,t)=>{var i,s;if(a[t])return t=a[t],i=r.timescale||1,s=r.presentationTimeOffset||0,t.timeline=e.timeline,t.duration=e.duration,t.number=e.number,t.presentationTime=n+(e.time-s)/i,t}).filter(e=>e)},sl=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=tl,i=I(e,t.template)):t.base?(s=Ro,i=I(e,t.base)):t.list&&(s=il,i=I(e,t.list));var r,n,a,e={attributes:e};return s&&(r=s(i,t.segmentTimeline),i.duration?({duration:n,timescale:a=1}=i,i.duration=n/a):r.length?i.duration=r.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},rl=e=>e.map(sl),A=(e,t)=>Ao(e.childNodes).filter(({tagName:e})=>e===t),nl=e=>e.textContent.trim(),al=e=>{var t,i,s,r,n,e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);return e?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},ol={mediaPresentationDuration(e){return al(e)},availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod(e){return al(e)},suggestedPresentationDelay(e){return al(e)},type(e){return e},timeShiftBufferDepth(e){return al(e)},start(e){return al(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return parseFloat(e.split("/").reduce((e,t)=>e/t))},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){var t=parseInt(e,10);return isNaN(t)?al(e):t},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},DEFAULT(e){return e}},D=e=>e&&e.attributes?Ao(e.attributes).reduce((e,t)=>{var i=ol[t.name]||ol.DEFAULT;return e[t.name]=i(t.value),e},{}):{},ll={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},dl=(e,t)=>t.length?Io(e.map(function(s){return t.map(function(e){var t=nl(e),i=Rn(s.baseUrl,t),e=I(D(e),{baseUrl:i});return i!==t&&!e.serviceLocation&&s.serviceLocation&&(e.serviceLocation=s.serviceLocation),e})})):e,hl=e=>{var t=A(e,"SegmentTemplate")[0],i=A(e,"SegmentList")[0],s=i&&A(i,"SegmentURL").map(e=>I({tag:"SegmentURL"},D(e))),e=A(e,"SegmentBase")[0],r=i||t,r=r&&A(r,"SegmentTimeline")[0],n=i||e||t,n=n&&A(n,"Initialization")[0],t=t&&D(t);t&&n?t.initialization=n&&D(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});const a={template:t,segmentTimeline:r&&A(r,"S").map(e=>D(e)),list:i&&I(D(i),{segmentUrls:s,initialization:D(n)}),base:e&&I(D(e),{initialization:D(n)})};return Object.keys(a).forEach(e=>{a[e]||delete a[e]}),a},ul=o=>Io(A(o.node,"EventStream").map(e=>{const n=D(e),a=n.schemeIdUri;return A(e,"Event").map(e=>{var t=D(e),i=t.presentationTime||0,s=n.timescale||1,r=t.duration||0,i=i/s+o.attributes.start;return{schemeIdUri:a,value:n.value,id:t.id,start:i,end:i+r/s,messageData:nl(e)||t.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})})),cl=(l,d,h)=>e=>{var t=D(e),i=dl(d,A(e,"BaseURL")),s=A(e,"Role")[0],s={role:D(s)};let r=I(l,t,s);var n,a,o,t=A(e,"Accessibility")[0],t="urn:scte:dash:cc:cea-608:2015"===(s=D(t)).schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===s.schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var t,s;return/=/.test(e)?([t,s=""]=e.split("="),i.channel=t,i.language=e,s.split(",").forEach(e=>{var[e,t]=e.split(":");"lang"===e?i.language=t:"er"===e?i.easyReader=Number(t):"war"===e?i.aspectRatio=Number(t):"3D"===e&&(i["3D"]=Number(t))})):i.language=e,i.channel&&(i.channel="SERVICE"+i.channel),i}):void 0,s=(t&&(r=I(r,{captionServices:t})),A(e,"Label")[0]),s=(s&&s.childNodes.length&&(t=s.childNodes[0].nodeValue.trim(),r=I(r,{label:t})),A(e,"ContentProtection").reduce((e,t)=>{var i=D(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),ll[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=A(t,"cenc:pssh")[0])&&(t=nl(i),e[s].pssh=t&&Kn(t)),e},{})),t=(Object.keys(s).length&&(r=I(r,{contentProtection:s})),hl(e)),s=A(e,"Representation"),e=I(h,t);return Io(s.map((n=r,a=i,o=e,e=>{var t=A(e,"BaseURL"),t=dl(a,t);const i=I(n,D(e)),s=hl(e);return t.map(e=>({segmentInfo:I(o,s),attributes:I(i,e)}))})))},pl=(e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=t,n=A(e,"Period");if(!n.length)throw new Error(Do.INVALID_NUMBER_OF_PERIOD);var a=A(e,"Location");const o=D(e);var l,d,t=dl([{baseUrl:t}],A(e,"BaseURL")),e=A(e,"ContentSteering");o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,a.length&&(o.locations=a.map(nl));const h=[];return n.forEach((e,t)=>{var i,s,r=D(e),t=h[t-1];r.start=({attributes:t,priorPeriodAttributes:i,mpdType:s}=[{attributes:r,priorPeriodAttributes:t?t.attributes:null,mpdType:o.type}][0],"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==s?null:0),h.push({node:e,attributes:r})}),{locations:o.locations,contentSteeringInfo:(i=r,1<(s=e).length&&i({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),s.length?((i=I({serverURL:nl(s[0])},D(s[0]))).queryBeforeStart="true"===i.queryBeforeStart,i):null),representationInfo:Io(h.map((l=o,d=t,(e,t)=>{var i=dl(d,A(e.node,"BaseURL")),s=I(l,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration),A(e.node,"AdaptationSet")),e=hl(e.node);return Io(r.map(cl(s,i,e)))}))),eventStream:Io(h.map(ul))}},ml=e=>{if(""===e)throw new Error(Do.DASH_EMPTY_MANIFEST);var t,i=new ko;let s;try{t=i.parseFromString(e,"application/xml"),s=t&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0{e=ml(e);if(!(e=A(e,"UTCTiming")[0]))return null;var t=D(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Do.UNSUPPORTED_UTC_TIMING_SCHEME)}return t};function fl(e,t){var i,s,r;return void 0===t&&(t=0),(e=w(e)).length-t<10||!E(e,Cl,{offset:t})?t:(t+=(void 0===(s=t)&&(s=0),r=(i=w(i=e))[s+5],i=i[s+6]<<21|i[s+7]<<14|i[s+8]<<7|i[s+9],(16&r)>>4?20+i:10+i),fl(e,t))}function yl(e){return"string"==typeof e?Nn(e):e}function _l(e,t,i){void 0===i&&(i=!1),s=t,t=Array.isArray(s)?s.map(yl):[yl(s)],e=w(e);var s,r=[];if(t.length)for(var n=0;n>>0,o=e.subarray(n+4,n+8);if(0==a)break;a=n+a;if(a>e.length){if(i)break;a=e.length}var l=e.subarray(n+8,a);E(o,t[0])&&(1===t.length?r.push(l):r.push.apply(r,_l(l,t.slice(1),i))),n=a}return r}function vl(e,t,i){var s;return i>=t.length?t.length:(s=Dl(t,i,!1),E(e.bytes,s.bytes)?i:vl(e,t,i+(e=Dl(t,i+s.length)).length+e.value+s.length))}function bl(e,t){i=t,t=Array.isArray(i)?i.map(function(e){return Ll(e)}):[Ll(i)],e=w(e);var i,s=[];if(t.length)for(var r=0;re.length?e.length:o+a.value),o=e.subarray(o,l);E(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(bl(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function Tl(e,t,i,s){void 0===s&&(s=1/0),e=w(e),i=[].concat(i);for(var r,n=0,a=0;n>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}function wl(e){e=w(e);for(var t=0;t>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i},Cl=w([73,68,51]),xl={EBML:w([26,69,223,163]),DocType:w([66,130]),Segment:w([24,83,128,103]),SegmentInfo:w([21,73,169,102]),Tracks:w([22,84,174,107]),Track:w([174]),TrackNumber:w([215]),DefaultDuration:w([35,227,131]),TrackEntry:w([174]),TrackType:w([131]),FlagDefault:w([136]),CodecID:w([134]),CodecPrivate:w([99,162]),VideoTrack:w([224]),AudioTrack:w([225]),Cluster:w([31,67,182,117]),Timestamp:w([231]),TimestampScale:w([42,215,177]),BlockGroup:w([160]),BlockDuration:w([155]),Block:w([161]),SimpleBlock:w([163])},Il=[128,64,32,16,8,4,2,1],Al=function(e){for(var t=1,i=0;it&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Hl=e=>T.log.debug?T.log.debug.bind(T,"VHS:",e+" >"):function(){};function P(...e){var t=T.obj||T;return(t.merge||t.mergeOptions).apply(t,e)}function Vl(...e){var t=T.time||T;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function zl(e,i){return Jl(e,function(e,t){return e-Ql<=i&&t+Ql>=i})}function $l(e,t){return Jl(e,function(e){return e-Yl>=t})}function Wl(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Gl(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},ed=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},id=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),sd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},rd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},nd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function ud(e){return e.excludeUntil&&e.excludeUntil===1/0}function cd(e){var t=hd(e);return!e.disabled&&!t}function pd(e,t){return t.attributes&&t.attributes[e]}function md(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const gd=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!cd(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),yd=t=>{if(!t||!t.playlists||!t.playlists.length)return md(t,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;eAn(e))){i=md(t,e=>fd(s,e));if(!i)return!1}}return!0};var _d={liveEdgeDelay:nd,duration:dd,seekable:function(e,t,i){var s=t||0,e=Kl(e,t,!0,i);return null===e?Vl():Vl(s,e)},getMediaInfoForTime:function({playlist:t,currentTime:i,startingSegmentIndex:s,startingPartIndex:r,startTime:n,exactManifestTimings:a}){let o=i-n;var l=id(t);let d=0;for(let e=0;ee+"-"+t,Td=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(const i in r.mediaGroups[e])for(const s in r.mediaGroups[e][i]){var t=r.mediaGroups[e][i][s];n(t,e,i,s)}})},wd=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Sd=(o,e,l=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{e.uri&&(e.resolvedUri=jl(n.uri,e.uri))})};class Ed{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,t)=>(e.set(t.id,t),e),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(const t of s){var e=i[t.class]||[];t.endDate?t.endTime=t.endDate.getTime()/1e3-this.offset_:t.endOnNext&&e[t.classListIndex+1]?t.endTime=e[t.classListIndex+1].startTime:t.duration?t.endTime=t.startTime+t.duration:t.plannedDuration?t.endTime=t.startTime+t.plannedDuration:t.endTime=t.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){if(!t)return i;var s=P(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=jl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=jl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=jl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=jl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=jl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=jl(t,e.uri))})},Id=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ad=(e,r,t=Id)=>{var i=P(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=kd(r);const n=P(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{xd(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)};class Ld extends Mr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Hl("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new Ed,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=jl(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,s=t["preloadSegment"];let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=rd(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:t,manifestString:i}){{var[{onwarn:i,oninfo:e,manifestString:s,customTagParsers:r=[],customTagMappers:n=[],llhls:a}]=[{onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new In,l=(i&&o.on("warn",i),e&&o.on("info",e),r.forEach(e=>o.addParser(e)),n.forEach(e=>o.addTagMapper(e)),o.push(s),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){l.hasOwnProperty(e)&&delete l[e]}),l.segments&&l.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce((e,t)=>Math.max(e,t.duration),0)),i&&i("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(e=sd(l)).length&&!l.partTargetDuration&&(r=e.reduce((e,t)=>Math.max(e,t.duration),0),i&&(i("manifest has no partTargetDuration defaulting to "+r),vd.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";t=t||this.parseManifest_({url:i,manifestString:e}),t.lastRequest=Date.now(),wd({playlist:t,uri:i,id:s}),e=Ad(this.main,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Dd(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Ed,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(i,e){if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.main.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.main.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),e);else{const s=this.state;var e=!this.media_||i.id!==this.media_.id,t=this.main.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(Dd(i,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(i.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=i,this.request=this.vhs_.xhr({uri:i.resolvedUri,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(i.lastRequest=Date.now(),i.resolvedUri=ql(i.resolvedUri,t),e)return this.playlistRequestError(this.request,i,s);this.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=ql(this.src,t);e=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(e)}})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,Sd(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=kd(t),t.segments.forEach(e=>{xd(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=bd(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function Pd(e,t,i,s){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),s(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function Od(){function d(e,a){e=P({timeout:45e3},e);var t=d.beforeRequest||T.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||T.Vhs.xhr._requestCallbackSet||new Set;const o=d._responseCallbackSet||T.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(T.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=!0===T.Vhs.xhr.original?jd:T.Vhs.xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);const l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),Pd(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestTime=Date.now(),l}return d.original=!0,d}function Nd(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Rd(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Md(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Ud(i){const s={};return Object.keys(i).forEach(e=>{var t=i[e];$n(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s}function Bd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Fd(e){return e.resolvedUri}const jd=T["xhr"],qd=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;eqd(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,zd=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*Hd)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},$d=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:_d.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{$d({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},Wd=(e,t)=>{if(4===e.readyState)return t()},Gd=(e,t,r)=>{let s=[],n,a=!1;function o(e,t,i,s){return t.abort(),a=!0,r(e,t,i,s)}function i(e,t){var i;if(!a)return e?o(e,t,"",s):(i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length),s=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;no(e,t,"",s)):o(null,t,i,s))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return Pd(e,null,{statusCode:e.status},i)})}},function(e,t){return Pd(l,e,t,i)});return l};Ui=T.EventTarget;function Xd(t,i){if(!Id(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Yd=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=pl(ml(e),i),s=rl(e.representationInfo);r=Qo({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return Sd(r,t,Kd),r},Qd=(e,t,i)=>{let a=!0,o=P(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=Ad(o,e.playlists[0],Xd))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,Td(n,(e,t,i,s)=>{s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Jd=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},Zd=(e,t)=>{var i={};for(const a in e){var s=e[a].sidx;if(s){var r=Ho(s);if(!t[r])break;var n=t[r].sidxInfo;Jd(n,s)&&(i[r]=t[r])}}return i};class eh extends Ui{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Hl("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(a,s,r){const n=a.sidx&&Ho(a.sidx);if(a.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const o=ql(a.sidx.resolvedUri),l=(t,i)=>{if(!this.requestErrored_(t,i,s)){t=this.mainPlaylistLoader_.sidxMapping_;let e;try{e=kl(w(i.response).subarray(8))}catch(e){return void this.requestErrored_(e,i,s)}return t[n]={sidxInfo:a.sidx,sidx:e},Mo(a,e,a.sidx.resolvedUri),r(!0)}};this.request=Gd(o,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?l(e,t):i&&"mp4"===i?({offset:r,length:n}=a.sidx.byterange,s.length>=n+r?l(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:Nd({byterange:a.sidx.byterange})},l))):l({status:t.status,message:`Unsupported ${i||"unknown"} container type for sidx segment at URL: `+o,response:"",playlist:a,internal:!0,playlistExclusionDuration:1/0,code:2},t)})}else this.mediaRequest_=window.setTimeout(()=>r(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(e,t)=>{if(this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const i=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=ql(this.mainPlaylistLoader_.srcUrl,t),!i)return s(t,i);this.handleMain_(),this.syncClientServerClock_(()=>s(t,i))}})}syncClientServerClock_(s){const r=gl(this.mainPlaylistLoader_.mainXml_);return null===r?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s()):"DIRECT"===r.method?(this.mainPlaylistLoader_.clientOffset_=r.value-Date.now(),s()):void(this.request=this.vhs_.xhr({uri:jl(this.mainPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},(t,i)=>{if(this.request){if(t)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s();let e;e="HEAD"===r.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),s()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=Yd({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=Qd(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=Zd(e.playlists,r);return Td(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=P(n,Zd(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},Dd(this.media(),Boolean(i))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]})),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}}var O={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function th(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}const ih=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),j(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},ce=function(e){return l(d.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),U(e))},$=function(e){e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return l(d.tkhd,e)},J=function(e){var t,i=l(d.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/_e),r=Math.floor(e.baseMediaDecodeTime%_e),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),l(d.trex,t)},pe=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},me=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=pe(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=pe(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?ge:me)(e,t)};function ve(e,t){var i=xe();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function n(e){for(var t=[];e--;)t.push(0);return t}function a(e){e=e||{},a.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new g(0,0),new g(0,1),new g(1,0),new g(1,1)],this.parse708captions_&&(this.cc708Stream_=new m({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function be(e){return 32<=e&&e<=127||160<=e&&e<=255}function o(e){this.windowNum=e,this.reset()}function Te(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new o(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function we(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))}function h(){for(var e=[],t=je+1;t--;)e.push({text:"",indent:0,offset:0});return e}function Se(e,t){var i=1;for(t$e;)e+=i*ze;return e}function Ee(e){var t,i;Ee.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Se(e.dts,i),e.pts=Se(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var ke,Ce={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:q=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=q(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},xe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ie={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tRe.ONE_SECOND_IN_TS/2))){for(a=(a=Ne()[e.samplerate])||t[0].data,o=0;o=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){for(var t,i=[],s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},o.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},o.prototype.addText=function(e){this.rows[this.rowIdx]+=e},o.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new o(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},m.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),Fe=(m.prototype=new p,m.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},m.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},m.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},m.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},m.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},m.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},m.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},m.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},m.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},m.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),je=14,qe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],g=function(e,t){g.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=h()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=h():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=h()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=we((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=we((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=qe.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=we(t),s+=we(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},p=(g.prototype=new p,g.prototype.flushDisplayed=function(e){const i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},g.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=h(),this.nonDisplayed_=h(),this.lastControlCode_=null,this.column_=0,this.row_=je,this.rollUpRows_=2,this.formatting_=[]},g.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},g.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},g.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},g.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},g.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},g.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},g.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},g.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},g.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},g.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,a=(a*=4)+(3&n[7]),o.timeStamp=a,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)),t.frames.push(o),(i=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=S.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=S.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new w,Ge.STREAM_TYPES={h264:27,adts:15},(Xe=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Xe.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case S.H264_STREAM_TYPE:e=n,t="video";break;case S.ADTS_STREAM_TYPE:e=a,t="audio";break;case S.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new w,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:st,TransportParseStream:Ge,ElementaryStream:Xe,TimestampRolloverStream:Ve,CaptionStream:it.CaptionStream,Cea608Stream:it.Cea608Stream,Cea708Stream:it.Cea708Stream,MetadataStream:b});for(Ke in S)S.hasOwnProperty(Ke)&&(rt[Ke]=S[Ke]);var nt,at,w=rt,Ve=i,ot=c.ONE_SECOND_IN_TS,lt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],dt=function(l){var d,h=0;dt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*ot/lt[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:lt[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},it=(dt.prototype=new Ve,dt),b=i,ht=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},ut=function(){var s,r,n=0;ut.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},gt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=mt(e,t),gt(e,t))},ft=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:mt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+ct(e.subarray(10,14)));do{if((t=ct(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=yt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;i=n.length-r,n=0i.pts?l++:(t++,n-=s.byteLength,a-=s.nalCount,o-=s.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=n,r.duration=o,r.nalCount=a,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,s,r,n=d.length-1,a=e.length-1,o=null,l=!1;0<=n&&0<=a;){if(t=d[n],i=e[a],t.pts===i.pts){l=!0;break}t.pts>i.pts?n--:(n===d.length-1&&(o=a),a--)}return l||null!==o?0===(s=l?a:o)?e:(r=(s=e.slice(s)).reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0}),s.byteLength=r.byteLength,s.duration=r.duration,s.nalCount=r.nalCount,s.pts=s[0].pts,s.dts=s[0].dts,s):null},this.alignGopsWith=function(e){d=e}}).prototype=new E,((k=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,k.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new E).flush=function(e){var t,i,s,r=0,n={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Pt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Lt.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=C.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},k.prototype.setRemux=function(e){this.remuxTracks=e},(St=function(s){var r,n,a=this,i=!0;St.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new A.MetadataStream,t.aacStream=new It,t.audioTimestampRolloverStream=new A.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new A.TimestampRolloverStream("timed-metadata"),t.adtsStream=new Ct,t.coalesceStream=new k(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Nt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new A.MetadataStream,i.packetStream=new A.TransportPacketStream,i.parseStream=new A.TransportParseStream,i.elementaryStream=new A.ElementaryStream,i.timestampRolloverStream=new A.TimestampRolloverStream,i.adtsStream=new Ct,i.h264Stream=new xt,i.captionStream=new A.CaptionStream(s),i.coalesceStream=new k(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new wt(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Nt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,I.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,I.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=At(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new E;function Rt(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Mt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function Vt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}var zt=St,i=function(e){return e>>>0},De=function(e){return("00"+e.toString(16)).slice(-2)},$t=i,Wt=Rt,Gt=i,Xt=s.getUint64,Kt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Le="undefined"!=typeof window?window:"undefined"!=typeof fe?fe:"undefined"!=typeof self?self:{},w=Le,Yt=Oe.discardEmulationPreventionBytes,Qt=p.CaptionStream,D=Mt,Jt=Ut,Zt=Bt,ei=Ft,ti=w,ii=function(e,h){var i=D(e,["moof","traf"]),e=D(e,["mdat"]),u={},s=[];return e.forEach(function(e,t){t=i[t];s.push({mdat:e,traf:t})}),s.forEach(function(e){var t,i,s,r,n,a=e.mdat,e=e.traf,o=D(e,["tfhd"]),o=ei(o[0]),l=o.trackId,d=D(e,["tfdt"]),d=0>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),P(e,["mdia","mdhd"])[0]);s&&(i.timescale=pi(s)),n.push(i)}),n},fi=function(e,i=0){return P(e,["emsg"]).map(e=>{var e=di.parseEmsgBox(new Uint8Array(e)),t=ci(e.message_data);return{cueTime:di.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:di.scaleTime(e.event_duration,e.timescale),frames:t}})},yi=He,_i=He,O=Ye,N={},R=(N.ts={parseType:function(e,t){e=jt(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=qt(e),i=4+Ht(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=qt(e),s=4+Ht(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ht(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=N.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=N.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=N.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=R/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in vi(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case _i.H264_STREAM_TYPE:s.video=[],Ti(e,i,s),0===s.video.length&&delete s.video;break;case _i.ADTS_STREAM_TYPE:s.audio=[],bi(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=O(e.dts,s),e.pts=O(e.pts,s),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=O(e.dts,r),e.pts=O(e.pts,r),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=O(t.dts,r),t.pts=O(t.pts,r),t.dtsTime=t.dts/R,t.ptsTime=t.pts/R),e):null};class Si{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new zt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new si,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=mi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=gi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=fi(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*c.ONE_SECOND_IN_TS,t=wi(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(c.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Si(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Si(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));const oh=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},lh=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},dh=(e,t)=>{t.gopInfo=e.data.gopInfo},hh=t=>{const{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=t,_={buffer:[]};let v=y;var b,T;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&oh(e,_,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&dh(e,_),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(v=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||v||(i.onmessage=null,lh({transmuxedData:_,callback:m}),uh(i))},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(b=e instanceof ArrayBuffer?e:e.buffer,T=e instanceof ArrayBuffer?0:e.byteOffset,i.postMessage({action:"push",data:b,byteOffset:T,byteLength:e.byteLength},[b])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},uh=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():hh(e.currentTransmux))},ch=(e,t)=>{e.postMessage({action:t}),uh(e)},ph=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(ch.bind(null,t,e)):(t.currentTransmux=e,ch(t,e))};const mh=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,hh(e))};var gh=e=>{ph("reset",e)},fh=(mh,e=>{const t=new ah,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function yh(t){const i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=_i({},t,{endAction:null,transmuxer:null,callback:null});const a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)}function _h(e){let t=0;return e.audio&&t++,e.video&&t++,t}function vh(e,t){var i=t.attributes||{},s=Mh(function(e){e=e.attributes||{};if(e.CODECS)return jn(e.CODECS)}(t)||[]);return!Rh(e,t)||s.audio||((e,t)=>{if(!Rh(e,t))return!0;var t=t.attributes||{},i=e.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1})(e,t)||(t=Mh(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return jn(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function bh(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Th(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}const wh={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Sh=e=>{e.forEach(e=>{e.abort()})},Eh=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),kh=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Ch=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:wh.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:wh.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:wh.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:wh.FAILURE,xhr:t}:null,xh=(r,n,a)=>(e,t)=>{var i=t.response,e=Ch(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:wh.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=wl(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: `+e,code:wh.FAILURE});yh({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},Ah=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{var p=i.map&&i.map.tracks||{};const m=Boolean(p.audio&&p.video);let g=e.bind(null,i,"audio","start");const f=e.bind(null,i,"audio","end");let y=e.bind(null,i,"video","start");const _=e.bind(null,i,"video","end");yh({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:m}),s=null),mh({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:m,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(m&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{g&&"undefined"!=typeof e.start&&(g(e.start),g=null),f&&"undefined"!=typeof e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&"undefined"!=typeof e.start&&(y(e.start),y=null),_&&"undefined"!=typeof e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:e=>{u&&(e.type="combined"===e.type?"video":e.type,u(null,i,e))}})}})},Dh=({segment:s,bytes:r,trackInfoFn:e,timingInfoFn:t,videoSegmentTimingInfoFn:i,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{let p=new Uint8Array(r);if(m=p,0<_l(m,["moof"]).length){s.isFmp4=!0;const g=s.map["tracks"],f={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio},y=(g.audio&&g.audio.codec&&"enca"!==g.audio.codec&&(f.audioCodec=g.audio.codec),g.video&&g.video.codec&&"encv"!==g.video.codec&&(f.videoCodec=g.video.codec),g.video&&g.audio&&(f.isMuxed=!0),e(s,f),(e,t)=>{h(s,{data:p,type:f.hasAudio&&!f.isMuxed?"audio":"video"}),t&&t.length&&a(s,t),e&&e.length&&o(s,e),u(null,s,{})});void yh({action:"probeMp4StartTime",timescales:s.map.timescales,data:p,transmuxer:s.transmuxer,callback:({data:i,startTime:e})=>{r=i.buffer,s.bytes=p=i,f.hasAudio&&!f.isMuxed&&t(s,"audio","start",e),f.hasVideo&&t(s,"video","start",e),yh({action:"probeEmsgID3",data:p,transmuxer:s.transmuxer,offset:e,callback:({emsgData:e,id3Frames:t})=>{r=e.buffer,s.bytes=p=e,g.video&&i.byteLength&&s.transmuxer?yh({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:p,timescales:s.map.timescales,trackIds:[g.video.id],callback:e=>{r=e.data.buffer,s.bytes=p=e.data,e.logs.forEach(function(e){c(P(e,{stream:"mp4CaptionParser"}))}),y(e.captions,t)}}):y(void 0,t)}})}})}else{var m;s.transmuxer?("undefined"==typeof s.container&&(s.container=wl(p)),"ts"!==s.container&&"aac"!==s.container?(e(s,{hasAudio:!1,hasVideo:!1}),u(null,s,{})):Ah({segment:s,bytes:r,trackInfoFn:e,timingInfoFn:t,videoSegmentTimingInfoFn:i,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})):u(null,s,{})}},Lh=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s},r){const n=e=>{e.data.source===t&&(s.removeEventListener("message",n),e=e.data.decrypted,r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.addEventListener("message",n);let a;a=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(Ud({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},Ph=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{Lh({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,Dh({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})})},Oh=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[];var _,v,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})=>{let f=0,y=!1;return(e,t)=>{if(!y){if(e)return y=!0,Sh(s),m(e,t);if((f+=1)===s.length){const i=function(){if(t.encryptedBytes)return Ph({decryptionWorker:r,segment:t,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g});Dh({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})};if(t.endOfAllRequests=Date.now(),t.map&&t.map.encryptedBytes&&!t.map.bytes)return Lh({decryptionWorker:r,id:t.requestId+"-init",encryptedBytes:t.map.encryptedBytes,key:t.map.key},e=>{t.map.bytes=e,Ih(t,e=>{if(e)return Sh(s),m(e,t);i()})});i()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f}),u=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=e(P(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),xh(s,a,i)),y.push(o)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(l=e(P(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),xh(s,[s.map.key],i)),y.push(l)),d=P(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Nd(s.map)}),{segment:_,finishProcessingFn:v}=[{segment:s,finishProcessingFn:i}][0],h=e(d,(e,t)=>{var e=Ch(e,t);return e?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void Ih(_,function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))}),y.push(h)),P(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Nd(s)}));({segment:b,finishProcessingFn:T,responseType:w}={segment:s,finishProcessingFn:i,responseType:u.responseType});var b,T,w,S,E,c=e(u,(e,t)=>{var e=Ch(e,t);return e?T(e,b):(e="arraybuffer"!==w&&t.responseText?ih(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=Eh(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b))});c.addEventListener("progress",({segment:S,progressFn:E}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return S.stats=P(S.stats,kh(e)),!S.stats.firstBytesReceivedAt&&S.stats.bytesReceived&&(S.stats.firstBytesReceivedAt=Date.now()),E(e,S)})),y.push(c);const k={};return y.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:k,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>Sh(y)},Nh=Hl("CodecUtils"),Rh=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},Mh=function(e){const s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(Fn(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),n=(Fh(r,(e,t)=>e.bandwidth-t.bandwidth),(r=r.filter(e=>!_d.isIncompatible(e.playlist))).filter(e=>_d.isEnabled(e.playlist)));o=(n=n.length?n:r.filter(e=>!_d.isDisabled(e.playlist))).filter(e=>e.bandwidth*O.BANDWIDTH_VARIANCEe.bandwidth===a.bandwidth)[0];if(!1===h){const g=p||n[0]||r[0];if(g&&g.playlist){let e=p?"bandwidthBestRep":"sortedPlaylistReps";return n[0]&&(e="enabledPlaylistReps"),Uh(`choosing ${Bh(g)} using ${e} with options`,c),g.playlist}}else{var m,h=o.filter(e=>e.width&&e.height),o=(Fh(h,(e,t)=>e.width-t.width),h.filter(e=>e.width===l&&e.height===d)),o=(a=o[o.length-1],o.filter(e=>e.bandwidth===a.bandwidth)[0]);let t,i;o||(m=(t=h.filter(e=>e.width>l||e.height>d)).filter(e=>e.width===t[0].width&&e.height===t[0].height),a=m[m.length-1],i=m.filter(e=>e.bandwidth===a.bandwidth)[0]);let s;u.leastPixelDiffSelector&&(m=h.map(e=>(e.pixelDiff=Math.abs(e.width-l)+Math.abs(e.height-d),e)),Fh(m,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=m[0]);const g=s||i||o||p||n[0]||r[0];if(g&&g.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":o?e="resolutionBestRep":p?e="bandwidthBestRep":n[0]&&(e="enabledPlaylistReps"),Uh(`choosing ${Bh(g)} using ${e} with options`,c),g.playlist}}return Uh("could not choose a playlist with options",c),null}}function qh(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return jh(this.playlists.main,this.systemBandwidth,parseInt(bh(this.tech_.el(),"width"),10)*e,parseInt(bh(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Hh(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const Vh=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:r})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach(e=>{const s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new a(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return T.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return T.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return T.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),o.addCue(i)})}),o.cues)&&o.cues.length){var s=o.cues,n=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),d=Object.keys(l).sort((e,t)=>Number(e)-Number(t));d.forEach((e,t)=>{var e=l[e],i=isFinite(r)?r:0;const s=Number(d[t+1])||i;e.forEach(e=>{e.endTime=s})})}}},zh={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},$h=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Wh=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,T.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},Gh=e=>"number"==typeof e&&isFinite(e),Xh=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?rd({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Kh=e=>e+"TimingInfo",Yh=(e,t)=>e.length?e.end(e.length-1):t,Qh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Jh=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Yl,Zh=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&sthis.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=Hl(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return fh({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&gh(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Vl();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Bd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=Fd(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&gh(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n=()=>{0===--e&&s()};!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,n)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Fl),n=Math.ceil((e-s)*Fl),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,n));for(const a in this.inbandTextTracks_)Hh(t,i,this.inbandTextTracks_[a]);Hh(t,i,this.segmentMetadataTrack_),n()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),t=Wl(e)||0,e=Gl(e,this.currentTime_()),i=!this.hasPlayed_()&&1<=e,s=e>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},i.isSyncRequest?i.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,r,t):null!==this.mediaIndex?(s=r[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1,i.startOfSegment=s.end||t,s.parts&&s.parts[a+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=a+1):i.mediaIndex=this.mediaIndex+1):({segmentIndex:s,startTime:a,partIndex:o}=_d.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),i.mediaIndex=s,i.startOfSegment=a,i.partIndex=o),t=r[i.mediaIndex];let n=t&&"number"==typeof i.partIndex&&t.parts&&t.parts[i.partIndex];if(!t||"number"==typeof i.partIndex&&!n)return null;"number"!=typeof i.partIndex&&t.parts&&(i.partIndex=0,n=t.parts[0]);var a,o,s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e=(e||!n||s||n.independent||(0===i.partIndex?(o=(a=r[i.mediaIndex-1]).parts&&a.parts.length&&a.parts[a.parts.length-1])&&o.independent&&(--i.mediaIndex,i.partIndex=a.parts.length-1,i.independent="previous segment"):t.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part")),this.mediaSource_&&"ended"===this.mediaSource_.readyState);return i.mediaIndex>=r.length-1&&e&&!this.seeking_()?null:this.generateSegmentInfo_(i)}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:n}),Wl(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Fl);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,calculateTimestampOffsetForEachSegment:r,overrideCheck:n}=[e][0],r?Yh(s,i):n||e!==t?e!_d.isIncompatible(e));let d=e.filter(_d.isEnabled);var e=(d=d.length?d:e.filter(e=>!_d.isDisabled(e))).filter(_d.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:_d.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return Fh(h,(e,t)=>Th(t.playlist,e.playlist)),h.length?h[0]:(Fh(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=Yl&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{p[e.stream]=p[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=p[e.stream];t.startTime=Math.min(t.startTime,e.startTime+c),t.endTime=Math.max(t.endTime,e.endTime+c),t.captions.push(e)}),Object.keys(p).forEach(e=>{var{startTime:t,endTime:i,captions:s}=p[e],r=this.inbandTextTracks_,n=(this.logger_(`adding cues from ${t} -> ${i} for `+e),r),a=this.vhs_.tech_,o=e;if(!n[o]){a.trigger({type:"usage",name:"vhs-608"});let s=o;/^cc708_/.test(o)&&(s="SERVICE"+o.split("_")[1]);var l=a.textTracks().getTrackById(s);if(l)n[o]=l;else{let e=o,t=o,i=!1;l=(a.options_.vhs&&a.options_.vhs.captionServices||{})[s];l&&(e=l.label,t=l.language,i=l.default),n[o]=a.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}Hh(t,i,r[e]);var{inbandTextTracks:d,captionArray:l,timestampOffset:h}={captionArray:s,inbandTextTracks:r,timestampOffset:c};if(l){const u=window.WebKitDataCue||window.VTTCue;l.forEach(i=>{const s=i.stream;i.content?i.content.forEach(e=>{var t=new u(i.startTime+h,i.endTime+h,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",d[s].addCue(t)}):d[s].addCue(new u(i.startTime+h,i.endTime+h,i.text))})}}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&Qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Kh(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,e)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=Bd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):this.loadQueue_.push(()=>{var e=_i({},t,{forceTimestampOffset:!0});_i(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)})}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_(Xh(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-O.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=Zh(e,this.sourceType_))&&("warn"===t.severity?T.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+Xh(e)):(this.logger_("Appended "+Xh(e)),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+Xh(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,Gh(t))&&Gh(i)&&(Hh(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}set replaceSegmentsUntil(e){this.logger_("Replacing currently buffered segments until "+e),this.replaceSegmentsUntil_=e}}function tu(){}function iu(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}const su=["video","audio"],ru=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},nu=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),nu("audio",s),nu("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!ru(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=iu(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},ou=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),lu={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(ou(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(ou(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];ou(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){T.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){T.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(ou(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){T.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=iu(s),i=qn(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(au(i,e),ou(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){T.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:r=>(e,t)=>{var i=t[e+"Buffer"],s=qn(r);ou(t.mediaSource,i)&&t.codecs[e]!==r&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to `+r),i.changeType(s),t.codecs[e]=r)}},du=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),nu(e,t)},hu=(i,s)=>e=>{var t=function(t){let i="";for(let e=0;e ${r})`}return i||"empty"}(s[i+"Buffered"]());s.logger_(i+` source buffer update end. Buffered: +/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */ +const jl=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,s=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||vn):/\/\//i.test(e)||(e=_n.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(vn.length):s?i.href.slice(i.protocol.length):i.href):_n.buildAbsoluteURL(e,t)},ql=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Hl=e=>T.log.debug?T.log.debug.bind(T,"VHS:",e+" >"):function(){};function P(...e){var t=T.obj||T;return(t.merge||t.mergeOptions).apply(t,e)}function Vl(...e){var t=T.time||T;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function zl(e,i){return Jl(e,function(e,t){return e-Ql<=i&&t+Ql>=i})}function $l(e,t){return Jl(e,function(e){return e-Yl>=t})}function Wl(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Gl(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},ed=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},id=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),sd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},rd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},nd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function ud(e){return e.excludeUntil&&e.excludeUntil===1/0}function cd(e){var t=hd(e);return!e.disabled&&!t}function pd(e,t){return t.attributes&&t.attributes[e]}function md(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const gd=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!cd(e)&&(e.attributes.BANDWIDTH||0)!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),yd=t=>{if(!t||!t.playlists||!t.playlists.length)return md(t,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;eAn(e))){i=md(t,e=>fd(s,e));if(!i)return!1}}return!0};var _d={liveEdgeDelay:nd,duration:dd,seekable:function(e,t,i){var s=t||0;let r=Kl(e,t,!0,i);return null===r?Vl():Vl(s,r=re+"-"+t,Td=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(const i in r.mediaGroups[e])for(const s in r.mediaGroups[e][i]){var t=r.mediaGroups[e][i][s];n(t,e,i,s)}})},wd=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Sd=(o,e,l=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{e.uri&&(e.resolvedUri=jl(n.uri,e.uri))})};class Ed{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,t)=>(e.set(t.id,t),e),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];const i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(const t of s){var e=i[t.class]||[];t.endDate?t.endTime=t.endDate.getTime()/1e3-this.offset_:t.endOnNext&&e[t.classListIndex+1]?t.endTime=e[t.classListIndex+1].startTime:t.duration?t.endTime=t.startTime+t.duration:t.plannedDuration?t.endTime=t.startTime+t.plannedDuration:t.endTime=t.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){if(!t)return i;var s=P(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=jl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=jl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=jl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=jl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=jl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=jl(t,e.uri))})},Id=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ad=(e,r,t=Id)=>{var i=P(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=kd(r);const n=P(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{xd(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)};class Ld extends Mr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Hl("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new Ed,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=jl(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,s=t["preloadSegment"];let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=rd(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:t,manifestString:i}){{var[{onwarn:i,oninfo:e,manifestString:s,customTagParsers:r=[],customTagMappers:n=[],llhls:a}]=[{onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new In,l=(i&&o.on("warn",i),e&&o.on("info",e),r.forEach(e=>o.addParser(e)),n.forEach(e=>o.addTagMapper(e)),o.push(s),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){l.hasOwnProperty(e)&&delete l[e]}),l.segments&&l.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce((e,t)=>Math.max(e,t.duration),0)),i&&i("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(e=sd(l)).length&&!l.partTargetDuration&&(r=e.reduce((e,t)=>Math.max(e,t.duration),0),i&&(i("manifest has no partTargetDuration defaulting to "+r),vd.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";t=t||this.parseManifest_({url:i,manifestString:e}),t.lastRequest=Date.now(),wd({playlist:t,uri:i,id:s}),e=Ad(this.main,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Dd(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Ed,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(i,e){if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.main.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.main.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),e);else{const s=this.state;var e=!this.media_||i.id!==this.media_.id,t=this.main.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(Dd(i,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(i.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=i,this.request=this.vhs_.xhr({uri:i.resolvedUri,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(i.lastRequest=Date.now(),i.resolvedUri=ql(i.resolvedUri,t),e)return this.playlistRequestError(this.request,i,s);this.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=ql(this.src,t);e=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(e)}})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,Sd(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=kd(t),t.segments.forEach(e=>{xd(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=bd(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function Pd(e,t,i,s){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),s(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function Od(){function d(e,a){e=P({timeout:45e3},e);var t=d.beforeRequest||T.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||T.Vhs.xhr._requestCallbackSet||new Set;const o=d._responseCallbackSet||T.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(T.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=!0===T.Vhs.xhr.original?jd:T.Vhs.xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);const l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),Pd(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestTime=Date.now(),l}return d.original=!0,d}function Nd(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Rd(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Md(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Ud(i){const s={};return Object.keys(i).forEach(e=>{var t=i[e];$n(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s}function Bd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Fd(e){return e.resolvedUri}const jd=T["xhr"],qd=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;eqd(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,zd=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*Hd)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},$d=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:_d.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{$d({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},Wd=(e,t)=>{if(4===e.readyState)return t()},Gd=(e,t,r)=>{let s=[],n,a=!1;function o(e,t,i,s){return t.abort(),a=!0,r(e,t,i,s)}function i(e,t){var i;if(!a)return e?o(e,t,"",s):(i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length),s=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;no(e,t,"",s)):o(null,t,i,s))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return Pd(e,null,{statusCode:e.status},i)})}},function(e,t){return Pd(l,e,t,i)});return l};Ui=T.EventTarget;function Xd(t,i){if(!Id(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Yd=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=pl(ml(e),i),s=rl(e.representationInfo);r=Qo({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return Sd(r,t,Kd),r},Qd=(e,t,i)=>{let a=!0,o=P(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=Ad(o,e.playlists[0],Xd))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,Td(n,(e,t,i,s)=>{s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Jd=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},Zd=(e,t)=>{var i={};for(const a in e){var s=e[a].sidx;if(s){var r=Ho(s);if(!t[r])break;var n=t[r].sidxInfo;Jd(n,s)&&(i[r]=t[r])}}return i};class eh extends Ui{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.media().attributes.serviceLocation||this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Hl("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(a,s,r){const n=a.sidx&&Ho(a.sidx);if(a.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const o=ql(a.sidx.resolvedUri),l=(t,i)=>{if(!this.requestErrored_(t,i,s)){t=this.mainPlaylistLoader_.sidxMapping_;let e;try{e=kl(w(i.response).subarray(8))}catch(e){return void this.requestErrored_(e,i,s)}return t[n]={sidxInfo:a.sidx,sidx:e},Mo(a,e,a.sidx.resolvedUri),r(!0)}};this.request=Gd(o,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?l(e,t):i&&"mp4"===i?({offset:r,length:n}=a.sidx.byterange,s.length>=n+r?l(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:Nd({byterange:a.sidx.byterange})},l))):l({status:t.status,message:`Unsupported ${i||"unknown"} container type for sidx segment at URL: `+o,response:"",playlist:a,internal:!0,playlistExclusionDuration:1/0,code:2},t)})}else this.mediaRequest_=window.setTimeout(()=>r(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(e,t)=>{if(this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const i=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=ql(this.mainPlaylistLoader_.srcUrl,t),!i)return s(t,i);this.handleMain_(),this.syncClientServerClock_(()=>s(t,i))}})}syncClientServerClock_(s){const r=gl(this.mainPlaylistLoader_.mainXml_);return null===r?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s()):"DIRECT"===r.method?(this.mainPlaylistLoader_.clientOffset_=r.value-Date.now(),s()):void(this.request=this.vhs_.xhr({uri:jl(this.mainPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},(t,i)=>{if(this.request){if(t)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s();let e;e="HEAD"===r.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),s()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=Yd({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=Qd(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=Zd(e.playlists,r);return Td(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=P(n,Zd(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},Dd(this.media(),Boolean(i))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]})),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}}var O={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function th(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}const ih=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),j(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},ce=function(e){return l(d.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),U(e))},$=function(e){e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return l(d.tkhd,e)},J=function(e){var t,i=l(d.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/_e),r=Math.floor(e.baseMediaDecodeTime%_e),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),l(d.trex,t)},pe=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},me=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=pe(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=pe(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?ge:me)(e,t)};function ve(e,t){var i=xe();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function n(e){for(var t=[];e--;)t.push(0);return t}function a(e){e=e||{},a.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new g(0,0),new g(0,1),new g(1,0),new g(1,1)],this.parse708captions_&&(this.cc708Stream_=new m({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function be(e){return 32<=e&&e<=127||160<=e&&e<=255}function o(e){this.windowNum=e,this.reset()}function Te(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new o(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function we(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))}function h(){for(var e=[],t=je+1;t--;)e.push({text:"",indent:0,offset:0});return e}function Se(e,t){var i=1;for(t$e;)e+=i*ze;return e}function Ee(e){var t,i;Ee.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Se(e.dts,i),e.pts=Se(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var ke,Ce={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:q=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=q(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},xe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ie={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tRe.ONE_SECOND_IN_TS/2))){for(a=(a=Ne()[e.samplerate])||t[0].data,o=0;o=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){for(var t,i=[],s=0;s=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},o.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},o.prototype.addText=function(e){this.rows[this.rowIdx]+=e},o.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new o(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},m.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),Fe=(m.prototype=new p,m.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},m.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},m.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0("0"+(255&e).toString(16)).slice(-2)).join(""),String.fromCharCode(parseInt(n,16))):(t=Be[r=a|o]||r,4096&r&&r===t?"":String.fromCharCode(t)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(i),e},m.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],i=i[e+2];return e=be(s)&&be(i)?this.handleText(++e,t,{isMultiByte:!0}):e},m.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},m.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],t=(t.setCurrentWindow(7&s),t.currentWindow),s=i[++e];return t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},m.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},m.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},m.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},m.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},m.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},m.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},m.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),je=14,qe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],g=function(e,t){g.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=h()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=h():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=h()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=we((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=we((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=qe.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=we(t),s+=we(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},p=(g.prototype=new p,g.prototype.flushDisplayed=function(e){const i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},g.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=h(),this.nonDisplayed_=h(),this.lastControlCode_=null,this.column_=0,this.row_=je,this.rollUpRows_=2,this.formatting_=[]},g.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},g.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},g.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},g.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},g.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},g.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},g.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},g.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},g.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},g.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,a=(a*=4)+(3&n[7]),o.timeStamp=a,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)),t.frames.push(o),(i=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=S.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=S.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new w,Ge.STREAM_TYPES={h264:27,adts:15},(Xe=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Xe.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case S.H264_STREAM_TYPE:e=n,t="video";break;case S.ADTS_STREAM_TYPE:e=a,t="audio";break;case S.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new w,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:st,TransportParseStream:Ge,ElementaryStream:Xe,TimestampRolloverStream:Ve,CaptionStream:it.CaptionStream,Cea608Stream:it.Cea608Stream,Cea708Stream:it.Cea708Stream,MetadataStream:b});for(Ke in S)S.hasOwnProperty(Ke)&&(rt[Ke]=S[Ke]);var nt,at,w=rt,Ve=i,ot=c.ONE_SECOND_IN_TS,lt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],dt=function(l){var d,h=0;dt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*ot/lt[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:lt[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},it=(dt.prototype=new Ve,dt),b=i,ht=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},ut=function(){var s,r,n=0;ut.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},gt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=mt(e,t),gt(e,t))},ft=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:mt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+ct(e.subarray(10,14)));do{if((t=ct(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=yt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;i=n.length-r,n=0i.pts?l++:(t++,n-=s.byteLength,a-=s.nalCount,o-=s.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=n,r.duration=o,r.nalCount=a,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,s,r,n=d.length-1,a=e.length-1,o=null,l=!1;0<=n&&0<=a;){if(t=d[n],i=e[a],t.pts===i.pts){l=!0;break}t.pts>i.pts?n--:(n===d.length-1&&(o=a),a--)}return l||null!==o?0===(s=l?a:o)?e:(r=(s=e.slice(s)).reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0}),s.byteLength=r.byteLength,s.duration=r.duration,s.nalCount=r.nalCount,s.pts=s[0].pts,s.dts=s[0].dts,s):null},this.alignGopsWith=function(e){d=e}}).prototype=new E,((k=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,k.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new E).flush=function(e){var t,i,s,r=0,n={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Pt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Lt.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=C.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},k.prototype.setRemux=function(e){this.remuxTracks=e},(St=function(s){var r,n,a=this,i=!0;St.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new A.MetadataStream,t.aacStream=new It,t.audioTimestampRolloverStream=new A.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new A.TimestampRolloverStream("timed-metadata"),t.adtsStream=new Ct,t.coalesceStream=new k(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Nt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new A.MetadataStream,i.packetStream=new A.TransportPacketStream,i.parseStream=new A.TransportParseStream,i.elementaryStream=new A.ElementaryStream,i.timestampRolloverStream=new A.TimestampRolloverStream,i.adtsStream=new Ct,i.h264Stream=new xt,i.captionStream=new A.CaptionStream(s),i.coalesceStream=new k(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new wt(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Nt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),vt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,I.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,I.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=At(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new E;function Rt(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Mt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function Vt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}var zt=St,i=function(e){return e>>>0},De=function(e){return("00"+e.toString(16)).slice(-2)},$t=i,Wt=Rt,Gt=i,Xt=s.getUint64,Kt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Le="undefined"!=typeof window?window:"undefined"!=typeof fe?fe:"undefined"!=typeof self?self:{},w=Le,Yt=Oe.discardEmulationPreventionBytes,Qt=p.CaptionStream,D=Mt,Jt=Ut,Zt=Bt,ei=Ft,ti=w,ii=function(e,h){var i=D(e,["moof","traf"]),e=D(e,["mdat"]),u={},s=[];return e.forEach(function(e,t){t=i[t];s.push({mdat:e,traf:t})}),s.forEach(function(e){var t,i,s,r,n,a=e.mdat,e=e.traf,o=D(e,["tfhd"]),o=ei(o[0]),l=o.trackId,d=D(e,["tfdt"]),d=0>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),P(e,["mdia","mdhd"])[0]);s&&(i.timescale=pi(s)),n.push(i)}),n},fi=function(e,i=0){return P(e,["emsg"]).map(e=>{var e=di.parseEmsgBox(new Uint8Array(e)),t=ci(e.message_data);return{cueTime:di.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:di.scaleTime(e.event_duration,e.timescale),frames:t}})},yi=He,_i=He,O=Ye,N={},R=(N.ts={parseType:function(e,t){e=jt(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=qt(e),i=4+Ht(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=qt(e),s=4+Ht(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ht(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=N.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=N.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=N.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=R/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in vi(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case _i.H264_STREAM_TYPE:s.video=[],Ti(e,i,s),0===s.video.length&&delete s.video;break;case _i.ADTS_STREAM_TYPE:s.audio=[],bi(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=O(e.dts,s),e.pts=O(e.pts,s),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=O(e.dts,r),e.pts=O(e.pts,r),e.dtsTime=e.dts/R,e.ptsTime=e.pts/R}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=O(t.dts,r),t.pts=O(t.pts,r),t.dtsTime=t.dts/R,t.ptsTime=t.pts/R),e):null};class Si{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new zt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new si,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=mi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=gi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=fi(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*c.ONE_SECOND_IN_TS,t=wi(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(c.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Si(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Si(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));const oh=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},lh=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},dh=(e,t)=>{t.gopInfo=e.data.gopInfo},hh=t=>{const{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=t,_={buffer:[]};let v=y;var b,T;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&oh(e,_,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&dh(e,_),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(v=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||v||(i.onmessage=null,lh({transmuxedData:_,callback:m}),uh(i))},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(b=e instanceof ArrayBuffer?e:e.buffer,T=e instanceof ArrayBuffer?0:e.byteOffset,i.postMessage({action:"push",data:b,byteOffset:T,byteLength:e.byteLength},[b])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},uh=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():hh(e.currentTransmux))},ch=(e,t)=>{e.postMessage({action:t}),uh(e)},ph=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(ch.bind(null,t,e)):(t.currentTransmux=e,ch(t,e))};const mh=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,hh(e))};var gh=e=>{ph("reset",e)},fh=(mh,e=>{const t=new ah,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function yh(t){const i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=_i({},t,{endAction:null,transmuxer:null,callback:null});const a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)}function _h(e){let t=0;return e.audio&&t++,e.video&&t++,t}function vh(e,t){var i=t.attributes||{},s=Mh(function(e){e=e.attributes||{};if(e.CODECS)return jn(e.CODECS)}(t)||[]);return!Rh(e,t)||s.audio||((e,t)=>{if(!Rh(e,t))return!0;var t=t.attributes||{},i=e.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1})(e,t)||(t=Mh(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return jn(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function bh(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Th(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}const wh={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Sh=e=>{e.forEach(e=>{e.abort()})},Eh=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),kh=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Ch=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:wh.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:wh.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:wh.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:wh.FAILURE,xhr:t}:null,xh=(r,n,a)=>(e,t)=>{var i=t.response,e=Ch(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:wh.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=wl(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: `+e,code:wh.FAILURE});yh({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},Ah=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{var p=i.map&&i.map.tracks||{};const m=Boolean(p.audio&&p.video);let g=e.bind(null,i,"audio","start");const f=e.bind(null,i,"audio","end");let y=e.bind(null,i,"video","start");const _=e.bind(null,i,"video","end");yh({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:m}),s=null),mh({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:m,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(m&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{g&&"undefined"!=typeof e.start&&(g(e.start),g=null),f&&"undefined"!=typeof e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&"undefined"!=typeof e.start&&(y(e.start),y=null),_&&"undefined"!=typeof e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:e=>{u&&(e.type="combined"===e.type?"video":e.type,u(null,i,e))}})}})},Dh=({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{let p=new Uint8Array(s);if(m=p,0<_l(m,["moof"]).length){i.isFmp4=!0;const g=i.map["tracks"],f={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio},y=(g.audio&&g.audio.codec&&"enca"!==g.audio.codec&&(f.audioCodec=g.audio.codec),g.video&&g.video.codec&&"encv"!==g.video.codec&&(f.videoCodec=g.video.codec),g.video&&g.audio&&(f.isMuxed=!0),e(i,f),(e,t)=>{h(i,{data:p,type:f.hasAudio&&!f.isMuxed?"audio":"video"}),t&&t.length&&a(i,t),e&&e.length&&o(i,e),u(null,i,{})});void yh({action:"probeMp4StartTime",timescales:i.map.timescales,data:p,transmuxer:i.transmuxer,callback:({data:e,startTime:t})=>{s=e.buffer,i.bytes=p=e,f.hasAudio&&!f.isMuxed&&r(i,"audio","start",t),f.hasVideo&&r(i,"video","start",t),yh({action:"probeEmsgID3",data:p,transmuxer:i.transmuxer,offset:t,callback:({emsgData:e,id3Frames:t})=>{s=e.buffer,i.bytes=p=e,g.video&&e.byteLength&&i.transmuxer?yh({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:p,timescales:i.map.timescales,trackIds:[g.video.id],callback:e=>{s=e.data.buffer,i.bytes=p=e.data,e.logs.forEach(function(e){c(P(e,{stream:"mp4CaptionParser"}))}),y(e.captions,t)}}):y(void 0,t)}})}})}else{var m;i.transmuxer?("undefined"==typeof i.container&&(i.container=wl(p)),"ts"!==i.container&&"aac"!==i.container?(e(i,{hasAudio:!1,hasVideo:!1}),u(null,i,{})):Ah({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})):u(null,i,{})}},Lh=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s},r){const n=e=>{e.data.source===t&&(s.removeEventListener("message",n),e=e.data.decrypted,r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.addEventListener("message",n);let a;a=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(Ud({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},Ph=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{Lh({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,Dh({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})})},Oh=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[];var _,v,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})=>{let f=0,y=!1;return(e,t)=>{if(!y){if(e)return y=!0,Sh(s),m(e,t);if((f+=1)===s.length){const i=function(){if(t.encryptedBytes)return Ph({decryptionWorker:r,segment:t,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g});Dh({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})};if(t.endOfAllRequests=Date.now(),t.map&&t.map.encryptedBytes&&!t.map.bytes)return Lh({decryptionWorker:r,id:t.requestId+"-init",encryptedBytes:t.map.encryptedBytes,key:t.map.key},e=>{t.map.bytes=e,Ih(t,e=>{if(e)return Sh(s),m(e,t);i()})});i()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f}),u=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=e(P(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),xh(s,a,i)),y.push(o)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(l=e(P(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),xh(s,[s.map.key],i)),y.push(l)),d=P(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Nd(s.map)}),{segment:_,finishProcessingFn:v}=[{segment:s,finishProcessingFn:i}][0],h=e(d,(e,t)=>{var e=Ch(e,t);return e?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void Ih(_,function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))}),y.push(h)),P(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Nd(s)}));({segment:b,finishProcessingFn:T,responseType:w}={segment:s,finishProcessingFn:i,responseType:u.responseType});var b,T,w,S,E,c=e(u,(e,t)=>{var e=Ch(e,t);return e?T(e,b):(e="arraybuffer"!==w&&t.responseText?ih(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=Eh(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b))});c.addEventListener("progress",({segment:S,progressFn:E}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return S.stats=P(S.stats,kh(e)),!S.stats.firstBytesReceivedAt&&S.stats.bytesReceived&&(S.stats.firstBytesReceivedAt=Date.now()),E(e,S)})),y.push(c);const k={};return y.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:k,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>Sh(y)},Nh=Hl("CodecUtils"),Rh=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},Mh=function(e){const s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(Fn(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),n=(Fh(r,(e,t)=>e.bandwidth-t.bandwidth),(r=r.filter(e=>!_d.isIncompatible(e.playlist))).filter(e=>_d.isEnabled(e.playlist)));o=(n=n.length?n:r.filter(e=>!_d.isDisabled(e.playlist))).filter(e=>e.bandwidth*O.BANDWIDTH_VARIANCEe.bandwidth===a.bandwidth)[0];if(!1===h){const g=p||n[0]||r[0];if(g&&g.playlist){let e=p?"bandwidthBestRep":"sortedPlaylistReps";return n[0]&&(e="enabledPlaylistReps"),Uh(`choosing ${Bh(g)} using ${e} with options`,c),g.playlist}}else{var m,h=o.filter(e=>e.width&&e.height),o=(Fh(h,(e,t)=>e.width-t.width),h.filter(e=>e.width===l&&e.height===d)),o=(a=o[o.length-1],o.filter(e=>e.bandwidth===a.bandwidth)[0]);let t,i;o||(m=(t=h.filter(e=>e.width>l||e.height>d)).filter(e=>e.width===t[0].width&&e.height===t[0].height),a=m[m.length-1],i=m.filter(e=>e.bandwidth===a.bandwidth)[0]);let s;u.leastPixelDiffSelector&&(m=h.map(e=>(e.pixelDiff=Math.abs(e.width-l)+Math.abs(e.height-d),e)),Fh(m,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=m[0]);const g=s||i||o||p||n[0]||r[0];if(g&&g.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":o?e="resolutionBestRep":p?e="bandwidthBestRep":n[0]&&(e="enabledPlaylistReps"),Uh(`choosing ${Bh(g)} using ${e} with options`,c),g.playlist}}return Uh("could not choose a playlist with options",c),null}}function qh(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return jh(this.playlists.main,this.systemBandwidth,parseInt(bh(this.tech_.el(),"width"),10)*e,parseInt(bh(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Hh(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const Vh=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:r})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach(e=>{const s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new a(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return T.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return T.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return T.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),o.addCue(i)})}),o.cues)&&o.cues.length){var s=o.cues,n=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),d=Object.keys(l).sort((e,t)=>Number(e)-Number(t));d.forEach((e,t)=>{var e=l[e],i=isFinite(r)?r:0;const s=Number(d[t+1])||i;e.forEach(e=>{e.endTime=s})})}}},zh={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},$h=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Wh=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,T.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},Gh=e=>"number"==typeof e&&isFinite(e),Xh=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?rd({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Kh=e=>e+"TimingInfo",Yh=(e,t)=>e.length?e.end(e.length-1):t,Qh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Jh=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Yl,Zh=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&sthis.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=Hl(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return fh({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&gh(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Vl();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Bd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=Fd(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&gh(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n=()=>{0===--e&&s()};!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,n)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Fl),n=Math.ceil((e-s)*Fl),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,n));for(const a in this.inbandTextTracks_)Hh(t,i,this.inbandTextTracks_[a]);Hh(t,i,this.segmentMetadataTrack_),n()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),t=Wl(e)||0,e=Gl(e,this.currentTime_()),i=!this.hasPlayed_()&&1<=e,s=e>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},i.isSyncRequest?i.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,r,t):null!==this.mediaIndex?(s=r[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1,i.startOfSegment=s.end||t,s.parts&&s.parts[a+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=a+1):i.mediaIndex=this.mediaIndex+1):({segmentIndex:s,startTime:a,partIndex:o}=_d.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),i.mediaIndex=s,i.startOfSegment=a,i.partIndex=o),t=r[i.mediaIndex];let n=t&&"number"==typeof i.partIndex&&t.parts&&t.parts[i.partIndex];if(!t||"number"==typeof i.partIndex&&!n)return null;"number"!=typeof i.partIndex&&t.parts&&(i.partIndex=0,n=t.parts[0]);var a,o,s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e=(e||!n||s||n.independent||(0===i.partIndex?(o=(a=r[i.mediaIndex-1]).parts&&a.parts.length&&a.parts[a.parts.length-1])&&o.independent&&(--i.mediaIndex,i.partIndex=a.parts.length-1,i.independent="previous segment"):t.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part")),this.mediaSource_&&"ended"===this.mediaSource_.readyState);return i.mediaIndex>=r.length-1&&e&&!this.seeking_()?null:this.generateSegmentInfo_(i)}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:n}),Wl(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Fl);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,calculateTimestampOffsetForEachSegment:r,overrideCheck:n}=[e][0],r?Yh(s,i):n||e!==t?e!_d.isIncompatible(e));let d=e.filter(_d.isEnabled);var e=(d=d.length?d:e.filter(e=>!_d.isDisabled(e))).filter(_d.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:_d.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return Fh(h,(e,t)=>Th(t.playlist,e.playlist)),h.length?h[0]:(Fh(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=Yl&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{p[e.stream]=p[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=p[e.stream];t.startTime=Math.min(t.startTime,e.startTime+c),t.endTime=Math.max(t.endTime,e.endTime+c),t.captions.push(e)}),Object.keys(p).forEach(e=>{var{startTime:t,endTime:i,captions:s}=p[e],r=this.inbandTextTracks_,n=(this.logger_(`adding cues from ${t} -> ${i} for `+e),r),a=this.vhs_.tech_,o=e;if(!n[o]){a.trigger({type:"usage",name:"vhs-608"});let s=o;/^cc708_/.test(o)&&(s="SERVICE"+o.split("_")[1]);var l=a.textTracks().getTrackById(s);if(l)n[o]=l;else{let e=o,t=o,i=!1;l=(a.options_.vhs&&a.options_.vhs.captionServices||{})[s];l&&(e=l.label,t=l.language,i=l.default),n[o]=a.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}Hh(t,i,r[e]);var{inbandTextTracks:d,captionArray:l,timestampOffset:h}={captionArray:s,inbandTextTracks:r,timestampOffset:c};if(l){const u=window.WebKitDataCue||window.VTTCue;l.forEach(i=>{const s=i.stream;i.content?i.content.forEach(e=>{var t=new u(i.startTime+h,i.endTime+h,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",d[s].addCue(t)}):d[s].addCue(new u(i.startTime+h,i.endTime+h,i.text))})}}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&Qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Kh(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,e)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=Bd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):this.loadQueue_.push(()=>{var e=_i({},t,{forceTimestampOffset:!0});_i(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)})}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_(Xh(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-O.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=Zh(e,this.sourceType_))&&("warn"===t.severity?T.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+Xh(e)):(this.logger_("Appended "+Xh(e)),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+Xh(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,Gh(t))&&Gh(i)&&(Hh(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}set replaceSegmentsUntil(e){this.logger_("Replacing currently buffered segments until "+e),this.replaceSegmentsUntil_=e}}function tu(){}function iu(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}const su=["video","audio"],ru=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},nu=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),nu("audio",s),nu("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!ru(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=iu(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},ou=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),lu={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(ou(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(ou(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];ou(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){T.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){T.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(ou(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){T.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=iu(s),i=qn(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(au(i,e),ou(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){T.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:r=>(e,t)=>{var i=t[e+"Buffer"],s=qn(r);ou(t.mediaSource,i)&&t.codecs[e]!==r&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to `+r),i.changeType(s),t.codecs[e]=r)}},du=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),nu(e,t)},hu=(i,s)=>e=>{var t=function(t){let i="";for(let e=0;e ${r})`}return i||"empty"}(s[i+"Buffered"]());s.logger_(i+` source buffer update end. Buffered: `,t),s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),nu(i,s)};class uu extends T.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>nu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Hl("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=hu("video",this),this.onAudioUpdateEnd_=hu("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){du({type:"mediaSource",sourceUpdater:this,action:lu.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){du({type:e,sourceUpdater:this,action:lu.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?du({type:"mediaSource",sourceUpdater:this,action:lu.removeSourceBuffer(e),name:"removeSourceBuffer"}):T.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!T.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?du({type:e,sourceUpdater:this,action:lu.changeType(t),name:"changeType"}):T.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(e=t,du({type:s,sourceUpdater:this,action:lu.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return ou(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Vl()}videoBuffered(){return ou(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Vl()}buffered(){var e=ou(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ou(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(t&&!e)return this.audioBuffered();if(e&&!t)return this.videoBuffered();{var r=this.audioBuffered();var n=this.videoBuffered();let e=null,t=null,i=0;var a=[],o=[];if(!(r&&r.length&&n&&n.length))return Vl();let s=r.length;for(;s--;)a.push({time:r.start(s),type:"start"}),a.push({time:r.end(s),type:"end"});for(s=n.length;s--;)a.push({time:n.start(s),type:"start"}),a.push({time:n.end(s),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),s=0;s{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"](()=>au(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const cu=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),pu=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class mu extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class gu extends eu{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?Vl([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):Vl()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Bd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=pu.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(pu,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return"undefined"!=typeof e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){Hh(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE"):this.loadSegment_(e))}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(this.subtitlesTrack_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===wh.TIMEOUT&&this.handleTimeout_(),e.code===wh.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));else{r.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest)this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";else{s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)});var n=this.subtitlesTrack_,a=n.cues;if(a){var o={};for(let e=a.length-1;0<=e;e--){var l=a[e],d=`${l.startTime}-${l.endTime}-`+l.text;o[d]?n.removeCue(l):o[d]=l}}this.handleAppendsDone_()}}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(t){let e,i=!1;if("function"!=typeof window.WebVTT)throw new mu;"function"==typeof window.TextDecoder?e=new window.TextDecoder("utf8"):(e=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,e);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=t.cues.push.bind(t.cues),s.ontimestampmap=e=>{t.timestampmap=e},s.onparsingerror=e=>{T.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){let e=t.segment.map.bytes;i&&(e=cu(e)),s.parse(e)}let r=t.bytes;i&&(r=cu(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){var s=e.segment;if(t)if(e.cues.length){var r=e.timestampmap;const n=r.MPEGTS/Fl-r.LOCAL+t.mapping;e.cues.forEach(e=>{e.startTime+=n,e.endTime+=n}),i.syncInfo||(r=e.cues[0].startTime,t=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,t-s.duration)})}else s.empty=!0}}const fu=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=id(i);r=r||0;for(let e=0;e{let n=null,a=null;r=r||0;var o=id(t);for(let e=0;e=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class yu extends T.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=Hl("SyncController")}getSyncPoint(e,t,i,s){e=this.runStrategies_(e,t,i,s);return e.length?this.selectSyncPoint_(e,{key:"time",value:s}):null}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+Xl({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(t,i,s,r){var n=[];for(let e=0;eo){let e;e=a<0?s.start-Xl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+Xl({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class _u extends T.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var vu=sh(rh(nh(function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);const a=new Uint8Array(e.byteLength);let o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const bu=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Tu=(e,t)=>{(t.activePlaylistLoader=e).load()},wu={AUDIO:(a,o)=>()=>{var{segmentLoaders:{[a]:e},mediaTypes:{[a]:t},excludePlaylist:i}=o,e=(bu(e,t),t.activeTrack()),s=t.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=t.tracks[s];if(e===r)i({error:{message:"Problem encountered loading the default audio track."}});else{T.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in t.tracks)t.tracks[n].enabled=t.tracks[n]===r;t.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s,e=(T.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),bu(e,t),t.activeTrack());e&&(e.mode="disabled"),t.onTrackChanged()}},Su={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",wu[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",wu[e](e,i))}},Eu={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=yd(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new Ld(e.playlists[0],n,o):e.resolvedUri?new Ld(e.resolvedUri,n,o):e.playlists&&"dash"===a?new eh(e.playlists[0],n,o,c):null,e=P({id:g,playlistLoader:t},e),Su[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new T.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),h[g]=r)}}e.on("error",wu[i](i,s))},SUBTITLES:(i,s)=>{var r,{tech:n,vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u}},mainPlaylistLoader:c}=s;for(const p in d[i]){h[p]||(h[p]=[]);for(const m in d[i][p])if(a.options_.useForcedSubtitles||!d[i][p][m].forced){let e=d[i][p][m],t;if("hls"===o)t=new Ld(e.resolvedUri,a,l);else if("dash"===o){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new eh(e.playlists[0],a,l,c)}else"vhs-json"===o&&(t=new Ld(e.playlists?e.playlists[0]:e.resolvedUri,a,l));e=P({id:m,playlistLoader:t},e),Su[i](i,e.playlistLoader,s),h[p].push(e),"undefined"==typeof u[m]&&(r=n.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,u[m]=r)}}e.on("error",wu[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const l in s[e]){r[l]||(r[l]=[]);for(const d in s[e][l]){var a=s[e][l][d];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:d,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?P(e,o[e.instreamId]):e).default&&delete e.default,r[l].push(P({id:d},a)),"undefined"==typeof n[d]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,n[d]=o)}}}}},ku=(t,i)=>{for(let e=0;e()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if(e[t].enabled)return e[t];return null},SUBTITLES:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if("showing"===e[t].mode||"hidden"===e[t].mode)return e[t];return null}},xu=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{Eu[e](e,n)});const{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=Cu[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,bu(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),Tu(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,bu(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),Tu(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n["mediaTypes"]],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o=a.AUDIO.activeGroup();o&&(o=(o.filter(e=>e.default)[0]||o[0]).id,a.AUDIO.tracks[o].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});const l=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};t.audioTracks().addEventListener("change",l),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",l),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio");for(const d in a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[d])};let Iu;const Au=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Du extends T.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e["maxPlaylistRetries"];null!==m&&"undefined"!=typeof m||(m=1/0),Iu=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:tu,activeTrack:tu,getActiveGroup:tu,onGroupChanged:tu,onTrackChanged:tu,lastTrack_:null,logger_:Hl(`MediaGroups[${e}]`)}}),t})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Vl(),this.hasPlayed_=!1,this.syncController_=new yu(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new vu,this.sourceUpdater_=new uu(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new _u;var g={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},g=(this.mainPlaylistLoader_="dash"===this.sourceType_?new eh(t,this.vhs_,P(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ld(t,this.vhs_,P(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new eu(P(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new eu(P(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new gu(P(g,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Au.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=Hl("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(g,()=>{const e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e.id||e.uri;s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n=i.main||s.length&&i[s[0]];for(const d in n)if(n[d].default){r={label:d};break}}if(!r)return e;var a=[];for(const h in i)if(i[h][r.label]){var o=i[h][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;gd(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),xu({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;gd(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;e=Object.keys(i.AUDIO);for(const r in i.AUDIO)for(const n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Iu.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!i)return l(d+" as current playlist is not set"),!0;if(s.id!==i.id){var h=Boolean(zl(e,t).length);if(!i.endList)return h||"number"!=typeof i.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=Gl(e,t),e=o?O.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:O.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${t} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else T.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments())}resetMainLoaderReplaceSegments(){var e=this.tech_.buffered(),e=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=e,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=Iu.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=Ql&&e-i<=Ql:e-t<=Ql)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(cd),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return T.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(T.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});var a,r=this.selectPlaylist();if(r)return i=t.internal?this.logger_:T.log.warn,a=t.message?" "+t.message:"",i(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+a+` Switching to playlist ${r.id}.`),r.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),r.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),i=r.targetDuration/2*1e3||5e3,a="number"==typeof r.lastRequest&&Date.now()-r.lastRequest<=i,this.switchMedia_(r,"exclude",n||a);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){const s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=zl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:Iu.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=Iu.Playlist.seekable(s,r,Iu.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=Iu.Playlist.seekable(s,r,Iu.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=Vl([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){const r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=vh(this.main(),t);const n={};var i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(n.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(n.video+=","+(e.audio||r.main.audioCodec||Hn)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(n.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||Hn,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),n.audio||n.video){const a={};let s;if(["video","audio"].forEach(function(e){var t,i;n.hasOwnProperty(e)&&(t=r[e].isFmp4,i=n[e],!(t?Dn:Ln)(i))&&(t=r[e].isFmp4?"browser":"muxer",a[t]=a[t]||[],a[t].push(n[e]),"audio"===e&&(s=t))}),i&&s&&t.attributes.AUDIO){const o=t.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===o&&e!==t&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${o} as ${s} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const l=[];if(["video","audio"].forEach(e=>{var t=(jn(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(jn(n[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push(`"${this.sourceUpdater_.codecs[e]}" -> "${n[e]}"`)}),l.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${l.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}e=Object.keys(a).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=vh(this.main,e)).audio||Ln(t.audio)||Dn(t.audio)||i.push("audio codec "+t.audio),!t.video||Ln(t.video)||Dn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){const r=[],n=this.main().playlists;e=Mh(jn(e));const a=_h(e),o=e.video&&jn(e.video)[0]||null,l=e.audio&&jn(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=vh(this.mainPlaylistLoader_.main,e),i=_h(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&jn(s.video)[0]||null,s=s.audio&&jn(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var s=this.seekable(),[r,n,s=0]=(s.length&&(t=s.start(0)),[e,this.cueTagsTrack_,t]);if(r.segments){let t=s,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(n,t+l.duration/2)){if("cueIn"in l){i.endTime=t,i.adEndTime=t,t+=l.duration,i=null;continue}if(t{for(const i of Object.keys(e)){var t;$h.has(i)||((t=new r(e.startTime,e.endTime,"")).id=e.id,t.type="com.apple.quicktime.HLS",t.value={key:zh[i],data:e[i]},"scte35Out"!==i&&"scte35In"!==i||(t.value.data=new Uint8Array(t.value.data.match(/[\da-f]{2}/gi)).buffer),s.addCue(t))}e.processDateRange()})}}}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Wh(this.inbandTextTracks_,e,this.tech_),Vh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}}class Lu{constructor(e,t,i){var s,r,n,a,o=e["playlistController_"],l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=vh(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=ud(t),s=cd(t);return"undefined"==typeof e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const Pu=["seeking","seeked","pause","playing","error"];class Ou{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Hl("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(Pu,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(Pu,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:Ql)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${Zl(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-Yl),o=[r,s];for(let e=0;e ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=$l(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+Ql;var n=!i.endList,a="number"==typeof i.partTargetDuration;return t>(r=n&&(a||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){s&&t.currentTime(s)});t.on("error",n),t.on("dispose",a),t.reloadSourceOnError=function(e){a(),Ru(t,e)}};function Mu(t,e){var i=e.media();let s=-1;for(let e=0;eTh(e,t)),e.filter(e=>!!vh(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:qh,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),O[t]},set(e){T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?T.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):O[t]=e}})}),"videojs-vhs"),Bu=(N.canPlaySource=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));const n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),Fu=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Mh(jn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r=qn(s.video),n=qn(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return P(e,a)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(T.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},ju=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(Uu);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},qu=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},Hu=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Vu=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},zu=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const t=document.createElement("video");return!!T.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&T.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){qu(N.xhr,e)},N.xhr.onResponse=function(e){Hu(N.xhr,e)},N.xhr.offRequest=function(e){Vu(N.xhr,e)},N.xhr.offResponse=function(e){zu(N.xhr,e)};class $u extends T.getComponent("Component"){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Hl("VhsHandler"),t.options_&&t.options_.playerId&&(i=T.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=ju())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=O.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===O.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=Pn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new Du(this.options_),e=P({liveRangeSafeTimeDelta:Ql},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new Ou(e),this.playlistController_.on("error",()=>{var e=T.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>ed(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ed(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=ju())?P(t,e):e;try{window.localStorage.setItem(Uu,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=yd(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!ud(e)).map((e,t)=>new Lu(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Bu({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=Fu({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{if("output-restricted"===e.status){e=this.playlistController_.main();if(e&&e.playlists){const t=[];e.playlists.forEach(e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))}),t.length&&(T.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=T.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),Mu(t,e.playlists)}),this.playlists.on("mediachange",()=>{Mu(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.6.0","mux.js":"7.0.0","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return uu.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return zd({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return $d({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{qu(this.xhr,e)},this.xhr.onResponse=e=>{Hu(this.xhr,e)},this.xhr.offRequest=e=>{Vu(this.xhr,e)},this.xhr.offResponse=e=>{zu(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const Wu={name:"videojs-http-streaming",VERSION:"3.6.0",canHandleSource(e,t={}){t=P(T.options,t);return Wu.canPlayType(e.type,t)},handleSource(e,t,i={}){i=P(T.options,i);return t.vhs=new $u(e,t,i),t.vhs.xhr=Od(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=Pn(e);return e&&(t=Wu.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(T.browser.IS_ANY_SAFARI||T.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return Dn("avc1.4d400d,mp4a.40.2")&&T.getTech("Html5").registerSourceHandler(Wu,0),T.VhsHandler=$u,T.VhsSourceHandler=Wu,T.Vhs=N,T.use||T.registerComponent("Vhs",N),T.options.vhs=T.options.vhs||{},T.getPlugin&&T.getPlugin("reloadSourceOnError")||T.registerPlugin("reloadSourceOnError",function(e){Ru(this,e)}),T}); \ No newline at end of file +/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */s(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))})}static get STEP(){return 32e3}decryptChunk_(t,i,s,r){return function(){var e=function(e,t,i){var s,r,n,a,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const bu=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Tu=(e,t)=>{(t.activePlaylistLoader=e).load()},wu={AUDIO:(a,o)=>()=>{var{mediaTypes:{[a]:e},excludePlaylist:t}=o,i=e.activeTrack(),s=e.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=e.tracks[s];if(i===r)t({error:{message:"Problem encountered loading the default audio track."}});else{T.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in e.tracks)e.tracks[n].enabled=e.tracks[n]===r;e.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{[i]:e}=s["mediaTypes"],t=(T.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),e.activeTrack());t&&(t.mode="disabled"),e.onTrackChanged()}},Su={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",wu[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",wu[e](e,i))}},Eu={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=yd(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new Ld(e.playlists[0],n,o):e.resolvedUri?new Ld(e.resolvedUri,n,o):e.playlists&&"dash"===a?new eh(e.playlists[0],n,o,c):null,e=P({id:g,playlistLoader:t},e),Su[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new T.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),h[g]=r)}}e.on("error",wu[i](i,s))},SUBTITLES:(i,s)=>{var r,{tech:n,vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u}},mainPlaylistLoader:c}=s;for(const p in d[i]){h[p]||(h[p]=[]);for(const m in d[i][p])if(a.options_.useForcedSubtitles||!d[i][p][m].forced){let e=d[i][p][m],t;if("hls"===o)t=new Ld(e.resolvedUri,a,l);else if("dash"===o){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new eh(e.playlists[0],a,l,c)}else"vhs-json"===o&&(t=new Ld(e.playlists?e.playlists[0]:e.resolvedUri,a,l));e=P({id:m,playlistLoader:t},e),Su[i](i,e.playlistLoader,s),h[p].push(e),"undefined"==typeof u[m]&&(r=n.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,u[m]=r)}}e.on("error",wu[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const l in s[e]){r[l]||(r[l]=[]);for(const d in s[e][l]){var a=s[e][l][d];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:d,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?P(e,o[e.instreamId]):e).default&&delete e.default,r[l].push(P({id:d},a)),"undefined"==typeof n[d]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,n[d]=o)}}}}},ku=(t,i)=>{for(let e=0;e()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if(e[t].enabled)return e[t];return null},SUBTITLES:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if("showing"===e[t].mode||"hidden"===e[t].mode)return e[t];return null}},xu=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{Eu[e](e,n)});const{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=Cu[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,bu(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),Tu(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,bu(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),Tu(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n["mediaTypes"]],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o=a.AUDIO.activeGroup();o&&(o=(o.filter(e=>e.default)[0]||o[0]).id,a.AUDIO.tracks[o].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});const l=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};t.audioTracks().addEventListener("change",l),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",l),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio");for(const d in a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[d])};class Iu{constructor(){this.priority_=[]}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=jl(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}}class Au extends T.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new Iu,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.logger_=Hl("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var i=t.serverUri||t.serverURL;i?i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=this.queryBeforeStart?i:jl(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart||!1,this.proxyServerUrl_=t.proxyServerURL||null,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"),this.queryBeforeStart&&this.requestSteeringManifest(this.steeringManifest.reloadUri)):(this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error"))}requestSteeringManifest(e){var t=this.steeringManifest.reloadUri;if(e||t){const i=e||this.getRequestURI(t);i?this.request_=this.xhr_({uri:i},(e,t)=>{if(e)return 410===t.status?(this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i)):429===t.status?(t=t.responseHeaders["retry-after"],this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${t} seconds.`),void this.startTTLTimeout_(parseInt(t,10))):(this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_());t=JSON.parse(this.request_.responseText);this.startTTLTimeout_(),this.assignSteeringProperties_(t)}):(this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose())}}setProxyServerUrl_(e){var e=new window.URL(e),t=new window.URL(this.proxyServerUrl_);return t.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(t.toString())}decodeDataUriManifest_(e){e=JSON.parse(window.atob(e));this.assignSteeringProperties_(e)}setSteeringParams_(e){var t,e=new window.URL(e),i=this.getPathway(),s=this.getBandwidth_();return i&&(t=`_${this.manifestType_}_pathway`,e.searchParams.set(t,i)),s&&(t=`_${this.manifestType_}_throughput`,e.searchParams.set(t,s)),e.toString()}assignSteeringProperties_(e){var t;this.steeringManifest.version=e.VERSION,this.steeringManifest.version?(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose()),t=(e=>{for(const t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority),this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))):(this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;var t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!t(i))return i}i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=window.setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){window.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new Iu}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}}let Du;const Lu=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Pu extends T.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e["maxPlaylistRetries"];null!==m&&"undefined"!=typeof m||(m=1/0),Du=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:tu,activeTrack:tu,getActiveGroup:tu,onGroupChanged:tu,onTrackChanged:tu,lastTrack_:null,logger_:Hl(`MediaGroups[${e}]`)}}),t})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Vl(),this.hasPlayed_=!1,this.syncController_=new yu(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new vu,this.sourceUpdater_=new uu(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new _u;var g={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},g=(this.mainPlaylistLoader_="dash"===this.sourceType_?new eh(t,this.vhs_,P(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ld(t,this.vhs_,P(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new eu(P(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new eu(P(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new gu(P(g,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new Au(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Lu.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=Hl("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(g,()=>{const e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e.id||e.uri;s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{var t=this.mediaTypes_[e],t=t?t.activeGroup():null;const i=this.contentSteeringController_.getPathway();t&&i&&(t=(t.length?t[0]:t).playlists.filter(e=>e.attributes.serviceLocation===i)).length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n=i.main||s.length&&i[s[0]];for(const d in n)if(n[d].default){r={label:d};break}}if(!r)return e;var a=[];for(const h in i)if(i[h][r.label]){var o=i[h][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;gd(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),xu({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;gd(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;e=Object.keys(i.AUDIO);for(const r in i.AUDIO)for(const n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Du.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!i)return l(d+" as current playlist is not set"),!0;if(s.id!==i.id){var h=Boolean(zl(e,t).length);if(!i.endList)return h||"number"!=typeof i.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=Gl(e,t),e=o?O.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:O.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${t} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else T.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments())}resetMainLoaderReplaceSegments(){var e=this.tech_.buffered(),e=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=e,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=Du.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=Ql&&e-i<=Ql:e-t<=Ql)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(cd),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return T.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){const o=this.pathwayAttribute_(s);var a=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(o),this.excludeThenChangePathway_(),void setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(o)},a)}let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(T.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});a=this.selectPlaylist();if(a)return r=t.internal?this.logger_:T.log.warn,i=t.message?" "+t.message:"",r(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+i+` Switching to playlist ${a.id}.`),a.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),a.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),r=a.targetDuration/2*1e3||5e3,i="number"==typeof a.lastRequest&&Date.now()-a.lastRequest<=r,this.switchMedia_(a,"exclude",n||i);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){const s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=zl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:Du.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=Du.Playlist.seekable(s,r,Du.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=Du.Playlist.seekable(s,r,Du.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=Vl([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){const r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=vh(this.main(),t);const n={};var i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(n.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(n.video+=","+(e.audio||r.main.audioCodec||Hn)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(n.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||Hn,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),n.audio||n.video){const a={};let s;if(["video","audio"].forEach(function(e){var t,i;n.hasOwnProperty(e)&&(t=r[e].isFmp4,i=n[e],!(t?Dn:Ln)(i))&&(t=r[e].isFmp4?"browser":"muxer",a[t]=a[t]||[],a[t].push(n[e]),"audio"===e&&(s=t))}),i&&s&&t.attributes.AUDIO){const o=t.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===o&&e!==t&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${o} as ${s} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const l=[];if(["video","audio"].forEach(e=>{var t=(jn(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(jn(n[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push(`"${this.sourceUpdater_.codecs[e]}" -> "${n[e]}"`)}),l.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${l.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}e=Object.keys(a).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=vh(this.main,e)).audio||Ln(t.audio)||Dn(t.audio)||i.push("audio codec "+t.audio),!t.video||Ln(t.video)||Dn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){const r=[],n=this.main().playlists;e=Mh(jn(e));const a=_h(e),o=e.video&&jn(e.video)[0]||null,l=e.audio&&jn(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=vh(this.mainPlaylistLoader_.main,e),i=_h(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&jn(s.video)[0]||null,s=s.audio&&jn(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var s=this.seekable(),[r,n,s=0]=(s.length&&(t=s.start(0)),[e,this.cueTagsTrack_,t]);if(r.segments){let t=s,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(n,t+l.duration/2)){if("cueIn"in l){i.endTime=t,i.adEndTime=t,t+=l.duration,i=null;continue}if(t{for(const i of Object.keys(e)){var t;$h.has(i)||((t=new r(e.startTime,e.endTime,"")).id=e.id,t.type="com.apple.quicktime.HLS",t.value={key:zh[i],data:e[i]},"scte35Out"!==i&&"scte35In"!==i||(t.value.data=new Uint8Array(t.value.data.match(/[\da-f]{2}/gi)).buffer),s.addCue(t))}e.processDateRange()})}}}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Wh(this.inbandTextTracks_,e,this.tech_),Vh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){var e=this.main();if(e.contentSteering){const t=e=>{for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering)};t(e),this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("mediaupdatetimeout",()=>{this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id),this.contentSteeringController_.abort(),this.contentSteeringController_.clearTTLTimeout_(),this.contentSteeringController_.clearAvailablePathways(),t(this.main())}),this.contentSteeringController_.queryBeforeStart||this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}excludeThenChangePathway_(){const r=this.contentSteeringController_.getPathway();if(r){const n=this.main().playlists,a=new Set;let s=!1;Object.keys(n).forEach(e=>{var e=n[e],t=this.pathwayAttribute_(e),t=t&&r!==t,i=(e.excludeUntil===1/0&&"content-steering"===e.lastExcludeReason_&&!t&&(delete e.excludeUntil,delete e.lastExcludeReason_,s=!0),!e.excludeUntil&&e.excludeUntil!==1/0);!a.has(e.id)&&t&&i&&(a.add(e.id),e.excludeUntil=1/0,e.lastExcludeReason_="content-steering",this.logger_(`excluding ${e.id} for `+e.lastExcludeReason_))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(e=>{var e=this.mediaTypes_[e];e.activePlaylistLoader&&(e=e.activePlaylistLoader.media_)&&e.attributes.serviceLocation!==r&&(s=!0)}),s&&this.changeSegmentPathway_()}}changeSegmentPathway_(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}}class Ou{constructor(e,t,i){var s,r,n,a,o=e["playlistController_"],l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=vh(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=ud(t),s=cd(t);return"undefined"==typeof e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const Nu=["seeking","seeked","pause","playing","error"];class Ru{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Hl("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(Nu,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(Nu,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:Ql)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${Zl(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-Yl),o=[r,s];for(let e=0;e ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=$l(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+Ql;var n=!i.endList,a="number"==typeof i.partTargetDuration;return t>(r=n&&(a||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){s&&t.currentTime(s)});t.on("error",n),t.on("dispose",a),t.reloadSourceOnError=function(e){a(),Uu(t,e)}};function Bu(t,e){var i=e.media();let s=-1;for(let e=0;eTh(e,t)),e.filter(e=>!!vh(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:qh,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),O[t]},set(e){T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?T.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):O[t]=e}})}),"videojs-vhs"),ju=(N.canPlaySource=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));const n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),qu=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Mh(jn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r=qn(s.video),n=qn(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return P(e,a)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(T.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},Hu=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(Fu);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},Vu=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},zu=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},$u=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Wu=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const t=document.createElement("video");return!!T.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&T.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){Vu(N.xhr,e)},N.xhr.onResponse=function(e){zu(N.xhr,e)},N.xhr.offRequest=function(e){$u(N.xhr,e)},N.xhr.offResponse=function(e){Wu(N.xhr,e)};class Gu extends T.getComponent("Component"){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Hl("VhsHandler"),t.options_&&t.options_.playerId&&(i=T.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=Hu())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=O.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===O.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=Pn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new Pu(this.options_),e=P({liveRangeSafeTimeDelta:Ql},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new Ru(e),this.playlistController_.on("error",()=>{var e=T.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>ed(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ed(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=Hu())?P(t,e):e;try{window.localStorage.setItem(Fu,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=yd(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!ud(e)).map((e,t)=>new Ou(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),ju({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=qu({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{if("output-restricted"===e.status){e=this.playlistController_.main();if(e&&e.playlists){const t=[];e.playlists.forEach(e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))}),t.length&&(T.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=T.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),Bu(t,e.playlists)}),this.playlists.on("mediachange",()=>{Bu(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.7.0","mux.js":"7.0.1","mpd-parser":"1.2.2","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return uu.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return zd({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return $d({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{Vu(this.xhr,e)},this.xhr.onResponse=e=>{zu(this.xhr,e)},this.xhr.offRequest=e=>{$u(this.xhr,e)},this.xhr.offResponse=e=>{Wu(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const Xu={name:"videojs-http-streaming",VERSION:"3.7.0",canHandleSource(e,t={}){t=P(T.options,t);return Xu.canPlayType(e.type,t)},handleSource(e,t,i={}){i=P(T.options,i);return t.vhs=new Gu(e,t,i),t.vhs.xhr=Od(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=Pn(e);return e&&(t=Xu.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(T.browser.IS_ANY_SAFARI||T.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return Dn("avc1.4d400d,mp4a.40.2")&&T.getTech("Html5").registerSourceHandler(Xu,0),T.VhsHandler=Gu,T.VhsSourceHandler=Xu,T.Vhs=N,T.use||T.registerComponent("Vhs",N),T.options.vhs=T.options.vhs||{},T.getPlugin&&T.getPlugin("reloadSourceOnError")||T.registerPlugin("reloadSourceOnError",function(e){Uu(this,e)}),T}); \ No newline at end of file diff --git a/node_modules/video.js/package.json b/node_modules/video.js/package.json index cdd76b19f6..761a1365e2 100644 --- a/node_modules/video.js/package.json +++ b/node_modules/video.js/package.json @@ -1,7 +1,7 @@ { "name": "video.js", "description": "An HTML5 video player that supports HLS and DASH with a common API and skin.", - "version": "8.6.0", + "version": "8.6.1", "main": "./dist/video.cjs.js", "module": "./dist/video.es.js", "style": "./dist/video-js.css", @@ -86,7 +86,7 @@ }, "dependencies": { "@babel/runtime": "^7.12.5", - "@videojs/http-streaming": "3.6.0", + "@videojs/http-streaming": "3.7.0", "@videojs/vhs-utils": "^4.0.0", "@videojs/xhr": "2.6.0", "aes-decrypter": "^4.0.1", @@ -94,7 +94,7 @@ "keycode": "2.2.0", "m3u8-parser": "^6.0.0", "mpd-parser": "^1.0.1", - "mux.js": "^6.2.0", + "mux.js": "^7.0.1", "safe-json-parse": "4.0.0", "videojs-contrib-quality-levels": "4.0.0", "videojs-font": "4.1.0", diff --git a/node_modules/video.js/src/css/components/_control-bar.scss b/node_modules/video.js/src/css/components/_control-bar.scss index dde90b0122..ae72c54185 100644 --- a/node_modules/video.js/src/css/components/_control-bar.scss +++ b/node_modules/video.js/src/css/components/_control-bar.scss @@ -10,6 +10,14 @@ @include background-color-with-alpha($primary-background-color, $primary-background-transparency); } +// Locks the display only if: +// - controls are not disabled +// - native controls are not used +// - there is no error +.video-js:not(.vjs-controls-disabled, .vjs-using-native-controls, .vjs-error) .vjs-control-bar.vjs-lock-showing { + display: flex !important; +} + // Video has started playing or we are in audioOnlyMode .vjs-has-started .vjs-control-bar, .vjs-audio-only-mode .vjs-control-bar { diff --git a/objects/aVideoEncoder.json.php b/objects/aVideoEncoder.json.php index 2752655307..94604511b1 100644 --- a/objects/aVideoEncoder.json.php +++ b/objects/aVideoEncoder.json.php @@ -32,6 +32,9 @@ if (empty($_REQUEST)) { } //_error_log("aVideoEncoder.json: start"); _error_log("aVideoEncoder.json: start"); +if(empty($global['allowedExtension'])){ + $global['allowedExtension'] = array(); +} if (empty($_REQUEST['format']) || !in_array($_REQUEST['format'], $global['allowedExtension'])) { $obj->msg = "aVideoEncoder.json: ERROR Extension not allowed File {$_REQUEST['format']}"; _error_log($obj->msg. ": " . json_encode($_REQUEST)); diff --git a/objects/functionInfiniteScroll.php b/objects/functionInfiniteScroll.php new file mode 100644 index 0000000000..0c66e587d3 --- /dev/null +++ b/objects/functionInfiniteScroll.php @@ -0,0 +1,136 @@ + ' . $page . ' (current)'; + } + $link = _addPageNumber($url, $page); + $li = "
  • "; + if (!empty($icon)) { + $li .= ""; + } else { + $li .= $page; + } + $li .= "
  • "; + return $li; +} + +function getPagination($total, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector = "", $infinityScrollAppendIntoSelector = "", $loadOnScroll = false, $showOnly = '') +{ + global $global, $advancedCustom; + if ($total < 2) { + return ''; + } + + $page = getCurrentPage(); + if ($total < $page) { + $page = $total; + } + + $isInfiniteScroll = !empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector); + + $uid = uniqid(); + + if ($total < $maxVisible) { + $maxVisible = $total; + } + if (empty($link)) { + $link = getSelfURI(); + if (preg_match("/(current=[0-9]+)/i", $link, $match)) { + $link = str_replace($match[1], "current=_pageNum_", $link); + } else { + $link .= (parse_url($link, PHP_URL_QUERY) ? '&' : '?') . 'current=_pageNum_'; + } + } + if ($isInfiniteScroll) { + $link = addQueryStringParameter($link, 'isInfiniteScroll', getCurrentPage()); + } + if (!empty($showOnly)) { + $link = addQueryStringParameter($link, 'showOnly', $showOnly); + } + $class = ''; + if (!empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector)) { + $class = "infiniteScrollPagination{$uid} hidden"; + } + + if ($isInfiniteScroll && $page > 1) { + return ""; + } + $pag = ' '; + + if ($isInfiniteScroll) { + $content = file_get_contents($global['systemRootPath'] . 'objects/functiongetPagination.php'); + $pag .= str_replace( + ['$uid', '$webSiteRootURL', '$infinityScrollGetFromSelector', '$infinityScrollAppendIntoSelector', '$loadMore', '$loadOnScroll'], + [$uid, $global['webSiteRootURL'], $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector, __('Load More'), (!empty($loadOnScroll) ? 'true' : 'false')], + $content + ); + } + + return $pag; +} diff --git a/objects/functions.php b/objects/functions.php index bdc1d4c85b..495cff4331 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -7335,140 +7335,6 @@ function getSEOTitle($text, $maxChars = 120) } } -function _addPageNumber($url, $page){ - if (preg_match("/_pageNum_/", $url, $match)) { - $url = str_replace("_pageNum_", $page, $url); - } - - $url = addQueryStringParameter($url, 'page', $page); - $url = addQueryStringParameter($url, 'current', $page); - - // remove duplicated - $pattern = '/\/page\/(\d+)\/\d+\//'; - $replacement = '/page/$1/'; - $url = preg_replace($pattern, $replacement, $url, 1); - return $url; -} - -function _getPageItem($url, $page, $uid, $isNext= false, $icon = ''){ - $class = ''; - if($isNext){ - $class .= 'pagination__next pagination__next'.$uid; - } - $currentPage = getCurrentPage(true); - if($page == $currentPage){ - return '
  • ' . $page . ' (current)
  • '; - } - $link = _addPageNumber($url, $page); - $li = "
  • "; - if(!empty($icon)){ - $li .= ""; - }else{ - $li .= $page; - } - $li .= "
  • "; - return $li; -} - -function getPagination($total, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector = "", $infinityScrollAppendIntoSelector = "", $loadOnScroll = false, $showOnly='') -{ - global $global, $advancedCustom; - if ($total < 2) { - return ''; - } - - $page = getCurrentPage(); - if ($total < $page) { - $page = $total; - } - - $isInfiniteScroll = !empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector); - - $uid = uniqid(); - - if ($total < $maxVisible) { - $maxVisible = $total; - } - if (empty($link)) { - $link = getSelfURI(); - if (preg_match("/(current=[0-9]+)/i", $link, $match)) { - $link = str_replace($match[1], "current=_pageNum_", $link); - } else { - $link .= (parse_url($link, PHP_URL_QUERY) ? '&' : '?') . 'current=_pageNum_'; - } - } - if($isInfiniteScroll){ - $link = addQueryStringParameter($link, 'isInfiniteScroll', getCurrentPage()); - } - if(!empty($showOnly)){ - $link = addQueryStringParameter($link, 'showOnly',$showOnly); - } - $class = ''; - if (!empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector)) { - $class = "infiniteScrollPagination{$uid} hidden"; - } - - if ($isInfiniteScroll && $page > 1) { - return ""; - } - $pag = ' '; - - if ($isInfiniteScroll) { - $content = file_get_contents($global['systemRootPath'] . 'objects/functiongetPagination.php'); - $pag .= str_replace( - ['$uid', '$webSiteRootURL', '$infinityScrollGetFromSelector', '$infinityScrollAppendIntoSelector', '$loadMore', '$loadOnScroll'], - [$uid, $global['webSiteRootURL'], $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector, __('Load More'), (!empty($loadOnScroll)?'true':'false')], - $content - ); - } - - return $pag; -} - function getShareMenu($title, $permaLink, $URLFriendly, $embedURL, $img, $class = "row bgWhite list-group-item menusDiv", $videoLengthInSeconds = 0, $bitLyLink = '') { global $global, $advancedCustom; diff --git a/objects/video.php b/objects/video.php index dff4ae9827..3b18758a75 100644 --- a/objects/video.php +++ b/objects/video.php @@ -5304,12 +5304,6 @@ if (!class_exists('Video')) { } $video = new Video("", "", $videos_id); - if (!$ignoreChannelname && $advancedCustomUser->addChannelNameOnLinks) { - $get['channelName'] = $video->getChannelName(); - } elseif ($ignoreChannelname) { - $get['channelName'] = null; - } - unset($get['v'], $get['videoName'], $get['videoName'], $get['isMediaPlaySite'], $get['parentsOnly']); $get_http = http_build_query($get); if (empty($get_http)) { @@ -5340,13 +5334,18 @@ if (!class_exists('Video')) { $subDir = "audio"; $subEmbedDir = "audioEmbed"; } + $siteURL = $global['webSiteRootURL']; + if (!$ignoreChannelname && $advancedCustomUser->addChannelNameOnLinks) { + $siteURL .= 'channel/'.urlencode($video->getChannelName()).'/'; + } + + if ($embed) { + $baseURL = "{$siteURL}{$subEmbedDir}/{$videos_id}"; + } else { + $baseURL = "{$siteURL}{$subDir}/{$videos_id}"; + } if ($type == Video::$urlTypeFriendly) { - $cat = ''; - if (!empty($_REQUEST['catName'])) { - $cat = "cat/{$_REQUEST['catName']}/"; - } - if (empty($clean_title)) { $clean_title = $video->getClean_title(); } @@ -5358,32 +5357,18 @@ if (!class_exists('Video')) { $videos_id = $encryptedVideos_id; } } - if ($embed) { - if (empty($advancedCustom->useVideoIDOnSEOLinks)) { - $url = "{$global['webSiteRootURL']}{$subEmbedDir}/{$clean_title}{$get_http}"; - } else { - $url = "{$global['webSiteRootURL']}{$subEmbedDir}/{$videos_id}/{$clean_title}{$get_http}"; - } - return parseVideos($url, $advancedCustom->embedAutoplay, $advancedCustom->embedLoop, $advancedCustom->embedStartMuted, $advancedCustom->embedShowinfo, $advancedCustom->embedControls->value); - } else { - if (empty($advancedCustom->useVideoIDOnSEOLinks)) { - return "{$global['webSiteRootURL']}{$cat}{$subDir}/{$clean_title}{$get_http}"; - } else { - return "{$global['webSiteRootURL']}{$subDir}/{$videos_id}/{$clean_title}{$get_http}"; - } - } + $url = "{$baseURL}/{$clean_title}{$get_http}"; } else { if (!empty($advancedCustom->makeVideosIDHarderToGuess)) { $encryptedVideos_id = '.' . idToHash($videos_id); $videos_id = $encryptedVideos_id; } - if ($embed) { - $url = "{$global['webSiteRootURL']}{$subEmbedDir}/{$videos_id}{$get_http}"; - return parseVideos($url, $advancedCustom->embedAutoplay, $advancedCustom->embedLoop, $advancedCustom->embedStartMuted, $advancedCustom->embedShowinfo, $advancedCustom->embedControls->value); - } else { - return "{$global['webSiteRootURL']}{$subDir}/{$videos_id}{$get_http}"; - } + $url = "{$baseURL}{$get_http}"; } + if ($embed) { + return parseVideos($url, $advancedCustom->embedAutoplay, $advancedCustom->embedLoop, $advancedCustom->embedStartMuted, $advancedCustom->embedShowinfo, $advancedCustom->embedControls->value); + } + return $url; } public static function getPermaLink($videos_id, $embed = false, $get = []) diff --git a/plugin/CustomizeAdvanced/CustomizeAdvanced.php b/plugin/CustomizeAdvanced/CustomizeAdvanced.php index 731d407284..103af562de 100644 --- a/plugin/CustomizeAdvanced/CustomizeAdvanced.php +++ b/plugin/CustomizeAdvanced/CustomizeAdvanced.php @@ -33,7 +33,6 @@ class CustomizeAdvanced extends PluginAbstract { public static function getDataObjectDeprecated() { return array( - 'useVideoIDOnSEOLinks', 'EnableMinifyJS', 'usePreloadLowResolutionImages', 'useFFMPEGToGenerateThumbs', @@ -258,7 +257,6 @@ class CustomizeAdvanced extends PluginAbstract { $obj->usePermalinks = false; self::addDataObjectHelper('usePermalinks', 'Do not show video title on URL', 'This option is not good for SEO, but makes the URL clear'); - $obj->useVideoIDOnSEOLinks = true; $obj->disableAnimatedGif = false; $obj->removeBrowserChannelLinkFromMenu = false; $obj->EnableMinifyJS = false; diff --git a/plugin/Gallery/functions.php b/plugin/Gallery/functions.php index fcea1dae28..73479c3dfb 100644 --- a/plugin/Gallery/functions.php +++ b/plugin/Gallery/functions.php @@ -1,5 +1,5 @@ ShortsCustomTitle)){ #Shorts.carousel { background: #99999922; margin-bottom: 30px; + display: none; } - + #Shorts.carousel.flickity-enabled { + display: block; + } + #Shorts.carousel .flickity-page-dots { bottom: -35px; } diff --git a/view/channelBody.php b/view/channelBody.php index 584aa4dfd5..3ca3a66b1c 100644 --- a/view/channelBody.php +++ b/view/channelBody.php @@ -1,5 +1,6 @@