rx-player 3.26.2 → 3.26.3-dev.2022021400

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 (218) hide show
  1. package/.github/workflows/perfs.yml +22 -0
  2. package/CHANGELOG.md +19 -1
  3. package/VERSION +1 -1
  4. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +6 -2
  5. package/dist/_esm5.processed/core/abr/buffer_based_chooser.d.ts +28 -6
  6. package/dist/_esm5.processed/core/abr/buffer_based_chooser.js +63 -12
  7. package/dist/_esm5.processed/core/abr/network_analyzer.d.ts +1 -1
  8. package/dist/_esm5.processed/core/abr/pending_requests_store.js +3 -5
  9. package/dist/_esm5.processed/core/abr/representation_estimator.d.ts +1 -1
  10. package/dist/_esm5.processed/core/abr/representation_estimator.js +2 -2
  11. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.d.ts +6 -0
  12. package/dist/_esm5.processed/core/api/media_element_track_choice_manager.js +20 -3
  13. package/dist/_esm5.processed/core/api/public_api.d.ts +3 -3
  14. package/dist/_esm5.processed/core/api/public_api.js +2 -2
  15. package/dist/_esm5.processed/core/api/track_choice_manager.d.ts +6 -6
  16. package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.d.ts +0 -2
  17. package/dist/_esm5.processed/core/eme/__tests__/__global__/utils.js +5 -10
  18. package/dist/_esm5.processed/core/eme/find_key_system.js +15 -5
  19. package/dist/_esm5.processed/core/eme/types.d.ts +2 -2
  20. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +4 -4
  21. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +1 -1
  22. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +2 -2
  23. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +5 -1
  24. package/dist/_esm5.processed/core/fetchers/utils/try_urls_with_backoff.js +1 -1
  25. package/dist/_esm5.processed/core/init/initialize_directfile.d.ts +2 -2
  26. package/dist/_esm5.processed/core/init/initialize_media_source.d.ts +1 -1
  27. package/dist/_esm5.processed/core/init/manifest_update_scheduler.d.ts +4 -4
  28. package/dist/_esm5.processed/core/init/stream_events_emitter/are_same_stream_events.d.ts +4 -4
  29. package/dist/_esm5.processed/core/init/stream_events_emitter/types.d.ts +2 -2
  30. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +3 -3
  31. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +32 -31
  32. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +4 -4
  33. package/dist/_esm5.processed/core/stream/representation/force_garbage_collection.js +3 -4
  34. package/dist/_esm5.processed/errors/request_error.js +3 -1
  35. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.d.ts +2 -2
  36. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/thumbnail_loader.js +1 -3
  37. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  38. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +1 -1
  39. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.d.ts +3 -3
  40. package/dist/_esm5.processed/manifest/adaptation.d.ts +2 -2
  41. package/dist/_esm5.processed/manifest/adaptation.js +3 -1
  42. package/dist/_esm5.processed/manifest/manifest.d.ts +9 -9
  43. package/dist/_esm5.processed/manifest/period.d.ts +3 -3
  44. package/dist/_esm5.processed/manifest/representation.d.ts +2 -2
  45. package/dist/_esm5.processed/manifest/representation_index/types.d.ts +18 -18
  46. package/dist/_esm5.processed/manifest/types.d.ts +3 -3
  47. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.d.ts +1 -1
  48. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.d.ts +3 -3
  49. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +6 -6
  50. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +3 -3
  51. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +2 -2
  52. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +14 -14
  53. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +17 -17
  54. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +1 -1
  55. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +28 -20
  56. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +19 -4
  57. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
  58. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +1 -1
  59. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +17 -35
  60. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +24 -23
  61. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +8 -8
  62. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +18 -27
  63. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +25 -23
  64. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +21 -15
  65. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +19 -19
  66. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.d.ts +15 -38
  67. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +8 -8
  68. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +30 -30
  69. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +3 -3
  70. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -1
  71. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +2 -2
  72. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +7 -7
  73. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +8 -8
  74. package/dist/_esm5.processed/parsers/manifest/types.d.ts +28 -28
  75. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.d.ts +3 -2
  76. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +15 -5
  77. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.d.ts +2 -2
  78. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.d.ts +11 -1
  79. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +31 -19
  80. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.d.ts +2 -2
  81. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.d.ts +1 -1
  82. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +2 -1
  83. package/dist/_esm5.processed/transports/dash/image_pipelines.js +1 -1
  84. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +1 -1
  85. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  86. package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
  87. package/dist/_esm5.processed/transports/dash/segment_loader.js +2 -2
  88. package/dist/_esm5.processed/transports/dash/segment_parser.d.ts +1 -1
  89. package/dist/_esm5.processed/transports/dash/text_loader.d.ts +1 -1
  90. package/dist/_esm5.processed/transports/dash/text_loader.js +1 -1
  91. package/dist/_esm5.processed/transports/dash/text_parser.d.ts +1 -1
  92. package/dist/_esm5.processed/transports/local/segment_loader.d.ts +1 -2
  93. package/dist/_esm5.processed/transports/local/segment_loader.js +1 -1
  94. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.d.ts +1 -1
  95. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +1 -1
  96. package/dist/_esm5.processed/transports/smooth/pipelines.js +1 -1
  97. package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +0 -1
  98. package/dist/_esm5.processed/transports/smooth/segment_loader.js +2 -2
  99. package/dist/_esm5.processed/transports/types.d.ts +36 -30
  100. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +1 -1
  101. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.d.ts +1 -1
  102. package/dist/_esm5.processed/utils/cancellable_sleep.js +1 -1
  103. package/dist/_esm5.processed/utils/cast_to_observable.d.ts +1 -2
  104. package/dist/_esm5.processed/utils/cast_to_observable.js +1 -1
  105. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -5
  106. package/dist/_esm5.processed/utils/request/fetch.js +7 -4
  107. package/dist/_esm5.processed/utils/request/xhr.d.ts +6 -6
  108. package/dist/_esm5.processed/utils/request/xhr.js +2 -1
  109. package/dist/_esm5.processed/utils/rx-from_cancellable_promise.d.ts +1 -2
  110. package/dist/rx-player.js +404 -321
  111. package/dist/rx-player.min.js +1 -1
  112. package/package.json +3 -4
  113. package/scripts/doc-generator/generate_header_html.js +6 -7
  114. package/scripts/doc-generator/generate_page_html.js +3 -4
  115. package/scripts/doc-generator/generate_page_list_html.js +4 -5
  116. package/scripts/doc-generator/generate_sidebar_html.js +4 -7
  117. package/scripts/doc-generator/utils.js +0 -11
  118. package/scripts/generate_demo_list.js +3 -3
  119. package/scripts/generate_documentation_list.js +3 -3
  120. package/scripts/launch_static_server.js +127 -67
  121. package/scripts/run_standalone_demo.js +1 -0
  122. package/scripts/start_demo_web_server.js +1 -0
  123. package/sonar-project.properties +1 -1
  124. package/src/compat/__tests__/fullscreen.test.ts +7 -7
  125. package/src/compat/__tests__/is_vtt_cue.test.ts +1 -1
  126. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +1 -1
  127. package/src/compat/eme/custom_media_keys/index.ts +7 -3
  128. package/src/core/abr/__tests__/{get_estimate_from_buffer_levels.test.ts → buffer_based_chooser.test.ts} +94 -123
  129. package/src/core/abr/buffer_based_chooser.ts +85 -20
  130. package/src/core/abr/network_analyzer.ts +1 -1
  131. package/src/core/abr/pending_requests_store.ts +3 -5
  132. package/src/core/abr/representation_estimator.ts +6 -3
  133. package/src/core/api/media_element_track_choice_manager.ts +22 -3
  134. package/src/core/api/public_api.ts +6 -6
  135. package/src/core/api/track_choice_manager.ts +10 -9
  136. package/src/core/eme/__tests__/__global__/utils.ts +5 -10
  137. package/src/core/eme/find_key_system.ts +14 -12
  138. package/src/core/eme/types.ts +2 -2
  139. package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -5
  140. package/src/core/fetchers/segment/segment_fetcher.ts +6 -3
  141. package/src/core/fetchers/utils/try_urls_with_backoff.ts +1 -1
  142. package/src/core/init/initialize_directfile.ts +2 -2
  143. package/src/core/init/initialize_media_source.ts +2 -2
  144. package/src/core/init/manifest_update_scheduler.ts +7 -7
  145. package/src/core/init/stream_events_emitter/are_same_stream_events.ts +4 -4
  146. package/src/core/init/stream_events_emitter/types.ts +2 -2
  147. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +3 -3
  148. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +32 -31
  149. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +4 -4
  150. package/src/core/stream/representation/force_garbage_collection.ts +3 -5
  151. package/src/errors/request_error.ts +4 -1
  152. package/src/experimental/tools/VideoThumbnailLoader/thumbnail_loader.ts +3 -6
  153. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +1 -1
  154. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +3 -3
  155. package/src/experimental/tools/mediaCapabilitiesProber/types.ts +3 -3
  156. package/src/manifest/adaptation.ts +6 -4
  157. package/src/manifest/manifest.ts +10 -10
  158. package/src/manifest/period.ts +3 -3
  159. package/src/manifest/representation.ts +2 -2
  160. package/src/manifest/representation_index/types.ts +18 -18
  161. package/src/manifest/types.ts +3 -3
  162. package/src/parsers/manifest/dash/common/__tests__/manifest_bounds_calculator.test.ts +1 -0
  163. package/src/parsers/manifest/dash/common/get_hdr_information.ts +1 -1
  164. package/src/parsers/manifest/dash/common/get_periods_time_infos.ts +3 -3
  165. package/src/parsers/manifest/dash/common/indexes/base.ts +6 -6
  166. package/src/parsers/manifest/dash/common/indexes/get_init_segment.ts +4 -2
  167. package/src/parsers/manifest/dash/common/indexes/get_segments_from_timeline.ts +2 -2
  168. package/src/parsers/manifest/dash/common/indexes/list.ts +14 -14
  169. package/src/parsers/manifest/dash/common/indexes/template.ts +17 -16
  170. package/src/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.ts +1 -1
  171. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +50 -22
  172. package/src/parsers/manifest/dash/common/infer_adaptation_type.ts +2 -2
  173. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +1 -1
  174. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +58 -70
  175. package/src/parsers/manifest/dash/common/parse_mpd.ts +8 -8
  176. package/src/parsers/manifest/dash/common/parse_periods.ts +80 -79
  177. package/src/parsers/manifest/dash/common/parse_representation_index.ts +83 -75
  178. package/src/parsers/manifest/dash/common/parse_representations.ts +44 -63
  179. package/src/parsers/manifest/dash/node_parser_types.ts +30 -30
  180. package/src/parsers/manifest/dash/parsers_types.ts +3 -3
  181. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -1
  182. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +4 -4
  183. package/src/parsers/manifest/smooth/create_parser.ts +23 -21
  184. package/src/parsers/manifest/smooth/representation_index.ts +14 -14
  185. package/src/parsers/manifest/types.ts +28 -28
  186. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +31 -33
  187. package/src/parsers/manifest/utils/clear_timeline_from_position.ts +15 -6
  188. package/src/parsers/manifest/utils/index_helpers.ts +2 -2
  189. package/src/parsers/manifest/utils/update_segment_timeline.ts +32 -21
  190. package/src/parsers/texttracks/webvtt/html/to_html.ts +2 -2
  191. package/src/parsers/texttracks/webvtt/parse_cue_block.ts +1 -1
  192. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +2 -2
  193. package/src/transports/dash/image_pipelines.ts +1 -1
  194. package/src/transports/dash/init_segment_loader.ts +1 -1
  195. package/src/transports/dash/manifest_parser.ts +1 -1
  196. package/src/transports/dash/segment_loader.ts +7 -7
  197. package/src/transports/dash/segment_parser.ts +3 -1
  198. package/src/transports/dash/text_loader.ts +2 -2
  199. package/src/transports/dash/text_parser.ts +3 -1
  200. package/src/transports/local/segment_loader.ts +4 -4
  201. package/src/transports/metaplaylist/manifest_loader.ts +1 -1
  202. package/src/transports/metaplaylist/pipelines.ts +1 -1
  203. package/src/transports/smooth/pipelines.ts +7 -7
  204. package/src/transports/smooth/segment_loader.ts +8 -8
  205. package/src/transports/types.ts +37 -30
  206. package/src/transports/utils/call_custom_manifest_loader.ts +6 -6
  207. package/src/transports/utils/generate_manifest_loader.ts +1 -1
  208. package/src/utils/__tests__/flat_map.test.ts +12 -7
  209. package/src/utils/cancellable_sleep.ts +1 -1
  210. package/src/utils/cast_to_observable.ts +1 -2
  211. package/src/utils/request/fetch.ts +16 -13
  212. package/src/utils/request/xhr.ts +9 -7
  213. package/src/utils/rx-from_cancellable_promise.ts +1 -2
  214. package/tsconfig.json +1 -2
  215. package/tsconfig.modules.json +1 -2
  216. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.d.ts +0 -29
  217. package/dist/_esm5.processed/core/abr/get_estimate_from_buffer_levels.js +0 -67
  218. package/src/core/abr/get_estimate_from_buffer_levels.ts +0 -85
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rx-player",
3
3
  "author": "Canal+",
4
- "version": "3.26.2",
4
+ "version": "3.26.3-dev.2022021400",
5
5
  "description": "Canal+ HTML5 Video Player",
6
6
  "main": "./dist/rx-player.js",
7
7
  "keywords": [
@@ -105,10 +105,10 @@
105
105
  "esm": "3.2.25",
106
106
  "express": "4.17.2",
107
107
  "highlight.js": "11.3.1",
108
- "html-entities": "^2.3.2",
108
+ "html-entities": "2.3.2",
109
109
  "istanbul-instrumenter-loader": "3.0.1",
110
110
  "jest": "27.4.5",
111
- "karma": "6.3.9",
111
+ "karma": "6.3.14",
112
112
  "karma-chrome-launcher": "3.1.0",
113
113
  "karma-coverage-istanbul-reporter": "3.0.3",
114
114
  "karma-firefox-launcher": "2.1.2",
@@ -122,7 +122,6 @@
122
122
  "react-dom": "17.0.2",
123
123
  "regenerator-runtime": "0.13.9",
124
124
  "rimraf": "3.0.2",
125
- "sanitize-html": "2.6.1",
126
125
  "semver": "7.3.5",
127
126
  "sinon": "12.0.1",
128
127
  "terser-webpack-plugin": "5.3.0",
@@ -1,7 +1,6 @@
1
1
  const path = require("path");
2
2
  const { encode } = require("html-entities");
3
3
  const {
4
- encodeHtmlAttributeValue,
5
4
  toUriCompatibleRelativePath,
6
5
  getGithubSvg,
7
6
  } = require("./utils");
@@ -30,12 +29,12 @@ function generateHeaderHtml(config, currentLinkIdx, currentPath, logoInfo) {
30
29
  case "local-doc": {
31
30
  const relativeUri = toUriCompatibleRelativePath(l.firstPage, currentDir);
32
31
  const activeClass = i === currentLinkIdx ? " navbar-active" : "";
33
- const cleanedHref = encodeHtmlAttributeValue(relativeUri);
32
+ const cleanedHref = encode(relativeUri);
34
33
  return `<a class="navbar-item${activeClass}${customClass} hideable"` +
35
34
  `href="${cleanedHref}">${encode(l.displayName)}</a>`;
36
35
  }
37
36
  case "external-link": {
38
- const cleanedHref = encodeHtmlAttributeValue(l.link);
37
+ const cleanedHref = encode(l.link);
39
38
  return `<a class="navbar-item${customClass} hideable"` +
40
39
  `href="${cleanedHref}">${encode(l.displayName)}</a>`;
41
40
  }
@@ -84,7 +83,7 @@ function constructVersionLinkHtmlInHeaderBar(versionInfo, customClass) {
84
83
  if (typeof versionInfo.link === "string") {
85
84
  hasLink = true;
86
85
  element += `<a class="navbar-item${customClass}"` +
87
- `href="${encodeHtmlAttributeValue(versionInfo.link)}">`;
86
+ `href="${encode(versionInfo.link)}">`;
88
87
  } else {
89
88
  element += `<span class="navbar-item${customClass}">`;
90
89
  }
@@ -101,7 +100,7 @@ function constructVersionLinkHtmlInHeaderBar(versionInfo, customClass) {
101
100
  * @returns {string}
102
101
  */
103
102
  function constructGithubLinkHtmlInHeaderBar(githubLnk, customClass) {
104
- const cleanedHref = encodeHtmlAttributeValue(githubLnk);
103
+ const cleanedHref = encode(githubLnk);
105
104
  return `<a aria-label="Link to repository" class="navbar-item${customClass} hideable" href="${cleanedHref}">` +
106
105
  getGithubSvg() +
107
106
  "</a>";
@@ -133,11 +132,11 @@ function constructLogoHtmlInHeaderBar(logoInfo) {
133
132
  let hasLink = false;
134
133
  if (typeof logoInfo.link === "string") {
135
134
  hasLink = true;
136
- logoHtml += `<a href="${encodeHtmlAttributeValue(logoInfo.link)}">`;
135
+ logoHtml += `<a href="${encode(logoInfo.link)}">`;
137
136
  }
138
137
  if (typeof logoInfo.url === "string") {
139
138
  logoHtml += `<img alt="Logo" class="navbar-item navbar-item-logo"` +
140
- ` src="${encodeHtmlAttributeValue(logoInfo.url)}" />`;
139
+ ` src="${encode(logoInfo.url)}" />`;
141
140
  }
142
141
  if (hasLink) {
143
142
  logoHtml += "</a>";
@@ -1,5 +1,4 @@
1
1
  const { encode } = require("html-entities");
2
- const { encodeHtmlAttributeValue } = require("./utils");
3
2
 
4
3
  /**
5
4
  * Generate HTML page for the given documentation.
@@ -42,7 +41,7 @@ function generatePageHtml(
42
41
  const styles = constructStylesHtml(cssUrls);
43
42
  const scripts = constructScriptsHtml(scriptUrls);
44
43
  const faviconHtml = typeof faviconUrl === "string" ?
45
- `<link rel="icon" type="image/png" href="${encodeHtmlAttributeValue(faviconUrl)}">` :
44
+ `<link rel="icon" type="image/png" href="${encode(faviconUrl)}">` :
46
45
  "";
47
46
  const hamburgerHtml = constructHamburgerBarHtml(pageListHtml);
48
47
 
@@ -98,7 +97,7 @@ function constructHamburgerBarHtml(pageListHtml) {
98
97
  */
99
98
  function constructStylesHtml(cssUrls) {
100
99
  return cssUrls.map(cssUrl =>
101
- `<link rel="stylesheet" href="${encodeHtmlAttributeValue(cssUrl)}"/>`)
100
+ `<link rel="stylesheet" href="${encode(cssUrl)}"/>`)
102
101
  .join("");
103
102
  }
104
103
 
@@ -108,7 +107,7 @@ function constructStylesHtml(cssUrls) {
108
107
  */
109
108
  function constructScriptsHtml(scriptUrls) {
110
109
  return scriptUrls.map(scriptUrl =>
111
- `<script type="text/javascript" src="${encodeHtmlAttributeValue(scriptUrl)}" ` +
110
+ `<script type="text/javascript" src="${encode(scriptUrl)}" ` +
112
111
  `charset="utf-8"></script>`
113
112
  ).join("");
114
113
  }
@@ -1,7 +1,6 @@
1
1
  const { encode } = require("html-entities");
2
2
  const path = require("path");
3
3
  const {
4
- encodeHtmlAttributeValue,
5
4
  getGithubSvg,
6
5
  toUriCompatibleRelativePath,
7
6
  } = require("./utils");
@@ -39,7 +38,7 @@ function generatePageListHtml(
39
38
  const pageActiveClasses = isPageActive ? " active" : "";
40
39
  const relativeUri = toUriCompatibleRelativePath(outputFile, currentDir);
41
40
  return `<li class="page-list-item${pageActiveClasses}">` +
42
- `<a href="${encodeHtmlAttributeValue(relativeUri)}">` +
41
+ `<a href="${encode(relativeUri)}">` +
43
42
  encode(displayName) +
44
43
  `</a></li>`;
45
44
  }
@@ -54,7 +53,7 @@ function generatePageListHtml(
54
53
  const { displayName, outputFile } = currentSubPage;
55
54
  const relativeUri = toUriCompatibleRelativePath(outputFile, currentDir);
56
55
  return `<li class="page-list-item${spActiveClasses}">` +
57
- `<a href="${encodeHtmlAttributeValue(relativeUri)}">` +
56
+ `<a href="${encode(relativeUri)}">` +
58
57
  encode(displayName) +
59
58
  `</a></li>`;
60
59
  }).join("\n") + "</ul></li>";
@@ -62,7 +61,7 @@ function generatePageListHtml(
62
61
  }
63
62
 
64
63
  case "external-link": {
65
- const cleanedHref = encodeHtmlAttributeValue(l.link);
64
+ const cleanedHref = encode(l.link);
66
65
  return `<li class="page-list-item">` +
67
66
  `<a href="${cleanedHref}">` +
68
67
  encode(l.displayName) +
@@ -70,7 +69,7 @@ function generatePageListHtml(
70
69
  }
71
70
 
72
71
  case "github-link":
73
- const cleanedHref = encodeHtmlAttributeValue(l.link);
72
+ const cleanedHref = encode(l.link);
74
73
  return `<li class="page-list-item">` +
75
74
  `<a aria-label="Link to repository" href="${cleanedHref}">` +
76
75
  getGithubSvg() +
@@ -1,9 +1,6 @@
1
1
  const path = require("path");
2
2
  const { encode } = require("html-entities");
3
- const {
4
- encodeHtmlAttributeValue,
5
- toUriCompatibleRelativePath,
6
- } = require("./utils");
3
+ const { toUriCompatibleRelativePath } = require("./utils");
7
4
 
8
5
  /**
9
6
  * Construct HTML element, as a string, which corresponds to the sidebar for
@@ -52,7 +49,7 @@ function generateSidebarHtml(
52
49
  path.dirname(currentPath)
53
50
  );
54
51
  const activeClass = isActive ? " active" : "";
55
- const cleanedHref = encodeHtmlAttributeValue(relativeUri);
52
+ const cleanedHref = encode(relativeUri);
56
53
  return "<li class=\"sidebar-item\">" +
57
54
  `<a class="sidebar-link${activeClass}" href="` +
58
55
  cleanedHref +
@@ -71,11 +68,11 @@ function constructSidebarHeaderHtml(logoInfo) {
71
68
  let hasLink = false;
72
69
  if (typeof logoInfo.link === "string") {
73
70
  hasLink = true;
74
- sidebarHeaderHtml += `<a href="${encodeHtmlAttributeValue(logoInfo.link)}">`;
71
+ sidebarHeaderHtml += `<a href="${encode(logoInfo.link)}">`;
75
72
  }
76
73
  if (typeof logoInfo.url === "string") {
77
74
  sidebarHeaderHtml += `<img alt="logo" class="sidebar-header-logo"` +
78
- ` src="${encodeHtmlAttributeValue(logoInfo.url)}" />`;
75
+ ` src="${encode(logoInfo.url)}" />`;
79
76
  }
80
77
  if (hasLink) {
81
78
  sidebarHeaderHtml += "</a>";
@@ -20,16 +20,6 @@ async function mkdirParent(dirPath, mode) {
20
20
  }
21
21
  };
22
22
 
23
- /**
24
- * @param {string} val
25
- * @returns {string}
26
- */
27
- function encodeHtmlAttributeValue(val) {
28
- return val
29
- .replace(/&/g, "&amp;")
30
- .replace(/"/g, "&quot;");
31
- }
32
-
33
23
  /**
34
24
  * @param {string} target
35
25
  * @param {string} currentDir
@@ -77,7 +67,6 @@ function getGithubSvg() {
77
67
  }
78
68
 
79
69
  module.exports = {
80
- encodeHtmlAttributeValue,
81
70
  getGithubSvg,
82
71
  mkdirParent,
83
72
  pathToUrl,
@@ -36,7 +36,7 @@
36
36
 
37
37
  const fs = require("fs");
38
38
  const path = require("path");
39
- const sanitizeHTML = require("sanitize-html");
39
+ const { encode } = require("html-entities");
40
40
  const semver = require("semver");
41
41
 
42
42
  const INITIAL_PATH = "./versions";
@@ -88,8 +88,8 @@ if (versions.length <= 0) {
88
88
  const version = sortedVersions[i];
89
89
  // const versionAsNumber = +version.split(".").join();
90
90
  const dirPath = path.join(INITIAL_PATH, version, "demo/index.html");
91
- body += `<li><a href=${sanitizeHTML(dirPath)}>` +
92
- sanitizeHTML(version) +
91
+ body += `<li><a href=${encode(dirPath)}>` +
92
+ encode(version) +
93
93
  "</a></li>";
94
94
  }
95
95
  body += "</ul>";
@@ -36,7 +36,7 @@
36
36
 
37
37
  const fs = require("fs");
38
38
  const path = require("path");
39
- const sanitizeHTML = require("sanitize-html");
39
+ const { encode } = require("html-entities");
40
40
  const semver = require("semver");
41
41
 
42
42
  const INITIAL_PATH = "./versions";
@@ -92,8 +92,8 @@ if (versions.length <= 0) {
92
92
  path.join(INITIAL_PATH, version, "doc/api/Overview.html") :
93
93
  path.join(INITIAL_PATH, version, "doc/pages/index.html");
94
94
 
95
- body += `<li><a href=${sanitizeHTML(dirPath)}>` +
96
- sanitizeHTML(version) +
95
+ body += `<li><a href=${encode(dirPath)}>` +
96
+ encode(version) +
97
97
  "</a></li>";
98
98
  }
99
99
  body += "</ul>";
@@ -2,16 +2,11 @@
2
2
  /* eslint-env node */
3
3
 
4
4
  /**
5
- * Run the standalone demo server
6
- * ==============================
5
+ * Launch static server
6
+ * ====================
7
7
  *
8
- * This script allows to build the standalone demo locally and start both an
9
- * HTTP and an HTTPS (only if a certificate and key have been generated) server
10
- * to serve it, on the port 8001 and 8444 respectively.
11
- *
12
- * You can run it as a script through `node run_standalone_demo.js`.
13
- * Be aware that this demo will be built again every time one of the library
14
- * file is updated.
8
+ * This script allows to start both an HTTP and an HTTPS (only if a certificate
9
+ * path and a key path have been given) static file server.
15
10
  */
16
11
 
17
12
  const express = require("express");
@@ -26,78 +21,143 @@ const getHumanReadableHours = require("./utils/get_human_readable_hours");
26
21
  * @param {Object} config - Associated configuration.
27
22
  * @param {number} config.httpPort - Port on which the server will be listening
28
23
  * for HTTP traffic.
29
- * @param {number} config.httpsPort - Port on which the server will be listening
30
- * for HTTPS traffic.
24
+ * @param {number} [config.httpsPort] - Port on which the server will be
25
+ * listening for HTTPS traffic.
26
+ * If not defined, the server won't listen for HTTPS traffic.
27
+ * @param {boolean} [config.verbose] - If set to `true` the server will output
28
+ * when the server start listening and when anything failed.
31
29
  * @param {string} [config.certificatePath] - Path to the TLS certificate that
32
30
  * will be used in HTTPS connections.
33
- * If not defined or if it doesn't lead to any file, the server won't listen for
34
- * HTTPS traffic.
35
- * @param {string} config.keyPath - Path to the public key allowing to encrypt
31
+ * If not defined, the server won't listen for HTTPS traffic.
32
+ * @param {string} [config.keyPath] - Path to the public key allowing to encrypt
36
33
  * the HTTPS connection.
37
- * If not defined or if it doesn't lead to any file, the server won't listen for
38
- * HTTPS traffic.
34
+ * If not defined, the server won't listen for HTTPS traffic.
35
+ * @returns {Object} Object with two properties:
36
+ * - `listeningPromise` (Promise.<Object>): This promise rejects if the HTTP
37
+ * server could not start but resolves in any other case (listening to HTTP
38
+ * alone or both HTTP and HTTPS), even if the asked HTTPS server could not
39
+ * be started.
40
+ *
41
+ * The resolved object contains two boolean properties: `http` and `https`,
42
+ * which are set to `true` when the corresponding server has been started.
43
+ *
44
+ * You can know the reason for the HTTPS server not starting by setting the
45
+ * `verbose` option to `true`. In that case, it will be logged.
46
+ *
47
+ * - `close` (Function): Method allowing to stop the servers from listening
48
+ * and to free their resources.
39
49
  */
40
50
  module.exports = function launchStaticServer(path, config) {
51
+ const shouldStartHttps = config.httpsPort !== undefined &&
52
+ config.certificatePath !== undefined &&
53
+ config.keyPath !== undefined;
54
+ let isHttpServerStarted = false
55
+ let isHttpsServerStarted = false;
56
+
41
57
  const app = express();
42
58
  app.use(express.static(path));
43
59
 
44
- if (config.certificatePath === undefined || config.keyPath === undefined) {
45
- console.warn(`[${getHumanReadableHours()}] ` +
46
- "Not launching the demo in HTTPS: certificate not generated.\n" +
47
- "You can run `npm run certificate` to generate a certificate.");
48
- }
60
+ let server;
61
+ const listeningPromise = new Promise((res, rej) => {
62
+ server = app.listen(config.httpPort, (err) => {
63
+ if (err) {
64
+ if (config.verbose) {
65
+ /* eslint-disable-next-line no-console */
66
+ console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
67
+ "Could not start static HTTP server:",
68
+ err);
69
+ }
70
+ server.close();
71
+ return rej(err);
72
+ }
73
+ if (config.verbose) {
74
+ /* eslint-disable-next-line no-console */
75
+ console.log(`[${getHumanReadableHours()}] ` +
76
+ `Listening HTTP at http://localhost:${config.httpPort}`);
77
+ }
78
+ isHttpServerStarted = true;
79
+ if (!shouldStartHttps || isHttpsServerStarted) {
80
+ res({ http: true, https: isHttpsServerStarted });
81
+ }
82
+ });
49
83
 
50
- app.listen(config.httpPort, (err) => {
51
- if (err) {
52
- /* eslint-disable no-console */
53
- console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
54
- "Could not start HTTP server:",
55
- err);
56
- /* eslint-enable no-console */
84
+ if (!shouldStartHttps) {
57
85
  return;
58
86
  }
59
- /* eslint-disable no-console */
60
- console.log(`[${getHumanReadableHours()}] ` +
61
- `Listening HTTP at http://localhost:${config.httpPort}`);
62
- /* eslint-enable no-console */
63
- });
64
87
 
65
- Promise.all([
66
- promisify(fs.readFile)(config.certificatePath),
67
- promisify(fs.readFile)(config.keyPath),
68
- ]).then(([pubFile, privFile]) => {
69
- if (pubFile != null && privFile != null) {
70
- https.createServer({
71
- key: privFile,
72
- cert: pubFile,
73
- }, app).listen(config.httpsPort, (err) => {
74
- if (err) {
75
- /* eslint-disable no-console */
88
+ Promise.all([
89
+ promisify(fs.readFile)(config.certificatePath),
90
+ promisify(fs.readFile)(config.keyPath),
91
+ ]).then(([certFile, keyFile]) => {
92
+ if (certFile != null && keyFile != null) {
93
+ https.createServer({
94
+ key: keyFile,
95
+ cert: certFile,
96
+ }, app).listen(config.httpsPort, (err) => {
97
+ if (err) {
98
+ if (config.verbose) {
99
+ /* eslint-disable-next-line no-console */
100
+ console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
101
+ "Could not start static HTTPS server:",
102
+ err);
103
+ }
104
+ if (isHttpServerStarted) {
105
+ res({ http: true, https: false });
106
+ }
107
+ return;
108
+ }
109
+ /* eslint-disable-next-line no-console */
110
+ console.log(`[${getHumanReadableHours()}] ` +
111
+ `Listening HTTPS at https://localhost:${config.httpsPort}`);
112
+ });
113
+ if (isHttpServerStarted) {
114
+ res();
115
+ }
116
+ isHttpsServerStarted = true;
117
+ } else {
118
+ const err = new Error("Impossible to load the certificate and/or key file");
119
+ if (config.verbose === true) {
120
+ /* eslint-disable-next-line no-console */
76
121
  console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
77
- "Could not start HTTPS server:",
122
+ "Could not start static HTTPS server:",
78
123
  err);
79
- /* eslint-enable no-console */
80
- return;
81
124
  }
82
- /* eslint-disable no-console */
83
- console.log(`[${getHumanReadableHours()}] ` +
84
- `Listening HTTPS at https://localhost:${config.httpsPort}`);
85
- /* eslint-enable no-console */
86
- });
87
- }
88
- }, (err) => {
89
- if (err.code === "ENOENT") {
90
- /* eslint-disable no-console */
91
- console.warn(`[${getHumanReadableHours()}] ` +
92
- "Not launching the demo in HTTPS: certificate not generated.\n" +
93
- "You can run `npm run certificate` to generate a certificate.");
94
- /* eslint-enable no-console */
95
- } else {
96
- /* eslint-disable no-console */
97
- console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
98
- "Could not readt keys and certificate:",
99
- err);
100
- /* eslint-enable no-console */
101
- }
125
+ if (isHttpServerStarted) {
126
+ res({ http: true, https: false });
127
+ }
128
+ return;
129
+ }
130
+ }, (err) => {
131
+ if (err.code === "ENOENT") {
132
+ if (config.verbose) {
133
+ /* eslint-disable-next-line no-console */
134
+ console.warn(`[${getHumanReadableHours()}] ` +
135
+ "Could not start static HTTPS server: ",
136
+ "Certificate not generated.\n" +
137
+ "(You can run `npm run certificate` to generate a certificate.)");
138
+ }
139
+ if (isHttpServerStarted) {
140
+ res({ http: true, https: false });
141
+ }
142
+ return;
143
+ } else {
144
+ const err = new Error("Could not read key and certificate file.");
145
+ if (config.verbose) {
146
+ /* eslint-disable-next-line no-console */
147
+ console.error(`\x1b[31m[${getHumanReadableHours()}]\x1b[0m ` +
148
+ "Could not start static HTTPS server:",
149
+ err);
150
+ }
151
+ if (isHttpServerStarted) {
152
+ res({ http: true, https: false });
153
+ }
154
+ return;
155
+ }
156
+ });
102
157
  });
158
+
159
+ return {
160
+ listeningPromise,
161
+ close() { server.close() },
162
+ };
103
163
  };
@@ -22,5 +22,6 @@ require("./generate_standalone_demo");
22
22
  launchStaticServer(path.join(__dirname, "../demo/standalone/"),
23
23
  { certificatePath: path.join(__dirname, "../localhost.crt"),
24
24
  keyPath: path.join(__dirname, "../localhost.key"),
25
+ verbose: true,
25
26
  httpPort: 8001,
26
27
  httpsPort: 8444 });
@@ -35,5 +35,6 @@ if (shouldRunFastVersion) {
35
35
  launchStaticServer(path.join(__dirname, "../demo/full/"),
36
36
  { certificatePath: path.join(__dirname, "../localhost.crt"),
37
37
  keyPath: path.join(__dirname, "../localhost.key"),
38
+ verbose: true,
38
39
  httpPort: 8000,
39
40
  httpsPort: 8443 });
@@ -1,7 +1,7 @@
1
1
  sonar.projectKey=rx-player
2
2
  sonar.organization=rx-player
3
3
  sonar.projectName=rx-player
4
- sonar.projectVersion=3.26.2
4
+ sonar.projectVersion=3.26.3-dev.2022021400
5
5
  sonar.sources=./src,./demo,./tests
6
6
  sonar.exclusions=demo/full/bundle.js,demo/standalone/lib.js,demo/bundle.js
7
7
  sonar.host.url=https://sonarcloud.io
@@ -23,15 +23,15 @@
23
23
 
24
24
  interface IFakeDocument {
25
25
  createElement(eltType: string) : HTMLElement;
26
- fullscreenElement? : Element | null;
27
- mozCancelFullScreen? : () => void;
28
- mozFullScreenElement? : HTMLElement;
29
- msExitFullscreen? : () => void;
30
- exitFullscreen? : () => void;
31
- msFullscreenElement? : Element | null;
26
+ fullscreenElement? : Element | null | undefined;
27
+ mozCancelFullScreen? : (() => void) | undefined;
28
+ mozFullScreenElement? : HTMLElement | undefined;
29
+ msExitFullscreen? : (() => void) | undefined;
30
+ exitFullscreen? : (() => void) | undefined;
31
+ msFullscreenElement? : Element | null | undefined;
32
32
  webkitExitFullscreen : () => void;
33
33
  webkitFullscreenElement : Element | null | undefined;
34
- webkitHidden? : boolean;
34
+ webkitHidden? : boolean | undefined;
35
35
  }
36
36
 
37
37
  const doc = document as unknown as IFakeDocument;
@@ -63,7 +63,7 @@ describe("Compat - isVTTCue", () => {
63
63
  const originalVTTCue = window.VTTCue;
64
64
  win.VTTCue = MockVTTCue;
65
65
  const cue = new VTTCue(0, 10, "");
66
- win.VTTCue = undefined;
66
+ delete win.VTTCue;
67
67
  const isVTTCue = require("../is_vtt_cue").default;
68
68
  expect(isVTTCue(cue)).toEqual(false);
69
69
  window.VTTCue = originalVTTCue;
@@ -45,7 +45,7 @@ class IE11MediaKeySession
45
45
  public keyStatuses: ICustomMediaKeyStatusMap;
46
46
  private readonly _mk: MSMediaKeys;
47
47
  private readonly _closeSession$: Subject<void>;
48
- private _ss?: MSMediaKeySession;
48
+ private _ss: MSMediaKeySession | undefined;
49
49
  constructor(mk: MSMediaKeys) {
50
50
  super();
51
51
  this.expiration = NaN;
@@ -173,14 +173,18 @@ if (isNode ||
173
173
  supported = supported && (distinctiveIdentifier !== "required");
174
174
 
175
175
  if (supported) {
176
- const keySystemConfigurationResponse = {
177
- videoCapabilities,
178
- audioCapabilities,
176
+ const keySystemConfigurationResponse : MediaKeySystemConfiguration = {
179
177
  initDataTypes: ["cenc"],
180
178
  distinctiveIdentifier: "not-allowed" as const,
181
179
  persistentState: "required" as const,
182
180
  sessionTypes: ["temporary", "persistent-license"],
183
181
  };
182
+ if (videoCapabilities !== undefined) {
183
+ keySystemConfigurationResponse.videoCapabilities = videoCapabilities;
184
+ }
185
+ if (audioCapabilities !== undefined) {
186
+ keySystemConfigurationResponse.audioCapabilities = audioCapabilities;
187
+ }
184
188
 
185
189
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
186
190
  const customMediaKeys = createCustomMediaKeys(keyType);