rx-player 3.30.1-dev.2023032800 → 3.31.0-dev.2023052200
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.
- package/CHANGELOG.md +14 -2
- package/CONTRIBUTING.md +48 -168
- package/FILES.md +40 -92
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/browser_detection.d.ts +3 -1
- package/dist/_esm5.processed/compat/browser_detection.js +7 -2
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +26 -0
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +1 -2
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +18 -1
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +105 -24
- package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +6 -6
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +19 -1
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +1 -1
- package/dist/_esm5.processed/core/api/debug/render.js +1 -1
- package/dist/_esm5.processed/core/api/public_api.js +2 -2
- package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +10 -1
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +20 -117
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +28 -3
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +2 -2
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +29 -18
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +1 -1
- package/dist/_esm5.processed/core/stream/period/period_stream.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +2 -2
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +6 -2
- package/dist/_esm5.processed/errors/index.d.ts +2 -2
- package/dist/_esm5.processed/errors/media_error.d.ts +23 -1
- package/dist/_esm5.processed/errors/media_error.js +18 -5
- package/dist/_esm5.processed/manifest/adaptation.d.ts +17 -2
- package/dist/_esm5.processed/manifest/adaptation.js +67 -1
- package/dist/_esm5.processed/manifest/manifest.d.ts +1 -1
- package/dist/_esm5.processed/manifest/manifest.js +3 -3
- package/dist/_esm5.processed/manifest/period.js +1 -1
- package/dist/_esm5.processed/manifest/representation.d.ts +11 -1
- package/dist/_esm5.processed/manifest/representation.js +16 -0
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -0
- package/dist/_esm5.processed/public_types.d.ts +6 -5
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.d.ts +4 -6
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +4 -6
- package/dist/rx-player.js +3086 -3024
- package/dist/rx-player.min.js +1 -1
- package/package.json +25 -26
- package/sonar-project.properties +1 -1
- package/src/compat/browser_detection.ts +7 -1
- package/src/compat/has_issues_with_high_media_source_duration.ts +27 -0
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +147 -48
- package/src/core/adaptive/adaptive_representation_selector.ts +1 -2
- package/src/core/adaptive/buffer_based_chooser.ts +143 -25
- package/src/core/adaptive/guess_based_chooser.ts +9 -8
- package/src/core/adaptive/utils/representation_score_calculator.ts +22 -2
- package/src/core/api/debug/render.ts +1 -1
- package/src/core/api/public_api.ts +2 -2
- package/src/core/api/tracks_management/media_element_track_choice_manager.ts +17 -8
- package/src/core/api/tracks_management/track_choice_manager.ts +20 -132
- package/src/core/init/media_source_content_initializer.ts +32 -4
- package/src/core/init/utils/media_source_duration_updater.ts +31 -19
- package/src/core/segment_buffers/index.ts +2 -0
- package/src/core/stream/adaptation/utils/create_representation_estimator.ts +2 -1
- package/src/core/stream/period/period_stream.ts +2 -1
- package/src/core/stream/representation/utils/append_segment_to_buffer.ts +8 -3
- package/src/core/stream/representation/utils/push_init_segment.ts +7 -1
- package/src/errors/__tests__/media_error.test.ts +6 -6
- package/src/errors/index.ts +4 -1
- package/src/errors/media_error.ts +67 -1
- package/src/manifest/__tests__/period.test.ts +90 -45
- package/src/manifest/adaptation.ts +77 -2
- package/src/manifest/manifest.ts +5 -3
- package/src/manifest/period.ts +2 -1
- package/src/manifest/representation.ts +23 -1
- package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +1 -1
- package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -0
- package/src/parsers/texttracks/ttml/parse_ttml.ts +1 -1
- package/src/public_types.ts +8 -3
- package/src/transports/smooth/isobmff/create_boxes.ts +4 -6
- package/src/typings/globals.d.ts +21 -21
- package/scripts/doc-generator/construct_table_of_contents.js +0 -76
- package/scripts/doc-generator/convert_MD_to_HMTL.js +0 -26
- package/scripts/doc-generator/create_documentation.js +0 -331
- package/scripts/doc-generator/create_documentation_page.js +0 -209
- package/scripts/doc-generator/create_page.js +0 -210
- package/scripts/doc-generator/generate_header_html.js +0 -147
- package/scripts/doc-generator/generate_page_html.js +0 -115
- package/scripts/doc-generator/generate_page_list_html.js +0 -92
- package/scripts/doc-generator/generate_sidebar_html.js +0 -85
- package/scripts/doc-generator/get_search_data_for_content.js +0 -137
- package/scripts/doc-generator/index.js +0 -34
- package/scripts/doc-generator/parse_doc_configs.js +0 -327
- package/scripts/doc-generator/scripts/lunr.js +0 -10
- package/scripts/doc-generator/scripts/script.js +0 -451
- package/scripts/doc-generator/styles/code.css +0 -99
- package/scripts/doc-generator/styles/style.css +0 -835
- package/scripts/doc-generator/utils.js +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.
|
|
3
|
+
## v3.31.0-dev.2023052200 (2023-05-22)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add `trackInfo` property to some `MediaError` to expose information on the track that caused the error [#1241]
|
|
4
8
|
|
|
5
9
|
### Bug fixes
|
|
6
10
|
|
|
7
11
|
- DASH: Fix issue which could lead to infinite rebuffering when switching between multiple Periods [#1232]
|
|
8
12
|
- Return actual ending duration through the `getVideoDuration` method when playing dynamic contents whose future end is already known [#1235]
|
|
13
|
+
- DASH/WASM: actually reject the `DASH_WASM.initialize`'s Promise if it fails [#1238]
|
|
14
|
+
- On the PlayStation 5, set `Infinity` MediaSource duration for live contents to prevent playback issues [#1250]
|
|
15
|
+
- DASH/WASM: actually reject the DASH_WASM.initialize's Promise if it fails [#1238]
|
|
9
16
|
|
|
10
17
|
### Other improvements
|
|
11
18
|
|
|
12
|
-
- adaptive: Perform various adaptive tweaks to avoid switching too much between qualities in some conditions
|
|
19
|
+
- adaptive: Perform various adaptive tweaks to avoid switching too much between qualities in some conditions [#1237]
|
|
20
|
+
- Directfile: Detect "forced" subtitles on Safari when playing directfile contents (such as HLS) [#1239]
|
|
21
|
+
- DRM: Reload when playback is unexpectedly frozen with encrypted but only decipherable data in the buffer [#1236]
|
|
22
|
+
- Improve `"direct"` `audioTrackSwitchingMode` compatibility by re-seeking [#1246]
|
|
23
|
+
- The `DEBUG_ELEMENT` feature now uses the `monospace` fallback font as a default for a better rendering on apple devices
|
|
24
|
+
- doc: externalize documentation-generator code
|
|
13
25
|
|
|
14
26
|
|
|
15
27
|
## v3.30.0 (2023-03-07)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
# Contributing to the RxPlayer
|
|
2
|
-
|
|
3
|
-
##
|
|
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
|
-
|
|
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
|
|
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`
|
|
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
|
-
|
|
63
|
-
## Code style ##################################################################
|
|
35
|
+
## Code style
|
|
64
36
|
|
|
65
|
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
160
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
256
|
-
## Creating a commit ###########################################################
|
|
183
|
+
## Creating a commit
|
|
257
184
|
|
|
258
|
-
|
|
259
|
-
### Checks #####################################################################
|
|
185
|
+
### Checks
|
|
260
186
|
|
|
261
|
-
Every commits in a PR should pass our quick checks (linter
|
|
262
|
-
|
|
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
|
|
287
|
-
go wrong in the future.
|
|
192
|
+
## The test suite
|
|
288
193
|
|
|
289
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
package/FILES.md
CHANGED
|
@@ -1,44 +1,14 @@
|
|
|
1
|
-
# File architecture
|
|
1
|
+
# File architecture
|
|
2
2
|
|
|
3
3
|
This page describes how the player files are organized. Each chapter go through
|
|
4
4
|
a single directory or subdirectory, in alphabetical order.
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [scripts/: Tools and scripts](#scripts)
|
|
13
|
-
- [src/: the source code](#src)
|
|
14
|
-
- [src/compat/: The compatibility files](#src-compat)
|
|
15
|
-
- [src/core/: The core files](#src-core)
|
|
16
|
-
- [src/errors/: Error definitions](#src-errors)
|
|
17
|
-
- [src/experimental/: Experimental features](#src-experimental)
|
|
18
|
-
- [src/features/: Feature switching](#src-features)
|
|
19
|
-
- [src/manifest/: The Manifest class](#src-manifest)
|
|
20
|
-
- [src/transports/: The transport protocols](#src-transports)
|
|
21
|
-
- [src/parsers/: The parsing files](#src-parsers)
|
|
22
|
-
- [src/typings/: Typescript typings](#src-typings)
|
|
23
|
-
- [src/utils/: The utils](#src-utils)
|
|
24
|
-
- [src/core/: The core directory](#core)
|
|
25
|
-
- [src/core/adaptive/: The adaptive bitrate code](#core-abr)
|
|
26
|
-
- [src/core/api/: The API definition](#core-api)
|
|
27
|
-
- [src/core/stream/: Load the right segments](#core-stream)
|
|
28
|
-
- [src/core/decrypt/: Decryption management](#core-decrypt)
|
|
29
|
-
- [src/core/fetchers/: The fetchers](#core-fetchers)
|
|
30
|
-
- [src/core/segment_buffers/: The Media buffers](#core-sb)
|
|
31
|
-
- [src/core/init/: Media streaming logic](#core-init)
|
|
32
|
-
- [src/**/__tests__: the unit tests directories](#src-tests)
|
|
33
|
-
- [tests/: the player's tests](#tests)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<a name="demo"></a>
|
|
37
|
-
## The demo/ directory: Demos of rx-player implementations #####################
|
|
38
|
-
|
|
39
|
-
Demonstration of functional codebases implementing the rx-player.
|
|
40
|
-
|
|
41
|
-
At the time of writing, there are two demos:
|
|
7
|
+
## `demo/`: Demo applications
|
|
8
|
+
|
|
9
|
+
The `demo/` directory contains demos of application using the RxPlayer.
|
|
10
|
+
|
|
11
|
+
At the time of writing, there are two distinct demos:
|
|
42
12
|
|
|
43
13
|
- _full_: Demo with a graphic interface, written with the React library, to
|
|
44
14
|
showcase what the player can do
|
|
@@ -48,36 +18,35 @@ At the time of writing, there are two demos:
|
|
|
48
18
|
the displayed page.
|
|
49
19
|
|
|
50
20
|
|
|
51
|
-
|
|
52
|
-
## The dist/ directory: Player builds ##########################################
|
|
21
|
+
## `dist/`: Builds
|
|
53
22
|
|
|
54
|
-
|
|
23
|
+
The `demo/` directory stores the player builds of the last version released.
|
|
55
24
|
|
|
56
|
-
Contains
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
Contains the minified (``rx-player.min.js``) and the non-minified files
|
|
26
|
+
(``rx-player.js``). Both are automatically generated with scripts at every new
|
|
27
|
+
release.
|
|
59
28
|
|
|
60
29
|
Two directories, namely ``_esm5.raw`` and ``_esm5.processed`` can also be
|
|
61
30
|
generated in here if the right scripts are called.
|
|
62
31
|
These allow to publish more modular codebases to npm.
|
|
63
32
|
|
|
64
33
|
|
|
65
|
-
|
|
66
|
-
## The doc/ directory: Player documentation ####################################
|
|
34
|
+
## `doc/`: Documentation
|
|
67
35
|
|
|
68
|
-
|
|
36
|
+
The `doc/` directory contains the RxPlayer's documentation, mostly written in
|
|
37
|
+
markdown, on various subjects related to the rx-player:
|
|
69
38
|
- API documentation
|
|
70
39
|
- tutorials
|
|
71
40
|
- list of deprecated APIs...
|
|
72
41
|
- how to transition between RxPlayer versions
|
|
42
|
+
- how to contribute
|
|
73
43
|
- etc.
|
|
74
44
|
|
|
75
45
|
|
|
76
|
-
|
|
77
|
-
## The scripts/ directory: scripts #####################################
|
|
46
|
+
## `scripts/`: Project-managing scripts
|
|
78
47
|
|
|
79
|
-
|
|
80
|
-
code.
|
|
48
|
+
The `scripts/` directory contains various scripts used to help the test and the
|
|
49
|
+
management of the player code.
|
|
81
50
|
|
|
82
51
|
For example:
|
|
83
52
|
- generating one of the demo and starting the server to run it
|
|
@@ -86,16 +55,14 @@ For example:
|
|
|
86
55
|
- generating the rx-player build before publishing on npm
|
|
87
56
|
|
|
88
57
|
|
|
89
|
-
|
|
90
|
-
## The src/ directory: the source code #########################################
|
|
58
|
+
## `src/`: The source code
|
|
91
59
|
|
|
92
|
-
The src contains the entire source code of the rx-player.
|
|
60
|
+
The `src` directory contains the entire source code of the rx-player.
|
|
93
61
|
|
|
94
62
|
It is subdivized into subdirectories which are defined here.
|
|
95
63
|
|
|
96
64
|
|
|
97
|
-
|
|
98
|
-
### src/compat/: The compatibility files #######################################
|
|
65
|
+
### `src/compat/`: Compatibility files
|
|
99
66
|
|
|
100
67
|
``src/compat`` contains functions allowing to use browser APIs in a
|
|
101
68
|
cross-browser manner.
|
|
@@ -110,8 +77,7 @@ Every functions needed in the rest of the code are exported in
|
|
|
110
77
|
``import { whatINeed } from "../compat";``)
|
|
111
78
|
|
|
112
79
|
|
|
113
|
-
|
|
114
|
-
### src/core/: The core files ##################################################
|
|
80
|
+
### `src/core/`: Core logic
|
|
115
81
|
|
|
116
82
|
Defines the logic and behavior of the player, regardless of the browser and of
|
|
117
83
|
the streaming technology used.
|
|
@@ -126,22 +92,19 @@ This directory contains other subdirectories which are listed in the next
|
|
|
126
92
|
chapter.
|
|
127
93
|
|
|
128
94
|
|
|
129
|
-
|
|
130
|
-
### src/errors/: Error definitions #############################################
|
|
95
|
+
### `src/errors/`: Error definitions
|
|
131
96
|
|
|
132
97
|
Contains the definition of the error classes used in the rx-player and
|
|
133
98
|
accessible through the API.
|
|
134
99
|
|
|
135
100
|
|
|
136
|
-
|
|
137
|
-
### src/experimental/: Experimental features ###################################
|
|
101
|
+
### `src/experimental/`: Experimental features
|
|
138
102
|
|
|
139
103
|
You will find here experimental features. Those are tested features who might
|
|
140
104
|
completely change their API in new player versions.
|
|
141
105
|
|
|
142
106
|
|
|
143
|
-
|
|
144
|
-
### src/features/: Feature switching ###########################################
|
|
107
|
+
### `src/features/`: Feature switching
|
|
145
108
|
|
|
146
109
|
This manage activated or deactivated features (e.g. DASH, TTML subtitles
|
|
147
110
|
parsing).
|
|
@@ -150,16 +113,14 @@ It exports an object defining the different activated features and provide utils
|
|
|
150
113
|
to initialize and update them.
|
|
151
114
|
|
|
152
115
|
|
|
153
|
-
|
|
154
|
-
### src/manifest/: The Manifest class ##########################################
|
|
116
|
+
### `src/manifest/`: Manifest Object definition
|
|
155
117
|
|
|
156
118
|
Defines a common `Manifest` class, regardless of the streaming technology (DASH,
|
|
157
119
|
HSS...). This class is then used by the rest of the RxPlayer, to allow
|
|
158
120
|
interaction with it without considering the underlying technology used.
|
|
159
121
|
|
|
160
122
|
|
|
161
|
-
|
|
162
|
-
### src/transports/: The transport protocols ###################################
|
|
123
|
+
### `src/transports/`: Streaming protocols implementation
|
|
163
124
|
|
|
164
125
|
Defines a common interface for multiple streaming technologies (DASH, HSS).
|
|
165
126
|
|
|
@@ -175,8 +136,7 @@ As in most of the code of the rx-player, everything used in the other parts of
|
|
|
175
136
|
the code is exported in the index.js file at the root of this directory.
|
|
176
137
|
|
|
177
138
|
|
|
178
|
-
|
|
179
|
-
### src/parsers/: The parsers ##################################################
|
|
139
|
+
### `src/parsers/`: The parsers
|
|
180
140
|
|
|
181
141
|
Functions to parse various formats into the same interface.
|
|
182
142
|
|
|
@@ -187,22 +147,19 @@ The parsed data being either:
|
|
|
187
147
|
- image containers: BIF
|
|
188
148
|
|
|
189
149
|
|
|
190
|
-
|
|
191
|
-
### src/typings/: Typescript typings ###########################################
|
|
150
|
+
### `src/typings/`: Typescript typings
|
|
192
151
|
|
|
193
152
|
This directory contains only declaration files for TypeScript. It is
|
|
194
153
|
automatically added as a `typeRoots` when the TypeScript code is transpiled.
|
|
195
154
|
|
|
196
155
|
|
|
197
|
-
|
|
198
|
-
### src/utils/: The utils ######################################################
|
|
156
|
+
### `src/utils/`: Util functions
|
|
199
157
|
|
|
200
158
|
This directory contains general helpers which are used in different parts of the
|
|
201
159
|
rx-player code.
|
|
202
160
|
|
|
203
161
|
|
|
204
|
-
|
|
205
|
-
## The src/core/ directory #####################################################
|
|
162
|
+
## Inside `src/core/`
|
|
206
163
|
|
|
207
164
|
As written in the previous chapter, this is the "core" of the player, where the
|
|
208
165
|
logic is defined.
|
|
@@ -210,8 +167,7 @@ logic is defined.
|
|
|
210
167
|
As this directory is versatile and complicated, it also deserves its own chapter.
|
|
211
168
|
|
|
212
169
|
|
|
213
|
-
|
|
214
|
-
### src/core/adaptive/: The adaptive bitrate code ##############################
|
|
170
|
+
### `src/core/adaptive/`: Adaptive BitRate logic
|
|
215
171
|
|
|
216
172
|
Defines functions which manages the adaptive streaming part of the player.
|
|
217
173
|
|
|
@@ -226,29 +182,25 @@ This allows to isolate this complex part and facilitate future refactoring and
|
|
|
226
182
|
improvements.
|
|
227
183
|
|
|
228
184
|
|
|
229
|
-
|
|
230
|
-
### src/core/api/: The API definition ##########################################
|
|
185
|
+
### `src/core/api/`: API definition
|
|
231
186
|
|
|
232
187
|
Defines the rx-player API. This is the part the library user will directly
|
|
233
188
|
interact with.
|
|
234
189
|
|
|
235
190
|
|
|
236
|
-
|
|
237
|
-
### src/core/stream/: Load the right segments ##################################
|
|
191
|
+
### `src/core/stream/`: Segment-picking logic
|
|
238
192
|
|
|
239
193
|
The code there calculate which segments should be downloaded, ask for their
|
|
240
194
|
download and push the segments into the `SegmentBuffers`.
|
|
241
195
|
|
|
242
196
|
|
|
243
|
-
|
|
244
|
-
### src/core/decrypt/: Decryption management ###################################
|
|
197
|
+
### `src/core/decrypt/`: Decryption handling
|
|
245
198
|
|
|
246
199
|
Defines functions allowing to handle encrypted contents through the EME browser
|
|
247
200
|
APIs.
|
|
248
201
|
|
|
249
202
|
|
|
250
|
-
|
|
251
|
-
### src/core/fetchers/: The fetchers ###########################################
|
|
203
|
+
### `src/core/fetchers/`: Load resources
|
|
252
204
|
|
|
253
205
|
Handle the segments and Manifest downloading pipelines (load and parse) as
|
|
254
206
|
defined in the ``src/transports/`` directory.
|
|
@@ -258,8 +210,7 @@ It facilitates the role of loading the Manifest and new segments for the rest of
|
|
|
258
210
|
the core.
|
|
259
211
|
|
|
260
212
|
|
|
261
|
-
|
|
262
|
-
### src/core/segment_buffers/: The media buffers ###############################
|
|
213
|
+
### `src/core/segment_buffers/`: Media buffers
|
|
263
214
|
|
|
264
215
|
Code allowing to interact with the media buffers called `SegmentBuffers`.
|
|
265
216
|
|
|
@@ -272,8 +223,7 @@ for other type of contents (like subtitles), we rely on completely custom media
|
|
|
272
223
|
buffers implementations.
|
|
273
224
|
|
|
274
225
|
|
|
275
|
-
|
|
276
|
-
### src/core/init/: Content initialization #####################################
|
|
226
|
+
### `src/core/init/`: Content initialization and orchestration
|
|
277
227
|
|
|
278
228
|
This is the central part which download manifests, initialize MSE and EME APIs,
|
|
279
229
|
instanciate the central `StreamOrchestrator` (which will allow to download and
|
|
@@ -281,8 +231,7 @@ push segments so the content can play) and link together many subparts of the
|
|
|
281
231
|
player.
|
|
282
232
|
|
|
283
233
|
|
|
284
|
-
|
|
285
|
-
## src/**/__tests__: the unit tests directories ################################
|
|
234
|
+
## `src/**/__tests__`: Unit tests
|
|
286
235
|
|
|
287
236
|
You will find multiple directories named `__tests__` in the RxPlayer.
|
|
288
237
|
Those contain unit tests and are put in the same directory than the code it
|
|
@@ -304,8 +253,7 @@ Their filename don't follow the same convention than single-source unit tests
|
|
|
304
253
|
but should still be suffixed by `.test.ts`.
|
|
305
254
|
|
|
306
255
|
|
|
307
|
-
|
|
308
|
-
## The tests/ directory: the player's tests ####################################
|
|
256
|
+
## `tests/`: The RxPlayer's general tests
|
|
309
257
|
|
|
310
258
|
This directory contains most testing code for the RxPlayer.
|
|
311
259
|
|