rx-player 4.0.0-beta.1 → 4.0.0-beta.2

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 (169) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/CONTRIBUTING.md +48 -168
  3. package/FILES.md +40 -92
  4. package/VERSION +1 -1
  5. package/dist/_esm5.processed/compat/browser_detection.d.ts +3 -1
  6. package/dist/_esm5.processed/compat/browser_detection.js +7 -2
  7. package/dist/_esm5.processed/compat/eme/load_session.js +1 -1
  8. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
  9. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +26 -0
  10. package/dist/_esm5.processed/config.d.ts +2 -0
  11. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +5 -4
  12. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +18 -1
  13. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +106 -25
  14. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +6 -6
  15. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +8 -5
  16. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +19 -1
  17. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +1 -1
  18. package/dist/_esm5.processed/core/api/debug/render.js +1 -1
  19. package/dist/_esm5.processed/core/api/playback_observer.js +1 -0
  20. package/dist/_esm5.processed/core/api/public_api.d.ts +54 -1
  21. package/dist/_esm5.processed/core/api/public_api.js +232 -35
  22. package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +10 -1
  23. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +13 -1
  24. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +30 -15
  25. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +3 -1
  26. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +67 -152
  27. package/dist/_esm5.processed/core/api/utils.d.ts +10 -0
  28. package/dist/_esm5.processed/core/api/utils.js +20 -0
  29. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +7 -1
  30. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +2 -0
  31. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +5 -1
  32. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +1 -1
  33. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +47 -10
  34. package/dist/_esm5.processed/core/init/types.d.ts +9 -1
  35. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +28 -1
  36. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +22 -9
  37. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +58 -0
  38. package/dist/_esm5.processed/core/init/utils/{media_duration_updater.js → media_source_duration_updater.js} +84 -87
  39. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +36 -2
  40. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +82 -2
  41. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -7
  42. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +31 -40
  43. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +8 -0
  44. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +12 -0
  45. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +8 -0
  46. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +12 -0
  47. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +11 -4
  48. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  49. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +47 -0
  50. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +70 -0
  51. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +15 -8
  52. package/dist/_esm5.processed/core/stream/period/period_stream.js +1 -1
  53. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +22 -13
  54. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -2
  55. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +2 -2
  56. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +3 -2
  57. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +8 -8
  58. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +2 -2
  59. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +2 -3
  60. package/dist/_esm5.processed/default_config.d.ts +25 -0
  61. package/dist/_esm5.processed/default_config.js +27 -2
  62. package/dist/_esm5.processed/errors/index.d.ts +2 -2
  63. package/dist/_esm5.processed/errors/media_error.d.ts +23 -1
  64. package/dist/_esm5.processed/errors/media_error.js +18 -5
  65. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +1 -1
  66. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +8 -7
  67. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +17 -9
  68. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +0 -2
  69. package/dist/_esm5.processed/manifest/adaptation.d.ts +21 -2
  70. package/dist/_esm5.processed/manifest/adaptation.js +76 -1
  71. package/dist/_esm5.processed/manifest/manifest.js +1 -1
  72. package/dist/_esm5.processed/manifest/period.js +2 -2
  73. package/dist/_esm5.processed/manifest/representation.d.ts +33 -2
  74. package/dist/_esm5.processed/manifest/representation.js +21 -0
  75. package/dist/_esm5.processed/manifest/utils.js +1 -3
  76. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +1 -1
  77. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +1 -1
  78. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -0
  79. package/dist/_esm5.processed/public_types.d.ts +13 -3
  80. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +1 -1
  81. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.d.ts +4 -6
  82. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +4 -6
  83. package/dist/_esm5.processed/utils/is_null_or_undefined.d.ts +1 -1
  84. package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -1
  85. package/dist/mpd-parser.wasm +0 -0
  86. package/dist/rx-player.js +4709 -4218
  87. package/dist/rx-player.min.js +1 -1
  88. package/package.json +42 -36
  89. package/scripts/build/generate_build.js +1 -1
  90. package/scripts/fast_demo_build.js +4 -3
  91. package/scripts/generate_full_demo.js +1 -1
  92. package/sonar-project.properties +1 -1
  93. package/src/compat/browser_detection.ts +7 -1
  94. package/src/compat/eme/load_session.ts +1 -1
  95. package/src/compat/has_issues_with_high_media_source_duration.ts +27 -0
  96. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +147 -48
  97. package/src/core/adaptive/adaptive_representation_selector.ts +7 -4
  98. package/src/core/adaptive/buffer_based_chooser.ts +144 -26
  99. package/src/core/adaptive/guess_based_chooser.ts +9 -8
  100. package/src/core/adaptive/network_analyzer.ts +9 -4
  101. package/src/core/adaptive/utils/representation_score_calculator.ts +22 -2
  102. package/src/core/api/debug/render.ts +1 -1
  103. package/src/core/api/playback_observer.ts +1 -0
  104. package/src/core/api/public_api.ts +277 -44
  105. package/src/core/api/track_management/media_element_tracks_store.ts +17 -8
  106. package/src/core/api/track_management/track_dispatcher.ts +37 -14
  107. package/src/core/api/track_management/tracks_store.ts +77 -167
  108. package/src/core/api/utils.ts +26 -0
  109. package/src/core/decrypt/session_events_listener.ts +6 -1
  110. package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +2 -1
  111. package/src/core/decrypt/utils/loaded_sessions_store.ts +8 -1
  112. package/src/core/init/directfile_content_initializer.ts +1 -0
  113. package/src/core/init/media_source_content_initializer.ts +52 -9
  114. package/src/core/init/types.ts +9 -1
  115. package/src/core/init/utils/content_time_boundaries_observer.ts +46 -10
  116. package/src/core/init/utils/{media_duration_updater.ts → media_source_duration_updater.ts} +100 -112
  117. package/src/core/init/utils/rebuffering_controller.ts +114 -3
  118. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +56 -55
  119. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +16 -0
  120. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +16 -0
  121. package/src/core/segment_buffers/implementations/types.ts +16 -4
  122. package/src/core/segment_buffers/index.ts +2 -0
  123. package/src/core/stream/adaptation/utils/create_representation_estimator.ts +114 -0
  124. package/src/core/stream/orchestrator/stream_orchestrator.ts +16 -8
  125. package/src/core/stream/period/period_stream.ts +2 -1
  126. package/src/core/stream/representation/representation_stream.ts +34 -22
  127. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +8 -3
  128. package/src/core/stream/representation/utils/push_init_segment.ts +11 -6
  129. package/src/core/stream/representation/utils/push_media_segment.ts +3 -3
  130. package/src/default_config.ts +29 -2
  131. package/src/errors/__tests__/media_error.test.ts +6 -6
  132. package/src/errors/index.ts +4 -1
  133. package/src/errors/media_error.ts +67 -1
  134. package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +10 -7
  135. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +17 -6
  136. package/src/experimental/tools/mediaCapabilitiesProber/index.ts +0 -4
  137. package/src/manifest/__tests__/manifest.test.ts +7 -7
  138. package/src/manifest/__tests__/period.test.ts +90 -45
  139. package/src/manifest/adaptation.ts +89 -1
  140. package/src/manifest/manifest.ts +1 -1
  141. package/src/manifest/period.ts +4 -2
  142. package/src/manifest/representation.ts +67 -1
  143. package/src/manifest/utils.ts +1 -3
  144. package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +1 -1
  145. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -0
  146. package/src/parsers/texttracks/ttml/parse_ttml.ts +1 -1
  147. package/src/public_types.ts +16 -1
  148. package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
  149. package/src/transports/smooth/isobmff/create_boxes.ts +4 -6
  150. package/src/typings/globals.d.ts +20 -20
  151. package/src/utils/is_null_or_undefined.ts +1 -1
  152. package/dist/_esm5.processed/core/init/utils/media_duration_updater.d.ts +0 -56
  153. package/scripts/doc-generator/construct_table_of_contents.js +0 -76
  154. package/scripts/doc-generator/convert_MD_to_HMTL.js +0 -26
  155. package/scripts/doc-generator/create_documentation.js +0 -331
  156. package/scripts/doc-generator/create_documentation_page.js +0 -209
  157. package/scripts/doc-generator/create_page.js +0 -210
  158. package/scripts/doc-generator/generate_header_html.js +0 -147
  159. package/scripts/doc-generator/generate_page_html.js +0 -115
  160. package/scripts/doc-generator/generate_page_list_html.js +0 -92
  161. package/scripts/doc-generator/generate_sidebar_html.js +0 -85
  162. package/scripts/doc-generator/get_search_data_for_content.js +0 -137
  163. package/scripts/doc-generator/index.js +0 -34
  164. package/scripts/doc-generator/parse_doc_configs.js +0 -327
  165. package/scripts/doc-generator/scripts/lunr.js +0 -10
  166. package/scripts/doc-generator/scripts/script.js +0 -451
  167. package/scripts/doc-generator/styles/code.css +0 -99
  168. package/scripts/doc-generator/styles/style.css +0 -835
  169. package/scripts/doc-generator/utils.js +0 -74
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## v4.0.0-beta.2 (2023-03-08)
4
+
5
+ ### Changes
6
+
7
+ - If all Representations from the current track become undecipherable, automatically switch to another track (also send a `trackUpdate` event) instead of stopping on error [#1234]
8
+ - Only send `MediaError` errors with the `NO_PLAYABLE_REPRESENTATION` error code when no Representation from all tracks of a given type can be played [#1234]
9
+
10
+ ### Features
11
+
12
+ - Add `representationListUpdate` event for when the list of available Representation for a current track changes [#1240]
13
+ - Add `"no-playable-representation"` as a `reason` for `trackUpdate` events when the track switch is due to encrypted Representations [#1234]
14
+
15
+ ### Other improvements
16
+
17
+ - DRM: Reload when playback is unexpectedly frozen with encrypted but only decipherable data in the buffer to work-around rare encryption-related issues [#1236]
18
+
19
+
20
+ ## v3.31.0 (2023-06-14)
21
+
22
+ ### Features
23
+
24
+ - Add `isContentLoaded`, `isBuffering`, `isPaused`, and `getLastStoredContentPosition` methods [#1248]
25
+ - Add `play` and `paused` events [#1253]
26
+ - Add `trackInfo` property to some `MediaError` to expose information on the track that caused the error [#1241]
27
+
28
+ ### Bug fixes
29
+
30
+ - DASH: Fix issue which could lead to infinite rebuffering when switching between multiple Periods [#1232]
31
+ - Return actual ending duration through the `getVideoDuration` method when playing dynamic contents whose future end is already known [#1235]
32
+ - DASH/WASM: actually reject the `DASH_WASM.initialize`'s Promise if it fails [#1238]
33
+ - On the PlayStation 5, set `Infinity` MediaSource duration for live contents to prevent playback issues [#1250]
34
+
35
+ ### Other improvements
36
+
37
+ - adaptive: Perform various adaptive tweaks to avoid switching too much between qualities in some conditions [#1237]
38
+ - Directfile: Detect "forced" subtitles on Safari when playing directfile contents (such as HLS) [#1239]
39
+ - Improve `"direct"` `audioTrackSwitchingMode` compatibility by re-seeking [#1246]
40
+ - The `DEBUG_ELEMENT` feature now uses the `monospace` fallback font as a default for a better rendering on apple devices
41
+ - doc: externalize documentation-generator code
42
+
3
43
  ## v4.0.0-beta.1 (2023-03-08)
4
44
 
5
45
  ### Bug fixes
package/CONTRIBUTING.md CHANGED
@@ -1,32 +1,6 @@
1
- # Contributing to the RxPlayer #################################################
2
-
3
- ## Table of contents ###########################################################
4
-
5
- - [Issues and new features](#issues)
6
- - [Reading the current code](#reading)
7
- - [Code style](#code)
8
- - [Linting](#code-lint)
9
- - [Types](#code-types)
10
- - [Forbidden functions and classes](#code-forbidden)
11
- - [Starting the demo page](#demo)
12
- - [Building the demo and serving it](#demo-running)
13
- - [Using HTTPS](#demo-https)
14
- - [Creating a commit](#commit)
15
- - [Checks](#commit-checks)
16
- - [Convention](#commit-name)
17
- - [The test suite](#testing)
18
- - [Unit tests](#testing-unit)
19
- - [Integration tests](#testing-integration)
20
- - [Memory tests](#testing-memory)
21
- - [Documentation](#doc)
22
- - [Opening a pull request](#pr)
23
- - [Checks](#pr-checks)
24
- - [Which branch to merge to](#pr-branch)
25
-
26
-
27
-
28
- <a name="issues"></a>
29
- ## Issues and new features #####################################################
1
+ # Contributing to the RxPlayer
2
+
3
+ ## Issues and new features
30
4
 
31
5
  If you detect a problem with the RxPlayer, or if you desire a new feature,
32
6
  please first [open an issue on the github's
@@ -38,12 +12,11 @@ Those have to follow the conventions defined below.
38
12
 
39
13
 
40
14
 
41
- <a name="reading"></a>
42
- ## Reading the current code ####################################################
15
+ ## Reading the current code
43
16
 
44
17
  Even if we hope the current code is straightforward, readable and commented
45
18
  enough we can still admit that going blind into the codebase can be hard at
46
- first (as it would be for any non-small codebase).
19
+ first as this is a pretty big technical project on a specific matter.
47
20
 
48
21
  We thus encourage you to rely on the architecture documentation you can usually
49
22
  find alongside the code, in `README.md` files.
@@ -51,7 +24,7 @@ You can for example start by reading `src/README.md`, to have a clearer idea
51
24
  of the general code architecture of the player.
52
25
 
53
26
  Also, for a more exhaustive approach to the documentation of the project's file
54
- organization, you can look at `FILES.md` at the root of this repository.
27
+ organization, you can look at [`FILES.md`](./FILES.md).
55
28
 
56
29
  The code of the RxPlayer being heavily modularized, you should not need to read
57
30
  the whole documentation to be ready, only the parts you want to update
@@ -59,18 +32,17 @@ the whole documentation to be ready, only the parts you want to update
59
32
 
60
33
 
61
34
 
62
- <a name="code"></a>
63
- ## Code style ##################################################################
35
+ ## Code style
64
36
 
65
- <a name="code-lint"></a>
66
- ### Linting ####################################################################
37
+ ### Linting
67
38
 
68
39
  The code style in `src` is automatically checked by a "linter", `eslint`.
69
40
 
70
41
  It basically follows those principles:
71
42
  - 2 spaces indentation
72
43
  - 90 columns maximum
73
- - optimize your code for readability
44
+ - readability and being explicit is generally better than performance and
45
+ being smart
74
46
 
75
47
  You can easily check if you followed our style rules by calling `npm run lint`.
76
48
 
@@ -79,10 +51,9 @@ calling `npm run lint:demo`, or the style of the test files (in the `tests`
79
51
  directory) by calling `npm run lint:tests`.
80
52
 
81
53
 
82
- <a name="code-types"></a>
83
- ### Types ######################################################################
54
+ ### Types
84
55
 
85
- #### General TypeScript rules ##################################################
56
+ #### General TypeScript rules
86
57
 
87
58
  We try to be as strict as possible with types:
88
59
 
@@ -91,9 +62,6 @@ We try to be as strict as possible with types:
91
62
  - the `as` TypeScript keyword, used for type casting, should also be avoided
92
63
  as much as possible.
93
64
 
94
- - the `is` keyword is fine in some situations, but simpler solutions should be
95
- preferred.
96
-
97
65
  This is to be sure we can detect as much as possible type errors automatically
98
66
  with TypeScript.
99
67
 
@@ -101,7 +69,7 @@ with TypeScript.
101
69
 
102
70
  TypeScript's `type` and `interface` should all be named beginning with the
103
71
  letter `I`, for easier identification purposes\*:
104
- ```
72
+ ```ts
105
73
  interface IMyObject {
106
74
  someKey: string;
107
75
  }
@@ -110,88 +78,48 @@ type IStringOrNumber = string |
110
78
  number;
111
79
  ```
112
80
 
113
- \*We know that this rule is a controversial subject amongst TypeScript
114
- developpers, yet we still decide to enforce it for now.
115
-
116
- #### Generic parameters typing #################################################
117
-
118
- Generic parameters are usually named in order `T` (for the first generic
119
- parameter), then `U` (if there's two), then `V` (if there's three):
120
-
121
- Examples:
122
- ```
123
- type IMyGenericType<T> = Array<T>;
124
-
125
- type IMyGenericType2<T, U> = Promise<T> |
126
- U;
127
-
128
- function mergeThree<T, U, V>(
129
- arg1: T,
130
- arg2: U,
131
- arg3: V
132
- ) : T & U & V {
133
- return Object.assign({}, arg1, arg2, arg3);
81
+ `enum`s and `const enum`s, which have the particularity in TypeScript of
82
+ actually having an influence on the outputed code, do not follow this rule
83
+ however (because those are not just types erased during transpilation):
84
+ ```ts
85
+ enum MyEnum {
86
+ ValueA = 1,
87
+ ValueB = 2,
134
88
  }
135
- ```
136
89
 
137
- Some exceptions exist like for things like key-values couples, which can be named
138
- respectively `K` and `V`:
139
- ```
140
- type IMyMap<K, V> = Map<K, V>;
141
- ```
142
-
143
- This is a general convention for generic parameters inherited from Java, and
144
- re-used by TypeScript, and it helps identifying which type is a generic
145
- parameter vs which type is a real type (no prefix) vs which type is a type
146
- definition (prefixed by `I`).
147
-
148
- If what they correspond to is not obvious (and if there's more than one, it
149
- might well be), you're encouraged to add a more verbose and clear name, that you
150
- should prefix by `T`:
151
- ```
152
- function loadResource<TResourceFormat>(
153
- url : string
154
- ) : Promise<TResourceFormat> {
155
- // ...
90
+ const enum MyConstEnum {
91
+ Value1 = 1,
92
+ Value2 = 2,
156
93
  }
157
94
  ```
158
95
 
159
- However note that typing rules for generic parameters is a very minor
160
- consideration and may not always need to be respected depending on the code it
161
- is applied on.
162
- In the end, it will be up to the RxPlayer's maintainers to decide that those
163
- rules should be enforced or not on a given code.
164
-
96
+ \*We know that this rule is a controversial subject amongst TypeScript
97
+ developpers, yet we still decide to enforce it for now.
165
98
 
166
- <a name="code-forbidden"></a>
167
- ### Forbidden functions and classes ############################################
99
+ ### Forbidden functions and classes
168
100
 
169
101
  Some native functions, methods or classes should never be used to ensure
170
- compatibility with every browsers. To work around those, we usually rely on
102
+ compatibility with most browsers. To work around those, we usually rely on
171
103
  "ponyfills" which are JavaScript re-implementations.
172
104
 
173
105
  This concerns the following static methods:
174
106
  - `Object.assign`: use `src/utils/object_assign.ts` instead
175
107
  - `Object.values`: use `src/utils/object_values.ts` instead
176
108
 
177
- The following methods:
109
+ And the following methods:
178
110
  - `Array.prototype.includes`: use `src/utils/array_includes.ts` instead
179
111
  - `Array.prototype.find`: use `src/utils/array_find.ts` instead
180
112
  - `Array.prototype.findIndex`: use `src/utils/array_find_index.ts` instead
181
113
  - `String.prototype.startsWith`: use `src/utils/starts_with.ts` instead
182
114
  - `String.prototype.substr`: use `String.prototype.substring` instead
183
115
  - `NodeList.prototype.forEach`: use a regular for loop instead
184
-
185
- The following class:
186
- - `Promise`: use `src/utils/promise.ts` instead
116
+ - `Promise.prototype.finally`: Use `then` or both `then` and `catch` of that
117
+ Promise's methods instead.
187
118
 
188
119
 
120
+ ## The demo page
189
121
 
190
- <a name="demo"></a>
191
- ## Starting the demo page ######################################################
192
-
193
- <a name="demo-running"></a>
194
- ### Building the demo and serving it ###########################################
122
+ ### Building the demo and serving it
195
123
 
196
124
  You might want to quickly test your code modification(s) on a real use case.
197
125
 
@@ -227,10 +155,10 @@ npm run standalone
227
155
 
228
156
  Both will detect when the RxPlayer's files (or even the demo files) are updated
229
157
  and perform a new build when that's the case. In that way, the server will
230
- always serve the last local version of the code.
158
+ always serve the last local version of the code. Note however that hot-reload is
159
+ not enabled currently, you'll have to refresh the page yourself.
231
160
 
232
- <a name="demo-https"></a>
233
- ### Serving the demo page through HTTPS ########################################
161
+ ### Serving the demo page through HTTPS
234
162
 
235
163
  You might want to serve the demo via HTTPS. This is for example needed to be
236
164
  able to play encrypted contents in Chrome.
@@ -252,52 +180,18 @@ when going to one of the demo pages in HTTPS. In most browsers, you can however
252
180
  safely ignore that warning.
253
181
 
254
182
 
255
- <a name="commit"></a>
256
- ## Creating a commit ###########################################################
183
+ ## Creating a commit
257
184
 
258
- <a name="commit-checks"></a>
259
- ### Checks #####################################################################
185
+ ### Checks
260
186
 
261
- Every commits in a PR should pass our quick checks (linter, typescript check
262
- and unit tests). To check if that's the case, you can run locally the `check`
187
+ Every commits in a PR should pass our quick checks (linter and TypeScript
188
+ check). To check if that's the case, you can run locally the `check`
263
189
  script by calling `npm run check`.
264
190
 
265
- Those checks give us some guarantees that every merged commit in the `master`
266
- branch is stable enough.
267
-
268
- This gives us more confidence on our code and also allows more advanced
269
- debugging if we detect a regression by the usage of tools such as git-bisect.
270
-
271
-
272
- <a name="commit-name"></a>
273
- ### Convention #################################################################
274
-
275
- When creating a new commit it is advised (though not enforced) to add a message
276
- containing multiple paragraphs.
277
-
278
- The first paragraph should be a short summary of what the commit does, short
279
- enough so it can usually be displayed on one line - probably like the usual
280
- commit messages you are used to.
281
- The following paragraphs can be as long as you want (note that relying on a
282
- [maximum column width of around 72 is a sensible
283
- default](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
284
- even if we do not enforce that either).
285
191
 
286
- The goal here is to help understand your changes at a later time, in case things
287
- go wrong in the future.
192
+ ## The test suite
288
193
 
289
- _You can create a commit with multiple paragraphs either through the command
290
- line either by setting multiple `-m` options to git-commit, or just by calling
291
- `git commit` with no `-m` option and editing the message manually in the opened
292
- editor._
293
-
294
-
295
-
296
- <a name="testing"></a>
297
- ## The test suite ##############################################################
298
-
299
- <a name="testing-unit"></a>
300
- ### Unit tests #################################################################
194
+ ### Unit tests
301
195
 
302
196
  Unit tests test function implementations. Mostly to check if they give a sane
303
197
  output for every input given.
@@ -307,15 +201,14 @@ Writing unit tests for new code is encouraged.
307
201
  Unit tests are written in a \_\_tests\_\_ directory, itself created in the same
308
202
  directory that the code it tests.
309
203
 
310
- They are written with the help of the Jest library and are named the following
311
- way: `filename_containing_the_function_tested.test.ts`.
204
+ They are written and run with the help of the Jest library and are named the
205
+ following way: `filename_containing_the_function_tested.test.ts`.
312
206
 
313
207
  To understand how to create a new test file, you can take inspiration from
314
208
  the current unit tests.
315
209
 
316
210
 
317
- <a name="testing-integration"></a>
318
- ### Integration tests ##########################################################
211
+ ### Integration tests
319
212
 
320
213
  What we call integration tests are tests testing the entire API of the RxPlayer.
321
214
 
@@ -332,8 +225,7 @@ If you want to know how it works, we invite you to rely on the already created
332
225
  tests and to read the corresponding files.
333
226
 
334
227
 
335
- <a name="testing-memory"></a>
336
- ### Memory tests ###############################################################
228
+ ### Memory tests
337
229
 
338
230
  Memory tests replicate simple scenarios and try to detect memory leaks.
339
231
 
@@ -342,8 +234,7 @@ You can also help us improving our memory tests. Those are written in
342
234
 
343
235
 
344
236
 
345
- <a name="doc"></a>
346
- ## Documentation ###############################################################
237
+ ## Documentation
347
238
 
348
239
  The documentation is written in the `doc` directory, at the root of the project.
349
240
 
@@ -353,20 +244,9 @@ calling the `doc` script through `npm run doc`.
353
244
 
354
245
 
355
246
 
356
- <a name="pr"></a>
357
- ## Opening a pull request ######################################################
358
-
359
- <a name="pr-checks"></a>
360
- ### Checks #####################################################################
361
-
362
- Before doing a Pull Request, please ensure that all integration tests pass by
363
- calling `npm run test:integration`.
364
-
365
- Then, please call `npm run test:memory`, which tests for memory leaks.
366
-
247
+ ## Opening a pull request
367
248
 
368
- <a name="pr-branch"></a>
369
- ### Which branch to merge to ###################################################
249
+ ### Which branch to merge to
370
250
 
371
251
  Pull requests for bug fixes, new tests or documentation should be done on the
372
252
  `master` branch.