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/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v3.28.0-dev.
|
|
3
|
+
## v3.28.0-dev.2022062700
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
7
|
- Add `label` to audio, video and text track APIs (such as `getAvailableAudioTracks`) which gives a human-readable description of the corresponding track, if available in the Manifest [#1105, #1109]
|
|
8
8
|
- Automatically set the LogLevel to `"DEBUG"` if a global `__RX_PLAYER_DEBUG_MODE__` constant is set to `true`, to simplify debugging [#1115]
|
|
9
|
-
- TTML: Add support for percent based thickness for textOutline in TTML Subtitles [#1108]
|
|
10
9
|
|
|
11
10
|
### Bug fixes
|
|
12
11
|
|
|
13
12
|
- Use the first **compatible** codec of the current AdaptationSet when creating a SourceBuffer [#1094]
|
|
14
13
|
- DASH/DRM: Fix potential infinite rebuffering when a KID is not anounced in the MPD [#1113]
|
|
14
|
+
- DRM: Fix quality fallback when loading a content whose license has been cached under an extended `singleLicensePer` setting and when starting (and staying) with a quality whose key id is not in it [#1133]
|
|
15
15
|
- DASH: Avoid infinite loop due to rounding errors while parsing multi-Periods MPDs [#1111, #1110]
|
|
16
|
+
- After a `RELOADING` state, stay in `PAUSED` if the media element was paused synchronously before the side-effect which triggered the reloading (usually coming from the API) was perform [#1132]
|
|
16
17
|
- Fix issue with `maxVideoBufferSize` setting which could lead to too much data being buffered [#1125]
|
|
17
18
|
- Prevent possibility of requests loops and infinite rebuffering when a pushed segment is always completely and immediately garbage collected by the browser [#1123]
|
|
19
|
+
- DASH: Fix potential rare memory leak when stopping the content after it has reloaded at least once [#1135]
|
|
18
20
|
- DASH: Fix issues that could arise if a segment is calculated to start at a negative position [#1122]
|
|
19
21
|
- DASH: Fix possibility of wrong segments being requested when a SegmentTimeline in a given Period (whose Period@end is set) had an S@r set to `-1` at its end [#1098]
|
|
20
22
|
- DASH: If the first `<S>` has its S@t attribute not set, make as if it is set to `0` [#1118]
|
|
21
|
-
- Reload in the paused state when the action that lead to reloading was performed directly as the RxPlayer went into the `PAUSED` state [#1132]
|
|
22
23
|
|
|
23
24
|
### Other improvements
|
|
24
25
|
|
|
26
|
+
- TTML: Add support for percent based thickness for textOutline in TTML Subtitles [#1108]
|
|
25
27
|
- If seeking after the last potential position, load last segments before ending [#1097]
|
|
26
28
|
- The duration set on the media element is now only relative to the current chosen tracks (it was previously relative to all potential track). This allows to seek later when switching e.g. to a longer video track [#1102]
|
|
27
29
|
- Errors coming from an HTMLMediaElement now have the browser's error message if it exists [#1112]
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.28.0-dev.
|
|
1
|
+
3.28.0-dev.2022062700
|
package/appveyor.yml
CHANGED
|
@@ -23,8 +23,10 @@ import { IPendingRequestStoreBegin, IPendingRequestStoreProgress } from "./utils
|
|
|
23
23
|
/**
|
|
24
24
|
* Select the most adapted Representation according to the network and buffer
|
|
25
25
|
* metrics it receives.
|
|
26
|
+
*
|
|
26
27
|
* @param {Object} options - Initial configuration (see type definition)
|
|
27
|
-
* @returns {Object} - Interface allowing to select a Representation
|
|
28
|
+
* @returns {Object} - Interface allowing to select a Representation.
|
|
29
|
+
* @see IRepresentationEstimator
|
|
28
30
|
*/
|
|
29
31
|
export default function createAdaptiveRepresentationSelector(options: IAdaptiveRepresentationSelectorArguments): IRepresentationEstimator;
|
|
30
32
|
/**
|
|
@@ -175,11 +177,7 @@ export interface IABRFiltersObject {
|
|
|
175
177
|
*/
|
|
176
178
|
width?: number;
|
|
177
179
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Callbacks returned by `getEstimateReference`.
|
|
180
|
-
* Those needs to be called as soon as the corresponding events to obtain
|
|
181
|
-
* coherent Representation estimates.
|
|
182
|
-
*/
|
|
180
|
+
/** Callbacks returned by `getEstimateReference`. */
|
|
183
181
|
export interface IRepresentationEstimatorCallbacks {
|
|
184
182
|
/** Callback to call when a segment has been completely pushed to the buffer. */
|
|
185
183
|
addedSegment(val: IAddedSegmentCallbackPayload): void;
|
|
@@ -303,14 +301,37 @@ export interface IRepresentationEstimatorArguments {
|
|
|
303
301
|
* Type of the function returned by `createAdaptiveRepresentationSelector`,
|
|
304
302
|
* allowing to estimate the most adapted `Representation`.
|
|
305
303
|
*/
|
|
306
|
-
export declare type IRepresentationEstimator = (
|
|
304
|
+
export declare type IRepresentationEstimator = (
|
|
305
|
+
/** Information on the content for which a Representation will be chosen */
|
|
306
|
+
context: {
|
|
307
307
|
manifest: Manifest;
|
|
308
308
|
period: Period;
|
|
309
309
|
adaptation: Adaptation;
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
310
|
+
},
|
|
311
|
+
/** Reference emitting the Representation currently loaded. */
|
|
312
|
+
currentRepresentation: IReadOnlySharedReference<Representation | null>,
|
|
313
|
+
/** Reference emitting the list of available Representations to choose from. */
|
|
314
|
+
representations: IReadOnlySharedReference<Representation[]>,
|
|
315
|
+
/** Regularly emits playback conditions */
|
|
316
|
+
playbackObserver: IReadOnlyPlaybackObserver<IRepresentationEstimatorPlaybackObservation>,
|
|
317
|
+
/**
|
|
318
|
+
* After this `CancellationSignal` emits, resources will be disposed and
|
|
319
|
+
* estimates will stop to be emitted.
|
|
320
|
+
*/
|
|
321
|
+
stopAllEstimates: CancellationSignal) => IRepresentationEstimatorResponse;
|
|
322
|
+
/** Value returned by an `IRepresentationEstimator` */
|
|
323
|
+
export interface IRepresentationEstimatorResponse {
|
|
324
|
+
/**
|
|
325
|
+
* Regularly produces estimates of the best Representation to play (from the
|
|
326
|
+
* list given).
|
|
327
|
+
*/
|
|
328
|
+
estimates: IReadOnlySharedReference<IABREstimate>;
|
|
329
|
+
/**
|
|
330
|
+
* Callback which need to be called as soon as the corresponding events to
|
|
331
|
+
* obtain accurate Representation estimates.
|
|
332
|
+
*/
|
|
333
|
+
callbacks: IRepresentationEstimatorCallbacks;
|
|
334
|
+
}
|
|
314
335
|
/** Arguments received by `createAdaptiveRepresentationSelector`. */
|
|
315
336
|
export interface IAdaptiveRepresentationSelectorArguments {
|
|
316
337
|
/** Initial bitrate chosen, per type (minimum if not set) */
|
|
@@ -32,8 +32,10 @@ import selectOptimalRepresentation from "./utils/select_optimal_representation";
|
|
|
32
32
|
/**
|
|
33
33
|
* Select the most adapted Representation according to the network and buffer
|
|
34
34
|
* metrics it receives.
|
|
35
|
+
*
|
|
35
36
|
* @param {Object} options - Initial configuration (see type definition)
|
|
36
|
-
* @returns {Object} - Interface allowing to select a Representation
|
|
37
|
+
* @returns {Object} - Interface allowing to select a Representation.
|
|
38
|
+
* @see IRepresentationEstimator
|
|
37
39
|
*/
|
|
38
40
|
export default function createAdaptiveRepresentationSelector(options) {
|
|
39
41
|
/**
|
|
@@ -45,17 +47,16 @@ export default function createAdaptiveRepresentationSelector(options) {
|
|
|
45
47
|
/**
|
|
46
48
|
* Returns Object emitting Representation estimates as well as callbacks
|
|
47
49
|
* allowing to helping it produce them.
|
|
50
|
+
*
|
|
51
|
+
* @see IRepresentationEstimator
|
|
48
52
|
* @param {Object} context
|
|
49
|
-
* @param {Object} currentRepresentation
|
|
50
|
-
*
|
|
51
|
-
* @param {Object}
|
|
52
|
-
*
|
|
53
|
-
* @param {Object} playbackObserver - Emits regularly playback conditions
|
|
54
|
-
* @param {Object} cancellationSignal - After this `CancellationSignal` emits,
|
|
55
|
-
* estimates will stop to be emitted.
|
|
53
|
+
* @param {Object} currentRepresentation
|
|
54
|
+
* @param {Object} representations
|
|
55
|
+
* @param {Object} playbackObserver
|
|
56
|
+
* @param {Object} stopAllEstimates
|
|
56
57
|
* @returns {Array.<Object>}
|
|
57
58
|
*/
|
|
58
|
-
return function getEstimates(context, currentRepresentation, representations, playbackObserver,
|
|
59
|
+
return function getEstimates(context, currentRepresentation, representations, playbackObserver, stopAllEstimates) {
|
|
59
60
|
var type = context.adaptation.type;
|
|
60
61
|
var bandwidthEstimator = _getBandwidthEstimator(type);
|
|
61
62
|
var manualBitrate = takeFirstSet(manualBitrates[type], createSharedReference(-1));
|
|
@@ -66,7 +67,7 @@ export default function createAdaptiveRepresentationSelector(options) {
|
|
|
66
67
|
limitWidth: takeFirstSet(throttlers.limitWidth[type], createSharedReference(undefined)),
|
|
67
68
|
throttleBitrate: takeFirstSet(throttlers.throttleBitrate[type], throttlers.throttle[type], createSharedReference(Infinity)),
|
|
68
69
|
};
|
|
69
|
-
return getEstimateReference({ bandwidthEstimator: bandwidthEstimator, context: context, currentRepresentation: currentRepresentation, filters: filters, initialBitrate: initialBitrate, manualBitrate: manualBitrate, minAutoBitrate: minAutoBitrate, maxAutoBitrate: maxAutoBitrate, playbackObserver: playbackObserver, representations: representations, lowLatencyMode: lowLatencyMode },
|
|
70
|
+
return getEstimateReference({ bandwidthEstimator: bandwidthEstimator, context: context, currentRepresentation: currentRepresentation, filters: filters, initialBitrate: initialBitrate, manualBitrate: manualBitrate, minAutoBitrate: minAutoBitrate, maxAutoBitrate: maxAutoBitrate, playbackObserver: playbackObserver, representations: representations, lowLatencyMode: lowLatencyMode }, stopAllEstimates);
|
|
70
71
|
};
|
|
71
72
|
/**
|
|
72
73
|
* Returns interface allowing to estimate network throughtput for a given type.
|
|
@@ -100,10 +101,10 @@ export default function createAdaptiveRepresentationSelector(options) {
|
|
|
100
101
|
* events to help it doing those estimates.
|
|
101
102
|
*
|
|
102
103
|
* @param {Object} args
|
|
103
|
-
* @param {Object}
|
|
104
|
+
* @param {Object} stopAllEstimates
|
|
104
105
|
* @returns {Array.<Object>}
|
|
105
106
|
*/
|
|
106
|
-
function getEstimateReference(_a,
|
|
107
|
+
function getEstimateReference(_a, stopAllEstimates) {
|
|
107
108
|
var bandwidthEstimator = _a.bandwidthEstimator, context = _a.context, currentRepresentation = _a.currentRepresentation, filters = _a.filters, initialBitrate = _a.initialBitrate, lowLatencyMode = _a.lowLatencyMode, manualBitrate = _a.manualBitrate, maxAutoBitrate = _a.maxAutoBitrate, minAutoBitrate = _a.minAutoBitrate, playbackObserver = _a.playbackObserver, representationsRef = _a.representations;
|
|
108
109
|
var scoreCalculator = new RepresentationScoreCalculator();
|
|
109
110
|
var networkAnalyzer = new NetworkAnalyzer(initialBitrate !== null && initialBitrate !== void 0 ? initialBitrate : 0, lowLatencyMode);
|
|
@@ -121,15 +122,12 @@ function getEstimateReference(_a, cancellationSignal) {
|
|
|
121
122
|
* This TaskCanceller is used both for restarting estimates with a new
|
|
122
123
|
* configuration and to cancel them altogether.
|
|
123
124
|
*/
|
|
124
|
-
var currentEstimatesCanceller = new TaskCanceller();
|
|
125
|
-
cancellationSignal.register(function () {
|
|
126
|
-
currentEstimatesCanceller.cancel();
|
|
127
|
-
});
|
|
125
|
+
var currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
|
|
128
126
|
// Create `ISharedReference` on which estimates will be emitted.
|
|
129
127
|
var estimateRef = createEstimateReference(manualBitrate.getValue(), representationsRef.getValue(), currentEstimatesCanceller.signal);
|
|
130
|
-
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal:
|
|
131
|
-
representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal:
|
|
132
|
-
return
|
|
128
|
+
manualBitrate.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal: stopAllEstimates });
|
|
129
|
+
representationsRef.onUpdate(restartEstimatesProductionFromCurrentConditions, { clearSignal: stopAllEstimates });
|
|
130
|
+
return { estimates: estimateRef, callbacks: callbacks };
|
|
133
131
|
function createEstimateReference(manualBitrateVal, representations, innerCancellationSignal) {
|
|
134
132
|
if (manualBitrateVal >= 0) {
|
|
135
133
|
// A manual bitrate has been set. Just choose Representation according to it.
|
|
@@ -172,13 +170,8 @@ function getEstimateReference(_a, cancellationSignal) {
|
|
|
172
170
|
* Only used in very specific scenarios.
|
|
173
171
|
*/
|
|
174
172
|
var guessBasedChooser = new GuessBasedChooser(scoreCalculator, prevEstimate);
|
|
175
|
-
var lastPlaybackObservation;
|
|
176
173
|
// get initial observation for initial estimate
|
|
177
|
-
var
|
|
178
|
-
lastPlaybackObservation = obs;
|
|
179
|
-
}, { includeLastObservation: true });
|
|
180
|
-
unregisterInitial(); // The initial is emitted synchronously, we can now remove it
|
|
181
|
-
// TODO cleaner playbackObserver.getLast() or something?
|
|
174
|
+
var lastPlaybackObservation = playbackObserver.getReference().getValue();
|
|
182
175
|
/** Reference through which estimates are emitted. */
|
|
183
176
|
var innerEstimateRef = createSharedReference(getCurrentEstimate());
|
|
184
177
|
// subscribe to subsequent playback observations
|
|
@@ -319,7 +312,7 @@ function getEstimateReference(_a, cancellationSignal) {
|
|
|
319
312
|
var manualBitrateVal = manualBitrate.getValue();
|
|
320
313
|
var representations = representationsRef.getValue();
|
|
321
314
|
currentEstimatesCanceller.cancel();
|
|
322
|
-
currentEstimatesCanceller = new TaskCanceller();
|
|
315
|
+
currentEstimatesCanceller = new TaskCanceller({ cancelOn: stopAllEstimates });
|
|
323
316
|
var newRef = createEstimateReference(manualBitrateVal, representations, currentEstimatesCanceller.signal);
|
|
324
317
|
newRef.onUpdate(function onNewEstimate(newEstimate) {
|
|
325
318
|
estimateRef.setValue(newEstimate);
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import noop from "../../utils/noop";
|
|
17
|
+
import { IReadOnlySharedReference } from "../../utils/reference";
|
|
17
18
|
import { CancellationSignal } from "../../utils/task_canceller";
|
|
18
19
|
/**
|
|
19
20
|
* Class allowing to "observe" current playback conditions so the RxPlayer is
|
|
@@ -55,21 +56,36 @@ export default class PlaybackObserver {
|
|
|
55
56
|
*/
|
|
56
57
|
private _internalSeekingEventsIncomingCounter;
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* `null` if no observation has been made yet.
|
|
59
|
+
* Stores the last playback observation produced by the `PlaybackObserver`.:
|
|
61
60
|
*/
|
|
62
|
-
private
|
|
61
|
+
private _observationRef;
|
|
63
62
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* `TaskCanceller` allowing to free all resources and stop producing playback
|
|
64
|
+
* observations.
|
|
66
65
|
*/
|
|
67
|
-
private
|
|
66
|
+
private _canceller;
|
|
68
67
|
/**
|
|
68
|
+
* Create a new `PlaybackObserver`, which allows to produce new "playback
|
|
69
|
+
* observations" on various media events and intervals.
|
|
70
|
+
*
|
|
71
|
+
* Note that creating a `PlaybackObserver` lead to the usage of resources,
|
|
72
|
+
* such as event listeners which will only be freed once the `stop` method is
|
|
73
|
+
* called.
|
|
69
74
|
* @param {HTMLMediaElement} mediaElement
|
|
70
75
|
* @param {Object} options
|
|
71
76
|
*/
|
|
72
77
|
constructor(mediaElement: HTMLMediaElement, options: IPlaybackObserverOptions);
|
|
78
|
+
/**
|
|
79
|
+
* Stop the `PlaybackObserver` from emitting playback observations and free all
|
|
80
|
+
* resources reserved to emitting them such as event listeners, intervals and
|
|
81
|
+
* subscribing callbacks.
|
|
82
|
+
*
|
|
83
|
+
* Once `stop` is called, no new playback observation will ever be emitted.
|
|
84
|
+
*
|
|
85
|
+
* Note that it is important to call stop once the `PlaybackObserver` is no
|
|
86
|
+
* more needed to avoid unnecessarily leaking resources.
|
|
87
|
+
*/
|
|
88
|
+
stop(): void;
|
|
73
89
|
/**
|
|
74
90
|
* Returns the current position advertised by the `HTMLMediaElement`, in
|
|
75
91
|
* seconds.
|
|
@@ -101,18 +117,16 @@ export default class PlaybackObserver {
|
|
|
101
117
|
*/
|
|
102
118
|
getReadyState(): number;
|
|
103
119
|
/**
|
|
104
|
-
* Returns an
|
|
105
|
-
*
|
|
120
|
+
* Returns an `IReadOnlySharedReference` storing the last playback observation
|
|
121
|
+
* produced by the `PlaybackObserver` and updated each time a new one is
|
|
122
|
+
* produced.
|
|
106
123
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* `subscribe` will receive the same events at the same time.
|
|
110
|
-
* This was done for performance and simplicity reasons.
|
|
124
|
+
* This value can then be for example subscribed to to be notified of future
|
|
125
|
+
* playback observations.
|
|
111
126
|
*
|
|
112
|
-
* @
|
|
113
|
-
* @returns {Observable}
|
|
127
|
+
* @returns {Object}
|
|
114
128
|
*/
|
|
115
|
-
|
|
129
|
+
getReference(): IReadOnlySharedReference<IPlaybackObservation>;
|
|
116
130
|
/**
|
|
117
131
|
* Register a callback so it regularly receives playback observations.
|
|
118
132
|
* @param {Function} cb
|
|
@@ -121,12 +135,11 @@ export default class PlaybackObserver {
|
|
|
121
135
|
* be first emitted synchronously.
|
|
122
136
|
* - `clearSignal`: If set, the callback will be unregistered when this
|
|
123
137
|
* CancellationSignal emits.
|
|
124
|
-
* @returns {Function} - Allows to easily unregister the callback
|
|
125
138
|
*/
|
|
126
139
|
listen(cb: (observation: IPlaybackObservation) => void, options?: {
|
|
127
140
|
includeLastObservation?: boolean | undefined;
|
|
128
141
|
clearSignal?: CancellationSignal | undefined;
|
|
129
|
-
}):
|
|
142
|
+
}): typeof noop | undefined;
|
|
130
143
|
/**
|
|
131
144
|
* Generate a new playback observer which can listen to other
|
|
132
145
|
* properties and which can only be accessed to read observations (e.g.
|
|
@@ -138,15 +151,16 @@ export default class PlaybackObserver {
|
|
|
138
151
|
*
|
|
139
152
|
* As argument, this method takes a function which will allow to produce
|
|
140
153
|
* the new set of properties to be present on each observation.
|
|
141
|
-
* @param {Function}
|
|
154
|
+
* @param {Function} transform
|
|
142
155
|
* @returns {Object}
|
|
143
156
|
*/
|
|
144
|
-
deriveReadOnlyObserver<TDest>(
|
|
157
|
+
deriveReadOnlyObserver<TDest>(transform: (observationRef: IReadOnlySharedReference<IPlaybackObservation>, cancellationSignal: CancellationSignal) => IReadOnlySharedReference<TDest>): IReadOnlyPlaybackObserver<TDest>;
|
|
145
158
|
/**
|
|
146
|
-
* Creates the
|
|
159
|
+
* Creates the `IReadOnlySharedReference` that will generate playback
|
|
160
|
+
* observations.
|
|
147
161
|
* @returns {Observable}
|
|
148
162
|
*/
|
|
149
|
-
private
|
|
163
|
+
private _createSharedReference;
|
|
150
164
|
private _generateInitialObservation;
|
|
151
165
|
}
|
|
152
166
|
/** "Event" that triggered the playback observation. */
|
|
@@ -286,18 +300,16 @@ export interface IReadOnlyPlaybackObserver<TObservationType> {
|
|
|
286
300
|
*/
|
|
287
301
|
getIsPaused(): boolean;
|
|
288
302
|
/**
|
|
289
|
-
* Returns an
|
|
290
|
-
*
|
|
303
|
+
* Returns an `IReadOnlySharedReference` storing the last playback observation
|
|
304
|
+
* produced by the `IReadOnlyPlaybackObserver` and updated each time a new one
|
|
305
|
+
* is produced.
|
|
291
306
|
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* `subscribe` will receive the same events at the same time.
|
|
295
|
-
* This was done for performance and simplicity reasons.
|
|
307
|
+
* This value can then be for example subscribed to to be notified of future
|
|
308
|
+
* playback observations.
|
|
296
309
|
*
|
|
297
|
-
* @
|
|
298
|
-
* @returns {Observable}
|
|
310
|
+
* @returns {Object}
|
|
299
311
|
*/
|
|
300
|
-
|
|
312
|
+
getReference(): IReadOnlySharedReference<TObservationType>;
|
|
301
313
|
/**
|
|
302
314
|
* Register a callback so it regularly receives playback observations.
|
|
303
315
|
* @param {Function} cb
|
|
@@ -311,16 +323,16 @@ export interface IReadOnlyPlaybackObserver<TObservationType> {
|
|
|
311
323
|
listen(cb: (observation: TObservationType) => void, options?: {
|
|
312
324
|
includeLastObservation?: boolean | undefined;
|
|
313
325
|
clearSignal?: CancellationSignal | undefined;
|
|
314
|
-
}):
|
|
326
|
+
}): void;
|
|
315
327
|
/**
|
|
316
328
|
* Generate a new `IReadOnlyPlaybackObserver` from this one.
|
|
317
329
|
*
|
|
318
330
|
* As argument, this method takes a function which will allow to produce
|
|
319
331
|
* the new set of properties to be present on each observation.
|
|
320
|
-
* @param {Function}
|
|
332
|
+
* @param {Function} transform
|
|
321
333
|
* @returns {Object}
|
|
322
334
|
*/
|
|
323
|
-
deriveReadOnlyObserver<TDest>(
|
|
335
|
+
deriveReadOnlyObserver<TDest>(transform: (observationRef: IReadOnlySharedReference<TObservationType>, cancellationSignal: CancellationSignal) => IReadOnlySharedReference<TDest>): IReadOnlyPlaybackObserver<TDest>;
|
|
324
336
|
}
|
|
325
337
|
export interface IPlaybackObserverOptions {
|
|
326
338
|
withMediaSource: boolean;
|