rx-player 3.28.0-dev.2022061700 → 3.28.0-dev.2022062700
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 +5 -3
- package/VERSION +1 -1
- package/appveyor.yml +1 -1
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +32 -11
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +19 -26
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +47 -35
- package/dist/_esm5.processed/core/api/playback_observer.js +120 -117
- package/dist/_esm5.processed/core/api/public_api.d.ts +4 -6
- package/dist/_esm5.processed/core/api/public_api.js +18 -18
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +60 -31
- package/dist/_esm5.processed/core/init/content_time_boundaries_observer.js +1 -1
- package/dist/_esm5.processed/core/init/create_stream_playback_observer.d.ts +1 -1
- package/dist/_esm5.processed/core/init/create_stream_playback_observer.js +23 -6
- package/dist/_esm5.processed/core/init/initial_seek_and_play.js +3 -3
- package/dist/_esm5.processed/core/init/initialize_directfile.js +1 -1
- package/dist/_esm5.processed/core/init/load_on_media_source.js +1 -1
- package/dist/_esm5.processed/core/init/stall_avoider.js +12 -8
- package/dist/_esm5.processed/core/stream/adaptation/create_representation_estimator.js +1 -1
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +5 -4
- package/dist/_esm5.processed/core/stream/period/create_empty_adaptation_stream.js +1 -1
- package/dist/_esm5.processed/core/stream/period/period_stream.js +21 -5
- package/dist/_esm5.processed/core/stream/reload_after_switch.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/append_segment_to_buffer.js +1 -1
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +1 -1
- package/dist/_esm5.processed/utils/reference.d.ts +29 -19
- package/dist/_esm5.processed/utils/reference.js +21 -5
- package/dist/rx-player.js +366 -257
- package/dist/rx-player.min.js +1 -1
- package/package.json +2 -2
- package/sonar-project.properties +1 -1
- package/src/README.md +84 -68
- package/src/core/adaptive/adaptive_representation_selector.ts +47 -40
- package/src/core/api/playback_observer.ts +185 -173
- package/src/core/api/public_api.ts +23 -21
- package/src/core/decrypt/content_decryptor.ts +57 -23
- package/src/core/init/content_time_boundaries_observer.ts +1 -1
- package/src/core/init/create_stream_playback_observer.ts +69 -47
- package/src/core/init/initial_seek_and_play.ts +3 -3
- package/src/core/init/initialize_directfile.ts +1 -1
- package/src/core/init/load_on_media_source.ts +1 -1
- package/src/core/init/stall_avoider.ts +12 -9
- package/src/core/stream/adaptation/create_representation_estimator.ts +6 -6
- package/src/core/stream/orchestrator/stream_orchestrator.ts +5 -4
- package/src/core/stream/period/create_empty_adaptation_stream.ts +1 -1
- package/src/core/stream/period/period_stream.ts +33 -14
- package/src/core/stream/reload_after_switch.ts +1 -1
- package/src/core/stream/representation/append_segment_to_buffer.ts +1 -1
- package/src/core/stream/representation/representation_stream.ts +1 -1
- package/src/utils/reference.ts +40 -28
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.
|
|
4
|
+
"version": "3.28.0-dev.2022062700",
|
|
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
|
|
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",
|
package/sonar-project.properties
CHANGED
|
@@ -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.
|
|
4
|
+
sonar.projectVersion=3.28.0-dev.2022062700
|
|
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
|
|
25
|
-
+-------------------------------------------+
|
|
26
|
-
| Public API |
|
|
27
|
+
| |
|
|
28
|
+
V Front-facing API |
|
|
29
|
+
+-------------------------------------------+ |
|
|
30
|
+
| Public API | |
|
|
27
31
|
| (./core/api) | +----------------+
|
|
28
32
|
+-------------------------------------------+ | |
|
|
29
|
-
+--------------------+ | |
|
|
30
|
-
| TrackChoiceManager | <--+ |
|
|
31
|
-
| (./core/api) | |
|
|
32
|
-
+--------------------+ |
|
|
33
|
-
Facilitate track V
|
|
34
|
-
switching for +---------------+ |
|
|
35
|
-
the API | | |
|
|
36
|
-
+----------------+ | | +--------------------------+ |
|
|
37
|
-
| Content | | Init | ------> | | |
|
|
38
|
-
| Decryptor | <---- | (./core/init) |
|
|
39
|
-
|(./core/decrypt)|
|
|
40
|
-
| | | | | | |
|
|
41
|
-
+----------------+ +---------------+ +--------------------------+ |
|
|
42
|
-
Negotiate content |
|
|
43
|
-
decryption |
|
|
44
|
-
|
|
|
45
|
-
|
|
|
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
|
|
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
|
|
70
|
-
| +----------+ +----------+ +----------+ ---> | | |
|
|
71
|
-
| Create the right | | | | | |
|
|
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
|
-
| |
|
|
79
|
-
| |
|
|
80
|
-
| |
|
|
81
|
-
| |
|
|
82
|
-
| (audio) v
|
|
83
|
-
| +----------+ +----------+ +----------+ ----> +------------+ |
|
|
84
|
-
| (Representation- | | | | | |
|
|
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_):
|
|
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_):
|
|
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
|
|
|
@@ -52,8 +52,10 @@ import selectOptimalRepresentation from "./utils/select_optimal_representation";
|
|
|
52
52
|
/**
|
|
53
53
|
* Select the most adapted Representation according to the network and buffer
|
|
54
54
|
* metrics it receives.
|
|
55
|
+
*
|
|
55
56
|
* @param {Object} options - Initial configuration (see type definition)
|
|
56
|
-
* @returns {Object} - Interface allowing to select a Representation
|
|
57
|
+
* @returns {Object} - Interface allowing to select a Representation.
|
|
58
|
+
* @see IRepresentationEstimator
|
|
57
59
|
*/
|
|
58
60
|
export default function createAdaptiveRepresentationSelector(
|
|
59
61
|
options : IAdaptiveRepresentationSelectorArguments
|
|
@@ -73,14 +75,13 @@ export default function createAdaptiveRepresentationSelector(
|
|
|
73
75
|
/**
|
|
74
76
|
* Returns Object emitting Representation estimates as well as callbacks
|
|
75
77
|
* allowing to helping it produce them.
|
|
78
|
+
*
|
|
79
|
+
* @see IRepresentationEstimator
|
|
76
80
|
* @param {Object} context
|
|
77
|
-
* @param {Object} currentRepresentation
|
|
78
|
-
*
|
|
79
|
-
* @param {Object}
|
|
80
|
-
*
|
|
81
|
-
* @param {Object} playbackObserver - Emits regularly playback conditions
|
|
82
|
-
* @param {Object} cancellationSignal - After this `CancellationSignal` emits,
|
|
83
|
-
* estimates will stop to be emitted.
|
|
81
|
+
* @param {Object} currentRepresentation
|
|
82
|
+
* @param {Object} representations
|
|
83
|
+
* @param {Object} playbackObserver
|
|
84
|
+
* @param {Object} stopAllEstimates
|
|
84
85
|
* @returns {Array.<Object>}
|
|
85
86
|
*/
|
|
86
87
|
return function getEstimates(
|
|
@@ -92,9 +93,8 @@ export default function createAdaptiveRepresentationSelector(
|
|
|
92
93
|
playbackObserver : IReadOnlyPlaybackObserver<
|
|
93
94
|
IRepresentationEstimatorPlaybackObservation
|
|
94
95
|
>,
|
|
95
|
-
|
|
96
|
-
) :
|
|
97
|
-
IRepresentationEstimatorCallbacks ] {
|
|
96
|
+
stopAllEstimates : CancellationSignal
|
|
97
|
+
) : IRepresentationEstimatorResponse {
|
|
98
98
|
const { type } = context.adaptation;
|
|
99
99
|
const bandwidthEstimator = _getBandwidthEstimator(type);
|
|
100
100
|
const manualBitrate = takeFirstSet<IReadOnlySharedReference<number>>(
|
|
@@ -127,7 +127,7 @@ export default function createAdaptiveRepresentationSelector(
|
|
|
127
127
|
playbackObserver,
|
|
128
128
|
representations,
|
|
129
129
|
lowLatencyMode },
|
|
130
|
-
|
|
130
|
+
stopAllEstimates);
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
/**
|
|
@@ -163,7 +163,7 @@ export default function createAdaptiveRepresentationSelector(
|
|
|
163
163
|
* events to help it doing those estimates.
|
|
164
164
|
*
|
|
165
165
|
* @param {Object} args
|
|
166
|
-
* @param {Object}
|
|
166
|
+
* @param {Object} stopAllEstimates
|
|
167
167
|
* @returns {Array.<Object>}
|
|
168
168
|
*/
|
|
169
169
|
function getEstimateReference(
|
|
@@ -178,10 +178,8 @@ function getEstimateReference(
|
|
|
178
178
|
minAutoBitrate,
|
|
179
179
|
playbackObserver,
|
|
180
180
|
representations : representationsRef } : IRepresentationEstimatorArguments,
|
|
181
|
-
|
|
182
|
-
) :
|
|
183
|
-
IRepresentationEstimatorCallbacks ] {
|
|
184
|
-
|
|
181
|
+
stopAllEstimates : CancellationSignal
|
|
182
|
+
) : IRepresentationEstimatorResponse {
|
|
185
183
|
const scoreCalculator = new RepresentationScoreCalculator();
|
|
186
184
|
const networkAnalyzer = new NetworkAnalyzer(initialBitrate ?? 0, lowLatencyMode);
|
|
187
185
|
const requestsStore = new PendingRequestsStore();
|
|
@@ -200,10 +198,7 @@ function getEstimateReference(
|
|
|
200
198
|
* This TaskCanceller is used both for restarting estimates with a new
|
|
201
199
|
* configuration and to cancel them altogether.
|
|
202
200
|
*/
|
|
203
|
-
let currentEstimatesCanceller = new TaskCanceller();
|
|
204
|
-
cancellationSignal.register(() => {
|
|
205
|
-
currentEstimatesCanceller.cancel();
|
|
206
|
-
});
|
|
201
|
+
let currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
|
|
207
202
|
|
|
208
203
|
// Create `ISharedReference` on which estimates will be emitted.
|
|
209
204
|
const estimateRef = createEstimateReference(manualBitrate.getValue(),
|
|
@@ -211,11 +206,11 @@ function getEstimateReference(
|
|
|
211
206
|
currentEstimatesCanceller.signal);
|
|
212
207
|
|
|
213
208
|
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions,
|
|
214
|
-
{ clearSignal:
|
|
209
|
+
{ clearSignal: stopAllEstimates });
|
|
215
210
|
representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions,
|
|
216
|
-
{ clearSignal:
|
|
211
|
+
{ clearSignal: stopAllEstimates });
|
|
217
212
|
|
|
218
|
-
return
|
|
213
|
+
return { estimates: estimateRef, callbacks };
|
|
219
214
|
|
|
220
215
|
function createEstimateReference(
|
|
221
216
|
manualBitrateVal : number,
|
|
@@ -273,14 +268,8 @@ function getEstimateReference(
|
|
|
273
268
|
*/
|
|
274
269
|
const guessBasedChooser = new GuessBasedChooser(scoreCalculator, prevEstimate);
|
|
275
270
|
|
|
276
|
-
let lastPlaybackObservation : IRepresentationEstimatorPlaybackObservation;
|
|
277
|
-
|
|
278
271
|
// get initial observation for initial estimate
|
|
279
|
-
|
|
280
|
-
lastPlaybackObservation = obs;
|
|
281
|
-
}, { includeLastObservation: true });
|
|
282
|
-
unregisterInitial(); // The initial is emitted synchronously, we can now remove it
|
|
283
|
-
// TODO cleaner playbackObserver.getLast() or something?
|
|
272
|
+
let lastPlaybackObservation = playbackObserver.getReference().getValue();
|
|
284
273
|
|
|
285
274
|
/** Reference through which estimates are emitted. */
|
|
286
275
|
const innerEstimateRef = createSharedReference<IABREstimate>(getCurrentEstimate());
|
|
@@ -475,12 +464,13 @@ function getEstimateReference(
|
|
|
475
464
|
const manualBitrateVal = manualBitrate.getValue();
|
|
476
465
|
const representations = representationsRef.getValue();
|
|
477
466
|
currentEstimatesCanceller.cancel();
|
|
478
|
-
currentEstimatesCanceller = new TaskCanceller();
|
|
467
|
+
currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
|
|
479
468
|
const newRef = createEstimateReference(
|
|
480
469
|
manualBitrateVal,
|
|
481
470
|
representations,
|
|
482
471
|
currentEstimatesCanceller.signal
|
|
483
472
|
);
|
|
473
|
+
|
|
484
474
|
newRef.onUpdate(function onNewEstimate(newEstimate : IABREstimate) : void {
|
|
485
475
|
estimateRef.setValue(newEstimate);
|
|
486
476
|
}, { clearSignal: currentEstimatesCanceller.signal,
|
|
@@ -700,11 +690,7 @@ export interface IABRFiltersObject {
|
|
|
700
690
|
width?: number;
|
|
701
691
|
}
|
|
702
692
|
|
|
703
|
-
/**
|
|
704
|
-
* Callbacks returned by `getEstimateReference`.
|
|
705
|
-
* Those needs to be called as soon as the corresponding events to obtain
|
|
706
|
-
* coherent Representation estimates.
|
|
707
|
-
*/
|
|
693
|
+
/** Callbacks returned by `getEstimateReference`. */
|
|
708
694
|
export interface IRepresentationEstimatorCallbacks {
|
|
709
695
|
/** Callback to call when a segment has been completely pushed to the buffer. */
|
|
710
696
|
addedSegment(val : IAddedSegmentCallbackPayload) : void;
|
|
@@ -832,17 +818,38 @@ export interface IRepresentationEstimatorArguments {
|
|
|
832
818
|
* allowing to estimate the most adapted `Representation`.
|
|
833
819
|
*/
|
|
834
820
|
export type IRepresentationEstimator = (
|
|
821
|
+
/** Information on the content for which a Representation will be chosen */
|
|
835
822
|
context : { manifest : Manifest;
|
|
836
823
|
period : Period;
|
|
837
824
|
adaptation : Adaptation; },
|
|
825
|
+
/** Reference emitting the Representation currently loaded. */
|
|
838
826
|
currentRepresentation : IReadOnlySharedReference<Representation | null>,
|
|
827
|
+
/** Reference emitting the list of available Representations to choose from. */
|
|
839
828
|
representations : IReadOnlySharedReference<Representation[]>,
|
|
829
|
+
/** Regularly emits playback conditions */
|
|
840
830
|
playbackObserver : IReadOnlyPlaybackObserver<
|
|
841
831
|
IRepresentationEstimatorPlaybackObservation
|
|
842
832
|
>,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
833
|
+
/**
|
|
834
|
+
* After this `CancellationSignal` emits, resources will be disposed and
|
|
835
|
+
* estimates will stop to be emitted.
|
|
836
|
+
*/
|
|
837
|
+
stopAllEstimates : CancellationSignal
|
|
838
|
+
) => IRepresentationEstimatorResponse;
|
|
839
|
+
|
|
840
|
+
/** Value returned by an `IRepresentationEstimator` */
|
|
841
|
+
export interface IRepresentationEstimatorResponse {
|
|
842
|
+
/**
|
|
843
|
+
* Regularly produces estimates of the best Representation to play (from the
|
|
844
|
+
* list given).
|
|
845
|
+
*/
|
|
846
|
+
estimates: IReadOnlySharedReference<IABREstimate>;
|
|
847
|
+
/**
|
|
848
|
+
* Callback which need to be called as soon as the corresponding events to
|
|
849
|
+
* obtain accurate Representation estimates.
|
|
850
|
+
*/
|
|
851
|
+
callbacks: IRepresentationEstimatorCallbacks;
|
|
852
|
+
}
|
|
846
853
|
|
|
847
854
|
/** Arguments received by `createAdaptiveRepresentationSelector`. */
|
|
848
855
|
export interface IAdaptiveRepresentationSelectorArguments {
|