@vkontakte/videoplayer-core 2.0.181-dev.05b016920.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 +8 -8
- package/es2015.esm.js +8 -8
- package/esnext.cjs +8 -8
- package/esnext.esm.js +8 -8
- package/evergreen.esm.js +15 -15
- 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 +18 -1
- package/types/providers/DashProvider/baseDashProvider.d.ts +3 -0
- package/types/providers/DashProvider/lib/buffer.d.ts +22 -2
- package/types/providers/DashProvider/lib/player.d.ts +3 -0
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +3 -0
- package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +2 -0
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +15 -2
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +1 -0
- package/types/providers/DashProviderVirtual/lib/player/types.d.ts +2 -0
- 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/types.d.ts +10 -1
- package/types/utils/ClientChecker/services/DeviceChecker.d.ts +4 -0
- package/types/utils/ClientChecker/types/userAgentData.d.ts +4 -2
- 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 +25 -0
- package/types/utils/userHappinessTriggers.d.ts +4 -0
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
|
@@ -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;
|
|
@@ -13,6 +15,7 @@ export interface Dependencies {
|
|
|
13
15
|
manifest: Manifest | null;
|
|
14
16
|
tracer: ITracer;
|
|
15
17
|
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
18
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
16
19
|
}
|
|
17
20
|
export interface Gap extends IRange<Milliseconds> {
|
|
18
21
|
representation: Representation["id"];
|
|
@@ -39,6 +42,7 @@ export declare class BufferManager {
|
|
|
39
42
|
updateEnd$: IValueSubject<void>;
|
|
40
43
|
private subscription;
|
|
41
44
|
private kind;
|
|
45
|
+
private chunkDownloadHistory;
|
|
42
46
|
private initData;
|
|
43
47
|
private parsedInitData;
|
|
44
48
|
private representations;
|
|
@@ -80,7 +84,7 @@ export declare class BufferManager {
|
|
|
80
84
|
private lastDataObtainedTimestampMs;
|
|
81
85
|
private loadByteRangeSegmentsTimeoutId;
|
|
82
86
|
private brokenSegmentAppendDetected;
|
|
83
|
-
constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, getSeekTargetPosition, 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>>;
|
|
@@ -124,9 +128,25 @@ export declare class BufferManager {
|
|
|
124
128
|
* @private
|
|
125
129
|
*/
|
|
126
130
|
private onSomeByteRangesDataLoaded;
|
|
131
|
+
/**
|
|
132
|
+
* Запись в историю чанков для MlAbr. Байты приходят параметром: у каждого пути
|
|
133
|
+
* аппенда свой источник истины о размере (результат fetch'а, диапазон батча,
|
|
134
|
+
* накопленные подкармливания), на SegmentProgress его нет. Пропуск без
|
|
135
|
+
* startedAtMs — у батчей byte-range время общее на группу сегментов, а без
|
|
136
|
+
* известного старта fetch'а время загрузки не выводится.
|
|
137
|
+
*/
|
|
138
|
+
private recordChunkDownload;
|
|
127
139
|
private onSegmentFullyAppended;
|
|
128
140
|
private detectBrokenSegmentAppend;
|
|
129
141
|
private abortSegment;
|
|
142
|
+
/**
|
|
143
|
+
* Прогрев sidx всех репрезентаций для MlAbr: модели нужны размеры будущих
|
|
144
|
+
* сегментов каждого качества к первому решению, а без прогрева индексы
|
|
145
|
+
* приезжают лениво — только при первом переключении на качество. Idle-очередь
|
|
146
|
+
* качает по одному индексу между делом; здесь грузим все недостающие параллельно.
|
|
147
|
+
* loadInit регистрирует промис в initData синхронно и ошибок наружу не бросает.
|
|
148
|
+
*/
|
|
149
|
+
private warmUpRepresentations;
|
|
130
150
|
private loadNextInit;
|
|
131
151
|
private isFirstSegmentPreloadEnabled;
|
|
132
152
|
private isStartPositionWithinFirstSegment;
|
|
@@ -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",
|
|
@@ -23,6 +24,7 @@ export interface Params {
|
|
|
23
24
|
isOnDemand: boolean;
|
|
24
25
|
dashMaxTvVideoQuality: Nullable<ExactVideoQuality>;
|
|
25
26
|
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
27
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
26
28
|
}
|
|
27
29
|
export declare class Player {
|
|
28
30
|
private element;
|
|
@@ -91,6 +93,7 @@ export declare class Player {
|
|
|
91
93
|
private isOnDemand;
|
|
92
94
|
private dashMaxTvVideoQuality;
|
|
93
95
|
private getSeekTargetPosition;
|
|
96
|
+
private chunkDownloadHistory;
|
|
94
97
|
private destroyController;
|
|
95
98
|
constructor(params: Params);
|
|
96
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,6 +18,7 @@ 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;
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ 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;
|
|
@@ -57,7 +58,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
57
58
|
protected readonly getCurrentStallDuration: () => Milliseconds | undefined;
|
|
58
59
|
protected readonly getSeekTargetPosition: (() => Milliseconds | undefined) | undefined;
|
|
59
60
|
protected brokenSegmentAppendDetected: boolean;
|
|
60
|
-
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tracer, tuning, getCurrentPosition, getCurrentStallDuration, getSeekTargetPosition, manifest, segmentCacheService }: Dependencies);
|
|
61
|
+
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tracer, tuning, getCurrentPosition, getCurrentStallDuration, getSeekTargetPosition, manifest, segmentCacheService, chunkDownloadHistory }: Dependencies);
|
|
61
62
|
protected abstract loadItems(itemsToLoad: IBufferPlaybackQueueItem<T>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
62
63
|
protected abstract selectItemsToLoad(): IBufferPlaybackQueueItem<T>[];
|
|
63
64
|
protected abstract prepareFetchParams(items: IBufferPlaybackQueueItem<T>[], representation: Representation): FetchParamsWithUrl;
|
|
@@ -108,7 +109,13 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
108
109
|
protected abortDownload(): void;
|
|
109
110
|
protected abortDownloadingItems(): void;
|
|
110
111
|
protected abortNativeBuffer(): Promise<boolean>;
|
|
111
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Прогрев индексов остальных репрезентаций. За mlAbr.enabled — параллельно и
|
|
114
|
+
* сразу: MlAbr нужны размеры сегментов всех качеств к первому решению модели,
|
|
115
|
+
* idle-отсрочка опоздала бы. loadInitIfNeeded дедупится initDataPromises, ошибок
|
|
116
|
+
* наружу не бросает.
|
|
117
|
+
*/
|
|
118
|
+
protected loadInits(): void;
|
|
112
119
|
protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
113
120
|
protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
114
121
|
private isStartPositionWithinFirstSegment;
|
|
@@ -131,6 +138,12 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
131
138
|
protected onItemFullyAppended(appendedItem: IBufferPlaybackQueueItem<T>): void;
|
|
132
139
|
private detectBrokenSegmentAppend;
|
|
133
140
|
protected removeSegment(nextRemoveItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Запись в историю чанков для MlAbr. Без size или startedAtMs запись не
|
|
143
|
+
* выводится корректно (размер неизвестен до sidx, старт — до перевода в
|
|
144
|
+
* DOWNLOADING): молча пропускаем, история просто копится медленнее.
|
|
145
|
+
*/
|
|
146
|
+
private recordChunkDownload;
|
|
134
147
|
protected onDownloadItem(downloadedItem: IBufferPlaybackQueueItem<T>): void;
|
|
135
148
|
protected pruneVirtualBuffer(currentPosition: Milliseconds): void;
|
|
136
149
|
protected updateRepresentationsBaseUrlIfNeeded(): void;
|
|
@@ -81,6 +81,7 @@ export declare abstract class BasePlayer {
|
|
|
81
81
|
private isOnDemand;
|
|
82
82
|
private dashMaxTvVideoQuality;
|
|
83
83
|
private getSeekTargetPosition;
|
|
84
|
+
private chunkDownloadHistory;
|
|
84
85
|
protected constructor(params: Params);
|
|
85
86
|
protected abstract prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
|
|
86
87
|
protected abstract setSourceInitDuration(): void;
|
|
@@ -2,6 +2,7 @@ import type ThroughputEstimator from "../../../../utils/ThroughputEstimator";
|
|
|
2
2
|
import type { ITuningConfig } from "../../../../utils/tuningConfig";
|
|
3
3
|
import type { VideoCodec } from "../../../../player/types";
|
|
4
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",
|
|
@@ -17,4 +18,5 @@ export interface Params {
|
|
|
17
18
|
isOnDemand?: boolean;
|
|
18
19
|
dashMaxTvVideoQuality?: Nullable<ExactVideoQuality>;
|
|
19
20
|
getSeekTargetPosition?: () => Milliseconds | undefined;
|
|
21
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
20
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;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Byte } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import { VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { IChunkDownloadRecord } from "./chunkDownloadHistory";
|
|
4
|
+
/**
|
|
5
|
+
* Контракт модели PPO ABR, версия артефакта 22.10 (карточка модели — Confluence
|
|
6
|
+
* pageId=2177405140). Константы зашиты в .tflite и конфигурироваться не могут.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ML_ABR_ACTIONS = 8;
|
|
9
|
+
export declare const ML_ABR_HISTORY = 24;
|
|
10
|
+
/** Горизонт размеров будущих чанков (v22.10): 4 чанка вперёд на качество. */
|
|
11
|
+
export declare const ML_ABR_FOREHORON = 4;
|
|
12
|
+
/** Лестница модели: индекс массива — индекс действия артефакта. */
|
|
13
|
+
export declare const ML_ABR_LADDER: readonly VideoQuality[];
|
|
14
|
+
export declare const ladderIndexOfQuality: (quality: VideoQuality) => number;
|
|
15
|
+
export interface IMlAbrInputSource {
|
|
16
|
+
/** История загрузок, от старых к новым; длиннее H — берутся последние H. */
|
|
17
|
+
history: readonly IChunkDownloadRecord[];
|
|
18
|
+
/** Размеры будущих чанков по качествам лестницы (F=4, от следующего); оценка в байтах уже подставлена правилом. */
|
|
19
|
+
nextChunkSizes: ReadonlyMap<VideoQuality, readonly Byte[]>;
|
|
20
|
+
/** Доступные качества: лестница ∩ внешние лимиты. Вход маски модели. */
|
|
21
|
+
availableQualities: ReadonlySet<VideoQuality>;
|
|
22
|
+
/** Заполненность буфера в секундах, до преобразования speed. */
|
|
23
|
+
bufferSeconds: number;
|
|
24
|
+
/** Флаг размера буфера: 0 → 70 с, 1 → 120 с. */
|
|
25
|
+
bufferFlag: 0 | 1;
|
|
26
|
+
/** Доля оставшегося видео: remaining / total. */
|
|
27
|
+
remainingRatio: number;
|
|
28
|
+
/** playbackRate: v22.10 поддерживает ≠1 двумя преобразованиями (buffer/speed, download×speed). */
|
|
29
|
+
playbackRate: number;
|
|
30
|
+
}
|
|
31
|
+
export interface IMlAbrModelInput {
|
|
32
|
+
/** [H] измеренная полоса чанка, Mbps/10. */
|
|
33
|
+
readonly throughput: Float32Array;
|
|
34
|
+
/** [H] время загрузки чанка, с/10 (уже ×speed). */
|
|
35
|
+
readonly download: Float32Array;
|
|
36
|
+
/** [A×H] one-hot история выборов. */
|
|
37
|
+
readonly actionHistory: Float32Array;
|
|
38
|
+
/** [A×F] размеры будущих чанков, байт/1e6. */
|
|
39
|
+
readonly chunkSizes: Float32Array;
|
|
40
|
+
/** [A×H] размеры скачанных чанков, байт/1e6. */
|
|
41
|
+
readonly prevChunkSizes: Float32Array;
|
|
42
|
+
/** [A] маска доступности, строго 0/1. */
|
|
43
|
+
readonly actionMask: Float32Array;
|
|
44
|
+
/** [3] buffer_s (÷speed), buffer_flag, remaining/total. */
|
|
45
|
+
readonly actorScalars: Float32Array;
|
|
46
|
+
}
|
|
47
|
+
export declare const buildMlAbrModelInput: (source: IMlAbrInputSource) => IMlAbrModelInput;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { IMlAbrModelInput } from "./modelInput";
|
|
2
|
+
import type { TMlAbrWorkerResponse } from "./workerProtocol";
|
|
3
|
+
export declare enum MlAbrRuntimeStatus {
|
|
4
|
+
NotStarted = "not_started",
|
|
5
|
+
InProgress = "in_progress",
|
|
6
|
+
Completed = "completed",
|
|
7
|
+
Failed = "failed"
|
|
8
|
+
}
|
|
9
|
+
export interface IMlAbrDecision {
|
|
10
|
+
/** Индекс качества в лестнице модели. */
|
|
11
|
+
qualityIndex: number;
|
|
12
|
+
/** Вероятности по действиям; для телеметрии (top-3). */
|
|
13
|
+
probs: Float32Array;
|
|
14
|
+
}
|
|
15
|
+
interface IMinimalWorker {
|
|
16
|
+
onmessage: ((event: MessageEvent<TMlAbrWorkerResponse>) => void) | null;
|
|
17
|
+
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
18
|
+
terminate(): void;
|
|
19
|
+
}
|
|
20
|
+
export interface IMlAbrWorkerClientDeps {
|
|
21
|
+
/** Точка подмены в тестах; в проде — глобальный fetch. */
|
|
22
|
+
fetch?: typeof fetch;
|
|
23
|
+
/** Точка подмены в тестах; в проде — глобальный Worker. */
|
|
24
|
+
Worker?: new (workerUrl: string) => IMinimalWorker;
|
|
25
|
+
}
|
|
26
|
+
export interface IMlAbrWorkerClientOptions {
|
|
27
|
+
/** URL артефакта worker.js на CDN (версионируемый путь — ручка экспериментов). */
|
|
28
|
+
workerJsUrl: string;
|
|
29
|
+
/** Байты модели: instance-провайдер или fetch гостевого URL; null — источника нет. */
|
|
30
|
+
model: Promise<ArrayBuffer | null>;
|
|
31
|
+
/** Каталог litert-артефакта; оттуда параллельно префетчатся iife и wasm. */
|
|
32
|
+
litertWasmUrl?: string;
|
|
33
|
+
/** Таймаут от создания до init-result; превышение гасит воркер. */
|
|
34
|
+
initTimeoutMs?: number;
|
|
35
|
+
deps?: IMlAbrWorkerClientDeps;
|
|
36
|
+
}
|
|
37
|
+
export interface IMlAbrWorkerClient {
|
|
38
|
+
readonly status: MlAbrRuntimeStatus;
|
|
39
|
+
readonly failureReason: string | undefined;
|
|
40
|
+
/** Резолвится после init-result; отказ — исключением с причиной. */
|
|
41
|
+
readonly ready: Promise<void>;
|
|
42
|
+
predict(input: IMlAbrModelInput): Promise<IMlAbrDecision>;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Клиент воркера: все сетевые заходы стартуют ПАРАЛЛЕЛЬНО с момента
|
|
47
|
+
* создания — код воркера, litert iife, wasm-бинарь (10+ МБ — главный
|
|
48
|
+
* полюс, вариант выбирается той же пробой relaxedSimd, что у loadLiteRt)
|
|
49
|
+
* и модель. Воркер собирается из уже скачанного кода через blob, получает
|
|
50
|
+
* всё предзагруженное первым сообщением и не ходит в сеть сам.
|
|
51
|
+
*
|
|
52
|
+
* Статусная машина вместо исключений: конвейер ABR синхронен, любую
|
|
53
|
+
* неготовность превращает в воздержание правила; причина отказа — строкой
|
|
54
|
+
* в debug-лог. Артефакты кросс-доменные — fetch требует CORS на CDN-ресурсе.
|
|
55
|
+
*/
|
|
56
|
+
export declare const createMlAbrWorkerClient: (options: IMlAbrWorkerClientOptions) => IMlAbrWorkerClient;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { IMlAbrModelInput } from "./modelInput";
|
|
2
|
+
/**
|
|
3
|
+
* Протокол воркера ML ABR (артефакт uvp-deps на CDN, репозиторий
|
|
4
|
+
* uvp-deps — источник правды схемы). Контракт зеркалируется типами сюда:
|
|
5
|
+
* SDK не зависит от пакета воркера, расхождение ловится интеграционным
|
|
6
|
+
* прогоном, а не типами.
|
|
7
|
+
*
|
|
8
|
+
* Один init (модель transferable), затем поток predict. Ответы несут id
|
|
9
|
+
* запроса: порядок predict'ов не гарантирован, потребитель сверяется по id.
|
|
10
|
+
* Массивы входа передаются transferable — после отправки буферы
|
|
11
|
+
* отсоединены, пересозданием занимается отправитель (построитель входов
|
|
12
|
+
* собирает свежие массивы на каждый цикл).
|
|
13
|
+
*/
|
|
14
|
+
export declare const ML_ABR_WORKER_PROTOCOL_VERSION = 1;
|
|
15
|
+
export interface IMlAbrInitMessage {
|
|
16
|
+
type: "init";
|
|
17
|
+
id: number;
|
|
18
|
+
/** Байты .tflite-артефакта; воркер забирает буфер transferable. */
|
|
19
|
+
model: ArrayBuffer;
|
|
20
|
+
/** Код iife-сборки litert, предзагруженный клиентом параллельно; без него — litertJsUrl. */
|
|
21
|
+
litertJsCode?: string;
|
|
22
|
+
/** Байты wasm-бинаря; воркер резолвит их через blob и locateFile. */
|
|
23
|
+
litertWasmBytes?: ArrayBuffer;
|
|
24
|
+
/** Fallback: URL iife-сборки LiteRT, если код не предзагружен. */
|
|
25
|
+
litertJsUrl?: string;
|
|
26
|
+
/** Каталог wasm-бинарёй: оттуда loadLiteRt берёт .js-лоадер (кэш прогрет префетчем клиента). */
|
|
27
|
+
litertWasmUrl?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IMlAbrPredictMessage {
|
|
30
|
+
type: "predict";
|
|
31
|
+
id: number;
|
|
32
|
+
input: IMlAbrModelInput;
|
|
33
|
+
}
|
|
34
|
+
export interface IMlAbrDestroyMessage {
|
|
35
|
+
type: "destroy";
|
|
36
|
+
}
|
|
37
|
+
export type TMlAbrWorkerRequest = IMlAbrInitMessage | IMlAbrPredictMessage | IMlAbrDestroyMessage;
|
|
38
|
+
export interface IMlAbrInitOk {
|
|
39
|
+
type: "init-result";
|
|
40
|
+
id: number;
|
|
41
|
+
ok: true;
|
|
42
|
+
protocolVersion: typeof ML_ABR_WORKER_PROTOCOL_VERSION;
|
|
43
|
+
/** Фактические имена входов артефакта (args_N или семантические). */
|
|
44
|
+
inputNames: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface IMlAbrInitFail {
|
|
47
|
+
type: "init-result";
|
|
48
|
+
id: number;
|
|
49
|
+
ok: false;
|
|
50
|
+
reason: string;
|
|
51
|
+
}
|
|
52
|
+
export interface IMlAbrPredictOk {
|
|
53
|
+
type: "predict-result";
|
|
54
|
+
id: number;
|
|
55
|
+
ok: true;
|
|
56
|
+
/** Индекс качества в лестнице модели. */
|
|
57
|
+
qualityIndex: number;
|
|
58
|
+
/** Вероятности по действиям; transferable обратно. */
|
|
59
|
+
probs: Float32Array;
|
|
60
|
+
}
|
|
61
|
+
export interface IMlAbrPredictFail {
|
|
62
|
+
type: "predict-result";
|
|
63
|
+
id: number;
|
|
64
|
+
ok: false;
|
|
65
|
+
reason: string;
|
|
66
|
+
}
|
|
67
|
+
export type TMlAbrWorkerResponse = IMlAbrInitOk | IMlAbrInitFail | IMlAbrPredictOk | IMlAbrPredictFail;
|
|
@@ -12,7 +12,8 @@ export declare abstract class BaseRule<
|
|
|
12
12
|
readonly activePhases: ReadonlySet<AbrPhase>;
|
|
13
13
|
protected subscription: Subscription;
|
|
14
14
|
protected type: RuleType;
|
|
15
|
-
|
|
15
|
+
/** Имя правила: публично — AbrManager фильтрует набор по именам в ML-режиме. */
|
|
16
|
+
name: string;
|
|
16
17
|
protected confidence: RuleConfidence;
|
|
17
18
|
constructor(phaseConfig: RulePhaseConfig);
|
|
18
19
|
init(_initContext: IRuleInitContext): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IAbrRule, IAbrRuleResolution, IRuleInitContext, IVideoAbrContext, RuleLogData } from "../../types";
|
|
2
|
+
import type { IVideoTrack } from "../../../../../player/types";
|
|
3
|
+
import { LimitAboveRule } from "../limitAboveRule";
|
|
4
|
+
import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
|
|
5
|
+
import { type IMlAbrDecision } from "../../mlAbr/workerClient";
|
|
6
|
+
export type MlAbrModelSource = "getModels" | "guest";
|
|
7
|
+
/**
|
|
8
|
+
* Голос модели в конвейере. Синхронный контракт execute сохранён: инференс
|
|
9
|
+
* асинхронный, результат живёт в кэше с dirty-флагом, пересчёт запускается
|
|
10
|
+
* мимо execute. До готовности и при любом отказе правило голосует воздержанием —
|
|
11
|
+
* конвейер работает на классическом наборе.
|
|
12
|
+
*/
|
|
13
|
+
export declare class MlAbrRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
14
|
+
private initContext;
|
|
15
|
+
private history;
|
|
16
|
+
private modelResolver;
|
|
17
|
+
private modelSource;
|
|
18
|
+
private runtime;
|
|
19
|
+
private decision;
|
|
20
|
+
private decisionDirty;
|
|
21
|
+
private predictInFlight;
|
|
22
|
+
private lastLoggedStatus;
|
|
23
|
+
private decisionOwner;
|
|
24
|
+
constructor(phaseConfig: RulePhaseConfig);
|
|
25
|
+
/** Владелец решения: конвейер гасит Throughput/Bola, пока модель реально голосует. */
|
|
26
|
+
isDecisionOwner(): boolean;
|
|
27
|
+
init(initContext: IRuleInitContext): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
30
|
+
protected createLogData(selectedTrack: IVideoTrack, decision: IMlAbrDecision | undefined, sizesEstimated: boolean | undefined, warmup: number, abstainReason: string | undefined): RuleLogData;
|
|
31
|
+
private lastSizesEstimated;
|
|
32
|
+
private modelSourceOf;
|
|
33
|
+
private warmupOf;
|
|
34
|
+
private warmupFallback;
|
|
35
|
+
/** Гейты входа в ML-режим (PRD «Steady модели»); undefined — можно голосовать. */
|
|
36
|
+
private abstainReason;
|
|
37
|
+
/**
|
|
38
|
+
* «Сначала байты, потом чанк»: рантайм (и его dynamic import) не трогается,
|
|
39
|
+
* пока байты модели не в руках. Провайдер → null и нет guestUrl → вообще
|
|
40
|
+
* ничего не грузим, правило навсегда воздерживается.
|
|
41
|
+
*/
|
|
42
|
+
private ensureModelLoaded;
|
|
43
|
+
private maybePredict;
|
|
44
|
+
private buildInputSource;
|
|
45
|
+
private nextSizesOf;
|
|
46
|
+
private isWithinLimits;
|
|
47
|
+
private trackOfQuality;
|
|
48
|
+
/** remaining/total требует позиции плейхеда; ближайшая оценка — левый край окна сегментов. */
|
|
49
|
+
private approxPlayedMs;
|
|
50
|
+
/** Наблюдаемость (требование тикета): переходы состояний — в debug-лог, дубли не пишем. */
|
|
51
|
+
private logState;
|
|
52
|
+
}
|