@vkontakte/videoplayer-core 2.0.169-dev.b7ed8d2a3.0 → 2.0.169
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 +40 -40
- package/es2015.esm.js +40 -40
- package/esnext.cjs +34 -34
- package/esnext.esm.js +14 -14
- package/evergreen.esm.js +34 -34
- package/package.json +2 -2
- package/types/providers/DashProvider/lib/fetcher.d.ts +5 -1
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.versionA.d.ts +18 -0
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +5 -2
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +2 -0
- package/types/utils/ClientChecker/services/DisplayChecker.d.ts +6 -0
- package/types/utils/ClientChecker/types/displayMode.d.ts +8 -0
- package/types/utils/tuningConfig.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.169
|
|
3
|
+
"version": "2.0.169",
|
|
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.98
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.98"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -2,6 +2,7 @@ import type { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } f
|
|
|
2
2
|
import type ThroughputEstimator from "../../../utils/ThroughputEstimator";
|
|
3
3
|
import type { Byte, 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";
|
|
5
6
|
import type { CommonInit, GenericContainerParser, Segment, SegmentReference } from "../../utils/parsers/types";
|
|
6
7
|
declare global {
|
|
7
8
|
interface Navigator {
|
|
@@ -27,6 +28,7 @@ export interface IParams {
|
|
|
27
28
|
measureNonSegmentRequests?: boolean;
|
|
28
29
|
measureFastSamples?: boolean;
|
|
29
30
|
preloadFirstSegment?: boolean;
|
|
31
|
+
maxQualityForFirstSegmentPreload?: ExactVideoQuality;
|
|
30
32
|
}
|
|
31
33
|
export type Priority = "high" | "low" | "auto";
|
|
32
34
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -44,6 +46,7 @@ export interface FetchParams {
|
|
|
44
46
|
bufferOptimisation?: boolean;
|
|
45
47
|
ignoreNetworkErrors?: boolean;
|
|
46
48
|
urlCacheMechanismEnabled?: boolean;
|
|
49
|
+
representationHeight?: number;
|
|
47
50
|
}
|
|
48
51
|
export type RepresentationFetchResult = {
|
|
49
52
|
init: CommonInit | null;
|
|
@@ -74,11 +77,12 @@ export declare class Fetcher {
|
|
|
74
77
|
private measureNonSegmentRequests;
|
|
75
78
|
private measureFastSamples;
|
|
76
79
|
private preloadFirstSegment;
|
|
80
|
+
private maxQualityForFirstSegmentPreload;
|
|
77
81
|
private startupPhase;
|
|
78
82
|
private performanceObserver;
|
|
79
83
|
private pendingConnectionMetrics;
|
|
80
84
|
private handleExtendedNetworkErrorsSet;
|
|
81
|
-
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment }: IParams);
|
|
85
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment, maxQualityForFirstSegmentPreload }: IParams);
|
|
82
86
|
private onHeadersReceived;
|
|
83
87
|
private setupPerformanceObserver;
|
|
84
88
|
private processPerformanceResourceTiming;
|
|
@@ -79,8 +79,26 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
79
79
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
80
80
|
destroy(): void;
|
|
81
81
|
protected verifyBufferPlaybackQueue(position: Milliseconds): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Удаляет из `bufferPlaybackQueue` «зомби»-сегменты — те, что попали в очередь через
|
|
84
|
+
* `onSomeDataLoaded` → `onDownloadItem` (sub-segment feeding) со статусом `DOWNLOADING`,
|
|
85
|
+
* а затем были сброшены в `NONE` вызовом `abortDownloadingItems` (`data` = null, `loadedBytes` = 0),
|
|
86
|
+
* но из самой очереди не удалены.
|
|
87
|
+
*
|
|
88
|
+
* Зомби вызывает дедлок:
|
|
89
|
+
* 1. `maintain` → `maintainPlaybackBuffer` → `selectDownloadingItems` начинает выбор новых сегментов
|
|
90
|
+
* для скачивания после последнего элемента `bufferPlaybackQueue`. Зомби в очереди сдвигает
|
|
91
|
+
* эту позицию вперёд — сегмент пропускается и никогда не перевыбирается.
|
|
92
|
+
* 2. `maintain` → `maintainNativeBuffer` ищет `nextPlayingItem` как первый элемент с `bufferStatus` !== `FED`.
|
|
93
|
+
* Находит зомби, но не может его скормить (`data` = null) и не переходит к следующим сегментам.
|
|
94
|
+
*
|
|
95
|
+
* Метод вызывается в `maintain` между `verifyBufferPlaybackQueue` и `maintainPlaybackBuffer`,
|
|
96
|
+
* чтобы очистить очередь до того, как `selectDownloadingItems` начнёт по ней работать.
|
|
97
|
+
*/
|
|
98
|
+
protected sanitizeBufferPlaybackQueue(): boolean;
|
|
82
99
|
protected forceSwitchCondition(oldRepresentation: Representation, newRepresentation: Representation): boolean;
|
|
83
100
|
protected clearBuffer(): Promise<void>;
|
|
101
|
+
private resetBuffer;
|
|
84
102
|
protected abortDownload(): void;
|
|
85
103
|
protected abortDownloadingItems(): void;
|
|
86
104
|
protected abortNativeBuffer(): Promise<boolean>;
|
|
@@ -2,6 +2,7 @@ import type { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } f
|
|
|
2
2
|
import type ThroughputEstimator from "../../../utils/ThroughputEstimator";
|
|
3
3
|
import type { Byte, 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";
|
|
5
6
|
import type { CommonInit, GenericContainerParser, Segment, SegmentReference } from "../../utils/parsers/types";
|
|
6
7
|
declare global {
|
|
7
8
|
interface Navigator {
|
|
@@ -27,6 +28,7 @@ export interface IParams {
|
|
|
27
28
|
measureNonSegmentRequests?: boolean;
|
|
28
29
|
measureFastSamples?: boolean;
|
|
29
30
|
preloadFirstSegment?: boolean;
|
|
31
|
+
maxQualityForFirstSegmentPreload?: ExactVideoQuality;
|
|
30
32
|
}
|
|
31
33
|
export type Priority = "high" | "low" | "auto";
|
|
32
34
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -73,11 +75,12 @@ export declare class Fetcher {
|
|
|
73
75
|
private measureNonSegmentRequests;
|
|
74
76
|
private measureFastSamples;
|
|
75
77
|
private preloadFirstSegment;
|
|
78
|
+
private maxQualityForFirstSegmentPreload;
|
|
76
79
|
private startupPhase;
|
|
77
80
|
private performanceObserver;
|
|
78
81
|
private pendingConnectionMetrics;
|
|
79
82
|
private handleExtendedNetworkErrorsSet;
|
|
80
|
-
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment }: IParams);
|
|
83
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment, maxQualityForFirstSegmentPreload }: IParams);
|
|
81
84
|
private onHeadersReceived;
|
|
82
85
|
private setupPerformanceObserver;
|
|
83
86
|
private processResourceTiming;
|
|
@@ -87,7 +90,7 @@ export declare class Fetcher {
|
|
|
87
90
|
private trackRequestStart;
|
|
88
91
|
fetchManifest: ReturnType<typeof abortable<[string], string | null>>;
|
|
89
92
|
fetch: ReturnType<typeof abortable<[string, FetchParams], ArrayBuffer | null>>;
|
|
90
|
-
fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, dowbloadAbortSignal: AbortSignal, priority?: Priority): Promise<RepresentationFetchResult<T> | null | undefined>;
|
|
93
|
+
fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, dowbloadAbortSignal: AbortSignal, priority?: Priority, representationHeight?: number): Promise<RepresentationFetchResult<T> | null | undefined>;
|
|
91
94
|
destroy(): void;
|
|
92
95
|
private fetchByteRangeRepresentation;
|
|
93
96
|
private fetchTemplateRepresentation;
|
|
@@ -23,6 +23,8 @@ export declare abstract class BasePlayer {
|
|
|
23
23
|
protected stallTracer: ITracer | null;
|
|
24
24
|
protected forceVideoCodec?: VideoCodec;
|
|
25
25
|
protected stallTimeInWaitingExitAttemptMade: Milliseconds;
|
|
26
|
+
protected stallStartTime: Milliseconds | null;
|
|
27
|
+
protected lastForceSeekTimestamp: Milliseconds | null;
|
|
26
28
|
protected videoBufferManager: IVirtualBufferManager | null;
|
|
27
29
|
protected audioBufferManager: IVirtualBufferManager | null;
|
|
28
30
|
protected bufferManagers: IVirtualBufferManager[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Checker } from "../types/checker";
|
|
2
|
+
import { DisplayMode } from "../types/displayMode";
|
|
2
3
|
export { isMobile } from "../utils/isMobile";
|
|
3
4
|
export declare class DisplayChecker implements Checker {
|
|
4
5
|
private _maxTouchPoints;
|
|
@@ -9,6 +10,8 @@ export declare class DisplayChecker implements Checker {
|
|
|
9
10
|
private _screenHeight;
|
|
10
11
|
private _screenWidth;
|
|
11
12
|
private _colorDepth;
|
|
13
|
+
private _displayMode;
|
|
14
|
+
private _isStandalone;
|
|
12
15
|
get isTouch(): boolean;
|
|
13
16
|
get maxTouchPoints(): number;
|
|
14
17
|
get height(): number;
|
|
@@ -18,5 +21,8 @@ export declare class DisplayChecker implements Checker {
|
|
|
18
21
|
get pixelRatio(): number;
|
|
19
22
|
get isHDR(): boolean;
|
|
20
23
|
get colorDepth(): number;
|
|
24
|
+
get displayMode(): DisplayMode;
|
|
25
|
+
get isStandalone(): boolean;
|
|
21
26
|
detect(): void;
|
|
27
|
+
private detectDisplayMode;
|
|
22
28
|
}
|
|
@@ -184,6 +184,7 @@ export type ITuningConfig = {
|
|
|
184
184
|
mutexStallExitPolicy: boolean;
|
|
185
185
|
useFetchPriorityHints: boolean;
|
|
186
186
|
useAbortMSEFix: boolean;
|
|
187
|
+
useByteRangeNullFetchRecovery: boolean;
|
|
187
188
|
enableBaseUrlSupport: boolean;
|
|
188
189
|
maxSegmentRetryCount: number;
|
|
189
190
|
sourceOpenTimeout: number;
|
|
@@ -202,7 +203,6 @@ export type ITuningConfig = {
|
|
|
202
203
|
minNativeBufferSize: Milliseconds;
|
|
203
204
|
removeTimeShiftFromSegment: Milliseconds;
|
|
204
205
|
tickMaintainInterval: Milliseconds;
|
|
205
|
-
tickMaintainThrottle: Milliseconds;
|
|
206
206
|
minSafeBufferToPlay: Milliseconds;
|
|
207
207
|
useBufferHoldingOnlyOnStall: boolean;
|
|
208
208
|
useNewAbr: boolean;
|
|
@@ -253,6 +253,8 @@ export type ITuningConfig = {
|
|
|
253
253
|
dashMaxTvVideoQuality: boolean;
|
|
254
254
|
checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
|
|
255
255
|
preloadFirstSegment: boolean;
|
|
256
|
+
jumpGapToNearestBuffer: boolean;
|
|
257
|
+
maxQualityForFirstSegmentPreload: ExactVideoQuality;
|
|
256
258
|
downloadTime: {
|
|
257
259
|
minLookaheadSegments: number;
|
|
258
260
|
safetyFactor: number;
|