rx-player 3.28.0-dev.2022062000 → 3.28.0-dev.2022063000

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 (45) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/compat/event_listeners.js +1 -1
  4. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +1 -6
  5. package/dist/_esm5.processed/core/api/playback_observer.d.ts +47 -35
  6. package/dist/_esm5.processed/core/api/playback_observer.js +120 -117
  7. package/dist/_esm5.processed/core/api/public_api.d.ts +4 -6
  8. package/dist/_esm5.processed/core/api/public_api.js +18 -18
  9. package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +1 -1
  10. package/dist/_esm5.processed/core/init/create_stream_playback_observer.d.ts +1 -1
  11. package/dist/_esm5.processed/core/init/create_stream_playback_observer.js +23 -6
  12. package/dist/_esm5.processed/core/init/initial_seek_and_play.js +3 -3
  13. package/dist/_esm5.processed/core/init/initialize_directfile.js +1 -1
  14. package/dist/_esm5.processed/core/init/load_on_media_source.js +1 -1
  15. package/dist/_esm5.processed/core/init/stall_avoider.js +12 -8
  16. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -4
  17. package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +1 -1
  18. package/dist/_esm5.processed/core/stream/period/period_stream.js +21 -5
  19. package/dist/_esm5.processed/core/stream/reload_after_switch.js +1 -1
  20. package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +1 -1
  21. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +1 -1
  22. package/dist/_esm5.processed/utils/reference.d.ts +2 -2
  23. package/dist/_esm5.processed/utils/reference.js +5 -4
  24. package/dist/rx-player.js +250 -198
  25. package/dist/rx-player.min.js +1 -1
  26. package/package.json +2 -2
  27. package/sonar-project.properties +1 -1
  28. package/src/README.md +84 -68
  29. package/src/compat/event_listeners.ts +1 -1
  30. package/src/core/adaptive/adaptive_representation_selector.ts +1 -7
  31. package/src/core/api/playback_observer.ts +185 -173
  32. package/src/core/api/public_api.ts +23 -21
  33. package/src/core/init/content_time_boundaries_observer.ts +1 -1
  34. package/src/core/init/create_stream_playback_observer.ts +69 -47
  35. package/src/core/init/initial_seek_and_play.ts +3 -3
  36. package/src/core/init/initialize_directfile.ts +1 -1
  37. package/src/core/init/load_on_media_source.ts +1 -1
  38. package/src/core/init/stall_avoider.ts +12 -9
  39. package/src/core/stream/orchestrator/stream_orchestrator.ts +5 -4
  40. package/src/core/stream/period/create_empty_adaptation_stream.ts +1 -1
  41. package/src/core/stream/period/period_stream.ts +33 -14
  42. package/src/core/stream/reload_after_switch.ts +1 -1
  43. package/src/core/stream/representation/append_segment_to_buffer.ts +1 -1
  44. package/src/core/stream/representation/representation_stream.ts +1 -1
  45. package/src/utils/reference.ts +7 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rx-player",
3
3
  "author": "Canal+",
4
- "version": "3.28.0-dev.2022062000",
4
+ "version": "3.28.0-dev.2022063000",
5
5
  "description": "Canal+ HTML5 Video Player",
6
6
  "main": "./dist/rx-player.js",
7
7
  "keywords": [
@@ -32,7 +32,7 @@
32
32
  "build:modular": "./scripts/build/generate_build.js",
33
33
  "build:report": "webpack --progress --config webpack.config.js --env production --env reportSize",
34
34
  "build:rxp:all": "npm run build && npm run build:min && npm run build:modular",
35
- "build:watch": "webpack --progress --config webpack.config.js -w -env production",
35
+ "build:watch": "webpack --progress --config webpack.config.js -w --env production",
36
36
  "build:min:watch": "webpack --progress --config webpack.config.js -w --env production --env minify",
37
37
  "build:wasm:debug": "cd ./src/parsers/manifest/dash/wasm-parser && cargo build --target wasm32-unknown-unknown && cp target/wasm32-unknown-unknown/debug/mpd_node_parser.wasm ../../../../../dist/mpd-parser.wasm",
38
38
  "build:wasm:release": "cd ./src/parsers/manifest/dash/wasm-parser && cargo build --target wasm32-unknown-unknown --release && wasm-opt -O3 -o ../../../../../dist/mpd-parser.wasm target/wasm32-unknown-unknown/release/mpd_node_parser.wasm && cd ../../../../../ && npm run wasm-strip",
@@ -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.28.0-dev.2022062000
4
+ sonar.projectVersion=3.28.0-dev.2022063000
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
package/src/README.md CHANGED
@@ -12,84 +12,100 @@ To better understand the player's architecture, you can find below a
12
12
  (simplified!) schema of it:
13
13
 
14
14
  ```
15
+ +---------------------+
16
+ | ---> Call / request |
17
+ +---------------------+
18
+
15
19
  +---------------------------------------------+ ,,,,,,,
16
20
  | | ( CDN )
17
21
  | Application/UI | ```````
18
22
  | | ^
19
23
  +---------------------------------------------+ |
20
- | ^ |
21
- | ~ |
24
+ | |
25
+ | |
22
26
  -----RxPlayer------------------------------------------------------------------|----------
23
- | ~ +---------------------+ |
24
- V ~ Front-facing API | ---> Call / request | |
25
- +-------------------------------------------+ | ~~~> Send events | |
26
- | Public API | +---------------------+ |
27
+ | |
28
+ V Front-facing API |
29
+ +-------------------------------------------+ |
30
+ | Public API | |
27
31
  | (./core/api) | +----------------+
28
32
  +-------------------------------------------+ | |
29
- +--------------------+ | | ^ +--------------> | transports |
30
- | TrackChoiceManager | <--+ | ~ | +~~~~~~~~~~~~~ | (./transports) |
31
- | (./core/api) | | ~ | ~ | |
32
- +--------------------+ | ~ | ~ +----------------+
33
- Facilitate track V ~ | ~ Abstract the streaming ^ ~
34
- switching for +---------------+ | ~ protocol | ~
35
- the API | | | V | ~
36
- +----------------+ | | +--------------------------+ | ~
37
- | Content | | Init | ------> | | | ~
38
- | Decryptor | <---- | (./core/init) | <~~~~~~ | Manifest Fetcher | | ~
39
- |(./core/decrypt)| ~~~~> | | |(./core/fetchers/manifest)| | ~
40
- | | | | | | | ~
41
- +----------------+ +---------------+ +--------------------------+ | ~
42
- Negotiate content | ^ Initialize Load and refresh the Manifest | ~
43
- decryption | ~ playback and | ~
44
- | ~ create/connect | ~
45
- | ~ modules | ~
46
- Stream (./core/stream) | ~ | ~
47
- +--------------------------------|-~-----------------------------+ | ~
48
- | V ~ | | ~
49
- | Create the right +-------------------------------+ | | ~
50
- | PeriodStreams depending | StreamOrchestrator | | | ~
51
- | on the current position, | (./core/stream/orchestrator) | | | ~
52
- | and settings +-------------------------------+ | | ~
53
- | | ^ | ^ | ^ | | ~
54
- | | ~ | ~ | ~ | | ~
55
- | | ~ | ~ | ~ | | ~
56
- | (audio) v ~ (video) V ~ (text) v ~ | | ~
57
- | Create the right +----------+ +----------+ +----------+ | +--------------+ | ~
58
- | AdaptationStream | | | | | |----> |SegmentBuffers| | ~
59
- | depending on the | Period |-+ | Period |-+ | Period |-+ | | Store | | ~
60
- | wanted track | Stream | | | Stream | | | Stream | | | |(./core/segmen| | ~
61
- | (One per Period | | | | | | | | | | |t_buffers) | | ~
62
- | and one per type +----------+ | +----------+ | +----------+ | | +--------------+ | ~
63
- | of media) | (./core/stream/period) | | Create one buffer | ~
64
- | +-----------+ +-----------+ +-----------+ | per type of media | ~
65
- | | ^ | ^ | ^ | | ~
66
- | | ~ | ~ | ~ | | ~
67
- | | ~ | ~ | ~ | | ~
68
- | | ~ | ~ | ~ | | ~
69
- | (audio) v ~ (video) V ~ (text) v ~ | +--------------+ | ~
70
- | +----------+ +----------+ +----------+ ---> | | | ~
71
- | Create the right | | | | | | <~~~ | ARS* | | ~
72
- | Representation- |Adaptation|-+ |Adaptation|-+ |Adaptation|-+ | |(./core/adapti| | ~
73
- | Stream depending | Stream | | | Stream | | | Stream | | | |ve) | | ~
74
- | on the current | | | | | | | | | | +--------------+ | ~
75
- | network, +----------+ | +----------+ | +----------+ | | *Adaptive | ~
76
- | settings... | (./core/stream/adaptation) | | Representation | ~
77
- | +-----------+ +-----------+ +-----------+ | Selector: | ~
78
- | | ^ | ^ | ^ | Find the best | ~
79
- | | ~ | ~ | ~ | Representation | ~
80
- | | ~ | ~ | ~ | to play | ~
81
- | | ~ | ~ | ~ | | ~
82
- | (audio) v ~ (video) V ~ (text) v ~ | | ~
83
- | +----------+ +----------+ +----------+ ----> +------------+ | ~
84
- | (Representation- | | | | | | <~~~~ | Segment | -+ ~
85
- | Stream). |Represe...|-+ |Represe...|-+ |Represe...|-+ | | fetcher | <~~+
33
+ +--------------------+ | | +--------------> | transports |
34
+ | TrackChoiceManager | <--+ | | | (./transports) |
35
+ | (./core/api) | | | | |
36
+ +--------------------+ | | +----------------+
37
+ Facilitate track V | Abstract the streaming ^
38
+ switching for +---------------+ | protocol |
39
+ the API | | | |
40
+ +----------------+ | | +--------------------------+ |
41
+ | Content | | Init | ------> | | |
42
+ | Decryptor | <---- | (./core/init) | | Manifest Fetcher | |
43
+ |(./core/decrypt)| | | |(./core/fetchers/manifest)| |
44
+ | | | | | | |
45
+ +----------------+ +---------------+ +--------------------------+ |
46
+ Negotiate content | Initialize Load and refresh the Manifest |
47
+ decryption | playback and |
48
+ | create/connect |
49
+ | modules |
50
+ Stream (./core/stream) | |
51
+ +--------------------------------|-------------------------------+ |
52
+ | V | |
53
+ | Create the right +-------------------------------+ | |
54
+ | PeriodStreams depending | StreamOrchestrator | | |
55
+ | on the current position, | (./core/stream/orchestrator) | | |
56
+ | and settings +-------------------------------+ | |
57
+ | | | | | |
58
+ | | | | | |
59
+ | | | | | |
60
+ | (audio) v (video) V (text) v | |
61
+ | Create the right +----------+ +----------+ +----------+ | +--------------+ |
62
+ | AdaptationStream | | | | | |----> |SegmentBuffers| |
63
+ | depending on the | Period |-+ | Period |-+ | Period |-+ | | Store | |
64
+ | wanted track | Stream | | | Stream | | | Stream | | | |(./core/segmen| |
65
+ | (One per Period | | | | | | | | | | |t_buffers) | |
66
+ | and one per type +----------+ | +----------+ | +----------+ | | +--------------+ |
67
+ | of media) | (./core/stream/period) | | Create one buffer |
68
+ | +-----------+ +-----------+ +-----------+ | per type of media |
69
+ | | | | | |
70
+ | | | | | |
71
+ | | | | | |
72
+ | | | | | |
73
+ | (audio) v (video) V (text) v | +--------------+ |
74
+ | +----------+ +----------+ +----------+ ---> | | |
75
+ | Create the right | | | | | | | | ARS* | |
76
+ | Representation- |Adaptation|-+ |Adaptation|-+ |Adaptation|-+ | |(./core/adapti| |
77
+ | Stream depending | Stream | | | Stream | | | Stream | | | |ve) | |
78
+ | on the current | | | | | | | | | | +--------------+ |
79
+ | network, +----------+ | +----------+ | +----------+ | | *Adaptive |
80
+ | settings... | (./core/stream/adaptation) | | Representation |
81
+ | +-----------+ +-----------+ +-----------+ | Selector: |
82
+ | | | | | Find the best |
83
+ | | | | | Representation |
84
+ | | | | | to play |
85
+ | | | | | |
86
+ | (audio) v (video) V (text) v | |
87
+ | +----------+ +----------+ +----------+ ----> +------------+ |
88
+ | (Representation- | | | | | | | | Segment | -+
89
+ | Stream). |Represe...|-+ |Represe...|-+ |Represe...|-+ | | fetcher |
86
90
  | Download and push| Stream | | | Stream | | | Stream | | | |(./core/fetch|
87
91
  | segments based on| | | | | | | | | | |ers/segment) |
88
92
  | the current +----------+ | +----------+ | +----------+ | | +-------------+
89
93
  | position and | (./core/stream/representation) | | Load media segments
90
94
  | buffer state +-----------+ +-----------+ +-----------+ |
91
- | |
92
- +----------------------------------------------------------------+
95
+ | | | | |
96
+ +-------------------------|---------------|--------------|-------+
97
+ | | |
98
+ +---------|---------------|--------------|-------+
99
+ | (audio)V (video)V V |
100
+ | +------------+ +------------+ +-----------+ |
101
+ Media buffers | | Audio/Video| | Audio/Video| | Text | |
102
+ on which media | | Segment | | Segment | | Segment | |
103
+ data to decode | | Buffer | | Buffer | | Buffer | |
104
+ is pushed, so | +------------+ +------------+ +-----------+ |
105
+ it can be | |
106
+ decoded at the | SegmentBuffer implementations |
107
+ right time | (./core/segment_buffers/implementations) |
108
+ +------------------------------------------------+
93
109
  ```
94
110
 
95
111
  For the directories not represented in that schema:
@@ -97,7 +113,7 @@ For the directories not represented in that schema:
97
113
  - `Compat` (_./compat_): Regroups every functions related to improving
98
114
  compatibility with browsers / environments.
99
115
 
100
- - `errors` (_./errors_): Define error subclasses, most of all for the API.
116
+ - `errors` (_./errors_): Defines error subclasses, most of all for the API.
101
117
 
102
118
  - `experimental` (_./experimental_): Special directory for "experimental" tools
103
119
  and features.
@@ -111,8 +127,8 @@ For the directories not represented in that schema:
111
127
 
112
128
  - `parsers` (_./parsers_): Various parsers for several formats
113
129
 
114
- - `tools` (_./tools_): Define "tools", APIs which are not part of the RxPlayer
115
- class.
130
+ - `tools` (_./tools_): Defines "tools", APIs which are not part of the
131
+ RxPlayer class.
116
132
 
117
133
  - `typings` (_./typings_): Define TypeScript typings.
118
134
 
@@ -175,7 +175,7 @@ function getDocumentVisibilityRef(
175
175
  "visibilitychange";
176
176
 
177
177
  const isHidden = document[hidden as "hidden"];
178
- const ref = createSharedReference(isHidden);
178
+ const ref = createSharedReference(!isHidden);
179
179
 
180
180
  addEventListener(document, visibilityChangeEvent, () => {
181
181
  const isVisible = !(document[hidden as "hidden"]);
@@ -268,14 +268,8 @@ function getEstimateReference(
268
268
  */
269
269
  const guessBasedChooser = new GuessBasedChooser(scoreCalculator, prevEstimate);
270
270
 
271
- let lastPlaybackObservation : IRepresentationEstimatorPlaybackObservation;
272
-
273
271
  // get initial observation for initial estimate
274
- const unregisterInitial = playbackObserver.listen(obs => {
275
- lastPlaybackObservation = obs;
276
- }, { includeLastObservation: true });
277
- unregisterInitial(); // The initial is emitted synchronously, we can now remove it
278
- // TODO cleaner playbackObserver.getLast() or something?
272
+ let lastPlaybackObservation = playbackObserver.getReference().getValue();
279
273
 
280
274
  /** Reference through which estimates are emitted. */
281
275
  const innerEstimateRef = createSharedReference<IABREstimate>(getCurrentEstimate());