/*! @license * Shaka Player * Copyright 2016 Google LLC * SPDX-License-Identifier: Apache-2.0 */ goog.provide('shaka.hls.HlsParser'); goog.require('goog.Uri'); goog.require('goog.asserts'); goog.require('shaka.abr.Ewma'); goog.require('shaka.hls.ManifestTextParser'); goog.require('shaka.hls.Playlist'); goog.require('shaka.hls.PlaylistType'); goog.require('shaka.hls.Tag'); goog.require('shaka.hls.Utils'); goog.require('shaka.log'); goog.require('shaka.media.DrmEngine'); goog.require('shaka.media.InitSegmentReference'); goog.require('shaka.media.ManifestParser'); goog.require('shaka.media.PresentationTimeline'); goog.require('shaka.media.SegmentIndex'); goog.require('shaka.media.SegmentReference'); goog.require('shaka.net.DataUriPlugin'); goog.require('shaka.net.NetworkingEngine'); goog.require('shaka.util.ArrayUtils'); goog.require('shaka.util.BufferUtils'); goog.require('shaka.util.ContentSteeringManager'); goog.require('shaka.util.Error'); goog.require('shaka.util.FakeEvent'); goog.require('shaka.util.LanguageUtils'); goog.require('shaka.util.ManifestParserUtils'); goog.require('shaka.util.MimeUtils'); goog.require('shaka.util.Networking'); goog.require('shaka.util.OperationManager'); goog.require('shaka.util.Pssh'); goog.require('shaka.media.SegmentUtils'); goog.require('shaka.util.Timer'); goog.require('shaka.util.TXml'); goog.require('shaka.util.Platform'); goog.require('shaka.util.Uint8ArrayUtils'); goog.requireType('shaka.hls.Segment'); /** * HLS parser. * * @implements {shaka.extern.ManifestParser} * @export */ shaka.hls.HlsParser = class { /** * Creates an Hls Parser object. */ constructor() { /** @private {?shaka.extern.ManifestParser.PlayerInterface} */ this.playerInterface_ = null; /** @private {?shaka.extern.ManifestConfiguration} */ this.config_ = null; /** @private {number} */ this.globalId_ = 1; /** @private {!Map.} */ this.globalVariables_ = new Map(); /** * A map from group id to stream infos created from the media tags. * @private {!Map.>} */ this.groupIdToStreamInfosMap_ = new Map(); /** * For media playlist lazy-loading to work in livestreams, we have to assume * that each stream of a type (video, audio, etc) has the same mappings of * sequence number to start time. * This map stores those relationships. * Only used during livestreams; we do not assume that VOD content is * aligned in that way. * @private {!Map.>} */ this.mediaSequenceToStartTimeByType_ = new Map(); // Set initial maps. const ContentType = shaka.util.ManifestParserUtils.ContentType; this.mediaSequenceToStartTimeByType_.set(ContentType.VIDEO, new Map()); this.mediaSequenceToStartTimeByType_.set(ContentType.AUDIO, new Map()); this.mediaSequenceToStartTimeByType_.set(ContentType.TEXT, new Map()); this.mediaSequenceToStartTimeByType_.set(ContentType.IMAGE, new Map()); /** * The values are strings of the form "