@vkontakte/videoplayer-core 2.0.167-dev.fc8d8316c.0 → 2.0.168-beta.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 +32 -32
- package/es2015.esm.js +16 -16
- package/esnext.cjs +29 -29
- package/esnext.esm.js +9 -9
- package/evergreen.esm.js +9 -9
- package/package.json +2 -2
- package/types/providers/DashProvider/lib/buffer.d.ts +2 -0
- package/types/providers/DashProvider/lib/fetcher.d.ts +7 -1
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +7 -1
- package/types/providers/utils/parsers/types.d.ts +1 -0
- package/types/utils/tuningConfig.d.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.168-beta.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.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.97-beta.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -74,6 +74,7 @@ export declare class BufferManager {
|
|
|
74
74
|
private index;
|
|
75
75
|
private lastDataObtainedTimestampMs;
|
|
76
76
|
private loadByteRangeSegmentsTimeoutId;
|
|
77
|
+
private preDownloadedFirstSegment;
|
|
77
78
|
constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
|
|
78
79
|
startWith: ReturnType<typeof abortable<[Representation["id"]]>>;
|
|
79
80
|
switchToWithPreviousAbort(newRepresentationId: Representation["id"], dropBuffer?: boolean): Promise<void | undefined>;
|
|
@@ -102,6 +103,7 @@ export declare class BufferManager {
|
|
|
102
103
|
private loadSegments;
|
|
103
104
|
private loadTemplateSegment;
|
|
104
105
|
private updateRepresentationsBaseUrlIfNeeded;
|
|
106
|
+
private feedPreDownloadedFirstSegment;
|
|
105
107
|
private loadByteRangeSegments;
|
|
106
108
|
private prepareByteRangeFetchSegmentParams;
|
|
107
109
|
private prepareTemplateFetchSegmentParams;
|
|
@@ -25,6 +25,8 @@ export interface IParams {
|
|
|
25
25
|
handleExtendedNetworkErrorsSet?: boolean;
|
|
26
26
|
useUrlCacheMechanism?: boolean;
|
|
27
27
|
measureNonSegmentRequests?: boolean;
|
|
28
|
+
measureFastSamples?: boolean;
|
|
29
|
+
preloadFirstSegment?: boolean;
|
|
28
30
|
}
|
|
29
31
|
export type Priority = "high" | "low" | "auto";
|
|
30
32
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -47,6 +49,7 @@ export type RepresentationFetchResult = {
|
|
|
47
49
|
init: CommonInit | null;
|
|
48
50
|
segments: Segment[];
|
|
49
51
|
dataView: DataView;
|
|
52
|
+
firstSegmentData?: ArrayBuffer;
|
|
50
53
|
};
|
|
51
54
|
export declare class Fetcher {
|
|
52
55
|
private throughputEstimator;
|
|
@@ -69,11 +72,13 @@ export declare class Fetcher {
|
|
|
69
72
|
private useEnableSubtitlesParam;
|
|
70
73
|
private useUrlCacheMechanism;
|
|
71
74
|
private measureNonSegmentRequests;
|
|
75
|
+
private measureFastSamples;
|
|
76
|
+
private preloadFirstSegment;
|
|
72
77
|
private startupPhase;
|
|
73
78
|
private performanceObserver;
|
|
74
79
|
private pendingConnectionMetrics;
|
|
75
80
|
private handleExtendedNetworkErrorsSet;
|
|
76
|
-
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
|
|
81
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment }: IParams);
|
|
77
82
|
private onHeadersReceived;
|
|
78
83
|
private setupPerformanceObserver;
|
|
79
84
|
private processPerformanceResourceTiming;
|
|
@@ -87,6 +92,7 @@ export declare class Fetcher {
|
|
|
87
92
|
destroy(): void;
|
|
88
93
|
private fetchByteRangeRepresentation;
|
|
89
94
|
private fetchTemplateRepresentation;
|
|
95
|
+
private isLikelyCacheHitByTtfb;
|
|
90
96
|
private doFetch;
|
|
91
97
|
private unsubscribeAbortSubscription;
|
|
92
98
|
}
|
|
@@ -25,6 +25,8 @@ export interface IParams {
|
|
|
25
25
|
handleExtendedNetworkErrorsSet?: boolean;
|
|
26
26
|
useUrlCacheMechanism?: boolean;
|
|
27
27
|
measureNonSegmentRequests?: boolean;
|
|
28
|
+
measureFastSamples?: boolean;
|
|
29
|
+
preloadFirstSegment?: boolean;
|
|
28
30
|
}
|
|
29
31
|
export type Priority = "high" | "low" | "auto";
|
|
30
32
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -46,6 +48,7 @@ export type RepresentationFetchResult<T extends Segment> = {
|
|
|
46
48
|
initMetadata: CommonInit | null;
|
|
47
49
|
initDataView: DataView;
|
|
48
50
|
segments: T[];
|
|
51
|
+
firstSegmentData?: ArrayBuffer;
|
|
49
52
|
};
|
|
50
53
|
export declare class Fetcher {
|
|
51
54
|
private throughputEstimator;
|
|
@@ -68,11 +71,13 @@ export declare class Fetcher {
|
|
|
68
71
|
private useEnableSubtitlesParam;
|
|
69
72
|
private useUrlCacheMechanism;
|
|
70
73
|
private measureNonSegmentRequests;
|
|
74
|
+
private measureFastSamples;
|
|
75
|
+
private preloadFirstSegment;
|
|
71
76
|
private startupPhase;
|
|
72
77
|
private performanceObserver;
|
|
73
78
|
private pendingConnectionMetrics;
|
|
74
79
|
private handleExtendedNetworkErrorsSet;
|
|
75
|
-
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
|
|
80
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests, measureFastSamples, preloadFirstSegment }: IParams);
|
|
76
81
|
private onHeadersReceived;
|
|
77
82
|
private setupPerformanceObserver;
|
|
78
83
|
private processResourceTiming;
|
|
@@ -86,5 +91,6 @@ export declare class Fetcher {
|
|
|
86
91
|
destroy(): void;
|
|
87
92
|
private fetchByteRangeRepresentation;
|
|
88
93
|
private fetchTemplateRepresentation;
|
|
94
|
+
private isLikelyCacheHitByTtfb;
|
|
89
95
|
private doFetch;
|
|
90
96
|
}
|
|
@@ -43,6 +43,25 @@ export type ITuningConfig = {
|
|
|
43
43
|
measureNonSegmentRequests: boolean;
|
|
44
44
|
smallSampleMinDuration: Milliseconds;
|
|
45
45
|
cacheThresholdSize: Milliseconds;
|
|
46
|
+
/**
|
|
47
|
+
* Фичафлаг UVP-10855: лечит залипание throughput на быстрых соединениях.
|
|
48
|
+
*
|
|
49
|
+
* Проблема: на быстром соединении крупный сегмент реально скачивается за ≤ cacheThresholdSize
|
|
50
|
+
* (например 200 КБ за 10 мс = 160 Мбит/с), а sanityCheck режет такие сэмплы как «кэш».
|
|
51
|
+
* Промежуточных сэмплов нет (нужно streamMinSampleTime=300 мс), поэтому эстиматор не получает
|
|
52
|
+
* ни одного значения, throughput стоит на стартовой оценке → ABR не поднимает качество
|
|
53
|
+
* (мелкие сегменты качаются быстро → замкнутый круг).
|
|
54
|
+
*
|
|
55
|
+
* При true:
|
|
56
|
+
* 1. Фетчер детектит кэш-хиты двумя сигналами (OR) и НЕ измеряет их:
|
|
57
|
+
* - fromCache — попадание в Cache API (doFetch дёргает onCacheHit);
|
|
58
|
+
* - TTFB — headersReceivedAt - requestStartedAt < max(rtt*0.5, 2мс) (кэш ~0, реал ≥ RTT).
|
|
59
|
+
* 2. sanityCheck отключает порог time ≤ cacheThresholdSize → реальные быстрые сэмплы проходят.
|
|
60
|
+
* Честный кэш (мгновенная отдача → rate > 1 Гбит/с) по-прежнему режется проверкой rate выше.
|
|
61
|
+
*
|
|
62
|
+
* По умолчанию false — поведение не меняется.
|
|
63
|
+
*/
|
|
64
|
+
measureFastSamples: boolean;
|
|
46
65
|
rttPenaltyRequestSize: Byte;
|
|
47
66
|
streamMinSampleSize: Byte;
|
|
48
67
|
streamMinSampleTime: Milliseconds;
|
|
@@ -231,6 +250,7 @@ export type ITuningConfig = {
|
|
|
231
250
|
filterOnDemandQualityList: boolean;
|
|
232
251
|
dashMaxTvVideoQuality: boolean;
|
|
233
252
|
checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
|
|
253
|
+
preloadFirstSegment: boolean;
|
|
234
254
|
downloadTime: {
|
|
235
255
|
minLookaheadSegments: number;
|
|
236
256
|
safetyFactor: number;
|