diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 26801b272b..95227eb47d 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -71,6 +71,24 @@ shaka.hls.HlsParser = class { */ 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 "