@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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../../../player/types";
|
|
2
2
|
import type { Byte, IComponentLogger, IObservable, IRectangle, ITracer, IValueSubject, Kbps, Milliseconds, Nullable, QualityLimits } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
4
|
+
import type { MlModelResolver } from "../../../player/types";
|
|
4
5
|
import type { Representation, Segment } from "../parsers/types";
|
|
6
|
+
import type { IChunkDownloadHistory } from "./mlAbr/chunkDownloadHistory";
|
|
5
7
|
import type { ElementSizeManager } from "../HTMLVideoElement/ElementSizeManager";
|
|
6
8
|
import type { IObservableMediaElement } from "../HTMLVideoElement/observable";
|
|
7
9
|
import type { AbrPhase } from "./controllers/abrPhaseController";
|
|
@@ -25,7 +27,8 @@ export declare enum VideoRuleName {
|
|
|
25
27
|
UpperLimit = "upper_limit_rule",
|
|
26
28
|
Throughput = "throughput_rule",
|
|
27
29
|
AbandonRequest = "abandon_request_rule",
|
|
28
|
-
InsufficientBuffer = "insufficient_buffer_rule"
|
|
30
|
+
InsufficientBuffer = "insufficient_buffer_rule",
|
|
31
|
+
MlAbr = "ml_abr_rule"
|
|
29
32
|
}
|
|
30
33
|
export declare enum AudioRuleName {
|
|
31
34
|
MinAudioForVideo = "min_audio_for_video_rule",
|
|
@@ -59,6 +62,10 @@ export interface IInitAbrManagerContext {
|
|
|
59
62
|
throughput$: IValueSubject<Kbps>;
|
|
60
63
|
rtt$: IValueSubject<Milliseconds>;
|
|
61
64
|
throughputVariance$?: IValueSubject<number>;
|
|
65
|
+
/** История загрузок видеочанков для MlAbr; не передан — фича деградирует в воздержание. */
|
|
66
|
+
chunkDownloadHistory?: IChunkDownloadHistory;
|
|
67
|
+
/** Провайдер байтов модели из инстанс-данных приложения; гейт загрузки рантайма. */
|
|
68
|
+
mlAbrModelResolver?: MlModelResolver;
|
|
62
69
|
element: HTMLMediaElement;
|
|
63
70
|
abrLogger: IComponentLogger;
|
|
64
71
|
tracer: ITracer;
|
|
@@ -92,6 +99,8 @@ export interface IAbrRule<
|
|
|
92
99
|
C extends IBaseAbrControllerContext
|
|
93
100
|
> {
|
|
94
101
|
readonly activePhases: ReadonlySet<AbrPhase>;
|
|
102
|
+
/** Имя правила из VideoRuleName/AudioRuleName; AbrManager фильтрует набор по именам. */
|
|
103
|
+
readonly name: string;
|
|
95
104
|
init(initContext: IRuleInitContext): void;
|
|
96
105
|
destroy(): void;
|
|
97
106
|
execute(context: C): IAbrRuleResolution<T>;
|
|
@@ -20,6 +20,7 @@ export interface DeviceHardware {
|
|
|
20
20
|
export declare class DeviceChecker implements Checker {
|
|
21
21
|
private _displayChecker;
|
|
22
22
|
private _isMobile;
|
|
23
|
+
private _isSmartTV;
|
|
23
24
|
private _current;
|
|
24
25
|
private _iosVersion;
|
|
25
26
|
private _highEntropyValues;
|
|
@@ -31,6 +32,7 @@ export declare class DeviceChecker implements Checker {
|
|
|
31
32
|
get current(): CurrentClientDevice;
|
|
32
33
|
get os(): OS;
|
|
33
34
|
get details(): DeviceDetails;
|
|
35
|
+
get isSmartTV(): boolean;
|
|
34
36
|
get hardware(): DeviceHardware;
|
|
35
37
|
get highEntropyValues(): HighEntropyValues;
|
|
36
38
|
get isIOS(): boolean;
|
|
@@ -42,12 +44,14 @@ export declare class DeviceChecker implements Checker {
|
|
|
42
44
|
get isWindows(): boolean;
|
|
43
45
|
get isLinux(): boolean;
|
|
44
46
|
get isMobile(): boolean;
|
|
47
|
+
get isTablet(): boolean;
|
|
45
48
|
get iOSVersion(): number | undefined;
|
|
46
49
|
detect(): void;
|
|
47
50
|
private detectHardware;
|
|
48
51
|
detectGpu(): Promise<void>;
|
|
49
52
|
private requestGpuInfo;
|
|
50
53
|
private detectHighEntropyValues;
|
|
54
|
+
private detectSmartTv;
|
|
51
55
|
private detectDevice;
|
|
52
56
|
private detectOS;
|
|
53
57
|
private normalizeOSName;
|
|
@@ -19,6 +19,7 @@ export declare enum UADataPlatform {
|
|
|
19
19
|
}
|
|
20
20
|
export interface HighEntropyValues {
|
|
21
21
|
mobile?: boolean;
|
|
22
|
+
formFactors?: string[];
|
|
22
23
|
model?: string;
|
|
23
24
|
platform?: UADataPlatform;
|
|
24
25
|
platformVersion?: string;
|
|
@@ -27,7 +28,8 @@ export interface HighEntropyValues {
|
|
|
27
28
|
brands?: UADataBrandItem[];
|
|
28
29
|
}
|
|
29
30
|
export type NavigatorWithUserAgentData = Navigator & {
|
|
30
|
-
userAgentData
|
|
31
|
-
|
|
31
|
+
userAgentData?: {
|
|
32
|
+
mobile?: boolean;
|
|
33
|
+
getHighEntropyValues?: (values: Array<string>) => Promise<HighEntropyValues>;
|
|
32
34
|
};
|
|
33
35
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ITracer } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerEvents, IPlayerExperimental, IPlayerInfo } from "../player/types";
|
|
3
|
+
export declare class UserHappinessController {
|
|
4
|
+
private readonly subscription;
|
|
5
|
+
private readonly observer?;
|
|
6
|
+
constructor(info: IPlayerInfo, events: IPlayerEvents, experimental: IPlayerExperimental, tracer: ITracer, configuredTriggers: unknown);
|
|
7
|
+
destroy(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Пороги метрик довольности пользователя. Источник формул и значений:
|
|
3
|
+
* UVP-11892 и документация метрики:
|
|
4
|
+
* https://confluence.vk.team/pages/viewpage.action?pageId=2056272767
|
|
5
|
+
*/
|
|
6
|
+
export declare const MIN_SESSION_TVT_SECONDS = 30;
|
|
7
|
+
export declare const MAX_STALL_RATIO = 1.5;
|
|
8
|
+
export declare const MAX_MOBILE_STALL_RATIO = 3;
|
|
9
|
+
export declare const MAX_FIRST_FRAME_TIME_MS = 2e3;
|
|
10
|
+
export declare const MAX_MOBILE_FIRST_FRAME_TIME_MS = 1300;
|
|
11
|
+
export declare const MIN_QUALITY_SCORE = .8;
|
|
12
|
+
export declare const ALLOWED_DEFICIT_RANK = .2;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IValueSubject } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerEvents, IPlayerExperimental, IPlayerInfo } from "../../player/types";
|
|
3
|
+
import type { UserHappinessTrigger } from "../userHappinessTriggers";
|
|
4
|
+
import type { UserHappinessQualityPlatform, UserHappinessThresholds } from "./types";
|
|
5
|
+
export declare class UserHappinessObserver {
|
|
6
|
+
private readonly subscription;
|
|
7
|
+
private readonly sessionFinalized$;
|
|
8
|
+
readonly lowQuality$: IValueSubject<boolean>;
|
|
9
|
+
readonly highStallRatio$: IValueSubject<boolean>;
|
|
10
|
+
readonly hasFatalError$: IValueSubject<boolean>;
|
|
11
|
+
readonly slowFirstFrame$: IValueSubject<boolean>;
|
|
12
|
+
constructor(info: IPlayerInfo, events: IPlayerEvents, experimental: IPlayerExperimental, triggers: readonly UserHappinessTrigger[], thresholds: UserHappinessThresholds, qualityPlatform: UserHappinessQualityPlatform);
|
|
13
|
+
destroy(): void;
|
|
14
|
+
finalizeSession(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IValueObservable, IValueSubject, Milliseconds, Seconds, Subscription } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerEvents, IPlayerInfo } from "../../../player/types";
|
|
3
|
+
export declare const createHighStallRatio: (info: IPlayerInfo, events: IPlayerEvents, watchedTimeSeconds$: IValueObservable<Seconds>, sessionFinalized$: IValueObservable<boolean>, subscription: Subscription, maxStallRatio: number, nowInt: () => Milliseconds) => IValueSubject<boolean>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
export declare const QUALITY_RANKS: Partial<Record<VideoQuality, number>>;
|
|
3
|
+
export declare const DEFAULT_NETWORK_QUALITY_THRESHOLDS: readonly [281, 452, 967, 2300, 2551, 4483, 8965];
|
|
4
|
+
export declare const WEBM_NETWORK_QUALITY_THRESHOLDS: readonly [196.4, 357.7, 595.6, 1108, 2100, 7850, 16770];
|
|
5
|
+
export declare const AV1_NETWORK_QUALITY_THRESHOLDS: readonly [245, 424, 641, 1140, 2048, 3935, 7469];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type IValueObservable, type IValueSubject, type Seconds, type Subscription } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerExperimental, IPlayerInfo } from "../../../../player/types";
|
|
3
|
+
import type { UserHappinessQualityPlatform, UserHappinessThresholds } from "../../types";
|
|
4
|
+
export declare const createLowQuality: (info: IPlayerInfo, experimental: IPlayerExperimental, totalViewTimeSeconds$: IValueObservable<Seconds>, sessionFinalized$: IValueObservable<boolean>, subscription: Subscription, thresholds: Pick<UserHappinessThresholds, "minQualityScore" | "allowedDeficitRank">, qualityPlatform: UserHappinessQualityPlatform) => IValueSubject<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createLowQuality } from "./createLowQuality";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface QualityScoreFineStats {
|
|
2
|
+
requiredQualityTotalSeconds: number;
|
|
3
|
+
qualityScoreFineSeconds: number;
|
|
4
|
+
}
|
|
5
|
+
export interface QualityStats {
|
|
6
|
+
totalSeconds: number;
|
|
7
|
+
rankSeconds: number;
|
|
8
|
+
unknownSeconds: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ModeStats {
|
|
11
|
+
totalSeconds: number;
|
|
12
|
+
rankSeconds: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import { Surface, VideoFormat } from "../../../../player/types";
|
|
3
|
+
import type { UserHappinessQualityPlatform } from "../../types";
|
|
4
|
+
import type { ModeStats, QualityScoreFineStats, QualityStats } from "./types";
|
|
5
|
+
export declare const getQualityRank: (quality: VideoQuality | undefined) => number | undefined;
|
|
6
|
+
/** Ранг цели для fallback по mode_stats, без viewport и сетевых ограничений. */
|
|
7
|
+
export declare const getFallbackModeQualityRank: (surface: Surface, isLive: boolean, availableQualities: VideoQuality[]) => number | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Восстанавливает required_quality для текущего runtime-интервала по правилам SQL:
|
|
10
|
+
* mode/surface → viewport → max_quality → network_quality_rank.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getRequiredQualityRank: (surface: Surface, availableQualities: VideoQuality[], options: {
|
|
13
|
+
viewportSize?: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
throughputKbps?: number;
|
|
18
|
+
format?: VideoFormat;
|
|
19
|
+
platform: UserHappinessQualityPlatform;
|
|
20
|
+
}) => number | undefined;
|
|
21
|
+
/** Добавляет одну пару actual|required в потоковые агрегаты quality_score_fine сессии. */
|
|
22
|
+
export declare const addRequiredQualityPair: (stats: QualityScoreFineStats, actualQualityRank: number | undefined, requiredQualityRank: number, watchTimeSeconds: number) => void;
|
|
23
|
+
/** Реализация quality_score_fine для агрегированных пар actual|required одной сессии. */
|
|
24
|
+
export declare const getQualityScoreFine: (stats: QualityScoreFineStats) => number | undefined;
|
|
25
|
+
/** Точная проверка finalize_quality из fallback-ветки PDF/SQL. */
|
|
26
|
+
export declare const finalizeQualityFallback: (qualityStats: QualityStats, modeStats: ModeStats, allowedDeficitRank: number) => boolean | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IValueSubject, Milliseconds, Subscription } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerEvents } from "../../../player/types";
|
|
3
|
+
export declare const createSlowFirstFrame: (events: IPlayerEvents, subscription: Subscription, maxFirstFrameTimeMs: Milliseconds) => IValueSubject<boolean>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
export type UserHappinessQualityPlatform = "web2" | "mvk" | "smart_tv";
|
|
3
|
+
export interface UserHappinessThresholds {
|
|
4
|
+
maxFirstFrameTimeMs: Milliseconds;
|
|
5
|
+
maxStallRatio: number;
|
|
6
|
+
minQualityScore: number;
|
|
7
|
+
allowedDeficitRank: number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IValueSubject, Milliseconds, Seconds, Subscription } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IPlayerEvents, IPlayerInfo } from "../../../player/types";
|
|
3
|
+
export declare const createWatchedTimeSeconds: (info: IPlayerInfo, events: IPlayerEvents, subscription: Subscription, nowInt: () => Milliseconds) => IValueSubject<Seconds>;
|
|
@@ -5,6 +5,7 @@ import { IOSPreferredFormat } from "../enums/IOSPreferredFormat";
|
|
|
5
5
|
import type { Byte, Kbps, Milliseconds, RecursivePartial, Seconds, TimerModule } from "@vkontakte/videoplayer-shared";
|
|
6
6
|
import { type ExactVideoQuality, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
7
7
|
import { AudioRuleName, VideoRuleName } from "../providers/utils/Abr/types";
|
|
8
|
+
import type { UserHappinessTrigger } from "./userHappinessTriggers";
|
|
8
9
|
import type { SegmentCacheConfig } from "../providers/utils/segmentCache/types";
|
|
9
10
|
export type ITuningConfig = {
|
|
10
11
|
/** @deprecated */
|
|
@@ -282,6 +283,26 @@ export type ITuningConfig = {
|
|
|
282
283
|
budgetFactor: number;
|
|
283
284
|
fallbackSegmentDurationMs: Milliseconds;
|
|
284
285
|
};
|
|
286
|
+
/**
|
|
287
|
+
* ML-правило ABR (UVP-12133). Поведенческие ручки; сессионный провайдер модели
|
|
288
|
+
* `instance.core.getAbrMLModel` — инстанс-данные initPlayer, не tuning.
|
|
289
|
+
*/
|
|
290
|
+
mlAbr: {
|
|
291
|
+
/** Фича-флаг. Выключен — правило не регистрируется, сеть и бандл не меняются. */
|
|
292
|
+
enabled: boolean;
|
|
293
|
+
/** Гостевая модель, когда провайдер не передан или вернул null. */
|
|
294
|
+
guestModelUrl: string | undefined;
|
|
295
|
+
/** Артефакт воркера на CDN; версионируемый путь — ручка флагов и экспериментов. */
|
|
296
|
+
workerJsUrl: string;
|
|
297
|
+
/** Каталог litert-артефакта на CDN; оттуда префетчатся iife и wasm параллельно модели. */
|
|
298
|
+
litertWasmUrl: string;
|
|
299
|
+
/** Прогрев: минимум записей истории чанков до входа в ML-режим. */
|
|
300
|
+
minHistorySize: number;
|
|
301
|
+
/** Сила голоса правила в конвейере. */
|
|
302
|
+
confidence: "high" | "normal";
|
|
303
|
+
/** Таймаут от создания клиента до готовности инференса в воркере. */
|
|
304
|
+
runtimeInitTimeoutMs: Milliseconds;
|
|
305
|
+
};
|
|
285
306
|
videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodecName][];
|
|
286
307
|
filterOnDemandQualityList: boolean;
|
|
287
308
|
dashMaxTvVideoQuality: boolean;
|
|
@@ -310,6 +331,8 @@ export type ITuningConfig = {
|
|
|
310
331
|
*/
|
|
311
332
|
recoverStuckSegmentLoading: boolean;
|
|
312
333
|
skipReloadOfFullyBufferedPartiallyEjectedSegments: boolean;
|
|
334
|
+
/** В Safari ждёт завершения append init-сегмента после abort перед выполнением remove. */
|
|
335
|
+
deferRemoveUntilAbortCompletes: boolean;
|
|
313
336
|
};
|
|
314
337
|
dashCmafLive: {
|
|
315
338
|
externalStopControl: boolean;
|
|
@@ -369,6 +392,8 @@ export type ITuningConfig = {
|
|
|
369
392
|
};
|
|
370
393
|
enableWakeLock: boolean;
|
|
371
394
|
enableTelemetryAtStart: boolean;
|
|
395
|
+
/** Список user-happiness-триггеров, включённых для отправки в tracer. Пустой список отключает их. */
|
|
396
|
+
userHappinessTriggers: UserHappinessTrigger[];
|
|
372
397
|
forceFormat: VideoFormat | undefined;
|
|
373
398
|
formatsToAvoid: VideoFormat[];
|
|
374
399
|
disableChromecast: boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const USER_HAPPINESS_TRIGGER_NAMES: readonly ["has_fatal_error", "slow_first_frame", "high_stall_ratio", "low_quality"];
|
|
2
|
+
export type UserHappinessTrigger = (typeof USER_HAPPINESS_TRIGGER_NAMES)[number];
|
|
3
|
+
export declare const isUserHappinessTrigger: (value: unknown) => value is UserHappinessTrigger;
|
|
4
|
+
export declare const normalizeUserHappinessTriggers: (value: unknown) => UserHappinessTrigger[];
|