@vkontakte/videoplayer-core 2.0.181-dev.111b83b80.0 → 2.0.181-dev.132333d53.0
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/es2015.cjs +16 -16
- package/es2015.esm.js +8 -8
- package/esnext.cjs +8 -8
- package/esnext.esm.js +15 -15
- package/evergreen.esm.js +8 -8
- package/package.json +2 -2
- package/types/index.d.ts +3 -1
- package/types/player/Player.d.ts +2 -0
- package/types/player/types.d.ts +20 -3
- package/types/providers/DashProvider/baseDashProvider.d.ts +3 -0
- package/types/providers/DashProvider/lib/buffer.d.ts +49 -5
- package/types/providers/DashProvider/lib/fetcher.d.ts +31 -6
- package/types/providers/DashProvider/lib/player.d.ts +5 -0
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +3 -0
- package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +3 -0
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +21 -4
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +30 -6
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +2 -0
- package/types/providers/DashProviderVirtual/lib/player/types.d.ts +4 -1
- package/types/providers/ProviderContainer/index.d.ts +2 -0
- package/types/providers/types.d.ts +2 -1
- package/types/providers/utils/Abr/abrManager.d.ts +2 -0
- package/types/providers/utils/Abr/mlAbr/chunkDownloadHistory.d.ts +34 -0
- package/types/providers/utils/Abr/mlAbr/modelInput.d.ts +47 -0
- package/types/providers/utils/Abr/mlAbr/workerClient.d.ts +57 -0
- package/types/providers/utils/Abr/mlAbr/workerProtocol.d.ts +67 -0
- package/types/providers/utils/Abr/rules/baseRule.d.ts +2 -1
- package/types/providers/utils/Abr/rules/video/mlAbrRule.d.ts +52 -0
- package/types/providers/utils/Abr/rules/video/stallsRule.d.ts +9 -11
- package/types/providers/utils/Abr/types.d.ts +10 -1
- package/types/providers/utils/StallsManager.d.ts +1 -8
- package/types/utils/ClientChecker/services/DeviceChecker.d.ts +4 -0
- package/types/utils/ClientChecker/types/userAgentData.d.ts +4 -2
- package/types/utils/ThroughputEstimator.d.ts +20 -4
- package/types/utils/UserHappinessController.d.ts +8 -0
- package/types/utils/UserHappinessObserver/constants.d.ts +12 -0
- package/types/utils/UserHappinessObserver/index.d.ts +15 -0
- package/types/utils/UserHappinessObserver/metrics/hasFatalError.d.ts +3 -0
- package/types/utils/UserHappinessObserver/metrics/highStallRatio.d.ts +3 -0
- package/types/utils/UserHappinessObserver/metrics/lowQuality/constants.d.ts +5 -0
- package/types/utils/UserHappinessObserver/metrics/lowQuality/createLowQuality.d.ts +4 -0
- package/types/utils/UserHappinessObserver/metrics/lowQuality/index.d.ts +1 -0
- package/types/utils/UserHappinessObserver/metrics/lowQuality/types.d.ts +13 -0
- package/types/utils/UserHappinessObserver/metrics/lowQuality/utils.d.ts +26 -0
- package/types/utils/UserHappinessObserver/metrics/slowFirstFrame.d.ts +3 -0
- package/types/utils/UserHappinessObserver/types.d.ts +8 -0
- package/types/utils/UserHappinessObserver/utils/qualityPlatform.d.ts +2 -0
- package/types/utils/UserHappinessObserver/utils/thresholds.d.ts +2 -0
- package/types/utils/UserHappinessObserver/utils/watchedTimeSeconds.d.ts +3 -0
- package/types/utils/tuningConfig.d.ts +71 -20
- package/types/utils/userHappinessTriggers.d.ts +4 -0
- package/types/utils/buffer/getBackwardBufferDuration.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.181-dev.
|
|
3
|
+
"version": "2.0.181-dev.132333d53.0",
|
|
4
4
|
"author": "vk.ru",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.ru platform",
|
|
6
6
|
"homepage": "https://vk.ru",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"**/*.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vkontakte/videoplayer-shared": "1.0.110-dev.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.110-dev.132333d53.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { VERSION } from "./env";
|
|
2
2
|
import type { IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek } from "./player/types";
|
|
3
3
|
import type { VideoCodec } from "./player/types";
|
|
4
|
+
import type { ICoreInstanceData, MlModelResolver } from "./player/types";
|
|
4
5
|
import { VideoFormat, Surface, PredefinedQualityLimits, VideoCodecName } from "./player/types";
|
|
5
6
|
import Player from "./player/Player";
|
|
6
7
|
import type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, ISources, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics } from "./player/types";
|
|
7
8
|
import { PlaybackState, ChromecastState, HttpConnectionType } from "./player/types";
|
|
8
9
|
import type { IOptionalTuningConfig } from "./utils/tuningConfig";
|
|
10
|
+
import type { UserHappinessTrigger } from "./utils/userHappinessTriggers";
|
|
9
11
|
export { clientChecker, isMobile } from "./utils/ClientChecker";
|
|
10
12
|
export { areValidLiveRecordSources } from "./utils/videoFormat";
|
|
11
13
|
export { WebmCodecStrategy } from "./enums/WebmCodecStrategy";
|
|
@@ -15,5 +17,5 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from "@
|
|
|
15
17
|
* @deprecated
|
|
16
18
|
*/
|
|
17
19
|
declare const SDK_VERSION: string;
|
|
18
|
-
export type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, ExactVideoQuality, IRange, ISeekRequest, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics };
|
|
20
|
+
export type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, UserHappinessTrigger, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, ExactVideoQuality, IRange, ISeekRequest, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics, ICoreInstanceData, MlModelResolver };
|
|
19
21
|
export { Player, PlaybackState, ChromecastState, HttpConnectionType, Surface, Subscription, VideoFormat, VideoQuality, Observable, Subject, ValueSubject, VERSION, SDK_VERSION, PredefinedQualityLimits, VideoCodec, VideoCodecName };
|
package/types/player/Player.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export default class Player implements IPlayer {
|
|
|
26
26
|
private wasSetStartedQuality;
|
|
27
27
|
private desiredState;
|
|
28
28
|
info: PlayerInfoImpl;
|
|
29
|
+
private userHappinessController;
|
|
29
30
|
events: PlayerEventsImpl;
|
|
30
31
|
experimental: PlayerExperimentalImpl;
|
|
31
32
|
private devNullLog;
|
|
@@ -37,6 +38,7 @@ export default class Player implements IPlayer {
|
|
|
37
38
|
* Очищает необходимые поля при переключении на другое видео
|
|
38
39
|
*/
|
|
39
40
|
private resetDesiredState;
|
|
41
|
+
private createUserHappinessController;
|
|
40
42
|
/**
|
|
41
43
|
* Возвращает плеер в начальное состояние
|
|
42
44
|
* Позвонялет переиспользовать для другого видео
|
package/types/player/types.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export interface IPlayerEvents {
|
|
|
227
227
|
*/
|
|
228
228
|
fetcherRecoverableError$: IObservable<IError>;
|
|
229
229
|
/**
|
|
230
|
-
* Произошел
|
|
230
|
+
* Произошел серьёзный/долгий stall.
|
|
231
231
|
*/
|
|
232
232
|
severeStallOccured$: IObservable<boolean>;
|
|
233
233
|
}
|
|
@@ -350,7 +350,7 @@ export interface PlayerInfoValues {
|
|
|
350
350
|
*/
|
|
351
351
|
isBuffering$: boolean;
|
|
352
352
|
/**
|
|
353
|
-
* Состояние
|
|
353
|
+
* Состояние stall. Возникает по истечении stallIgnoreThreshold после старта нежелательной буферизации
|
|
354
354
|
* Статус только нежелательной буферизации возникает при опустошении буфера в процессе воспроизведения
|
|
355
355
|
* и не возникает при начальном наполнении буфера или после перемотки
|
|
356
356
|
*/
|
|
@@ -519,7 +519,7 @@ export interface PlayerEventsImpl {
|
|
|
519
519
|
fetcherError$: Subject<IError>;
|
|
520
520
|
severeStallOccured$: Subject<boolean>;
|
|
521
521
|
}
|
|
522
|
-
interface IPlayerExperimental {
|
|
522
|
+
export interface IPlayerExperimental {
|
|
523
523
|
/**
|
|
524
524
|
* Элемент, который сейчас вставлен в container.
|
|
525
525
|
* Может быть видеоэлементом, iframe и вообще чем угодно в общем случае.
|
|
@@ -562,6 +562,8 @@ export interface IConfig {
|
|
|
562
562
|
* Нужно ли recoverableError обрабатывать как ошибку провайдера или будет снаружи обрабатываться.
|
|
563
563
|
*/
|
|
564
564
|
handleNetworkRecoverableErrorAsProviderError?: boolean;
|
|
565
|
+
/** Инстанс-данные слоёв: сессионный контекст приложения (UVP-12133). */
|
|
566
|
+
instance?: ICoreInstanceData;
|
|
565
567
|
}
|
|
566
568
|
export interface ISources {
|
|
567
569
|
[VideoFormat.MPEG]?: IMpegSource;
|
|
@@ -661,6 +663,21 @@ export interface IVideoTrack extends IBaseTrack {
|
|
|
661
663
|
streamId?: IVideoStream["id"];
|
|
662
664
|
tvDisabled?: boolean;
|
|
663
665
|
}
|
|
666
|
+
/**
|
|
667
|
+
* Провайдер байтов ML-артефакта. Возвращает расшифрованный бандл или null —
|
|
668
|
+
* null означает «юзер-специфичной модели нет», и фича идёт в гостевом режиме
|
|
669
|
+
* либо деградирует. Общий контракт для будущих ML-фич плеера (UVP-12133).
|
|
670
|
+
*/
|
|
671
|
+
export type MlModelResolver = () => Promise<ArrayBuffer | null>;
|
|
672
|
+
/**
|
|
673
|
+
* Инстанс-данные слоя core: сессионный контекст приложения, передаётся первым
|
|
674
|
+
* параметром initPlayer в адресованной секции `instance.core` — в один ряд с
|
|
675
|
+
* statAuthToken/refreshStatAuthToken, а не в поведенческий sdkConfig.
|
|
676
|
+
*/
|
|
677
|
+
export interface ICoreInstanceData {
|
|
678
|
+
/** Модель ABR: расшифрованный бандл из account.getModels (приложение) | null → гостевая (UVP-12133). */
|
|
679
|
+
getAbrMLModel?: MlModelResolver;
|
|
680
|
+
}
|
|
664
681
|
export interface IAudioStream {
|
|
665
682
|
id: string;
|
|
666
683
|
language?: string;
|
|
@@ -11,6 +11,7 @@ import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager
|
|
|
11
11
|
import TextTrackManager from "../utils/TextTrackManager";
|
|
12
12
|
import StallsManager from "../utils/StallsManager";
|
|
13
13
|
import { AbrManager } from "../utils/Abr/abrManager";
|
|
14
|
+
import type { IChunkDownloadHistory } from "../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
14
15
|
import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
|
|
15
16
|
type IParams = IProviderParams<IDashURLSource> & {
|
|
16
17
|
sourceHls?: IHLSSource;
|
|
@@ -32,6 +33,8 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
32
33
|
protected stallsManager: StallsManager;
|
|
33
34
|
protected elementSizeManager: ElementSizeManager;
|
|
34
35
|
protected abrManager: AbrManager;
|
|
36
|
+
/** Один на плеер: оба DASH-провайдера пишут, правило MlAbr читает (UVP-12133). */
|
|
37
|
+
protected chunkDownloadHistory: IChunkDownloadHistory;
|
|
35
38
|
protected videoTracksMap: Map<IVideoTrack, {
|
|
36
39
|
stream: Stream;
|
|
37
40
|
representation: Representation;
|
|
@@ -2,8 +2,10 @@ import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
|
2
2
|
import type { IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import { abortable } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
import type { Fetcher } from "./fetcher";
|
|
5
|
-
import type { CommonInit, Manifest, Representation, Segment, Stream
|
|
5
|
+
import type { CommonInit, Manifest, Representation, Segment, Stream } from "../../utils/parsers/types";
|
|
6
|
+
import { StreamKind } from "../../utils/parsers/types";
|
|
6
7
|
import type { VideoSegmentLoadProgress } from "../../utils/Abr/types";
|
|
8
|
+
import type { IChunkDownloadHistory } from "../../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
7
9
|
export interface Dependencies {
|
|
8
10
|
fetcher: Fetcher;
|
|
9
11
|
tuning: ITuningConfig;
|
|
@@ -12,6 +14,8 @@ export interface Dependencies {
|
|
|
12
14
|
compatibilityMode?: boolean;
|
|
13
15
|
manifest: Manifest | null;
|
|
14
16
|
tracer: ITracer;
|
|
17
|
+
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
18
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
15
19
|
}
|
|
16
20
|
export interface Gap extends IRange<Milliseconds> {
|
|
17
21
|
representation: Representation["id"];
|
|
@@ -38,6 +42,7 @@ export declare class BufferManager {
|
|
|
38
42
|
updateEnd$: IValueSubject<void>;
|
|
39
43
|
private subscription;
|
|
40
44
|
private kind;
|
|
45
|
+
private chunkDownloadHistory;
|
|
41
46
|
private initData;
|
|
42
47
|
private parsedInitData;
|
|
43
48
|
private representations;
|
|
@@ -56,6 +61,7 @@ export declare class BufferManager {
|
|
|
56
61
|
private destroyAbortController;
|
|
57
62
|
private useSmartRepresentationSwitch;
|
|
58
63
|
private readonly getCurrentPosition;
|
|
64
|
+
private readonly getSeekTargetPosition;
|
|
59
65
|
private readonly isActiveLowLatency;
|
|
60
66
|
private tuning;
|
|
61
67
|
private forwardBufferTarget;
|
|
@@ -74,13 +80,11 @@ export declare class BufferManager {
|
|
|
74
80
|
private liveUpdateSegmentIndex;
|
|
75
81
|
private liveInitialAdditionalOffset;
|
|
76
82
|
private isSeekingLive;
|
|
77
|
-
private isBackwardPruneInFlight;
|
|
78
83
|
private index;
|
|
79
84
|
private lastDataObtainedTimestampMs;
|
|
80
85
|
private loadByteRangeSegmentsTimeoutId;
|
|
81
|
-
private preDownloadedFirstSegment;
|
|
82
86
|
private brokenSegmentAppendDetected;
|
|
83
|
-
constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest, tracer }: Dependencies);
|
|
87
|
+
constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, getSeekTargetPosition, isActiveLowLatency, compatibilityMode, manifest, tracer, chunkDownloadHistory }: Dependencies);
|
|
84
88
|
startWith: ReturnType<typeof abortable<[Representation["id"]]>>;
|
|
85
89
|
switchToWithPreviousAbort(newRepresentationId: Representation["id"], dropBuffer?: boolean): Promise<void | undefined>;
|
|
86
90
|
switchTo: ReturnType<typeof abortable<[Representation["id"], boolean | undefined], void>>;
|
|
@@ -109,7 +113,6 @@ export declare class BufferManager {
|
|
|
109
113
|
private loadSegments;
|
|
110
114
|
private loadTemplateSegment;
|
|
111
115
|
private updateRepresentationsBaseUrlIfNeeded;
|
|
112
|
-
private feedPreDownloadedFirstSegment;
|
|
113
116
|
private loadByteRangeSegments;
|
|
114
117
|
private prepareByteRangeFetchSegmentParams;
|
|
115
118
|
private buildCacheMetadata;
|
|
@@ -125,11 +128,52 @@ export declare class BufferManager {
|
|
|
125
128
|
* @private
|
|
126
129
|
*/
|
|
127
130
|
private onSomeByteRangesDataLoaded;
|
|
131
|
+
/**
|
|
132
|
+
* Запись в историю чанков для MlAbr. Байты приходят параметром: у каждого пути
|
|
133
|
+
* аппенда свой источник истины о размере (результат fetch'а, диапазон батча,
|
|
134
|
+
* накопленные подкармливания), на SegmentProgress его нет. Пропуск без
|
|
135
|
+
* startedAtMs — у батчей byte-range время общее на группу сегментов, а без
|
|
136
|
+
* известного старта fetch'а время загрузки не выводится.
|
|
137
|
+
*/
|
|
138
|
+
private recordChunkDownload;
|
|
128
139
|
private onSegmentFullyAppended;
|
|
129
140
|
private detectBrokenSegmentAppend;
|
|
130
141
|
private abortSegment;
|
|
142
|
+
/**
|
|
143
|
+
* Прогрев sidx всех репрезентаций для MlAbr: модели нужны размеры будущих
|
|
144
|
+
* сегментов каждого качества к первому решению, а без прогрева индексы
|
|
145
|
+
* приезжают лениво — только при первом переключении на качество. Idle-очередь
|
|
146
|
+
* качает по одному индексу между делом; здесь грузим все недостающие параллельно.
|
|
147
|
+
* loadInit регистрирует промис в initData синхронно и ошибок наружу не бросает.
|
|
148
|
+
*/
|
|
149
|
+
private warmUpRepresentations;
|
|
131
150
|
private loadNextInit;
|
|
151
|
+
private isFirstSegmentPreloadEnabled;
|
|
152
|
+
private isStartPositionWithinFirstSegment;
|
|
153
|
+
/**
|
|
154
|
+
* Работа с прелоадом первого сегмента.
|
|
155
|
+
*
|
|
156
|
+
* Загружает init+index репрезентации и применяет их через onInitFetched (результаты сетятся в initData /
|
|
157
|
+
* parsedInitData / segments). Резолвится после применения инита.
|
|
158
|
+
*
|
|
159
|
+
* Режимы вызова:
|
|
160
|
+
* - critical=true — только startWith (стартовая загрузка);
|
|
161
|
+
* - critical=false — switchTo и ленивые idle-догрузки остальных репрезентаций.
|
|
162
|
+
*
|
|
163
|
+
* С прелоадом первого сегмента (critical && isFirstSegmentPreloadEnabled):
|
|
164
|
+
* - фетчер делает один combined-запрос init+index+первый сегмент;
|
|
165
|
+
* - инит применяется досрочно из onInitFetched, до скачанных байтов сегмента, и сразу ставится
|
|
166
|
+
* init-аппенд в SourceBufferTaskQueue — раньше кормления чанков сегмента (кормление синхронно
|
|
167
|
+
* внутри onProgress, поэтому без этого сегмент аппендился бы раньше инита);
|
|
168
|
+
* - резолв loadInit ждёт завершения init-аппенда;
|
|
169
|
+
* - чанки сегмента кормятся через handleFirstSegmentChunk, хвост добивается в finalizeCombinedStreaming
|
|
170
|
+
*/
|
|
132
171
|
private loadInit;
|
|
172
|
+
/**
|
|
173
|
+
* Здесь мы только финалим хвостовую часть — сегментную — комбинированного запроса.
|
|
174
|
+
* Если сегмент не докачался не беда, loadSegments подхватит.
|
|
175
|
+
*/
|
|
176
|
+
private finalizeCombinedStreaming;
|
|
133
177
|
private dropBuffer;
|
|
134
178
|
private pruneBuffer;
|
|
135
179
|
private abortBuffer;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from "../../../player/types";
|
|
2
2
|
import type ThroughputEstimator from "../../../utils/ThroughputEstimator";
|
|
3
|
-
import type { Byte, IValueSubject, ISubject, Milliseconds, IRange, ITracer, IError } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { Byte, ExactVideoQuality, IValueSubject, ISubject, Milliseconds, IRange, ITracer, IError } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
import { abortable } from "@vkontakte/videoplayer-shared";
|
|
5
|
-
import type { ExactVideoQuality } from "@vkontakte/videoplayer-shared";
|
|
6
5
|
import type { CommonInit, GenericContainerParser, Segment, SegmentReference } from "../../utils/parsers/types";
|
|
7
6
|
import type { ISegmentCacheStorage, CacheMetadata, SegmentCacheMode } from "../../utils/segmentCache";
|
|
8
7
|
declare global {
|
|
@@ -50,13 +49,19 @@ export interface FetchParams {
|
|
|
50
49
|
ignoreNetworkErrors?: boolean;
|
|
51
50
|
representationHeight?: number;
|
|
52
51
|
cacheMetadata?: CacheMetadata;
|
|
52
|
+
firstSegmentPreload?: boolean;
|
|
53
|
+
onInitFetched?: (data: IRepresentationInitReady) => void;
|
|
54
|
+
onSegmentsDone?: (result: ICombinedBodyResult | null) => void;
|
|
53
55
|
}
|
|
54
|
-
export
|
|
56
|
+
export interface IRepresentationInitReady {
|
|
55
57
|
init: CommonInit | null;
|
|
56
58
|
segments: Segment[];
|
|
59
|
+
initData: ArrayBuffer;
|
|
60
|
+
globalFrom: Byte;
|
|
61
|
+
}
|
|
62
|
+
export interface ICombinedBodyResult {
|
|
57
63
|
dataView: DataView;
|
|
58
|
-
|
|
59
|
-
};
|
|
64
|
+
}
|
|
60
65
|
export declare class Fetcher {
|
|
61
66
|
private throughputEstimator;
|
|
62
67
|
private requestQuic;
|
|
@@ -97,11 +102,31 @@ export declare class Fetcher {
|
|
|
97
102
|
private trackRequestStart;
|
|
98
103
|
fetchManifest: ReturnType<typeof abortable<[string], string | null>>;
|
|
99
104
|
fetch: ReturnType<typeof abortable<[string, FetchParams], ArrayBuffer | null>>;
|
|
100
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Резолвится, когда получили init данные.
|
|
107
|
+
*/
|
|
108
|
+
fetchRepresentation(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, fetchParams: FetchParams): Promise<IRepresentationInitReady | null>;
|
|
101
109
|
/** Скипнутые сегменты не записаны в кэш — при следующем запросе региона докачаются как miss. */
|
|
102
110
|
private traceSkippedCacheSegments;
|
|
103
111
|
destroy(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Тут проверяем расположение данных, нам из манифеста приходит только длина сегмента, ничто не известно про оффсет от начала,
|
|
114
|
+
* заявлено, что первый сегмент идет сразу после индекса. Проверяем контракт: true — нарушен, первый сегмент лежит не сразу за индексом.
|
|
115
|
+
*/
|
|
116
|
+
private isFirstSegmentLayoutViolated;
|
|
117
|
+
private logFirstSegmentLayoutViolation;
|
|
118
|
+
/**
|
|
119
|
+
* Адаптируем onProgress комбинированного запроса: отдельно информируем о данных инита
|
|
120
|
+
* и о данных сегмента на основании одного combined-стрима.
|
|
121
|
+
*/
|
|
122
|
+
private createInitAndFirstSegmentStreamingOnProgress;
|
|
104
123
|
private fetchByteRangeRepresentation;
|
|
124
|
+
private fetchByteRangeRepresentationWithFirstSegment;
|
|
125
|
+
/**
|
|
126
|
+
* Если происходит downloadSignal то мы не хотим абортить загрузку инит части запроса,
|
|
127
|
+
* скачиваем нужную часть запроса, как только инит+индекс готов, сегмент хвост можно абортить.
|
|
128
|
+
*/
|
|
129
|
+
private createSegmentTailAbort;
|
|
105
130
|
private fetchTemplateRepresentation;
|
|
106
131
|
private isLikelyCacheHitByTtfb;
|
|
107
132
|
private doFetch;
|
|
@@ -8,6 +8,7 @@ import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
|
8
8
|
import type { ExactVideoQuality, IError, ISubject, ITracer, IValueSubject, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
9
9
|
import { abortable, Subject } from "@vkontakte/videoplayer-shared";
|
|
10
10
|
import type { VideoSegmentLoadProgress } from "../../utils/Abr/types";
|
|
11
|
+
import type { IChunkDownloadHistory } from "../../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
11
12
|
export declare enum State {
|
|
12
13
|
NONE = "none",
|
|
13
14
|
MANIFEST_READY = "manifest_ready",
|
|
@@ -22,6 +23,8 @@ export interface Params {
|
|
|
22
23
|
tracer: ITracer;
|
|
23
24
|
isOnDemand: boolean;
|
|
24
25
|
dashMaxTvVideoQuality: Nullable<ExactVideoQuality>;
|
|
26
|
+
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
27
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
25
28
|
}
|
|
26
29
|
export declare class Player {
|
|
27
30
|
private element;
|
|
@@ -89,6 +92,8 @@ export declare class Player {
|
|
|
89
92
|
private liveWasInterrupted;
|
|
90
93
|
private isOnDemand;
|
|
91
94
|
private dashMaxTvVideoQuality;
|
|
95
|
+
private getSeekTargetPosition;
|
|
96
|
+
private chunkDownloadHistory;
|
|
92
97
|
private destroyController;
|
|
93
98
|
constructor(params: Params);
|
|
94
99
|
initManifest: ReturnType<typeof abortable<[HTMLMediaElement, string, number]>>;
|
|
@@ -12,6 +12,7 @@ import StallsManager from "../utils/StallsManager";
|
|
|
12
12
|
import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
|
|
13
13
|
import type { BasePlayer } from "./lib/player/basePlayer";
|
|
14
14
|
import { AbrManager } from "../utils/Abr/abrManager";
|
|
15
|
+
import type { IChunkDownloadHistory } from "../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
15
16
|
type IParams = IProviderParams<IDashURLSource> & {
|
|
16
17
|
sourceHls?: IHLSSource;
|
|
17
18
|
forceVideoCodec?: VideoCodec;
|
|
@@ -32,6 +33,8 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
32
33
|
protected stallsManager: StallsManager;
|
|
33
34
|
protected elementSizeManager: ElementSizeManager;
|
|
34
35
|
protected abrManager: AbrManager;
|
|
36
|
+
/** Один на плеер: оба DASH-провайдера пишут, правило MlAbr читает (UVP-12133). */
|
|
37
|
+
protected chunkDownloadHistory: IChunkDownloadHistory;
|
|
35
38
|
protected videoTracksMap: Map<IVideoTrack, {
|
|
36
39
|
stream: Stream;
|
|
37
40
|
representation: Representation;
|
|
@@ -4,6 +4,7 @@ import type { Fetcher } from "../fetcher";
|
|
|
4
4
|
import type { ITuningConfig } from "../../../../utils/tuningConfig";
|
|
5
5
|
import type { VideoSegmentLoadProgress } from "../../../utils/Abr/types";
|
|
6
6
|
import type { ISegmentCacheStorage } from "../../../utils/segmentCache";
|
|
7
|
+
import type { IChunkDownloadHistory } from "../../../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
7
8
|
export type TRepresentationSwitchMode = "lazy" | "force";
|
|
8
9
|
export declare enum SwithRepresentationMode {
|
|
9
10
|
Lazy = "lazy",
|
|
@@ -17,9 +18,11 @@ export interface Dependencies {
|
|
|
17
18
|
compatibilityMode?: boolean;
|
|
18
19
|
manifest: Manifest | null;
|
|
19
20
|
segmentCacheService?: ISegmentCacheStorage;
|
|
21
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
20
22
|
getCurrentPosition(): Milliseconds | undefined;
|
|
21
23
|
getCurrentStallDuration(): Milliseconds;
|
|
22
24
|
isActiveLowLatency(): boolean;
|
|
25
|
+
getSeekTargetPosition?(): Milliseconds | undefined;
|
|
23
26
|
}
|
|
24
27
|
export interface IVirtualBufferManager<T extends Segment = Segment> {
|
|
25
28
|
error$: ISubject<IError>;
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fetcher, FetchParamsWithUrl, Priority
|
|
1
|
+
import type { Fetcher, FetchParamsWithUrl, Priority } from "../../fetcher";
|
|
2
2
|
import type { CommonInit, ContainerParser, Representation, Segment } from "../../../../utils/parsers/types";
|
|
3
3
|
import { StreamKind } from "../../../../utils/parsers/types";
|
|
4
4
|
import type { ITuningConfig } from "../../../../../utils/tuningConfig";
|
|
@@ -22,11 +22,12 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
22
22
|
protected readonly tuning: ITuningConfig;
|
|
23
23
|
protected readonly segmentCacheService: ISegmentCacheStorage | undefined;
|
|
24
24
|
protected representations: Map<Representation["id"], Representation>;
|
|
25
|
+
private chunkDownloadHistory;
|
|
25
26
|
protected playingRepresentationId: Representation["id"] | undefined;
|
|
26
27
|
protected downloadingRepresentationId: Representation["id"] | undefined;
|
|
27
28
|
protected switchingRepresentationId: Representation["id"] | null;
|
|
28
29
|
protected initData: Map<Representation["id"], ArrayBuffer>;
|
|
29
|
-
protected initDataPromises: Map<Representation["id"], Promise<
|
|
30
|
+
protected initDataPromises: Map<Representation["id"], Promise<unknown>>;
|
|
30
31
|
protected idleCallbacks: Map<Representation["id"], number>;
|
|
31
32
|
protected parsedInitData: Map<Representation["id"], CommonInit>;
|
|
32
33
|
protected forwardBufferRepresentations: Map<Representation["id"], T[]>;
|
|
@@ -55,8 +56,9 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
55
56
|
protected subscription: Subscription;
|
|
56
57
|
protected readonly getCurrentPosition: () => Milliseconds | undefined;
|
|
57
58
|
protected readonly getCurrentStallDuration: () => Milliseconds | undefined;
|
|
59
|
+
protected readonly getSeekTargetPosition: (() => Milliseconds | undefined) | undefined;
|
|
58
60
|
protected brokenSegmentAppendDetected: boolean;
|
|
59
|
-
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tracer, tuning, getCurrentPosition, getCurrentStallDuration, manifest, segmentCacheService }: Dependencies);
|
|
61
|
+
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tracer, tuning, getCurrentPosition, getCurrentStallDuration, getSeekTargetPosition, manifest, segmentCacheService, chunkDownloadHistory }: Dependencies);
|
|
60
62
|
protected abstract loadItems(itemsToLoad: IBufferPlaybackQueueItem<T>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
61
63
|
protected abstract selectItemsToLoad(): IBufferPlaybackQueueItem<T>[];
|
|
62
64
|
protected abstract prepareFetchParams(items: IBufferPlaybackQueueItem<T>[], representation: Representation): FetchParamsWithUrl;
|
|
@@ -107,9 +109,18 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
107
109
|
protected abortDownload(): void;
|
|
108
110
|
protected abortDownloadingItems(): void;
|
|
109
111
|
protected abortNativeBuffer(): Promise<boolean>;
|
|
110
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Прогрев индексов остальных репрезентаций. За mlAbr.enabled — параллельно и
|
|
114
|
+
* сразу: MlAbr нужны размеры сегментов всех качеств к первому решению модели,
|
|
115
|
+
* idle-отсрочка опоздала бы. loadInitIfNeeded дедупится initDataPromises, ошибок
|
|
116
|
+
* наружу не бросает.
|
|
117
|
+
*/
|
|
118
|
+
protected loadInits(): void;
|
|
111
119
|
protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
112
120
|
protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
121
|
+
private isStartPositionWithinFirstSegment;
|
|
122
|
+
private finalizeCombinedStreaming;
|
|
123
|
+
private resetStreamingItem;
|
|
113
124
|
protected maintainNativeBuffer(signal: AbortSignal): Promise<void>;
|
|
114
125
|
protected maintainPlaybackBuffer(position: Milliseconds): Promise<void>;
|
|
115
126
|
protected actualizeLastSegmentInfo(currentPosition: Milliseconds): void;
|
|
@@ -127,6 +138,12 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
127
138
|
protected onItemFullyAppended(appendedItem: IBufferPlaybackQueueItem<T>): void;
|
|
128
139
|
private detectBrokenSegmentAppend;
|
|
129
140
|
protected removeSegment(nextRemoveItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Запись в историю чанков для MlAbr. Без size или startedAtMs запись не
|
|
143
|
+
* выводится корректно (размер неизвестен до sidx, старт — до перевода в
|
|
144
|
+
* DOWNLOADING): молча пропускаем, история просто копится медленнее.
|
|
145
|
+
*/
|
|
146
|
+
private recordChunkDownload;
|
|
130
147
|
protected onDownloadItem(downloadedItem: IBufferPlaybackQueueItem<T>): void;
|
|
131
148
|
protected pruneVirtualBuffer(currentPosition: Milliseconds): void;
|
|
132
149
|
protected updateRepresentationsBaseUrlIfNeeded(): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from "../../../player/types";
|
|
2
2
|
import type ThroughputEstimator from "../../../utils/ThroughputEstimator";
|
|
3
|
-
import type { Byte, IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { Byte, ExactVideoQuality, IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
import { abortable } from "@vkontakte/videoplayer-shared";
|
|
5
|
-
import type { ExactVideoQuality } from "@vkontakte/videoplayer-shared";
|
|
6
5
|
import type { CommonInit, GenericContainerParser, Segment, SegmentReference, StreamKind } from "../../utils/parsers/types";
|
|
7
6
|
import type { ISegmentCacheStorage, CacheMetadata, SegmentCacheMode } from "../../utils/segmentCache";
|
|
8
7
|
declare global {
|
|
@@ -44,17 +43,30 @@ export interface FetchParams {
|
|
|
44
43
|
onProgressTasks?: Promise<void>[];
|
|
45
44
|
signal?: AbortSignal;
|
|
46
45
|
priority?: Priority;
|
|
46
|
+
representationHeight?: number;
|
|
47
47
|
measureThroughput?: boolean;
|
|
48
48
|
isLowLatency?: boolean;
|
|
49
49
|
bufferOptimisation?: boolean;
|
|
50
50
|
kind: StreamKind;
|
|
51
51
|
cacheMetadata?: CacheMetadata;
|
|
52
|
+
firstSegmentPreload?: boolean;
|
|
53
|
+
onInitFetched?: (data: IRepresentationInitReady) => void;
|
|
54
|
+
onSegmentsDone?: (result: ICombinedBodyResult | null) => void;
|
|
55
|
+
}
|
|
56
|
+
export interface IRepresentationInitReady {
|
|
57
|
+
init: CommonInit | null;
|
|
58
|
+
segments: Segment[];
|
|
59
|
+
initData: ArrayBuffer;
|
|
60
|
+
globalFrom: Byte;
|
|
61
|
+
}
|
|
62
|
+
export interface ICombinedBodyResult {
|
|
63
|
+
dataView: DataView;
|
|
52
64
|
}
|
|
53
65
|
export type RepresentationFetchResult<T extends Segment> = {
|
|
54
|
-
|
|
55
|
-
initDataView: DataView;
|
|
66
|
+
init: CommonInit | null;
|
|
56
67
|
segments: T[];
|
|
57
|
-
|
|
68
|
+
initData: ArrayBuffer;
|
|
69
|
+
globalFrom: Byte;
|
|
58
70
|
};
|
|
59
71
|
export declare class Fetcher {
|
|
60
72
|
private throughputEstimator;
|
|
@@ -96,11 +108,23 @@ export declare class Fetcher {
|
|
|
96
108
|
private trackRequestStart;
|
|
97
109
|
fetchManifest: ReturnType<typeof abortable<[string], string | null>>;
|
|
98
110
|
fetch: ReturnType<typeof abortable<[string, FetchParams], ArrayBuffer | null>>;
|
|
99
|
-
fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>,
|
|
111
|
+
fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, fetchParams?: FetchParams): Promise<RepresentationFetchResult<T> | null | undefined>;
|
|
100
112
|
/** Скипнутые сегменты не записаны в кэш — при следующем запросе региона докачаются как miss. */
|
|
101
113
|
private traceSkippedCacheSegments;
|
|
102
114
|
destroy(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Так как качем инит+сегмент, то нам нужно раньше сообщить, что мы получили инит+индекс часть,
|
|
117
|
+
* а сегментная пусть качается дальше.
|
|
118
|
+
*/
|
|
119
|
+
private createInitAndFirstSegmentStreamingOnProgress;
|
|
120
|
+
/**
|
|
121
|
+
* Проверяем, что данные сегмента идут сразу после индекса.
|
|
122
|
+
*/
|
|
123
|
+
private isFirstSegmentLayoutViolated;
|
|
124
|
+
private logFirstSegmentLayoutViolation;
|
|
103
125
|
private fetchByteRangeRepresentation;
|
|
126
|
+
private fetchByteRangeRepresentationWithFirstSegment;
|
|
127
|
+
private createSegmentTailAbort;
|
|
104
128
|
private fetchTemplateRepresentation;
|
|
105
129
|
private isLikelyCacheHitByTtfb;
|
|
106
130
|
private doFetch;
|
|
@@ -80,6 +80,8 @@ export declare abstract class BasePlayer {
|
|
|
80
80
|
updateDurationError$: Subject<IError>;
|
|
81
81
|
private isOnDemand;
|
|
82
82
|
private dashMaxTvVideoQuality;
|
|
83
|
+
private getSeekTargetPosition;
|
|
84
|
+
private chunkDownloadHistory;
|
|
83
85
|
protected constructor(params: Params);
|
|
84
86
|
protected abstract prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
|
|
85
87
|
protected abstract setSourceInitDuration(): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type ThroughputEstimator from "../../../../utils/ThroughputEstimator";
|
|
2
2
|
import type { ITuningConfig } from "../../../../utils/tuningConfig";
|
|
3
3
|
import type { VideoCodec } from "../../../../player/types";
|
|
4
|
-
import type { ExactVideoQuality, ITracer, Nullable } from "@vkontakte/videoplayer-shared";
|
|
4
|
+
import type { ExactVideoQuality, ITracer, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
5
|
+
import type { IChunkDownloadHistory } from "../../../utils/Abr/mlAbr/chunkDownloadHistory";
|
|
5
6
|
export declare enum State {
|
|
6
7
|
NONE = "none",
|
|
7
8
|
MANIFEST_READY = "manifest_ready",
|
|
@@ -16,4 +17,6 @@ export interface Params {
|
|
|
16
17
|
tracer: ITracer;
|
|
17
18
|
isOnDemand?: boolean;
|
|
18
19
|
dashMaxTvVideoQuality?: Nullable<ExactVideoQuality>;
|
|
20
|
+
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
21
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
19
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IMetadata, ISources } from "../../player/types";
|
|
2
2
|
import { VideoFormat } from "../../player/types";
|
|
3
|
+
import type { ICoreInstanceData } from "../../player/types";
|
|
3
4
|
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
4
5
|
import type { IError, ISubject, IValueSubject, IRectangle } from "@vkontakte/videoplayer-shared";
|
|
5
6
|
import { ValueSubject } from "@vkontakte/videoplayer-shared";
|
|
@@ -16,6 +17,7 @@ interface IParams extends IProviderDependencies {
|
|
|
16
17
|
panelSize?: IRectangle;
|
|
17
18
|
skipVideoElVolumeSync$: ValueSubject<boolean>;
|
|
18
19
|
handleNetworkRecoverableErrorAsProviderError?: boolean;
|
|
20
|
+
instanceData?: ICoreInstanceData;
|
|
19
21
|
}
|
|
20
22
|
export default class ProviderContainer implements IProviderContainer {
|
|
21
23
|
current$: IValueSubject<IProviderEntry>;
|
|
@@ -2,7 +2,7 @@ import type { ITuningConfig } from "../utils/tuningConfig";
|
|
|
2
2
|
import type { IComponentLogger, IError, ILogger, IRange, IRectangle, ISubject, ITracer, IValueSubject, IWarning, Milliseconds, QualityLimits, Seconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IChromecastInitializer } from "./ChromecastProvider/ChromecastInitializer/types";
|
|
4
4
|
import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackRate, PlaybackState } from "../player/types";
|
|
5
|
-
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ISources, IVideoStream, SeekState, VideoCodec } from "../player/types";
|
|
5
|
+
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ICoreInstanceData, ISources, IVideoStream, SeekState, VideoCodec } from "../player/types";
|
|
6
6
|
import type { IStateMachine } from "../utils/StateMachine/types";
|
|
7
7
|
import type ThroughputEstimator from "../utils/ThroughputEstimator";
|
|
8
8
|
export interface IProvider {
|
|
@@ -25,6 +25,7 @@ export interface IProviderParams<TSourceType> extends IProviderDependencies {
|
|
|
25
25
|
tuning: ITuningConfig;
|
|
26
26
|
panelSize?: IRectangle;
|
|
27
27
|
skipVideoElVolumeSync$: IValueSubject<boolean>;
|
|
28
|
+
instanceData?: ICoreInstanceData;
|
|
28
29
|
}
|
|
29
30
|
export interface DesiredStateValues {
|
|
30
31
|
audioStream: IAudioStream | undefined;
|
|
@@ -11,11 +11,13 @@ export declare class AbrManager {
|
|
|
11
11
|
private context;
|
|
12
12
|
private phaseController;
|
|
13
13
|
private allVideoRules;
|
|
14
|
+
private mlAbrRule;
|
|
14
15
|
private tracer;
|
|
15
16
|
init(context: IInitAbrManagerContext): void;
|
|
16
17
|
updateContext(updateContext: IUpdatableAbrManagerContext): void;
|
|
17
18
|
private getAudioReserve;
|
|
18
19
|
autoSelectTrack<T extends IVideoTrack | IAudioTrack>(kind: Exclude<StreamKind, StreamKind.TEXT>): T;
|
|
20
|
+
private withoutClassicDecisionOwners;
|
|
19
21
|
destroy(): void;
|
|
20
22
|
private initVideoElementAbrContext;
|
|
21
23
|
private updateTracksIfneeded;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Byte, IObservable, Milliseconds, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import { Subject } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { Representation } from "../../parsers/types";
|
|
4
|
+
export interface IChunkDownloadRecord {
|
|
5
|
+
bytes: Byte;
|
|
6
|
+
loadTimeMs: Milliseconds;
|
|
7
|
+
representationId: Representation["id"];
|
|
8
|
+
/**
|
|
9
|
+
* Неопределён, когда качество репрезентации не выводится ни из строки
|
|
10
|
+
* манифеста, ни из размеров: запись всё равно полезна истории полосы
|
|
11
|
+
* (bytes/loadTime), а построитель входов модели оставит её без one-hot.
|
|
12
|
+
*/
|
|
13
|
+
quality: VideoQuality | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface IChunkDownloadHistory {
|
|
16
|
+
/** Пушится на каждую запись; подписка правила пересчитывает кэш решения. */
|
|
17
|
+
readonly segmentDownloaded$: IObservable<IChunkDownloadRecord>;
|
|
18
|
+
add(record: IChunkDownloadRecord): void;
|
|
19
|
+
/** Записи от старых к новым; паддинг нулями делает построитель входов модели. */
|
|
20
|
+
snapshot(): readonly IChunkDownloadRecord[];
|
|
21
|
+
clear(): void;
|
|
22
|
+
}
|
|
23
|
+
/** Глубина истории модели PPO: H=24 зашита в артефакт (UVP-12133). */
|
|
24
|
+
export declare const CHUNK_HISTORY_CAPACITY = 24;
|
|
25
|
+
export declare class ChunkDownloadHistoryCollector implements IChunkDownloadHistory {
|
|
26
|
+
private readonly capacity;
|
|
27
|
+
readonly segmentDownloaded$: Subject<IChunkDownloadRecord>;
|
|
28
|
+
private readonly records;
|
|
29
|
+
constructor(capacity?: number);
|
|
30
|
+
add(record: IChunkDownloadRecord): void;
|
|
31
|
+
snapshot(): readonly IChunkDownloadRecord[];
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare const representationToQuality: (representation: Representation) => VideoQuality | undefined;
|