@vkontakte/videoplayer-core 2.0.160-dev.62e36bfb.0 → 2.0.160-dev.67a0a3b5.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 +14 -14
- package/esnext.cjs +8 -8
- package/esnext.esm.js +31 -31
- package/evergreen.esm.js +31 -31
- package/package.json +2 -2
- package/types/providers/DashProvider/lib/fetcher.d.ts +9 -1
- package/types/providers/DashProvider/lib/processNetworkErrors.d.ts +9 -0
- package/types/providers/DashProvider/lib/urlsCache.d.ts +23 -0
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +9 -1
- package/types/providers/DashProviderVirtual/lib/processNetworkErrors.d.ts +9 -0
- package/types/providers/DashProviderVirtual/lib/urlsCache.d.ts +22 -0
- package/types/providers/ProviderContainer/index.d.ts +5 -1
- package/types/providers/ProviderContainer/types.d.ts +5 -1
- package/types/utils/StatefulIterator/index.d.ts +3 -0
- package/types/utils/ThroughputEstimator.d.ts +1 -1
- package/types/utils/tuningConfig.d.ts +19 -1
- package/types/utils/videoFormat.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.160-dev.
|
|
3
|
+
"version": "2.0.160-dev.67a0a3b5.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"**/*.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vkontakte/videoplayer-shared": "1.0.89-dev.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.89-dev.67a0a3b5.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -22,6 +22,9 @@ export interface IParams {
|
|
|
22
22
|
compatibilityMode?: boolean;
|
|
23
23
|
tracer: ITracer;
|
|
24
24
|
useEnableSubtitlesParam?: boolean;
|
|
25
|
+
handleExtendedNetworkErrorsSet?: boolean;
|
|
26
|
+
useUrlCacheMechanism?: boolean;
|
|
27
|
+
measureNonSegmentRequests?: boolean;
|
|
25
28
|
}
|
|
26
29
|
export type Priority = "high" | "low" | "auto";
|
|
27
30
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -38,6 +41,7 @@ export interface FetchParams {
|
|
|
38
41
|
isLowLatency?: boolean;
|
|
39
42
|
bufferOptimisation?: boolean;
|
|
40
43
|
ignoreNetworkErrors?: boolean;
|
|
44
|
+
urlCacheMechanismEnabled?: boolean;
|
|
41
45
|
}
|
|
42
46
|
export type RepresentationFetchResult = {
|
|
43
47
|
init: CommonInit | null;
|
|
@@ -63,9 +67,13 @@ export declare class Fetcher {
|
|
|
63
67
|
private readonly subscription;
|
|
64
68
|
private compatibilityMode;
|
|
65
69
|
private useEnableSubtitlesParam;
|
|
70
|
+
private useUrlCacheMechanism;
|
|
71
|
+
private measureNonSegmentRequests;
|
|
72
|
+
private startupPhase;
|
|
66
73
|
private performanceObserver;
|
|
67
74
|
private pendingConnectionMetrics;
|
|
68
|
-
|
|
75
|
+
private handleExtendedNetworkErrorsSet;
|
|
76
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
|
|
69
77
|
private onHeadersReceived;
|
|
70
78
|
private setupPerformanceObserver;
|
|
71
79
|
private processPerformanceResourceTiming;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IError, ISubject } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
type Params = {
|
|
3
|
+
txtCode: string;
|
|
4
|
+
error$: ISubject<IError>;
|
|
5
|
+
recoverableError$: ISubject<IError>;
|
|
6
|
+
httpCode?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const processNetworkErrors: ({ txtCode, error$, recoverableError$, httpCode }: Params) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type CacheManager = {
|
|
2
|
+
get: () => Promise<Response | null>;
|
|
3
|
+
set: (response: Response) => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Пытаемся добиться кэширования вызовов.
|
|
7
|
+
* Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
|
|
8
|
+
* Из за этого обрабатываем кэш вручную.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createCacheManager: (url: string) => Promise<CacheManager>;
|
|
11
|
+
export declare function canUseCacheApi(): boolean;
|
|
12
|
+
export declare function normalizeUrl(url: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Проверяет, не просрочен ли кэшированный ответ
|
|
15
|
+
*/
|
|
16
|
+
export declare function isResponseExpired(response: Response): boolean;
|
|
17
|
+
export declare function cloneResponse(response: Response, url: string): Response;
|
|
18
|
+
/**
|
|
19
|
+
* Извлекает expires из оригинального URL (параметр expires1)
|
|
20
|
+
* Предполагается, что expires1 — timestamp в секундах
|
|
21
|
+
*/
|
|
22
|
+
export declare function getExpiresFromUrl(url: string): number;
|
|
23
|
+
export declare const dropUrlsCache: () => Promise<void>;
|
|
@@ -22,6 +22,9 @@ export interface IParams {
|
|
|
22
22
|
compatibilityMode?: boolean;
|
|
23
23
|
tracer: ITracer;
|
|
24
24
|
useEnableSubtitlesParam?: boolean;
|
|
25
|
+
handleExtendedNetworkErrorsSet?: boolean;
|
|
26
|
+
useUrlCacheMechanism?: boolean;
|
|
27
|
+
measureNonSegmentRequests?: boolean;
|
|
25
28
|
}
|
|
26
29
|
export type Priority = "high" | "low" | "auto";
|
|
27
30
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -37,6 +40,7 @@ export interface FetchParams {
|
|
|
37
40
|
measureThroughput?: boolean;
|
|
38
41
|
isLowLatency?: boolean;
|
|
39
42
|
bufferOptimisation?: boolean;
|
|
43
|
+
urlCacheMechanismEnabled?: boolean;
|
|
40
44
|
}
|
|
41
45
|
export type RepresentationFetchResult<T extends Segment> = {
|
|
42
46
|
initMetadata: CommonInit | null;
|
|
@@ -62,9 +66,13 @@ export declare class Fetcher {
|
|
|
62
66
|
private subscription;
|
|
63
67
|
private compatibilityMode;
|
|
64
68
|
private useEnableSubtitlesParam;
|
|
69
|
+
private useUrlCacheMechanism;
|
|
70
|
+
private measureNonSegmentRequests;
|
|
71
|
+
private startupPhase;
|
|
65
72
|
private performanceObserver;
|
|
66
73
|
private pendingConnectionMetrics;
|
|
67
|
-
|
|
74
|
+
private handleExtendedNetworkErrorsSet;
|
|
75
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
|
|
68
76
|
private onHeadersReceived;
|
|
69
77
|
private setupPerformanceObserver;
|
|
70
78
|
private processResourceTiming;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IError, ISubject } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
type Params = {
|
|
3
|
+
txtCode: string;
|
|
4
|
+
error$: ISubject<IError>;
|
|
5
|
+
recoverableError$: ISubject<IError>;
|
|
6
|
+
httpCode?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const processNetworkErrors: ({ txtCode, error$, recoverableError$, httpCode }: Params) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CacheManager = {
|
|
2
|
+
get: () => Promise<Response | null>;
|
|
3
|
+
set: (response: Response) => Promise<void>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Пытаемся добиться кэширования вызовов.
|
|
7
|
+
* Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
|
|
8
|
+
* Из за этого обрабатываем кэш вручную.
|
|
9
|
+
*/
|
|
10
|
+
export declare const createCacheManager: (url: string) => Promise<CacheManager>;
|
|
11
|
+
export declare function canUseCacheApi(): boolean;
|
|
12
|
+
export declare function normalizeUrl(url: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Проверяет, не просрочен ли кэшированный ответ
|
|
15
|
+
*/
|
|
16
|
+
export declare function isResponseExpired(response: Response): boolean;
|
|
17
|
+
export declare function cloneResponse(response: Response, url: string): Response;
|
|
18
|
+
/**
|
|
19
|
+
* Извлекает expires из оригинального URL (параметр expires1)
|
|
20
|
+
* Предполагается, что expires1 — timestamp в секундах
|
|
21
|
+
*/
|
|
22
|
+
export declare function getExpiresFromUrl(url: string): number;
|
|
@@ -19,7 +19,11 @@ interface IParams extends IProviderDependencies {
|
|
|
19
19
|
export default class ProviderContainer implements IProviderContainer {
|
|
20
20
|
current$: IValueSubject<IProviderEntry>;
|
|
21
21
|
providerError$: ISubject<IError>;
|
|
22
|
-
noAvailableProvidersError$: ISubject<
|
|
22
|
+
noAvailableProvidersError$: ISubject<{
|
|
23
|
+
forced?: VideoFormat;
|
|
24
|
+
input: VideoFormat[];
|
|
25
|
+
supported: VideoFormat[];
|
|
26
|
+
}>;
|
|
23
27
|
volumeMultiplierError$: ISubject<IError>;
|
|
24
28
|
providerOutput: IProviderOutput;
|
|
25
29
|
private subscription;
|
|
@@ -4,7 +4,11 @@ import type { IProvider, IProviderOutput } from "../types";
|
|
|
4
4
|
export interface IProviderContainer {
|
|
5
5
|
current$: IValueObservable<IProviderEntry>;
|
|
6
6
|
providerError$: ISubject<IError>;
|
|
7
|
-
noAvailableProvidersError$: ISubject<
|
|
7
|
+
noAvailableProvidersError$: ISubject<{
|
|
8
|
+
forced?: VideoFormat;
|
|
9
|
+
input: VideoFormat[];
|
|
10
|
+
supported: VideoFormat[];
|
|
11
|
+
}>;
|
|
8
12
|
volumeMultiplierError$: ISubject<IError>;
|
|
9
13
|
providerOutput: IProviderOutput;
|
|
10
14
|
init(): void;
|
|
@@ -3,9 +3,11 @@ export interface IStatefulIterator<T> {
|
|
|
3
3
|
getValue(): T;
|
|
4
4
|
isCompleted(): boolean;
|
|
5
5
|
isLast(): boolean;
|
|
6
|
+
all(): T[];
|
|
6
7
|
}
|
|
7
8
|
export declare class StatefulIterator<T> implements IStatefulIterator<T> {
|
|
8
9
|
private readonly length;
|
|
10
|
+
private array;
|
|
9
11
|
private index;
|
|
10
12
|
private iterator;
|
|
11
13
|
private current;
|
|
@@ -14,4 +16,5 @@ export declare class StatefulIterator<T> implements IStatefulIterator<T> {
|
|
|
14
16
|
getValue(): T;
|
|
15
17
|
isCompleted(): boolean;
|
|
16
18
|
isLast(): boolean;
|
|
19
|
+
all(): T[];
|
|
17
20
|
}
|
|
@@ -2,7 +2,7 @@ import type { VideoCodec, VideoFormat } from "../player/types";
|
|
|
2
2
|
import { WebmCodecStrategy } from "../enums/WebmCodecStrategy";
|
|
3
3
|
import { AndroidPreferredFormat } from "../enums/AndroidPreferredFormat";
|
|
4
4
|
import { IOSPreferredFormat } from "../enums/IOSPreferredFormat";
|
|
5
|
-
import type { Byte, Milliseconds, RecursivePartial, Seconds } from "@vkontakte/videoplayer-shared";
|
|
5
|
+
import type { Byte, Kbps, Milliseconds, RecursivePartial, Seconds } 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
8
|
export type ITuningConfig = {
|
|
@@ -33,6 +33,9 @@ export type ITuningConfig = {
|
|
|
33
33
|
basisTrendChangeCount: number;
|
|
34
34
|
changeThreshold: number;
|
|
35
35
|
useBrowserEstimation: boolean;
|
|
36
|
+
initialThroughput: Kbps;
|
|
37
|
+
measureNonSegmentRequests: boolean;
|
|
38
|
+
smallSampleMinDuration: Milliseconds;
|
|
36
39
|
rttPenaltyRequestSize: Byte;
|
|
37
40
|
streamMinSampleSize: Byte;
|
|
38
41
|
streamMinSampleTime: Milliseconds;
|
|
@@ -238,6 +241,7 @@ export type ITuningConfig = {
|
|
|
238
241
|
requestQuick: boolean;
|
|
239
242
|
/** @deprecated HLS.js удалён, флаг ничего не делает */
|
|
240
243
|
useHlsJs: boolean;
|
|
244
|
+
disableHlsOnDesktop: boolean;
|
|
241
245
|
useNativeHLSTextTracks: boolean;
|
|
242
246
|
useNewSwitchTo: boolean;
|
|
243
247
|
alwaysAbortPreviousSwitch: boolean;
|
|
@@ -321,6 +325,20 @@ export type ITuningConfig = {
|
|
|
321
325
|
* (Скорее всего имеет смысл включить такой же флаг в настройках ui)
|
|
322
326
|
*/
|
|
323
327
|
reuseOwnVideoElement?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Обрабатываем все сетевые ошибки, которые приходят с бэка.
|
|
330
|
+
* на http 500 не падаем в краш.
|
|
331
|
+
*/
|
|
332
|
+
handleExtendedNetworkErrorsSet?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Кэшируем ответы от сервера руками, так как из за динамичесокй природы некоторых параметров в урле
|
|
335
|
+
* браузер это не может сделать.
|
|
336
|
+
*/
|
|
337
|
+
useUrlCacheMechanism?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Очищаем кэш урлов при падение провайдера.
|
|
340
|
+
*/
|
|
341
|
+
dropUrlCacheWhenProviderCrashed?: boolean;
|
|
324
342
|
};
|
|
325
343
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
|
|
326
344
|
export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ISources, VideoFormat } from "../player/types";
|
|
2
|
-
export declare const filterAvailableFormats: (formats: VideoFormat[]) => VideoFormat[];
|
|
2
|
+
export declare const filterAvailableFormats: (formats: VideoFormat[], disableHlsOnDesktop?: boolean) => VideoFormat[];
|
|
3
3
|
export declare const isLiveFormat: (format: VideoFormat) => boolean;
|
|
4
|
-
export declare const areValidLiveRecordSources: (sources: ISources) => boolean;
|
|
4
|
+
export declare const areValidLiveRecordSources: (sources: ISources, disableHlsOnDesktop?: boolean) => boolean;
|