rx-player 3.29.0-dev.2022091600 → 3.29.0-dev.2022103100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/CHANGELOG.md +22 -10
  2. package/MAINTAINERS.md +2 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/browser_detection.d.ts +4 -1
  5. package/dist/_esm5.processed/compat/browser_detection.js +7 -1
  6. package/dist/_esm5.processed/compat/can_reuse_media_keys.d.ts +12 -0
  7. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +15 -0
  8. package/dist/_esm5.processed/compat/enable_audio_track.d.ts +11 -0
  9. package/dist/_esm5.processed/compat/enable_audio_track.js +26 -0
  10. package/dist/_esm5.processed/compat/index.d.ts +4 -2
  11. package/dist/_esm5.processed/compat/index.js +4 -2
  12. package/dist/_esm5.processed/compat/{should_renew_media_keys.d.ts → should_renew_media_key_system_access.d.ts} +3 -3
  13. package/dist/_esm5.processed/compat/{should_renew_media_keys.js → should_renew_media_key_system_access.js} +3 -3
  14. package/dist/_esm5.processed/config.d.ts +1 -0
  15. package/dist/_esm5.processed/core/api/playback_observer.d.ts +14 -5
  16. package/dist/_esm5.processed/core/api/playback_observer.js +54 -22
  17. package/dist/_esm5.processed/core/api/public_api.d.ts +7 -4
  18. package/dist/_esm5.processed/core/api/public_api.js +79 -61
  19. package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +9 -10
  20. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +1 -1
  21. package/dist/_esm5.processed/core/decrypt/find_key_system.js +3 -3
  22. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +4 -1
  23. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +98 -0
  24. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +173 -0
  25. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +4 -4
  26. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -1
  27. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +15 -16
  28. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -1
  29. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +5 -2
  30. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +103 -0
  31. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +414 -0
  32. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.d.ts +4 -3
  33. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +21 -22
  34. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +18 -4
  35. package/dist/_esm5.processed/core/init/initialize_media_source.js +10 -2
  36. package/dist/_esm5.processed/core/init/load_on_media_source.js +7 -1
  37. package/dist/_esm5.processed/core/init/stall_avoider.js +3 -1
  38. package/dist/_esm5.processed/default_config.d.ts +11 -0
  39. package/dist/_esm5.processed/default_config.js +11 -0
  40. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +1 -1
  41. package/dist/_esm5.processed/manifest/manifest.js +11 -2
  42. package/dist/_esm5.processed/manifest/representation.d.ts +12 -1
  43. package/dist/_esm5.processed/manifest/representation.js +1 -0
  44. package/dist/_esm5.processed/manifest/representation_index/static.d.ts +1 -1
  45. package/dist/_esm5.processed/manifest/representation_index/static.js +2 -2
  46. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +32 -15
  47. package/dist/_esm5.processed/manifest/update_period_in_place.js +1 -0
  48. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +10 -9
  49. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +11 -11
  50. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +1 -1
  51. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +3 -3
  52. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +1 -1
  53. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +4 -4
  54. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +7 -7
  55. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +12 -8
  56. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +5 -6
  57. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +16 -16
  58. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +11 -10
  59. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +14 -13
  60. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.d.ts +3 -4
  61. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +4 -12
  62. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +2 -4
  63. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +1 -3
  64. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +6 -2
  65. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.d.ts +1 -2
  66. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +3 -8
  67. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +1 -1
  68. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +2 -20
  69. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +0 -6
  70. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +0 -11
  71. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +5 -1
  72. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +2 -1
  73. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +2 -2
  74. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +7 -1
  75. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +17 -11
  76. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +2 -2
  77. package/dist/_esm5.processed/parsers/manifest/types.d.ts +24 -0
  78. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +8 -1
  79. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +9 -1
  80. package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +2 -1
  81. package/dist/_esm5.processed/transports/dash/construct_segment_url.d.ts +18 -0
  82. package/dist/_esm5.processed/transports/dash/construct_segment_url.js +21 -0
  83. package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +3 -2
  84. package/dist/_esm5.processed/transports/dash/image_pipelines.js +5 -3
  85. package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -2
  86. package/dist/_esm5.processed/transports/dash/text_loader.js +4 -2
  87. package/dist/_esm5.processed/transports/dash/text_parser.js +3 -1
  88. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +3 -2
  89. package/dist/_esm5.processed/transports/local/segment_loader.js +2 -2
  90. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +8 -8
  91. package/dist/_esm5.processed/transports/smooth/pipelines.js +11 -7
  92. package/dist/_esm5.processed/transports/smooth/utils.d.ts +4 -2
  93. package/dist/_esm5.processed/transports/smooth/utils.js +7 -1
  94. package/dist/_esm5.processed/transports/types.d.ts +5 -3
  95. package/dist/_esm5.processed/utils/event_emitter.d.ts +1 -2
  96. package/dist/_esm5.processed/utils/resolve_url.d.ts +7 -4
  97. package/dist/_esm5.processed/utils/resolve_url.js +11 -8
  98. package/dist/mpd-parser.wasm +0 -0
  99. package/dist/rx-player.js +5656 -13236
  100. package/dist/rx-player.min.js +1 -1
  101. package/jest.config.js +28 -23
  102. package/package.json +29 -29
  103. package/sonar-project.properties +1 -1
  104. package/src/compat/__tests__/can_reuse_media_keys.test.ts +54 -0
  105. package/src/compat/__tests__/enable_audio_track.test.ts +341 -0
  106. package/src/compat/__tests__/{should_renew_media_keys.test.ts → should_renew_media_key_system_access.test.ts} +7 -5
  107. package/src/compat/browser_detection.ts +10 -0
  108. package/src/compat/can_reuse_media_keys.ts +19 -0
  109. package/src/compat/enable_audio_track.ts +33 -0
  110. package/src/compat/index.ts +6 -2
  111. package/src/compat/{should_renew_media_keys.ts → should_renew_media_key_system_access.ts} +3 -3
  112. package/src/core/api/playback_observer.ts +97 -33
  113. package/src/core/api/public_api.ts +126 -74
  114. package/src/core/api/tracks_management/media_element_track_choice_manager.ts +3 -11
  115. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +182 -0
  116. package/src/core/decrypt/__tests__/__global__/utils.ts +2 -0
  117. package/src/core/decrypt/find_key_system.ts +3 -3
  118. package/src/core/decrypt/get_media_keys.ts +5 -1
  119. package/src/core/fetchers/cdn_prioritizer.ts +198 -0
  120. package/src/core/fetchers/manifest/manifest_fetcher.ts +7 -11
  121. package/src/core/fetchers/segment/segment_fetcher.ts +12 -10
  122. package/src/core/fetchers/segment/segment_fetcher_creator.ts +10 -1
  123. package/src/core/fetchers/utils/schedule_request.ts +482 -0
  124. package/src/core/init/content_time_boundaries_observer.ts +12 -12
  125. package/src/core/init/initialize_media_source.ts +31 -4
  126. package/src/core/init/load_on_media_source.ts +11 -2
  127. package/src/core/init/stall_avoider.ts +4 -1
  128. package/src/core/stream/orchestrator/stream_orchestrator.ts +0 -1
  129. package/src/default_config.ts +12 -0
  130. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +1 -0
  131. package/src/manifest/manifest.ts +11 -2
  132. package/src/manifest/representation.ts +15 -0
  133. package/src/manifest/representation_index/__tests__/static.test.ts +1 -1
  134. package/src/manifest/representation_index/static.ts +3 -3
  135. package/src/manifest/representation_index/types.ts +33 -15
  136. package/src/manifest/update_period_in_place.ts +1 -0
  137. package/src/parsers/manifest/dash/common/indexes/base.ts +22 -23
  138. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +6 -4
  139. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +5 -5
  140. package/src/parsers/manifest/dash/common/indexes/list.ts +19 -20
  141. package/src/parsers/manifest/dash/common/indexes/template.ts +23 -27
  142. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +25 -23
  143. package/src/parsers/manifest/dash/common/indexes/tokens.ts +7 -18
  144. package/src/parsers/manifest/dash/common/parse_mpd.ts +2 -4
  145. package/src/parsers/manifest/dash/common/parse_representation_index.ts +1 -6
  146. package/src/parsers/manifest/dash/common/parse_representations.ts +9 -0
  147. package/src/parsers/manifest/dash/common/resolve_base_urls.ts +5 -9
  148. package/src/parsers/manifest/dash/js-parser/node_parsers/BaseURL.ts +2 -29
  149. package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/AdaptationSet.test.ts +7 -11
  150. package/src/parsers/manifest/dash/node_parser_types.ts +0 -7
  151. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +3 -1
  152. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +1 -8
  153. package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +0 -13
  154. package/src/parsers/manifest/dash/wasm-parser/ts/types.ts +8 -0
  155. package/src/parsers/manifest/local/parse_local_manifest.ts +1 -0
  156. package/src/parsers/manifest/local/representation_index.ts +2 -2
  157. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +7 -1
  158. package/src/parsers/manifest/smooth/create_parser.ts +17 -13
  159. package/src/parsers/manifest/smooth/representation_index.ts +2 -2
  160. package/src/parsers/manifest/types.ts +26 -1
  161. package/src/parsers/manifest/utils/__tests__/get_first_time_from_adaptations.test.ts +15 -0
  162. package/src/parsers/manifest/utils/__tests__/get_last_time_from_adaptation.test.ts +15 -0
  163. package/src/parsers/texttracks/ttml/html/apply_extent.ts +8 -1
  164. package/src/parsers/texttracks/ttml/html/apply_origin.ts +9 -1
  165. package/src/parsers/texttracks/ttml/html/create_element.ts +2 -2
  166. package/src/transports/dash/construct_segment_url.ts +28 -0
  167. package/src/transports/dash/image_pipelines.ts +5 -2
  168. package/src/transports/dash/segment_loader.ts +5 -2
  169. package/src/transports/dash/text_loader.ts +5 -2
  170. package/src/transports/dash/text_parser.ts +3 -1
  171. package/src/transports/local/segment_loader.ts +3 -2
  172. package/src/transports/metaplaylist/pipelines.ts +28 -9
  173. package/src/transports/smooth/pipelines.ts +12 -6
  174. package/src/transports/smooth/utils.ts +13 -1
  175. package/src/transports/types.ts +6 -3
  176. package/src/utils/__tests__/event_emitter.test.ts +72 -67
  177. package/src/utils/__tests__/initialization_segment_cache.test.ts +7 -7
  178. package/src/utils/__tests__/resolve_url.test.ts +27 -23
  179. package/src/utils/event_emitter.ts +1 -3
  180. package/src/utils/resolve_url.ts +11 -8
  181. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.d.ts +0 -85
  182. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +0 -264
  183. package/dummy +0 -1
  184. package/src/core/fetchers/utils/try_urls_with_backoff.ts +0 -287
@@ -360,6 +360,17 @@ var DEFAULT_CONFIG = {
360
360
  * @type Number
361
361
  */
362
362
  DEFAULT_MAX_MANIFEST_REQUEST_RETRY: 4,
363
+ /**
364
+ * Default delay, in seconds, during which a CDN will be "downgraded".
365
+ *
366
+ * For example in case of media content being available on multiple CDNs, the
367
+ * RxPlayer may decide that a CDN is less reliable (for example, it returned a
368
+ * server error) and should thus be avoided, at least for some time
369
+ *
370
+ * This value is the amount of time this CDN will be "less considered" than the
371
+ * alternatives.
372
+ */
373
+ DEFAULT_CDN_DOWNGRADE_TIME: 60,
363
374
  /**
364
375
  * The default number of times a segment request will be re-performed when
365
376
  * on error which justify a retry.
@@ -161,7 +161,7 @@ var VideoThumbnailLoader = /** @class */ (function () {
161
161
  var lastRepInfo;
162
162
  if (this._lastRepresentationInfo === null) {
163
163
  var cleaner_1 = new TaskCanceller();
164
- var segmentFetcher = createSegmentFetcher("video", loader.video,
164
+ var segmentFetcher = createSegmentFetcher("video", loader.video, null,
165
165
  // We don't care about the SegmentFetcher's lifecycle events
166
166
  {}, { baseDelay: 0,
167
167
  maxDelay: 0,
@@ -32,6 +32,7 @@ import { MediaError } from "../errors";
32
32
  import arrayFind from "../utils/array_find";
33
33
  import EventEmitter from "../utils/event_emitter";
34
34
  import idGenerator from "../utils/id_generator";
35
+ import { getFilenameIndexInUrl } from "../utils/resolve_url";
35
36
  import warnOnce from "../utils/warn_once";
36
37
  import Adaptation from "./adaptation";
37
38
  import Period from "./period";
@@ -323,14 +324,18 @@ var Manifest = /** @class */ (function (_super) {
323
324
  var mimeType = _a.mimeType, url = _a.url;
324
325
  var adaptationID = "gen-image-ada-" + generateSupplementaryTrackID();
325
326
  var representationID = "gen-image-rep-" + generateSupplementaryTrackID();
327
+ var indexOfFilename = getFilenameIndexInUrl(url);
328
+ var cdnUrl = url.substring(0, indexOfFilename);
329
+ var filename = url.substring(indexOfFilename);
326
330
  var newAdaptation = new Adaptation({ id: adaptationID,
327
331
  type: "image",
328
332
  representations: [{
329
333
  bitrate: 0,
334
+ cdnMetadata: [{ baseUrl: cdnUrl }],
330
335
  id: representationID,
331
336
  mimeType: mimeType,
332
337
  index: new StaticRepresentationIndex({
333
- media: url,
338
+ media: filename,
334
339
  })
335
340
  }] }, { isManuallyAdded: true });
336
341
  if (newAdaptation.representations.length > 0 && !newAdaptation.isSupported) {
@@ -367,6 +372,9 @@ var Manifest = /** @class */ (function (_super) {
367
372
  var langsToMapOn = language != null ? [language] :
368
373
  languages != null ? languages :
369
374
  [];
375
+ var indexOfFilename = getFilenameIndexInUrl(url);
376
+ var cdnUrl = url.substring(0, indexOfFilename);
377
+ var filename = url.substring(indexOfFilename);
370
378
  return allSubs.concat(langsToMapOn.map(function (_language) {
371
379
  var adaptationID = "gen-text-ada-" + generateSupplementaryTrackID();
372
380
  var representationID = "gen-text-rep-" + generateSupplementaryTrackID();
@@ -374,11 +382,12 @@ var Manifest = /** @class */ (function (_super) {
374
382
  type: "text",
375
383
  language: _language, closedCaption: closedCaption, representations: [{
376
384
  bitrate: 0,
385
+ cdnMetadata: [{ baseUrl: cdnUrl }],
377
386
  id: representationID,
378
387
  mimeType: mimeType,
379
388
  codecs: codecs,
380
389
  index: new StaticRepresentationIndex({
381
- media: url,
390
+ media: filename,
382
391
  })
383
392
  }] }, { isManuallyAdded: true });
384
393
  if (newAdaptation.representations.length > 0 && !newAdaptation.isSupported) {
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { IContentProtections, IParsedRepresentation } from "../parsers/manifest";
16
+ import { ICdnMetadata, IContentProtections, IParsedRepresentation } from "../parsers/manifest";
17
17
  import { IHDRInformation } from "../public_types";
18
18
  import { IRepresentationIndex } from "./representation_index";
19
19
  import { IAdaptationType } from "./types";
@@ -29,6 +29,17 @@ declare class Representation {
29
29
  * Representation.
30
30
  */
31
31
  index: IRepresentationIndex;
32
+ /**
33
+ * Information on the CDN(s) on which requests should be done to request this
34
+ * Representation's initialization and media segments.
35
+ *
36
+ * `null` if there's no CDN involved here (e.g. resources are not requested
37
+ * through the network).
38
+ *
39
+ * An empty array means that no CDN are left to request the resource. As such,
40
+ * no resource can be loaded in that situation.
41
+ */
42
+ cdnMetadata: ICdnMetadata[] | null;
32
43
  /** Bitrate this Representation is in, in bits per seconds. */
33
44
  bitrate: number;
34
45
  /**
@@ -46,6 +46,7 @@ var Representation = /** @class */ (function () {
46
46
  if (args.hdrInfo !== undefined) {
47
47
  this.hdrInfo = args.hdrInfo;
48
48
  }
49
+ this.cdnMetadata = args.cdnMetadata;
49
50
  this.index = args.index;
50
51
  this.isSupported = opts.type === "audio" ||
51
52
  opts.type === "video" ?
@@ -23,7 +23,7 @@ export interface IStaticRepresentationIndexInfos {
23
23
  */
24
24
  export default class StaticRepresentationIndex implements IRepresentationIndex {
25
25
  /** URL at which the content is available. */
26
- private readonly _mediaURLs;
26
+ private readonly _url;
27
27
  /**
28
28
  * @param {Object} infos
29
29
  */
@@ -23,7 +23,7 @@ var StaticRepresentationIndex = /** @class */ (function () {
23
23
  * @param {Object} infos
24
24
  */
25
25
  function StaticRepresentationIndex(infos) {
26
- this._mediaURLs = infos.media;
26
+ this._url = infos.media;
27
27
  }
28
28
  /**
29
29
  * Static contents do not have any initialization segments.
@@ -41,7 +41,7 @@ var StaticRepresentationIndex = /** @class */ (function () {
41
41
  return [{ id: "0",
42
42
  isInit: false,
43
43
  number: 0,
44
- mediaURLs: [this._mediaURLs],
44
+ url: this._url,
45
45
  time: 0,
46
46
  end: Number.MAX_VALUE,
47
47
  duration: Number.MAX_VALUE,
@@ -41,7 +41,7 @@ export interface ISmoothInitSegmentPrivateInfos {
41
41
  * Supplementary information specific to Smooth media segments (that is, every
42
42
  * segments but the initialization segment).
43
43
  */
44
- export interface ISmoothSegmentPrivateInfos {
44
+ export interface ISmoothMediaSegmentPrivateInfos {
45
45
  /**
46
46
  * Start time of the segment as announced in the Manifest, in the same
47
47
  * timescale than the one indicated through `ISmoothInitSegmentPrivateInfos`.
@@ -100,23 +100,23 @@ export interface ILocalManifestSegmentPrivateInfos {
100
100
  */
101
101
  export interface IPrivateInfos {
102
102
  /** Smooth-specific information allowing to generate an initialization segment. */
103
- smoothInitSegment?: ISmoothInitSegmentPrivateInfos | undefined;
103
+ smoothInitSegment?: ISmoothInitSegmentPrivateInfos;
104
104
  /** Smooth-specific information linked to all Smooth media segments. */
105
- smoothMediaSegment?: ISmoothSegmentPrivateInfos | undefined;
105
+ smoothMediaSegment?: ISmoothMediaSegmentPrivateInfos;
106
106
  /** Information that should be present on all MetaPlaylist segments. */
107
- metaplaylistInfos?: IMetaPlaylistPrivateInfos | undefined;
107
+ metaplaylistInfos?: IMetaPlaylistPrivateInfos;
108
108
  /**
109
109
  * Local Manifest-specific information allowing to request the
110
110
  * initialization segment.
111
111
  */
112
- localManifestInitSegment?: ILocalManifestInitSegmentPrivateInfos | undefined;
112
+ localManifestInitSegment?: ILocalManifestInitSegmentPrivateInfos;
113
113
  /** Local Manifest-specific information allowing to request any media segment. */
114
- localManifestSegment?: ILocalManifestSegmentPrivateInfos | undefined;
114
+ localManifestSegment?: ILocalManifestSegmentPrivateInfos;
115
115
  /**
116
116
  * Function allowing to know if a given emsg's event name has been
117
117
  * explicitely authorized.
118
118
  */
119
- isEMSGWhitelisted?: ((evt: IEMSG) => boolean) | undefined;
119
+ isEMSGWhitelisted?: ((evt: IEMSG) => boolean);
120
120
  }
121
121
  /** Represent a single Segment from a Representation. */
122
122
  export interface ISegment {
@@ -141,15 +141,10 @@ export interface ISegment {
141
141
  */
142
142
  isInit: boolean;
143
143
  /**
144
- * URLs where this segment is available. From the most to least prioritary.
145
- * `null` if no URL exists.
144
+ * Store supplementary information on a segment that can be later exploited by
145
+ * the transport logic.
146
146
  */
147
- mediaURLs: string[] | null;
148
- /**
149
- * Allows to store supplementary information on a segment that can be later
150
- * exploited by the transport logic.
151
- */
152
- privateInfos: IPrivateInfos | undefined;
147
+ privateInfos: IPrivateInfos;
153
148
  /**
154
149
  * Estimated time, in seconds, at which the concerned segment should be
155
150
  * offseted when decoded.
@@ -211,6 +206,28 @@ export interface ISegment {
211
206
  * generated.
212
207
  */
213
208
  complete: boolean;
209
+ /**
210
+ * Optional relative or absolute URL to load the resource.
211
+ *
212
+ * If the URL is absolute (it contains the scheme at the beginning), it is the
213
+ * complete URL on which the resource should be requested.
214
+ *
215
+ * If the URL is relative (it does not contain a scheme at the beginning), it
216
+ * should be relative to the chosen CDN that should be recuperated through
217
+ * another mean
218
+ *
219
+ * If `null`, it means either:
220
+ *
221
+ * - that there is no way to reach the resource through a URL.
222
+ *
223
+ * - that there may be an URL, but is already communicated through another
224
+ * mean, like the currently chosen CDN.
225
+ *
226
+ * An empty string is equivalent to indicating that the chosen CDN's URL
227
+ * should be directly requested instead.
228
+ * In that way, it is equivalent to setting it to `null`.
229
+ */
230
+ url: string | null;
214
231
  /**
215
232
  * Optional byte range to retrieve the Segment from its URL(s).
216
233
  * TODO this should probably moved to `privateInfos` as this is
@@ -48,6 +48,7 @@ export default function updatePeriodInPlace(oldPeriod, newPeriod, updateType) {
48
48
  "not found when merging.");
49
49
  }
50
50
  else {
51
+ oldRepresentation.cdnMetadata = newRepresentation.cdnMetadata;
51
52
  if (updateType === MANIFEST_UPDATE_TYPE.Full) {
52
53
  oldRepresentation.index._replace(newRepresentation.index);
53
54
  }
@@ -16,7 +16,6 @@
16
16
  import { IRepresentationIndex, ISegment } from "../../../../../manifest";
17
17
  import { IEMSG } from "../../../../containers/isobmff";
18
18
  import { IIndexSegment } from "../../../utils/index_helpers";
19
- import { IResolvedBaseUrl } from "../resolve_base_urls";
20
19
  /**
21
20
  * Index property defined for a SegmentBase RepresentationIndex
22
21
  * This object contains every property needed to generate an ISegment for a
@@ -39,17 +38,21 @@ export interface IBaseIndex {
39
38
  */
40
39
  indexTimeOffset: number;
41
40
  /** Information on the initialization segment. */
42
- initialization?: {
43
- /** URLs to access the initialization segment. */
44
- mediaURLs: string[] | null;
41
+ initialization: {
42
+ /**
43
+ * URL path, to add to the wanted CDN, to access the initialization segment.
44
+ * `null` if no URL exists.
45
+ */
46
+ url: string | null;
45
47
  /** possible byte range to request it. */
46
48
  range?: [number, number] | undefined;
47
49
  } | undefined;
48
50
  /**
49
- * Base URL(s) to access any segment. Can contain tokens to replace to convert
50
- * it to real URLs.
51
+ * URL base to access any segment.
52
+ * Can contain token to replace to convert it to real URLs.
53
+ * `null` if no URL exists.
51
54
  */
52
- mediaURLs: string[] | null;
55
+ segmentUrlTemplate: string | null;
53
56
  /** Number from which the first segments in this index starts with. */
54
57
  startNumber?: number | undefined;
55
58
  /** Every segments defined in this index. */
@@ -97,8 +100,6 @@ export interface IBaseIndexContextArgument {
97
100
  periodStart: number;
98
101
  /** End of the period concerned by this RepresentationIndex, in seconds. */
99
102
  periodEnd: number | undefined;
100
- /** Base URL for the Representation concerned. */
101
- representationBaseURLs: IResolvedBaseUrl[];
102
103
  /** ID of the Representation concerned. */
103
104
  representationId?: string | undefined;
104
105
  /** Bitrate of the Representation concerned. */
@@ -17,7 +17,7 @@ import log from "../../../../../log";
17
17
  import { fromIndexTime, getIndexSegmentEnd, toIndexTime, } from "../../../utils/index_helpers";
18
18
  import getInitSegment from "./get_init_segment";
19
19
  import getSegmentsFromTimeline from "./get_segments_from_timeline";
20
- import { createIndexURLs } from "./tokens";
20
+ import { constructRepresentationUrl } from "./tokens";
21
21
  /**
22
22
  * Add a new segment to the index.
23
23
  *
@@ -54,16 +54,18 @@ var BaseRepresentationIndex = /** @class */ (function () {
54
54
  * @param {Object} context
55
55
  */
56
56
  function BaseRepresentationIndex(index, context) {
57
- var _a, _b;
58
- var periodStart = context.periodStart, periodEnd = context.periodEnd, representationBaseURLs = context.representationBaseURLs, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
57
+ var _a, _b, _c;
58
+ var periodStart = context.periodStart, periodEnd = context.periodEnd, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
59
59
  var timescale = (_a = index.timescale) !== null && _a !== void 0 ? _a : 1;
60
60
  var presentationTimeOffset = index.presentationTimeOffset != null ?
61
61
  index.presentationTimeOffset : 0;
62
62
  var indexTimeOffset = presentationTimeOffset - periodStart * timescale;
63
- var urlSources = representationBaseURLs.map(function (b) { return b.url; });
64
- var mediaURLs = createIndexURLs(urlSources, index.initialization !== undefined ?
65
- index.initialization.media :
66
- undefined, representationId, representationBitrate);
63
+ var initializationUrl = ((_b = index.initialization) === null || _b === void 0 ? void 0 : _b.media) === undefined ?
64
+ null :
65
+ constructRepresentationUrl(index.initialization.media, representationId, representationBitrate);
66
+ var segmentUrlTemplate = index.media === undefined ?
67
+ null :
68
+ constructRepresentationUrl(index.media, representationId, representationBitrate);
67
69
  // TODO If indexRange is either undefined or behind the initialization segment
68
70
  // the following logic will not work.
69
71
  // However taking the nth first bytes like `dash.js` does (where n = 1500) is
@@ -73,10 +75,8 @@ var BaseRepresentationIndex = /** @class */ (function () {
73
75
  var range = index.initialization !== undefined ? index.initialization.range :
74
76
  index.indexRange !== undefined ? [0, index.indexRange[0] - 1] :
75
77
  undefined;
76
- this._index = { indexRange: index.indexRange, indexTimeOffset: indexTimeOffset, initialization: { mediaURLs: mediaURLs, range: range },
77
- mediaURLs: createIndexURLs(urlSources, index.media, representationId, representationBitrate),
78
- startNumber: index.startNumber,
79
- timeline: (_b = index.timeline) !== null && _b !== void 0 ? _b : [], timescale: timescale };
78
+ this._index = { indexRange: index.indexRange, indexTimeOffset: indexTimeOffset, initialization: { url: initializationUrl, range: range }, segmentUrlTemplate: segmentUrlTemplate, startNumber: index.startNumber,
79
+ timeline: (_c = index.timeline) !== null && _c !== void 0 ? _c : [], timescale: timescale };
80
80
  this._scaledPeriodStart = toIndexTime(periodStart, this._index);
81
81
  this._scaledPeriodEnd = periodEnd == null ? undefined :
82
82
  toIndexTime(periodEnd, this._index);
@@ -24,7 +24,7 @@ import { IEMSG } from "../../../../containers/isobmff";
24
24
  export default function getInitSegment(index: {
25
25
  timescale: number;
26
26
  initialization?: {
27
- mediaURLs: string[] | null;
27
+ url: string | null;
28
28
  range?: [number, number] | undefined;
29
29
  } | undefined;
30
30
  indexRange?: [number, number] | undefined;
@@ -22,9 +22,9 @@
22
22
  export default function getInitSegment(index, isEMSGWhitelisted) {
23
23
  var _a;
24
24
  var initialization = index.initialization;
25
- var privateInfos;
25
+ var privateInfos = {};
26
26
  if (isEMSGWhitelisted !== undefined) {
27
- privateInfos = { isEMSGWhitelisted: isEMSGWhitelisted };
27
+ privateInfos.isEMSGWhitelisted = isEMSGWhitelisted;
28
28
  }
29
29
  return { id: "init",
30
30
  isInit: true,
@@ -35,6 +35,6 @@ export default function getInitSegment(index, isEMSGWhitelisted) {
35
35
  range: initialization != null ? initialization.range :
36
36
  undefined,
37
37
  indexRange: index.indexRange,
38
- mediaURLs: (_a = initialization === null || initialization === void 0 ? void 0 : initialization.mediaURLs) !== null && _a !== void 0 ? _a : null,
38
+ url: (_a = initialization === null || initialization === void 0 ? void 0 : initialization.url) !== null && _a !== void 0 ? _a : null,
39
39
  complete: true, privateInfos: privateInfos, timestampOffset: -(index.indexTimeOffset / index.timescale) };
40
40
  }
@@ -27,7 +27,7 @@ import { IIndexSegment } from "../../../utils/index_helpers";
27
27
  */
28
28
  export default function getSegmentsFromTimeline(index: {
29
29
  availabilityTimeComplete?: boolean | undefined;
30
- mediaURLs: string[] | null;
30
+ segmentUrlTemplate: string | null;
31
31
  startNumber?: number | undefined;
32
32
  timeline: IIndexSegment[];
33
33
  timescale: number;
@@ -41,7 +41,7 @@ function getWantedRepeatIndex(segmentStartTime, segmentDuration, wantedTime) {
41
41
  export default function getSegmentsFromTimeline(index, from, durationWanted, isEMSGWhitelisted, maximumTime) {
42
42
  var scaledUp = toIndexTime(from, index);
43
43
  var scaledTo = toIndexTime(from + durationWanted, index);
44
- var timeline = index.timeline, timescale = index.timescale, mediaURLs = index.mediaURLs, startNumber = index.startNumber;
44
+ var timeline = index.timeline, timescale = index.timescale, segmentUrlTemplate = index.segmentUrlTemplate, startNumber = index.startNumber;
45
45
  var currentNumber = startNumber !== null && startNumber !== void 0 ? startNumber : 1;
46
46
  var segments = [];
47
47
  var timelineLength = timeline.length;
@@ -56,9 +56,9 @@ export default function getSegmentsFromTimeline(index, from, durationWanted, isE
56
56
  var segmentTime = start + segmentNumberInCurrentRange * duration;
57
57
  while (segmentTime < scaledTo && segmentNumberInCurrentRange <= repeat) {
58
58
  var segmentNumber = currentNumber + segmentNumberInCurrentRange;
59
- var detokenizedURLs = mediaURLs === null ?
59
+ var detokenizedURL = segmentUrlTemplate === null ?
60
60
  null :
61
- mediaURLs.map(createDashUrlDetokenizer(segmentTime, segmentNumber));
61
+ createDashUrlDetokenizer(segmentTime, segmentNumber)(segmentUrlTemplate);
62
62
  var time = segmentTime - index.indexTimeOffset;
63
63
  var realDuration = duration;
64
64
  if (time < 0) {
@@ -70,7 +70,7 @@ export default function getSegmentsFromTimeline(index, from, durationWanted, isE
70
70
  end: (time + realDuration) / timescale,
71
71
  duration: realDuration / timescale,
72
72
  isInit: false, range: range, timescale: 1,
73
- mediaURLs: detokenizedURLs,
73
+ url: detokenizedURL,
74
74
  number: segmentNumber,
75
75
  timestampOffset: -(index.indexTimeOffset / timescale), complete: complete, privateInfos: { isEMSGWhitelisted: isEMSGWhitelisted } };
76
76
  segments.push(segment);
@@ -1,6 +1,5 @@
1
1
  import { IRepresentationIndex, ISegment } from "../../../../../manifest";
2
2
  import { IEMSG } from "../../../../containers/isobmff";
3
- import { IResolvedBaseUrl } from "../resolve_base_urls";
4
3
  /**
5
4
  * Index property defined for a SegmentList RepresentationIndex
6
5
  * This object contains every property needed to generate an ISegment for a
@@ -29,18 +28,21 @@ export interface IListIndex {
29
28
  indexTimeOffset: number;
30
29
  /** Information on the initialization segment. */
31
30
  initialization?: {
32
- /** URLs to access the initialization segment. */
33
- mediaURLs: string[] | null;
31
+ /**
32
+ * URL path, to add to the wanted CDN, to access the initialization segment.
33
+ * `null` if no URL exists.
34
+ */
35
+ url: string | null;
34
36
  /** possible byte range to request it. */
35
37
  range?: [number, number] | undefined;
36
38
  } | undefined;
37
39
  /** Information on the list of segments for this index. */
38
40
  list: Array<{
39
41
  /**
40
- * URLs of the segment.
42
+ * URL path, to add to the wanted CDN, to access this media segment.
41
43
  * `null` if no URL exists.
42
44
  */
43
- mediaURLs: string[] | null;
45
+ url: string | null;
44
46
  /** Possible byte-range of the segment. */
45
47
  mediaRange?: [number, number] | undefined;
46
48
  }>;
@@ -89,8 +91,6 @@ export interface IListIndexContextArgument {
89
91
  periodStart: number;
90
92
  /** End of the period concerned by this RepresentationIndex, in seconds. */
91
93
  periodEnd: number | undefined;
92
- /** Base URL for the Representation concerned. */
93
- representationBaseURLs: IResolvedBaseUrl[];
94
94
  /** ID of the Representation concerned. */
95
95
  representationId?: string | undefined;
96
96
  /** Bitrate of the Representation concerned. */
@@ -16,18 +16,18 @@
16
16
  import log from "../../../../../log";
17
17
  import { getTimescaledRange } from "../../../utils/index_helpers";
18
18
  import getInitSegment from "./get_init_segment";
19
- import { createIndexURLs } from "./tokens";
19
+ import { constructRepresentationUrl } from "./tokens";
20
20
  var ListRepresentationIndex = /** @class */ (function () {
21
21
  /**
22
22
  * @param {Object} index
23
23
  * @param {Object} context
24
24
  */
25
25
  function ListRepresentationIndex(index, context) {
26
- var _a;
26
+ var _a, _b;
27
27
  if (index.duration === undefined) {
28
28
  throw new Error("Invalid SegmentList: no duration");
29
29
  }
30
- var periodStart = context.periodStart, periodEnd = context.periodEnd, representationBaseURLs = context.representationBaseURLs, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
30
+ var periodStart = context.periodStart, periodEnd = context.periodEnd, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
31
31
  this._isEMSGWhitelisted = isEMSGWhitelisted;
32
32
  this._periodStart = periodStart;
33
33
  this._periodEnd = periodEnd;
@@ -35,15 +35,19 @@ var ListRepresentationIndex = /** @class */ (function () {
35
35
  0;
36
36
  var timescale = (_a = index.timescale) !== null && _a !== void 0 ? _a : 1;
37
37
  var indexTimeOffset = presentationTimeOffset - periodStart * timescale;
38
- var urlSources = representationBaseURLs.map(function (b) { return b.url; });
38
+ var initializationUrl = ((_b = index.initialization) === null || _b === void 0 ? void 0 : _b.media) === undefined ?
39
+ null :
40
+ constructRepresentationUrl(index.initialization.media, representationId, representationBitrate);
39
41
  var list = index.list.map(function (lItem) { return ({
40
- mediaURLs: createIndexURLs(urlSources, lItem.media, representationId, representationBitrate),
42
+ url: lItem.media === undefined ?
43
+ null :
44
+ constructRepresentationUrl(lItem.media, representationId, representationBitrate),
41
45
  mediaRange: lItem.mediaRange
42
46
  }); });
43
47
  this._index = { list: list, timescale: timescale, duration: index.duration, indexTimeOffset: indexTimeOffset, indexRange: index.indexRange,
44
48
  initialization: index.initialization == null ?
45
49
  undefined :
46
- { mediaURLs: createIndexURLs(urlSources, index.initialization.media, representationId, representationBitrate),
50
+ { url: initializationUrl,
47
51
  range: index.initialization.range } };
48
52
  }
49
53
  /**
@@ -74,11 +78,11 @@ var ListRepresentationIndex = /** @class */ (function () {
74
78
  var i = Math.floor(up / duration);
75
79
  while (i <= length) {
76
80
  var range = list[i].mediaRange;
77
- var mediaURLs = list[i].mediaURLs;
81
+ var url = list[i].url;
78
82
  var time = i * durationInSeconds + this._periodStart;
79
83
  var segment = { id: String(i), time: time, isInit: false, range: range, duration: durationInSeconds,
80
84
  timescale: 1,
81
- end: time + durationInSeconds, mediaURLs: mediaURLs, timestampOffset: -(index.indexTimeOffset / timescale),
85
+ end: time + durationInSeconds, url: url, timestampOffset: -(index.indexTimeOffset / timescale),
82
86
  complete: true,
83
87
  privateInfos: { isEMSGWhitelisted: this._isEMSGWhitelisted } };
84
88
  segments.push(segment);
@@ -16,7 +16,6 @@
16
16
  import { IRepresentationIndex, ISegment } from "../../../../../manifest";
17
17
  import { IEMSG } from "../../../../containers/isobmff";
18
18
  import ManifestBoundsCalculator from "../manifest_bounds_calculator";
19
- import { IResolvedBaseUrl } from "../resolve_base_urls";
20
19
  /**
21
20
  * Index property defined for a SegmentTemplate RepresentationIndex
22
21
  * This object contains every property needed to generate an ISegment for a
@@ -38,8 +37,10 @@ export interface ITemplateIndex {
38
37
  indexRange?: [number, number] | undefined;
39
38
  /** Information on the initialization segment. */
40
39
  initialization?: {
41
- /** URLs to access the initialization segment. */
42
- mediaURLs: string[] | null;
40
+ /**
41
+ * URL path, to add to the wanted CDN, to access the initialization segment.
42
+ */
43
+ url: string | null;
43
44
  /** possible byte range to request it. */
44
45
  range?: [number, number] | undefined;
45
46
  } | undefined;
@@ -48,7 +49,7 @@ export interface ITemplateIndex {
48
49
  * Can contain token to replace to convert it to real URLs.
49
50
  * `null` if no URL exists.
50
51
  */
51
- mediaURLs: string[] | null;
52
+ url: string | null;
52
53
  /**
53
54
  * Temporal offset, in the current timescale (see timescale), to add to the
54
55
  * presentation time (time a segment has at decoding time) to obtain the
@@ -109,8 +110,6 @@ export interface ITemplateIndexContextArgument {
109
110
  periodEnd: number | undefined;
110
111
  /** Whether the corresponding Manifest can be updated and changed. */
111
112
  isDynamic: boolean;
112
- /** Base URL for the Representation concerned. */
113
- representationBaseURLs: IResolvedBaseUrl[];
114
113
  /** ID of the Representation concerned. */
115
114
  representationId?: string | undefined;
116
115
  /** Bitrate of the Representation concerned. */
@@ -16,7 +16,7 @@
16
16
  import config from "../../../../../config";
17
17
  import assert from "../../../../../utils/assert";
18
18
  import getInitSegment from "./get_init_segment";
19
- import { createDashUrlDetokenizer, createIndexURLs, } from "./tokens";
19
+ import { createDashUrlDetokenizer, constructRepresentationUrl, } from "./tokens";
20
20
  import { getSegmentTimeRoundingError } from "./utils";
21
21
  /**
22
22
  * IRepresentationIndex implementation for DASH' SegmentTemplate without a
@@ -29,15 +29,10 @@ var TemplateRepresentationIndex = /** @class */ (function () {
29
29
  * @param {Object} context
30
30
  */
31
31
  function TemplateRepresentationIndex(index, context) {
32
- var _a;
33
- var aggressiveMode = context.aggressiveMode, availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.periodEnd, periodStart = context.periodStart, representationBaseURLs = context.representationBaseURLs, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
32
+ var _a, _b;
33
+ var aggressiveMode = context.aggressiveMode, availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.periodEnd, periodStart = context.periodStart, representationId = context.representationId, representationBitrate = context.representationBitrate, isEMSGWhitelisted = context.isEMSGWhitelisted;
34
34
  var timescale = (_a = index.timescale) !== null && _a !== void 0 ? _a : 1;
35
- var minBaseUrlAto = representationBaseURLs.length === 0 ?
36
- 0 :
37
- representationBaseURLs.reduce(function (acc, rbu) {
38
- return Math.min(acc, rbu.availabilityTimeOffset);
39
- }, Infinity);
40
- this._availabilityTimeOffset = availabilityTimeOffset + minBaseUrlAto;
35
+ this._availabilityTimeOffset = availabilityTimeOffset;
41
36
  this._manifestBoundsCalculator = manifestBoundsCalculator;
42
37
  this._aggressiveMode = aggressiveMode;
43
38
  var presentationTimeOffset = index.presentationTimeOffset != null ?
@@ -48,12 +43,17 @@ var TemplateRepresentationIndex = /** @class */ (function () {
48
43
  if (index.duration === undefined) {
49
44
  throw new Error("Invalid SegmentTemplate: no duration");
50
45
  }
51
- var urlSources = representationBaseURLs.map(function (b) { return b.url; });
46
+ var initializationUrl = ((_b = index.initialization) === null || _b === void 0 ? void 0 : _b.media) === undefined ?
47
+ null :
48
+ constructRepresentationUrl(index.initialization.media, representationId, representationBitrate);
49
+ var segmentUrlTemplate = index.media === undefined ?
50
+ null :
51
+ constructRepresentationUrl(index.media, representationId, representationBitrate);
52
52
  this._index = { duration: index.duration, timescale: timescale, indexRange: index.indexRange, indexTimeOffset: indexTimeOffset, initialization: index.initialization == null ?
53
53
  undefined :
54
- { mediaURLs: createIndexURLs(urlSources, index.initialization.media, representationId, representationBitrate),
54
+ { url: initializationUrl,
55
55
  range: index.initialization.range },
56
- mediaURLs: createIndexURLs(urlSources, index.media, representationId, representationBitrate), presentationTimeOffset: presentationTimeOffset, startNumber: index.startNumber };
56
+ url: segmentUrlTemplate, presentationTimeOffset: presentationTimeOffset, startNumber: index.startNumber };
57
57
  this._isDynamic = isDynamic;
58
58
  this._periodStart = periodStart;
59
59
  this._scaledRelativePeriodEnd = periodEnd === undefined ?
@@ -75,7 +75,7 @@ var TemplateRepresentationIndex = /** @class */ (function () {
75
75
  */
76
76
  TemplateRepresentationIndex.prototype.getSegments = function (fromTime, dur) {
77
77
  var index = this._index;
78
- var duration = index.duration, startNumber = index.startNumber, timescale = index.timescale, mediaURLs = index.mediaURLs;
78
+ var duration = index.duration, startNumber = index.startNumber, timescale = index.timescale, url = index.url;
79
79
  var scaledStart = this._periodStart * timescale;
80
80
  var scaledEnd = this._scaledRelativePeriodEnd;
81
81
  // Convert the asked position to the right timescales, and consider them
@@ -107,9 +107,9 @@ var TemplateRepresentationIndex = /** @class */ (function () {
107
107
  duration;
108
108
  var realTime = timeFromPeriodStart + scaledStart;
109
109
  var manifestTime = timeFromPeriodStart + this._index.presentationTimeOffset;
110
- var detokenizedURLs = mediaURLs === null ?
110
+ var detokenizedURL = url === null ?
111
111
  null :
112
- mediaURLs.map(createDashUrlDetokenizer(manifestTime, realNumber));
112
+ createDashUrlDetokenizer(manifestTime, realNumber)(url);
113
113
  var args = { id: String(realNumber),
114
114
  number: realNumber,
115
115
  time: realTime / timescale,
@@ -118,7 +118,7 @@ var TemplateRepresentationIndex = /** @class */ (function () {
118
118
  timescale: 1,
119
119
  isInit: false,
120
120
  scaledDuration: realDuration / timescale,
121
- mediaURLs: detokenizedURLs,
121
+ url: detokenizedURL,
122
122
  timestampOffset: -(index.indexTimeOffset / timescale),
123
123
  complete: true,
124
124
  privateInfos: {