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
@@ -19,7 +19,6 @@ import { IEMSG } from "../../../../../containers/isobmff";
19
19
  import { IIndexSegment } from "../../../../utils/index_helpers";
20
20
  import { ISegmentTimelineElement } from "../../../node_parser_types";
21
21
  import ManifestBoundsCalculator from "../../manifest_bounds_calculator";
22
- import { IResolvedBaseUrl } from "../../resolve_base_urls";
23
22
  /**
24
23
  * Index property defined for a SegmentTimeline RepresentationIndex
25
24
  * This object contains every property needed to generate an ISegment for a
@@ -45,16 +44,22 @@ export interface ITimelineIndex {
45
44
  indexTimeOffset: number;
46
45
  /** Information on the initialization segment. */
47
46
  initialization?: {
48
- /** URLs to access the initialization segment. */
49
- mediaURLs: string[] | null;
47
+ /**
48
+ * URL path, to add to the wanted CDN, to access the initialization segment.
49
+ * `null` if no URL exists.
50
+ */
51
+ url: string | null;
50
52
  /** possible byte range to request it. */
51
53
  range?: [number, number] | undefined;
52
54
  } | undefined;
53
55
  /**
54
- * Base URL(s) to access any segment. Can contain tokens to replace to convert
55
- * it to real URLs.
56
+ * Template for the URL suffix (to concatenate to the wanted CDN), to access any
57
+ * media segment.
58
+ * Can contain tokens to replace to convert it to real URLs.
59
+ *
60
+ * `null` if no URL exists.
56
61
  */
57
- mediaURLs: string[] | null;
62
+ segmentUrlTemplate: string | null;
58
63
  /** Number from which the first segments in this index starts with. */
59
64
  startNumber?: number | undefined;
60
65
  /**
@@ -130,8 +135,6 @@ export interface ITimelineIndexContextArgument {
130
135
  * index was received
131
136
  */
132
137
  receivedTime?: number | undefined;
133
- /** Base URL for the Representation concerned. */
134
- representationBaseURLs: IResolvedBaseUrl[];
135
138
  /** ID of the Representation concerned. */
136
139
  representationId?: string | undefined;
137
140
  /** Bitrate of the Representation concerned. */
@@ -208,8 +211,6 @@ export default class TimelineRepresentationIndex implements IRepresentationIndex
208
211
  getSegments(from: number, duration: number): ISegment[];
209
212
  /**
210
213
  * Returns true if the index should be refreshed.
211
- * @param {Number} _up
212
- * @param {Number} to
213
214
  * @returns {Boolean}
214
215
  */
215
216
  shouldRefresh(): false;
@@ -23,7 +23,7 @@ import isSegmentStillAvailable from "../../../../utils/is_segment_still_availabl
23
23
  import updateSegmentTimeline from "../../../../utils/update_segment_timeline";
24
24
  import getInitSegment from "../get_init_segment";
25
25
  import getSegmentsFromTimeline from "../get_segments_from_timeline";
26
- import { createIndexURLs } from "../tokens";
26
+ import { constructRepresentationUrl } from "../tokens";
27
27
  import { getSegmentTimeRoundingError } from "../utils";
28
28
  import constructTimelineFromElements from "./construct_timeline_from_elements";
29
29
  // eslint-disable-next-line max-len
@@ -34,12 +34,12 @@ var TimelineRepresentationIndex = /** @class */ (function () {
34
34
  * @param {Object} context
35
35
  */
36
36
  function TimelineRepresentationIndex(index, context) {
37
- var _a, _b, _c;
37
+ var _a, _b, _c, _d;
38
38
  if (!TimelineRepresentationIndex.isTimelineIndexArgument(index)) {
39
39
  throw new Error("The given index is not compatible with a " +
40
40
  "TimelineRepresentationIndex.");
41
41
  }
42
- var availabilityTimeComplete = context.availabilityTimeComplete, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, isLastPeriod = context.isLastPeriod, representationBaseURLs = context.representationBaseURLs, representationId = context.representationId, representationBitrate = context.representationBitrate, periodStart = context.periodStart, periodEnd = context.periodEnd, isEMSGWhitelisted = context.isEMSGWhitelisted;
42
+ var availabilityTimeComplete = context.availabilityTimeComplete, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, isLastPeriod = context.isLastPeriod, representationId = context.representationId, representationBitrate = context.representationBitrate, periodStart = context.periodStart, periodEnd = context.periodEnd, isEMSGWhitelisted = context.isEMSGWhitelisted;
43
43
  var timescale = (_a = index.timescale) !== null && _a !== void 0 ? _a : 1;
44
44
  var presentationTimeOffset = index.presentationTimeOffset != null ?
45
45
  index.presentationTimeOffset :
@@ -64,16 +64,19 @@ var TimelineRepresentationIndex = /** @class */ (function () {
64
64
  }
65
65
  this._isDynamic = isDynamic;
66
66
  this._parseTimeline = (_b = index.timelineParser) !== null && _b !== void 0 ? _b : null;
67
- var urlSources = representationBaseURLs.map(function (b) { return b.url; });
67
+ var initializationUrl = ((_c = index.initialization) === null || _c === void 0 ? void 0 : _c.media) === undefined ?
68
+ null :
69
+ constructRepresentationUrl(index.initialization.media, representationId, representationBitrate);
70
+ var segmentUrlTemplate = index.media === undefined ?
71
+ null :
72
+ constructRepresentationUrl(index.media, representationId, representationBitrate);
68
73
  this._index = { availabilityTimeComplete: availabilityTimeComplete, indexRange: index.indexRange, indexTimeOffset: indexTimeOffset, initialization: index.initialization == null ?
69
74
  undefined :
70
75
  {
71
- mediaURLs: createIndexURLs(urlSources, index.initialization.media, representationId, representationBitrate),
76
+ url: initializationUrl,
72
77
  range: index.initialization.range,
73
- },
74
- mediaURLs: createIndexURLs(urlSources, index.media, representationId, representationBitrate),
75
- startNumber: index.startNumber,
76
- timeline: (_c = index.timeline) !== null && _c !== void 0 ? _c : null, timescale: timescale };
78
+ }, segmentUrlTemplate: segmentUrlTemplate, startNumber: index.startNumber,
79
+ timeline: (_d = index.timeline) !== null && _d !== void 0 ? _d : null, timescale: timescale };
77
80
  this._scaledPeriodStart = toIndexTime(periodStart, this._index);
78
81
  this._scaledPeriodEnd = periodEnd === undefined ? undefined :
79
82
  toIndexTime(periodEnd, this._index);
@@ -97,13 +100,11 @@ var TimelineRepresentationIndex = /** @class */ (function () {
97
100
  this._index.timeline = this._getTimeline();
98
101
  }
99
102
  // destructuring to please TypeScript
100
- var _a = this._index, mediaURLs = _a.mediaURLs, startNumber = _a.startNumber, timeline = _a.timeline, timescale = _a.timescale, indexTimeOffset = _a.indexTimeOffset;
101
- return getSegmentsFromTimeline({ mediaURLs: mediaURLs, startNumber: startNumber, timeline: timeline, timescale: timescale, indexTimeOffset: indexTimeOffset }, from, duration, this._isEMSGWhitelisted, this._scaledPeriodEnd);
103
+ var _a = this._index, segmentUrlTemplate = _a.segmentUrlTemplate, startNumber = _a.startNumber, timeline = _a.timeline, timescale = _a.timescale, indexTimeOffset = _a.indexTimeOffset;
104
+ return getSegmentsFromTimeline({ segmentUrlTemplate: segmentUrlTemplate, startNumber: startNumber, timeline: timeline, timescale: timescale, indexTimeOffset: indexTimeOffset }, from, duration, this._isEMSGWhitelisted, this._scaledPeriodEnd);
102
105
  };
103
106
  /**
104
107
  * Returns true if the index should be refreshed.
105
- * @param {Number} _up
106
- * @param {Number} to
107
108
  * @returns {Boolean}
108
109
  */
109
110
  TimelineRepresentationIndex.prototype.shouldRefresh = function () {
@@ -14,13 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
- * @param {string} baseURLs
18
- * @param {string|undefined} media
19
- * @param {string|undefined} id
17
+ * @param {string} urlTemplate
18
+ * @param {string|undefined} representationId
20
19
  * @param {number|undefined} bitrate
21
20
  * @returns {string}
22
21
  */
23
- export declare function createIndexURLs(baseURLs: string[], media?: string, id?: string, bitrate?: number): string[] | null;
22
+ export declare function constructRepresentationUrl(urlTemplate: string, representationId?: string, bitrate?: number): string;
24
23
  /**
25
24
  * Replace "tokens" written in a given path (e.g. $RepresentationID$) by the corresponding
26
25
  * infos, taken from the given segment.
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import isNonEmptyString from "../../../../../utils/is_non_empty_string";
17
- import resolveURL from "../../../../../utils/resolve_url";
18
17
  /**
19
18
  * Pad with 0 in the left of the given n argument to reach l length
20
19
  * @param {Number|string} n
@@ -41,20 +40,13 @@ function processFormatedToken(replacer) {
41
40
  };
42
41
  }
43
42
  /**
44
- * @param {string} baseURLs
45
- * @param {string|undefined} media
46
- * @param {string|undefined} id
43
+ * @param {string} urlTemplate
44
+ * @param {string|undefined} representationId
47
45
  * @param {number|undefined} bitrate
48
46
  * @returns {string}
49
47
  */
50
- export function createIndexURLs(baseURLs, media, id, bitrate) {
51
- if (baseURLs.length === 0) {
52
- return media !== undefined ? [replaceRepresentationDASHTokens(media, id, bitrate)] :
53
- null;
54
- }
55
- return baseURLs.map(function (baseURL) {
56
- return replaceRepresentationDASHTokens(resolveURL(baseURL, media), id, bitrate);
57
- });
48
+ export function constructRepresentationUrl(urlTemplate, representationId, bitrate) {
49
+ return replaceRepresentationDASHTokens(urlTemplate, representationId, bitrate);
58
50
  }
59
51
  /**
60
52
  * Replace "tokens" written in a given path (e.g. $RepresentationID$) by the corresponding
@@ -25,7 +25,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
25
25
  import config from "../../../../config";
26
26
  import log from "../../../../log";
27
27
  import arrayFind from "../../../../utils/array_find";
28
- import { normalizeBaseURL } from "../../../../utils/resolve_url";
28
+ import { getFilenameIndexInUrl } from "../../../../utils/resolve_url";
29
29
  // eslint-disable-next-line max-len
30
30
  import getClockOffset from "./get_clock_offset";
31
31
  import getHTTPUTCTimingURL from "./get_http_utc-timing_url";
@@ -137,9 +137,7 @@ function parseCompleteIntermediateRepresentation(mpdIR, args, warnings, xlinkInf
137
137
  var rootChildren = mpdIR.children, rootAttributes = mpdIR.attributes;
138
138
  var isDynamic = rootAttributes.type === "dynamic";
139
139
  var initialBaseUrl = args.url !== undefined ?
140
- [{ url: normalizeBaseURL(args.url),
141
- availabilityTimeOffset: 0,
142
- availabilityTimeComplete: true }] :
140
+ [{ url: args.url.substring(0, getFilenameIndexInUrl(args.url)) }] :
143
141
  [];
144
142
  var mpdBaseUrls = resolveBaseURLs(initialBaseUrl, rootChildren.baseURLs);
145
143
  var availabilityStartTime = parseAvailabilityStartTime(rootAttributes, args.referenceDateTime);
@@ -24,7 +24,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
24
  };
25
25
  import objectAssign from "../../../../utils/object_assign";
26
26
  import { BaseRepresentationIndex, ListRepresentationIndex, TemplateRepresentationIndex, TimelineRepresentationIndex, } from "./indexes";
27
- import resolveBaseURLs from "./resolve_base_urls";
28
27
  /**
29
28
  * Parse the specific segment indexing information found in a representation
30
29
  * into a IRepresentationIndex implementation.
@@ -34,7 +33,6 @@ import resolveBaseURLs from "./resolve_base_urls";
34
33
  */
35
34
  export default function parseRepresentationIndex(representation, context) {
36
35
  var _a, _b;
37
- var representationBaseURLs = resolveBaseURLs(context.baseURLs, representation.children.baseURLs);
38
36
  var aggressiveMode = context.aggressiveMode, availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.end, periodStart = context.start, receivedTime = context.receivedTime, timeShiftBufferDepth = context.timeShiftBufferDepth, unsafelyBaseOnPreviousRepresentation = context.unsafelyBaseOnPreviousRepresentation, inbandEventStreams = context.inbandEventStreams, isLastPeriod = context.isLastPeriod;
39
37
  var isEMSGWhitelisted = function (inbandEvent) {
40
38
  if (inbandEventStreams === undefined) {
@@ -46,7 +44,7 @@ export default function parseRepresentationIndex(representation, context) {
46
44
  return schemeIdUri === inbandEvent.schemeIdUri;
47
45
  });
48
46
  };
49
- var reprIndexCtxt = { aggressiveMode: aggressiveMode, availabilityTimeComplete: true, availabilityTimeOffset: availabilityTimeOffset, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, isEMSGWhitelisted: isEMSGWhitelisted, isLastPeriod: isLastPeriod, manifestBoundsCalculator: manifestBoundsCalculator, isDynamic: isDynamic, periodEnd: periodEnd, periodStart: periodStart, receivedTime: receivedTime, representationBaseURLs: representationBaseURLs, representationBitrate: representation.attributes.bitrate,
47
+ var reprIndexCtxt = { aggressiveMode: aggressiveMode, availabilityTimeComplete: true, availabilityTimeOffset: availabilityTimeOffset, unsafelyBaseOnPreviousRepresentation: unsafelyBaseOnPreviousRepresentation, isEMSGWhitelisted: isEMSGWhitelisted, isLastPeriod: isLastPeriod, manifestBoundsCalculator: manifestBoundsCalculator, isDynamic: isDynamic, periodEnd: periodEnd, periodStart: periodStart, receivedTime: receivedTime, representationBitrate: representation.attributes.bitrate,
50
48
  representationId: representation.attributes.id, timeShiftBufferDepth: timeShiftBufferDepth };
51
49
  var representationIndex;
52
50
  if (representation.children.segmentBase !== undefined) {
@@ -18,6 +18,7 @@ import arrayFind from "../../../../utils/array_find";
18
18
  import objectAssign from "../../../../utils/object_assign";
19
19
  import { getWEBMHDRInformation } from "./get_hdr_information";
20
20
  import parseRepresentationIndex from "./parse_representation_index";
21
+ import resolveBaseURLs from "./resolve_base_urls";
21
22
  /**
22
23
  * Combine inband event streams from representation and
23
24
  * adaptation data.
@@ -109,9 +110,12 @@ export default function parseRepresentations(representationsIR, adaptation, cont
109
110
  else {
110
111
  representationBitrate = representation.attributes.bitrate;
111
112
  }
113
+ var representationBaseURLs = resolveBaseURLs(context.baseURLs, representation.children.baseURLs);
114
+ var cdnMetadata = representationBaseURLs.map(function (x) {
115
+ return ({ baseUrl: x.url, id: x.serviceLocation });
116
+ });
112
117
  // Construct Representation Base
113
- var parsedRepresentation = { bitrate: representationBitrate,
114
- index: representationIndex,
118
+ var parsedRepresentation = { bitrate: representationBitrate, cdnMetadata: cdnMetadata, index: representationIndex,
115
119
  id: representationID };
116
120
  // Add optional attributes
117
121
  var codecs = void 0;
@@ -16,8 +16,7 @@
16
16
  import { IBaseUrlIntermediateRepresentation } from "../node_parser_types";
17
17
  export interface IResolvedBaseUrl {
18
18
  url: string;
19
- availabilityTimeOffset: number;
20
- availabilityTimeComplete: boolean;
19
+ serviceLocation?: string | undefined;
21
20
  }
22
21
  /**
23
22
  * @param {Array.<string>} currentBaseURLs
@@ -20,14 +20,12 @@ import resolveURL from "../../../../utils/resolve_url";
20
20
  * @returns {Array.<string>}
21
21
  */
22
22
  export default function resolveBaseURLs(currentBaseURLs, newBaseUrlsIR) {
23
+ var _a;
23
24
  if (newBaseUrlsIR.length === 0) {
24
25
  return currentBaseURLs;
25
26
  }
26
27
  var newBaseUrls = newBaseUrlsIR.map(function (ir) {
27
- var _a, _b;
28
- return { url: ir.value,
29
- availabilityTimeOffset: (_a = ir.attributes.availabilityTimeOffset) !== null && _a !== void 0 ? _a : 0,
30
- availabilityTimeComplete: (_b = ir.attributes.availabilityTimeComplete) !== null && _b !== void 0 ? _b : true };
28
+ return { url: ir.value };
31
29
  });
32
30
  if (currentBaseURLs.length === 0) {
33
31
  return newBaseUrls;
@@ -38,11 +36,8 @@ export default function resolveBaseURLs(currentBaseURLs, newBaseUrlsIR) {
38
36
  for (var j = 0; j < newBaseUrls.length; j++) {
39
37
  var newBaseUrl = newBaseUrls[j];
40
38
  var newUrl = resolveURL(curBaseUrl.url, newBaseUrl.url);
41
- var newAvailabilityTimeOffset = curBaseUrl.availabilityTimeOffset +
42
- newBaseUrl.availabilityTimeOffset;
43
39
  result.push({ url: newUrl,
44
- availabilityTimeOffset: newAvailabilityTimeOffset,
45
- availabilityTimeComplete: newBaseUrl.availabilityTimeComplete });
40
+ serviceLocation: (_a = newBaseUrl.serviceLocation) !== null && _a !== void 0 ? _a : curBaseUrl.serviceLocation });
46
41
  }
47
42
  }
48
43
  return result;
@@ -17,7 +17,7 @@ import { IBaseUrlIntermediateRepresentation } from "../../node_parser_types";
17
17
  /**
18
18
  * Parse an BaseURL element into an BaseURL intermediate
19
19
  * representation.
20
- * @param {Element} adaptationSetElement - The BaseURL root element.
20
+ * @param {Element} root - The BaseURL root element.
21
21
  * @returns {Array.<Object|undefined>}
22
22
  */
23
23
  export default function parseBaseURL(root: Element): [IBaseUrlIntermediateRepresentation | undefined, Error[]];
@@ -13,36 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { parseBoolean, parseMPDFloat, ValueParser, } from "./utils";
17
16
  /**
18
17
  * Parse an BaseURL element into an BaseURL intermediate
19
18
  * representation.
20
- * @param {Element} adaptationSetElement - The BaseURL root element.
19
+ * @param {Element} root - The BaseURL root element.
21
20
  * @returns {Array.<Object|undefined>}
22
21
  */
23
22
  export default function parseBaseURL(root) {
24
- var attributes = {};
25
23
  var value = root.textContent;
26
24
  var warnings = [];
27
- var parseValue = ValueParser(attributes, warnings);
28
25
  if (value === null || value.length === 0) {
29
26
  return [undefined, warnings];
30
27
  }
31
- for (var i = 0; i < root.attributes.length; i++) {
32
- var attribute = root.attributes[i];
33
- switch (attribute.name) {
34
- case "availabilityTimeOffset":
35
- parseValue(attribute.value, { asKey: "availabilityTimeOffset",
36
- parser: parseMPDFloat,
37
- dashName: "availabilityTimeOffset" });
38
- break;
39
- case "availabilityTimeComplete":
40
- parseValue(attribute.value, { asKey: "availabilityTimeComplete",
41
- parser: parseBoolean,
42
- dashName: "availabilityTimeComplete" });
43
- break;
44
- }
45
- }
46
- return [{ value: value, attributes: attributes },
28
+ return [{ value: value },
47
29
  warnings];
48
30
  }
@@ -337,12 +337,6 @@ export interface IBaseUrlIntermediateRepresentation {
337
337
  * This is the inner content of a BaseURL node.
338
338
  */
339
339
  value: string;
340
- /** Attributes assiociated to the BaseURL node. */
341
- attributes: {
342
- /** availabilityTimeOffset attribute assiociated to that BaseURL node. */
343
- availabilityTimeOffset?: number;
344
- availabilityTimeComplete?: boolean;
345
- };
346
340
  }
347
341
  /** Intermediate representation for a Node following a "scheme" format. */
348
342
  export interface IScheme {
@@ -22,22 +22,11 @@ import { parseString } from "../utils";
22
22
  */
23
23
  export function generateBaseUrlAttrParser(baseUrlAttrs, linearMemory) {
24
24
  var textDecoder = new TextDecoder();
25
- var dataView;
26
25
  return function onMPDAttribute(attr, ptr, len) {
27
26
  switch (attr) {
28
27
  case 64 /* AttributeName.Text */:
29
28
  baseUrlAttrs.value = parseString(textDecoder, linearMemory.buffer, ptr, len);
30
29
  break;
31
- case 43 /* AttributeName.AvailabilityTimeOffset */: {
32
- dataView = new DataView(linearMemory.buffer);
33
- baseUrlAttrs.attributes.availabilityTimeOffset = dataView.getFloat64(ptr, true);
34
- break;
35
- }
36
- case 22 /* AttributeName.AvailabilityTimeComplete */: {
37
- baseUrlAttrs.attributes.availabilityTimeComplete =
38
- new DataView(linearMemory.buffer).getUint8(0) === 0;
39
- break;
40
- }
41
30
  }
42
31
  };
43
32
  }
@@ -135,5 +135,9 @@ export declare const enum AttributeName {
135
135
  MediaPresentationDuration = 68,
136
136
  EventStreamEltRange = 69,
137
137
  Namespace = 70,
138
- Label = 71
138
+ Label = 71,
139
+ ServiceLocation = 72,
140
+ QueryBeforeStart = 73,
141
+ ProxyServerUrl = 74,
142
+ DefaultServiceLocation = 75
139
143
  }
@@ -98,7 +98,8 @@ function parseRepresentation(representation, ctxt) {
98
98
  var contentProtections = representation.contentProtections === undefined ?
99
99
  undefined :
100
100
  formatContentProtections(representation.contentProtections);
101
- return { id: id, bitrate: representation.bitrate,
101
+ return { id: id, cdnMetadata: null,
102
+ bitrate: representation.bitrate,
102
103
  height: representation.height,
103
104
  width: representation.width,
104
105
  codecs: representation.codecs,
@@ -39,7 +39,7 @@ var LocalRepresentationIndex = /** @class */ (function () {
39
39
  end: 0,
40
40
  duration: 0,
41
41
  timescale: 1,
42
- mediaURLs: null,
42
+ url: null,
43
43
  complete: true,
44
44
  privateInfos: {
45
45
  localManifestInitSegment: { load: this._index.loadInitSegment }
@@ -77,7 +77,7 @@ var LocalRepresentationIndex = /** @class */ (function () {
77
77
  duration: wantedSegment.duration,
78
78
  timescale: 1,
79
79
  timestampOffset: wantedSegment.timestampOffset,
80
- mediaURLs: null,
80
+ url: null,
81
81
  complete: true,
82
82
  privateInfos: {
83
83
  localManifestSegment: { load: _this._index.loadSegment,
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { StaticRepresentationIndex, SUPPORTED_ADAPTATIONS_TYPE, } from "../../../manifest";
17
17
  import idGenerator from "../../../utils/id_generator";
18
+ import { getFilenameIndexInUrl } from "../../../utils/resolve_url";
18
19
  import MetaRepresentationIndex from "./representation_index";
19
20
  /**
20
21
  * Parse playlist string to JSON.
@@ -139,6 +140,7 @@ function createManifest(mplData, manifests, parserOptions) {
139
140
  representations.push({
140
141
  bitrate: currentRepresentation.bitrate,
141
142
  index: newIndex,
143
+ cdnMetadata: currentRepresentation.cdnMetadata,
142
144
  id: currentRepresentation.id,
143
145
  height: currentRepresentation.height,
144
146
  width: currentRepresentation.width,
@@ -168,6 +170,9 @@ function createManifest(mplData, manifests, parserOptions) {
168
170
  var newTextAdaptations = textTracks.map(function (track) {
169
171
  var adaptationID = "gen-text-ada-" + generateAdaptationID();
170
172
  var representationID = "gen-text-rep-" + generateRepresentationID();
173
+ var indexOfFilename = getFilenameIndexInUrl(track.url);
174
+ var cdnUrl = track.url.substring(0, indexOfFilename);
175
+ var filename = track.url.substring(indexOfFilename);
171
176
  return {
172
177
  id: adaptationID,
173
178
  type: "text",
@@ -176,10 +181,11 @@ function createManifest(mplData, manifests, parserOptions) {
176
181
  manuallyAdded: true,
177
182
  representations: [
178
183
  { bitrate: 0,
184
+ cdnMetadata: [{ baseUrl: cdnUrl }],
179
185
  id: representationID,
180
186
  mimeType: track.mimeType,
181
187
  codecs: track.codecs,
182
- index: new StaticRepresentationIndex({ media: track.url }),
188
+ index: new StaticRepresentationIndex({ media: filename }),
183
189
  },
184
190
  ],
185
191
  };
@@ -20,7 +20,7 @@ import assert from "../../../utils/assert";
20
20
  import { concat, itobe4, } from "../../../utils/byte_parsing";
21
21
  import isNonEmptyString from "../../../utils/is_non_empty_string";
22
22
  import objectAssign from "../../../utils/object_assign";
23
- import resolveURL, { normalizeBaseURL, } from "../../../utils/resolve_url";
23
+ import { getFilenameIndexInUrl } from "../../../utils/resolve_url";
24
24
  import { hexToBytes } from "../../../utils/string_parsing";
25
25
  import takeFirstSet from "../../../utils/take_first_set";
26
26
  import { createBox } from "../../containers/isobmff";
@@ -184,7 +184,7 @@ function createSmoothStreamingParser(parserOptions) {
184
184
  * @returns {Object}
185
185
  */
186
186
  function parseAdaptation(args) {
187
- var root = args.root, timescale = args.timescale, rootURL = args.rootURL, protections = args.protections, timeShiftBufferDepth = args.timeShiftBufferDepth, manifestReceivedTime = args.manifestReceivedTime, isLive = args.isLive;
187
+ var root = args.root, timescale = args.timescale, baseUrl = args.baseUrl, protections = args.protections, timeShiftBufferDepth = args.timeShiftBufferDepth, manifestReceivedTime = args.manifestReceivedTime, isLive = args.isLive;
188
188
  var timescaleAttr = root.getAttribute("Timescale");
189
189
  var _timescale = timescaleAttr === null ? timescale :
190
190
  isNaN(+timescaleAttr) ? timescale :
@@ -199,11 +199,11 @@ function createSmoothStreamingParser(parserOptions) {
199
199
  var adaptationType = typeAttribute;
200
200
  var subType = root.getAttribute("Subtype");
201
201
  var language = root.getAttribute("Language");
202
- var baseURLAttr = root.getAttribute("Url");
203
- var baseURL = baseURLAttr === null ? "" :
204
- baseURLAttr;
202
+ var UrlAttr = root.getAttribute("Url");
203
+ var UrlPathWithTokens = UrlAttr === null ? "" :
204
+ UrlAttr;
205
205
  if (0 /* __ENVIRONMENT__.CURRENT_ENV */ === 1 /* __ENVIRONMENT__.DEV */) {
206
- assert(baseURL !== "");
206
+ assert(UrlPathWithTokens !== "");
207
207
  }
208
208
  var _a = reduceChildren(root, function (res, _name, node) {
209
209
  switch (_name) {
@@ -233,11 +233,10 @@ function createSmoothStreamingParser(parserOptions) {
233
233
  (isNonEmptyString(language) ? ("_" + language) :
234
234
  "");
235
235
  var representations = qualityLevels.map(function (qualityLevel) {
236
- var path = resolveURL(rootURL, baseURL);
237
236
  var repIndex = {
238
237
  timeline: index.timeline,
239
238
  timescale: index.timescale,
240
- media: replaceRepresentationSmoothTokens(path, qualityLevel.bitrate, qualityLevel.customAttributes),
239
+ media: replaceRepresentationSmoothTokens(UrlPathWithTokens, qualityLevel.bitrate, qualityLevel.customAttributes),
241
240
  };
242
241
  var mimeType = isNonEmptyString(qualityLevel.mimeType) ?
243
242
  qualityLevel.mimeType :
@@ -276,7 +275,10 @@ function createSmoothStreamingParser(parserOptions) {
276
275
  DEFAULT_AGGRESSIVE_MODE :
277
276
  parserOptions.aggressiveMode;
278
277
  var reprIndex = new RepresentationIndex(repIndex, { aggressiveMode: aggressiveMode, isLive: isLive, manifestReceivedTime: manifestReceivedTime, segmentPrivateInfos: segmentPrivateInfos, timeShiftBufferDepth: timeShiftBufferDepth });
279
- var representation = objectAssign({}, qualityLevel, { index: reprIndex, mimeType: mimeType, codecs: codecs, id: id });
278
+ var representation = objectAssign({}, qualityLevel, { index: reprIndex,
279
+ cdnMetadata: [
280
+ { baseUrl: baseUrl },
281
+ ], mimeType: mimeType, codecs: codecs, id: id });
280
282
  if (keyIDs.length > 0 || firstProtection !== undefined) {
281
283
  var initDataValues = firstProtection === undefined ?
282
284
  [] :
@@ -310,7 +312,11 @@ function createSmoothStreamingParser(parserOptions) {
310
312
  return parsedAdaptation;
311
313
  }
312
314
  function parseFromDocument(doc, url, manifestReceivedTime) {
313
- var rootURL = normalizeBaseURL(url == null ? "" : url);
315
+ var baseUrl = "";
316
+ if (url !== undefined) {
317
+ var filenameIdx = getFilenameIndexInUrl(url);
318
+ baseUrl = url.substring(0, filenameIdx);
319
+ }
314
320
  var root = doc.documentElement;
315
321
  if (root == null || root.nodeName !== "SmoothStreamingMedia") {
316
322
  throw new Error("document root should be SmoothStreamingMedia");
@@ -353,7 +359,7 @@ function createSmoothStreamingParser(parserOptions) {
353
359
  }
354
360
  var adaptations = adaptationNodes
355
361
  .reduce(function (acc, node) {
356
- var adaptation = parseAdaptation({ root: node, rootURL: rootURL, timescale: timescale, protections: protections, isLive: isLive, timeShiftBufferDepth: timeShiftBufferDepth, manifestReceivedTime: manifestReceivedTime });
362
+ var adaptation = parseAdaptation({ root: node, baseUrl: baseUrl, timescale: timescale, protections: protections, isLive: isLive, timeShiftBufferDepth: timeShiftBufferDepth, manifestReceivedTime: manifestReceivedTime });
357
363
  if (adaptation === null) {
358
364
  return acc;
359
365
  }
@@ -118,7 +118,7 @@ var SmoothRepresentationIndex = /** @class */ (function () {
118
118
  return { id: "init",
119
119
  isInit: true,
120
120
  privateInfos: { smoothInitSegment: this._initSegmentInfos },
121
- mediaURLs: null,
121
+ url: null,
122
122
  time: 0,
123
123
  end: 0,
124
124
  duration: 0,
@@ -164,7 +164,7 @@ var SmoothRepresentationIndex = /** @class */ (function () {
164
164
  time: time / timescale,
165
165
  end: (time + duration) / timescale,
166
166
  duration: duration / timescale,
167
- timescale: 1, number: number, mediaURLs: [replaceSegmentSmoothTokens(media, time)],
167
+ timescale: 1, number: number, url: replaceSegmentSmoothTokens(media, time),
168
168
  complete: true,
169
169
  privateInfos: { smoothMediaSegment: { time: time, duration: duration } } };
170
170
  segments.push(segment);
@@ -77,10 +77,34 @@ export interface IContentProtections {
77
77
  /** The different encryption initialization data associated with that content. */
78
78
  initData: IContentProtectionInitData[];
79
79
  }
80
+ /** Represents metadata of a CDN which can serve resources. */
81
+ export interface ICdnMetadata {
82
+ /**
83
+ * The base URL on which resources can be requested though this CDN.
84
+ * In most transports, you will want to add the wanted media resource's URL
85
+ * to that one to request it.
86
+ */
87
+ baseUrl: string;
88
+ /**
89
+ * Identifier that might be re-used in other documents.
90
+ */
91
+ id?: string | undefined;
92
+ }
80
93
  /** Representation of a "quality" available in an Adaptation. */
81
94
  export interface IParsedRepresentation {
82
95
  /** Maximum bitrate the Representation is available in, in bits per seconds. */
83
96
  bitrate: number;
97
+ /**
98
+ * Information on the CDN(s) on which requests should be done to request this
99
+ * Representation's initialization and media segments.
100
+ *
101
+ * `null` if there's no CDN involved here (e.g. resources are not
102
+ * requested through the network).
103
+ *
104
+ * An empty array means that no CDN are left to request the resource. As such,
105
+ * no resource can be loaded in that situation.
106
+ */
107
+ cdnMetadata: ICdnMetadata[] | null;
84
108
  /**
85
109
  * Interface to get information about segments associated with this
86
110
  * Representation,
@@ -48,7 +48,14 @@ export default function applyExtent(element, extent) {
48
48
  if (secondExtent[2] === "px" ||
49
49
  secondExtent[2] === "%" ||
50
50
  secondExtent[2] === "em") {
51
- element.style.height = secondExtent[1] + secondExtent[2];
51
+ var toNum = Number(secondExtent[1]);
52
+ if (secondExtent[2] === "%" && !isNaN(toNum) &&
53
+ (toNum < 0 || toNum > 100)) {
54
+ element.style.width = "80%";
55
+ }
56
+ else {
57
+ element.style.height = secondExtent[1] + secondExtent[2];
58
+ }
52
59
  }
53
60
  else if (secondExtent[2] === "c") {
54
61
  addClassName(element, "proportional-style");
@@ -47,7 +47,15 @@ export default function applyOrigin(element, origin) {
47
47
  if (secondOrigin[2] === "px" ||
48
48
  secondOrigin[2] === "%" ||
49
49
  secondOrigin[2] === "em") {
50
- element.style.top = secondOrigin[1] + secondOrigin[2];
50
+ var toNum = Number(secondOrigin[1]);
51
+ if (secondOrigin[2] === "%" && !isNaN(toNum) &&
52
+ (toNum < 0 || toNum > 100)) {
53
+ element.style.bottom = "5%";
54
+ element.style.left = "10%";
55
+ }
56
+ else {
57
+ element.style.top = secondOrigin[1] + secondOrigin[2];
58
+ }
51
59
  }
52
60
  else if (secondOrigin[2] === "c") {
53
61
  addClassName(element, "proportional-style");
@@ -323,7 +323,8 @@ function createTextElement(el, style, shouldTrimWhiteSpace) {
323
323
  trimmed = trimmed.replace(/\s+/g, " ");
324
324
  textContent = trimmed;
325
325
  }
326
- textElement.innerHTML = textContent;
326
+ var textNode = document.createTextNode(textContent);
327
+ textElement.appendChild(textNode);
327
328
  textElement.className = "rxp-texttrack-span";
328
329
  applyTextStyle(textElement, style, shouldTrimWhiteSpace);
329
330
  return textElement;