@vkontakte/videoplayer-core 2.0.130-dev.3ce761c4.0 → 2.0.130-dev.ab6d64b6.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.js +66 -10
- package/es2015.esm.js +66 -10
- package/es2018.cjs.js +66 -10
- package/es2018.esm.js +65 -9
- package/es2024.cjs.js +126 -0
- package/es2024.esm.js +126 -0
- package/esnext.cjs.js +65 -9
- package/esnext.esm.js +65 -9
- package/evergreen.esm.js +64 -8
- package/package.json +17 -12
- package/types/player/Player.d.ts +9 -2
- package/types/player/types.d.ts +9 -8
- package/types/providers/ChromecastProvider/ChromecastInitializer/index.d.ts +5 -1
- package/types/providers/ChromecastProvider/index.d.ts +2 -0
- package/types/providers/DashLiveProvider/DashLiveProvider.d.ts +1 -0
- package/types/providers/DashLiveProvider/utils/FilesFetcher.d.ts +2 -1
- package/types/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +1 -0
- package/types/providers/DashLiveProvider/utils/ThroughputEstimator.d.ts +4 -0
- package/types/providers/DashProvider/baseDashProvider.d.ts +2 -2
- package/types/providers/DashProvider/lib/buffer.d.ts +0 -1
- package/types/providers/DashProvider/lib/fetcher.d.ts +4 -3
- package/types/providers/DashProvider/lib/player.d.ts +4 -2
- package/types/providers/DashProvider/lib/utils.d.ts +0 -10
- package/types/providers/ProviderContainer/index.d.ts +2 -0
- package/types/providers/WebRTCLiveProvider/WebRTCLiveProvider.d.ts +1 -0
- package/types/providers/types.d.ts +4 -1
- package/types/providers/utils/HTMLVideoElement/DroppedFramesManager.d.ts +3 -1
- package/types/providers/utils/HTMLVideoElement/observable.d.ts +0 -1
- package/types/providers/utils/StallsManager.d.ts +18 -4
- package/types/providers/utils/syncDesiredState.d.ts +3 -1
- package/types/utils/autoSelectTrack.d.ts +4 -3
- package/types/utils/qualityLimits.d.ts +18 -3
- package/types/utils/smoothedValue/baseSmoothedValue.d.ts +3 -0
- package/types/utils/tuningConfig.d.ts +25 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.130-dev.
|
|
3
|
+
"version": "2.0.130-dev.ab6d64b6.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -11,29 +11,34 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./types/index.d.ts",
|
|
14
15
|
"import": "./esnext.esm.js",
|
|
15
|
-
"require": "./esnext.cjs.js"
|
|
16
|
-
"types": "./types/index.d.ts"
|
|
16
|
+
"require": "./esnext.cjs.js"
|
|
17
17
|
},
|
|
18
18
|
"./evergreen": {
|
|
19
|
+
"types": "./types/index.d.ts",
|
|
19
20
|
"import": "./evergreen.esm.js",
|
|
20
|
-
"require": "./evergreen.cjs.js"
|
|
21
|
-
"types": "./types/index.d.ts"
|
|
21
|
+
"require": "./evergreen.cjs.js"
|
|
22
22
|
},
|
|
23
23
|
"./esnext": {
|
|
24
|
+
"types": "./types/index.d.ts",
|
|
24
25
|
"import": "./esnext.esm.js",
|
|
25
|
-
"require": "./esnext.cjs.js"
|
|
26
|
-
|
|
26
|
+
"require": "./esnext.cjs.js"
|
|
27
|
+
},
|
|
28
|
+
"./es2024": {
|
|
29
|
+
"types": "./types/index.d.ts",
|
|
30
|
+
"import": "./es2024.esm.js",
|
|
31
|
+
"require": "./es2024.cjs.js"
|
|
27
32
|
},
|
|
28
33
|
"./es2018": {
|
|
34
|
+
"types": "./types/index.d.ts",
|
|
29
35
|
"import": "./es2018.esm.js",
|
|
30
|
-
"require": "./es2018.cjs.js"
|
|
31
|
-
"types": "./types/index.d.ts"
|
|
36
|
+
"require": "./es2018.cjs.js"
|
|
32
37
|
},
|
|
33
38
|
"./es2015": {
|
|
39
|
+
"types": "./types/index.d.ts",
|
|
34
40
|
"import": "./es2015.esm.js",
|
|
35
|
-
"require": "./es2015.cjs.js"
|
|
36
|
-
"types": "./types/index.d.ts"
|
|
41
|
+
"require": "./es2015.cjs.js"
|
|
37
42
|
},
|
|
38
43
|
"./evergreen.esm.js": "./evergeen.esm.js",
|
|
39
44
|
"./esnext.esm.js": "./esnext.esm.js",
|
|
@@ -49,7 +54,7 @@
|
|
|
49
54
|
"**/*.d.ts"
|
|
50
55
|
],
|
|
51
56
|
"dependencies": {
|
|
52
|
-
"@vkontakte/videoplayer-shared": "1.0.58-dev.
|
|
57
|
+
"@vkontakte/videoplayer-shared": "1.0.58-dev.bc8d7a0b.0",
|
|
53
58
|
"hls.js": "~1.4.7"
|
|
54
59
|
}
|
|
55
60
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { IOptionalTuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality, ITracer } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import { ChromecastState, HttpConnectionType, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
|
|
4
4
|
export default class Player implements IPlayer {
|
|
5
5
|
private subscription;
|
|
6
6
|
private domContainer;
|
|
7
7
|
private providerContainer?;
|
|
8
8
|
private chromecastInitializer;
|
|
9
|
+
private logger;
|
|
10
|
+
private tracer;
|
|
11
|
+
private abrLogger;
|
|
9
12
|
private config;
|
|
10
13
|
private tuning;
|
|
11
14
|
private throughputEstimator;
|
|
@@ -107,9 +110,10 @@ export default class Player implements IPlayer {
|
|
|
107
110
|
element$: ValueSubject<HTMLVideoElement | undefined>;
|
|
108
111
|
tuningConfigName$: ValueSubject<string[]>;
|
|
109
112
|
enableDebugTelemetry$: ValueSubject<boolean>;
|
|
113
|
+
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
110
114
|
getCurrentTime$: ValueSubject<null>;
|
|
111
115
|
};
|
|
112
|
-
constructor(tuning?: IOptionalTuningConfig);
|
|
116
|
+
constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
|
|
113
117
|
initVideo(config: IConfig): IPlayer;
|
|
114
118
|
destroy(): void;
|
|
115
119
|
prepare(): IPlayer;
|
|
@@ -176,6 +180,7 @@ export default class Player implements IPlayer {
|
|
|
176
180
|
*/
|
|
177
181
|
releaseCamera(): this;
|
|
178
182
|
getExactTime(): Seconds;
|
|
183
|
+
getAllLogs(): ILogEntry[];
|
|
179
184
|
private getScene3D;
|
|
180
185
|
private setIntrinsicVideoSize;
|
|
181
186
|
private initDesiredStateSubscriptions;
|
|
@@ -183,7 +188,9 @@ export default class Player implements IPlayer {
|
|
|
183
188
|
private initChromecastSubscription;
|
|
184
189
|
private initStartingVideoTrack;
|
|
185
190
|
private setStartingVideoTrack;
|
|
191
|
+
private initLogs;
|
|
186
192
|
private initDebugTelemetry;
|
|
193
|
+
private initTracerSubscription;
|
|
187
194
|
private initWakeLock;
|
|
188
195
|
private setVideoTrackIdByQuality;
|
|
189
196
|
private getActiveLiveDelay;
|
package/types/player/types.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export interface IPlayer {
|
|
|
62
62
|
* Может быть точнее, чем `info.position$` в промежутках между timeupdate
|
|
63
63
|
*/
|
|
64
64
|
getExactTime(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Возвращает все логи с момента инициализации плеера
|
|
67
|
+
*/
|
|
68
|
+
getAllLogs(): ILogEntry[];
|
|
65
69
|
experimental: {
|
|
66
70
|
/**
|
|
67
71
|
* Элемент, который сейчас вставлен в container.
|
|
@@ -70,6 +74,7 @@ export interface IPlayer {
|
|
|
70
74
|
element$: IValueObservable<HTMLVideoElement | undefined>;
|
|
71
75
|
tuningConfigName$: IValueSubject<string[]>;
|
|
72
76
|
enableDebugTelemetry$: IValueSubject<boolean>;
|
|
77
|
+
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
73
78
|
/** функция вычисления текущей позиции проигрывания из под провадера (если расчет нестандартный) */
|
|
74
79
|
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
75
80
|
};
|
|
@@ -473,24 +478,20 @@ export declare enum VideoFormat {
|
|
|
473
478
|
/** @deprecated Больше не транскодируется */
|
|
474
479
|
DASH = "DASH",// "Старый" h264 даш, слитный: Аудиодорожка слита с видео
|
|
475
480
|
DASH_SEP = "DASH_SEP",// h264, но аудиодорожка отделена
|
|
476
|
-
/** @deprecated Используйте DASH_SEP */
|
|
477
|
-
DASH_SEP_VK = "DASH_SEP",
|
|
481
|
+
/** @deprecated Используйте DASH_SEP */ DASH_SEP_VK = "DASH_SEP",
|
|
478
482
|
DASH_WEBM = "DASH_WEBM",// Видео закодировано в VP9, аудио в opus, контейнер webm
|
|
479
483
|
DASH_WEBM_AV1 = "DASH_WEBM_AV1",// Видео закодировано в AV1, остальное как _WEBM
|
|
480
484
|
DASH_STREAMS = "DASH_STREAMS",// AdaptationSet может быть несколько. На текущий момент различаются только языки аудио. Возможно позже и кодеки будут. Пока H.264/AAC
|
|
481
|
-
/** @deprecated Используйте DASH_WEBM */
|
|
482
|
-
DASH_WEBM_VK = "DASH_WEBM",
|
|
485
|
+
/** @deprecated Используйте DASH_WEBM */ DASH_WEBM_VK = "DASH_WEBM",
|
|
483
486
|
DASH_ONDEMAND = "DASH_ONDEMAND",// На бэке сегменты транскодируются на лету. Кодек H.264. Формат манифеста отличается, SegmentTemplate вместо SegmentBase
|
|
484
|
-
/** @deprecated Используйте DASH_ONDEMAND */
|
|
485
|
-
DASH_ONDEMAND_VK = "DASH_ONDEMAND",
|
|
487
|
+
/** @deprecated Используйте DASH_ONDEMAND */ DASH_ONDEMAND_VK = "DASH_ONDEMAND",
|
|
486
488
|
DASH_LIVE = "DASH_LIVE",
|
|
487
489
|
DASH_LIVE_CMAF = "DASH_LIVE_CMAF",
|
|
488
490
|
/** @deprecated */
|
|
489
491
|
DASH_LIVE_WEBM = "DASH_LIVE_WEBM",
|
|
490
492
|
HLS = "HLS",
|
|
491
493
|
HLS_ONDEMAND = "HLS_ONDEMAND",
|
|
492
|
-
/** @deprecated Используйте HLS */
|
|
493
|
-
HLS_JS = "HLS",
|
|
494
|
+
/** @deprecated Используйте HLS */ HLS_JS = "HLS",
|
|
494
495
|
HLS_LIVE = "HLS_LIVE",
|
|
495
496
|
HLS_LIVE_CMAF = "HLS_LIVE_CMAF",
|
|
496
497
|
WEB_RTC_LIVE = "WEB_RTC_LIVE"
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ISubject, IValueSubject, IError } from '@vkontakte/videoplayer-shared';
|
|
1
|
+
import { ISubject, IValueSubject, ILogger, IError } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { ChromecastState } from '../../../player/types';
|
|
3
3
|
import { IChromecastConnection, IChromecastInitializer } from './types';
|
|
4
4
|
interface IParams {
|
|
5
5
|
receiverApplicationId?: string;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
|
+
dependencies: {
|
|
8
|
+
logger: ILogger;
|
|
9
|
+
};
|
|
7
10
|
}
|
|
8
11
|
export declare class ChromecastInitializer implements IChromecastInitializer {
|
|
9
12
|
readonly connection$: IValueSubject<IChromecastConnection | undefined>;
|
|
@@ -12,6 +15,7 @@ export declare class ChromecastInitializer implements IChromecastInitializer {
|
|
|
12
15
|
contentId?: string;
|
|
13
16
|
private readonly realCastState$;
|
|
14
17
|
private readonly subscription;
|
|
18
|
+
private readonly log;
|
|
15
19
|
private readonly params;
|
|
16
20
|
private isDestroyed;
|
|
17
21
|
constructor(params: IParams);
|
|
@@ -11,6 +11,7 @@ export default class ChromecastProvider implements IProvider {
|
|
|
11
11
|
private loadMediaTimeoutSubscription;
|
|
12
12
|
private videoState;
|
|
13
13
|
private params;
|
|
14
|
+
private log;
|
|
14
15
|
constructor(params: IParams);
|
|
15
16
|
destroy(): void;
|
|
16
17
|
private subscribe;
|
|
@@ -26,6 +27,7 @@ export default class ChromecastProvider implements IProvider {
|
|
|
26
27
|
private createMediaInfo;
|
|
27
28
|
private createLoadRequest;
|
|
28
29
|
private loadMedia;
|
|
30
|
+
private logRemoteEvent;
|
|
29
31
|
private syncPlayback;
|
|
30
32
|
}
|
|
31
33
|
export {};
|
|
@@ -9,7 +9,8 @@ export default class FilesFetcher {
|
|
|
9
9
|
private TIMEOUT;
|
|
10
10
|
private BITRATE_ESTIMATOR;
|
|
11
11
|
private MAX_PARALLEL_REQUESTS;
|
|
12
|
-
|
|
12
|
+
private logger;
|
|
13
|
+
constructor(RETRY_COUNT: number, TIMEOUT: number, BITRATE_ESTIMATOR: any, MAX_PARALLEL_REQUESTS: number, logger: (...args: any[]) => void);
|
|
13
14
|
private limitCompleteCount;
|
|
14
15
|
private _sendRequest;
|
|
15
16
|
private _getParallelRequestCount;
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* active time = (1.1 - 1.0) + (0.5 - 0.2) = 0.4
|
|
16
16
|
* throughput = total size / active time = 6500 bytes/sec
|
|
17
17
|
*/
|
|
18
|
+
type ILogger = (...args: any[]) => void;
|
|
18
19
|
export default class ThroughputEstimator {
|
|
19
20
|
private intervals;
|
|
20
21
|
private currentRate;
|
|
22
|
+
private logger;
|
|
23
|
+
constructor(logger: ILogger);
|
|
21
24
|
private _updateRate;
|
|
22
25
|
private _createInterval;
|
|
23
26
|
private _doMergeIntervals;
|
|
@@ -27,3 +30,4 @@ export default class ThroughputEstimator {
|
|
|
27
30
|
addInterval(timeStart: number, timeEnd: number, bytes: number): boolean;
|
|
28
31
|
getBitRate(): number;
|
|
29
32
|
}
|
|
33
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, S
|
|
|
3
3
|
import { IProvider, IProviderParams } from '../../providers/types';
|
|
4
4
|
import { TrackHistory } from '../../utils/autoSelectTrack';
|
|
5
5
|
import { IStateMachine } from '../../utils/StateMachine/types';
|
|
6
|
-
import { ISubscription, Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
6
|
+
import { ISubscription, ITracer, Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
7
7
|
import { Player } from './lib/player';
|
|
8
8
|
import { Scene3D } from '../../utils/3d/Scene3D';
|
|
9
9
|
import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
|
|
@@ -20,6 +20,7 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
20
20
|
protected video: HTMLVideoElement;
|
|
21
21
|
protected player: Player;
|
|
22
22
|
protected params: IParams;
|
|
23
|
+
protected tracer: ITracer;
|
|
23
24
|
protected textTracksManager: TextTrackManager;
|
|
24
25
|
protected droppedFramesManager: DroppedFramesManager;
|
|
25
26
|
protected stallsManager: StallsManager;
|
|
@@ -40,7 +41,6 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
40
41
|
protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
|
|
41
42
|
protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
|
|
42
43
|
protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
|
|
43
|
-
private readonly selectedRepresentations;
|
|
44
44
|
constructor(params: IParams);
|
|
45
45
|
protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
46
46
|
protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
|
|
@@ -108,7 +108,6 @@ export declare class BufferManager {
|
|
|
108
108
|
private pruneBuffer;
|
|
109
109
|
private abortBuffer;
|
|
110
110
|
getDebugBufferState(): IRange<Milliseconds> | undefined;
|
|
111
|
-
getBufferedTo(): number | null;
|
|
112
111
|
getForwardBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
|
|
113
112
|
private detectGaps;
|
|
114
113
|
private detectGapsWhenIdle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpConnectionType } from '../../../player/types';
|
|
2
2
|
import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
|
|
3
|
-
import { Byte, IValueSubject, Milliseconds, IRange, Subject, IError } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import { Byte, IValueSubject, Milliseconds, IRange, Subject, ITracer, IError } from '@vkontakte/videoplayer-shared';
|
|
4
4
|
import { CommonInit, GenericContainerParser, Segment, SegmentReference } from './types';
|
|
5
5
|
export declare enum RangeMethod {
|
|
6
6
|
HEADER = 0,
|
|
@@ -10,6 +10,7 @@ export interface IParams {
|
|
|
10
10
|
throughputEstimator?: ThroughputEstimator;
|
|
11
11
|
requestQuic: boolean;
|
|
12
12
|
compatibilityMode?: boolean;
|
|
13
|
+
tracer: ITracer;
|
|
13
14
|
useEnableSubtitlesParam?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export type Priority = 'high' | 'low' | 'auto';
|
|
@@ -34,6 +35,7 @@ export type RepresentationFetchResult = {
|
|
|
34
35
|
export declare class Fetcher {
|
|
35
36
|
private throughputEstimator;
|
|
36
37
|
private requestQuic;
|
|
38
|
+
private tracer;
|
|
37
39
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
38
40
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
39
41
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
@@ -43,8 +45,7 @@ export declare class Fetcher {
|
|
|
43
45
|
private subscription;
|
|
44
46
|
private compatibilityMode;
|
|
45
47
|
private useEnableSubtitlesParam;
|
|
46
|
-
|
|
47
|
-
constructor({ throughputEstimator, requestQuic, compatibilityMode, useEnableSubtitlesParam }: IParams);
|
|
48
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
|
|
48
49
|
private onHeadersReceived;
|
|
49
50
|
fetchManifest: (param_0: string) => Promise<string | null | undefined>;
|
|
50
51
|
fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
|
|
@@ -3,7 +3,7 @@ import { CommonInit, LiveStreamStatus, Manifest, Representation, StreamKind, Tex
|
|
|
3
3
|
import StateMachine from '../../../utils/StateMachine/StateMachine';
|
|
4
4
|
import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
|
|
5
5
|
import { ITuningConfig } from '../../../utils/tuningConfig';
|
|
6
|
-
import { IError, ISubject, IValueSubject, Milliseconds, Subject } from '@vkontakte/videoplayer-shared';
|
|
6
|
+
import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Subject } from '@vkontakte/videoplayer-shared';
|
|
7
7
|
export declare enum State {
|
|
8
8
|
NONE = "none",
|
|
9
9
|
MANIFEST_READY = "manifest_ready",
|
|
@@ -14,6 +14,7 @@ export interface Params {
|
|
|
14
14
|
throughputEstimator: ThroughputEstimator;
|
|
15
15
|
tuning: ITuningConfig;
|
|
16
16
|
compatibilityMode?: boolean;
|
|
17
|
+
tracer: ITracer;
|
|
17
18
|
}
|
|
18
19
|
export declare class Player {
|
|
19
20
|
private element;
|
|
@@ -21,6 +22,7 @@ export declare class Player {
|
|
|
21
22
|
private source;
|
|
22
23
|
private manifest;
|
|
23
24
|
private tuning;
|
|
25
|
+
private tracer;
|
|
24
26
|
private videoBufferManager;
|
|
25
27
|
private audioBufferManager;
|
|
26
28
|
private bufferManagers;
|
|
@@ -66,7 +68,6 @@ export declare class Player {
|
|
|
66
68
|
private stallWatchdogSubscription;
|
|
67
69
|
private livePauseWatchdogSubscription;
|
|
68
70
|
private destroyController;
|
|
69
|
-
private initedPruneBufferCallback;
|
|
70
71
|
constructor(params: Params);
|
|
71
72
|
initManifest: (param_0: HTMLVideoElement, param_1: string, param_2: number) => Promise<void | undefined>;
|
|
72
73
|
updateManifest: () => Promise<Manifest | null | undefined>;
|
|
@@ -82,6 +83,7 @@ export declare class Player {
|
|
|
82
83
|
getStreams(): Manifest['streams'] | undefined;
|
|
83
84
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
84
85
|
destroy(): void;
|
|
86
|
+
private initTracerSubscription;
|
|
85
87
|
private isManualDecreasePlaybackInLive;
|
|
86
88
|
private normolizeLiveOffset;
|
|
87
89
|
private tick;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Representation, Segment, SegmentReference, Stream, TemplateSegment, TemplateSegmentReference, TextRepresentation } from '../../../providers/DashProvider/lib/types';
|
|
2
2
|
import { IAudioStream, IAudioTrack, IInternalTextTrack, IVideoStream, IVideoTrack } from '../../../player/types';
|
|
3
|
-
import { IRange, Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
4
3
|
export declare const representationToVideoTrack: ({ id, width, height, bitrate, fps, quality: qualityString, streamId }: Representation) => IVideoTrack | undefined;
|
|
5
4
|
export declare const representationToAudioTrack: ({ id, bitrate }: Representation) => IAudioTrack;
|
|
6
5
|
export declare const representationToTextTrack: ({ language, label }: Stream, { id, url, isAuto }: Representation & {
|
|
@@ -14,12 +13,3 @@ export declare const isTemplateSegment: (segment: Segment) => segment is Templat
|
|
|
14
13
|
export declare const isTemplateSegmentReference: (segmentReference: SegmentReference) => segmentReference is TemplateSegmentReference;
|
|
15
14
|
export declare const isAbortError: (e: Error | unknown) => boolean;
|
|
16
15
|
export declare const isTextRepresentation: (representation: Representation | TextRepresentation) => representation is TextRepresentation;
|
|
17
|
-
/**
|
|
18
|
-
* @mutates intervals
|
|
19
|
-
*/
|
|
20
|
-
export declare const mergeIntervals: (intervals: IRange<Milliseconds>[]) => IRange<Milliseconds>[];
|
|
21
|
-
export declare const findInIterator: <T>(iterable: Iterator<T>, matchFn: (arg: T) => boolean) => T | null;
|
|
22
|
-
/**
|
|
23
|
-
* даёт `true` каждые `ms` миллисекунд
|
|
24
|
-
*/
|
|
25
|
-
export declare const semaphor: (ms: number) => () => boolean;
|
|
@@ -22,6 +22,8 @@ export default class ProviderContainer implements IProviderContainer {
|
|
|
22
22
|
private subscription;
|
|
23
23
|
private screenFormatsIterator;
|
|
24
24
|
private chromecastFormatsIterator;
|
|
25
|
+
private log;
|
|
26
|
+
private tracer;
|
|
25
27
|
private params;
|
|
26
28
|
private failoverIndex;
|
|
27
29
|
private volumeMultiplierManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IRectangle } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger, ITracer, IRectangle } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import { IChromecastInitializer } from '../providers/ChromecastProvider/ChromecastInitializer/types';
|
|
4
4
|
import { HttpConnectionType, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
|
|
5
5
|
import { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackState, PlaybackRate } from '../player/types';
|
|
@@ -15,6 +15,9 @@ export interface IProviderDependencies {
|
|
|
15
15
|
dependencies: {
|
|
16
16
|
throughputEstimator: ThroughputEstimator;
|
|
17
17
|
chromecastInitializer: IChromecastInitializer;
|
|
18
|
+
logger: ILogger;
|
|
19
|
+
tracer: ITracer;
|
|
20
|
+
abrLogger: IComponentLogger;
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
23
|
export interface IProviderParams<TSourceType> extends IProviderDependencies {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type ExactVideoQuality, IObservable, Subject } from '@vkontakte/videoplayer-shared';
|
|
1
|
+
import { type ExactVideoQuality, ILogger, IObservable, Subject } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { ITuningConfig } from '../../../utils/tuningConfig';
|
|
3
3
|
import { IVideoTrack } from '../../../player/types';
|
|
4
4
|
import { IStateMachine } from '../../../utils/StateMachine/types';
|
|
5
5
|
interface IConnectData {
|
|
6
|
+
logger: ILogger;
|
|
6
7
|
video: HTMLVideoElement;
|
|
7
8
|
tracks: IVideoTrack[];
|
|
8
9
|
droppedFramesChecker: ITuningConfig['droppedFramesChecker'];
|
|
@@ -13,6 +14,7 @@ interface IConnectData {
|
|
|
13
14
|
declare class DroppedFramesManager {
|
|
14
15
|
onDroopedVideoFramesLimit$: Subject<void>;
|
|
15
16
|
private subscription;
|
|
17
|
+
private log;
|
|
16
18
|
private video;
|
|
17
19
|
private droppedFramesChecker;
|
|
18
20
|
private isAuto;
|
|
@@ -24,6 +24,5 @@ export interface IObservableVideo {
|
|
|
24
24
|
inFullscreen$: IValueObservable<boolean>;
|
|
25
25
|
enterPip$: IObservable<PictureInPictureEvent>;
|
|
26
26
|
leavePip$: IObservable<PictureInPictureEvent>;
|
|
27
|
-
destroy: () => void;
|
|
28
27
|
}
|
|
29
28
|
export declare const observe: (video: HTMLVideoElement) => IObservableVideo;
|
|
@@ -8,20 +8,26 @@ interface IConnectData {
|
|
|
8
8
|
isBuffering$: IObservable<boolean>;
|
|
9
9
|
isSeeked$: IObservable<boolean>;
|
|
10
10
|
looped$: IObservable<Seconds>;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
playing$: IObservable<undefined>;
|
|
12
|
+
currentStallDuration$: IValueSubject<Milliseconds>;
|
|
13
|
+
tuning: ITuningConfig['stallsManager'];
|
|
14
|
+
abrParams: ITuningConfig['autoTrackSelection'];
|
|
13
15
|
}
|
|
14
16
|
declare class StallsManager {
|
|
15
17
|
private currentStallDuration$;
|
|
16
18
|
private videoLastDataObtainedTimestamp$;
|
|
17
19
|
private throughput$;
|
|
18
20
|
private rtt$;
|
|
19
|
-
private
|
|
21
|
+
private tuning;
|
|
22
|
+
private abrParams;
|
|
20
23
|
private isSeeked$;
|
|
21
24
|
private isBuffering$;
|
|
22
|
-
private currentStallsCount;
|
|
23
25
|
private maxQualityLimit;
|
|
24
26
|
private lastUniqueVideoTrackSelected;
|
|
27
|
+
private currentStallsCount;
|
|
28
|
+
private sumStallsDuration;
|
|
29
|
+
private lastStallDuration;
|
|
30
|
+
private providerStartWatchingTimestamp;
|
|
25
31
|
private lastUniqueVideoTrackSelectedTimestamp;
|
|
26
32
|
private predictedThroughputWithoutData;
|
|
27
33
|
private qualityRestrictionTimer;
|
|
@@ -30,7 +36,15 @@ declare class StallsManager {
|
|
|
30
36
|
connect(data: IConnectData): void;
|
|
31
37
|
get videoMaxQualityLimit(): ExactVideoQuality | undefined;
|
|
32
38
|
get predictedThroughput(): Kbps;
|
|
39
|
+
get abrTuningParams(): ITuningConfig['autoTrackSelection'];
|
|
33
40
|
set lastVideoTrackSelected(lastUniqueVideoTrackSelected: IVideoTrack);
|
|
34
41
|
destroy(): void;
|
|
42
|
+
private updateStoredAbrParams;
|
|
43
|
+
private calculateOptimalAbrParams;
|
|
44
|
+
private getStoredData;
|
|
45
|
+
private setStoredData;
|
|
46
|
+
private addStallInfoToHistory;
|
|
47
|
+
private updateStallData;
|
|
48
|
+
private subscribe;
|
|
35
49
|
}
|
|
36
50
|
export default StallsManager;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IListener, IObservable, ISubscription } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { IVolumeState, PlaybackRate } from '../../player/types';
|
|
3
3
|
import { IStateMachine } from '../../utils/StateMachine/types';
|
|
4
|
-
declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | undefined>, get: () => Value | undefined,
|
|
4
|
+
declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | undefined>, get: () => Value | undefined, // Текущее значение состояние
|
|
5
|
+
set: (value: Value | undefined) => void, // Применение нового значения
|
|
6
|
+
{ equal, changed$, onError, }?: {
|
|
5
7
|
equal?: (a: Value | undefined, b: Value | undefined) => boolean;
|
|
6
8
|
changed$?: IObservable<Value | undefined>;
|
|
7
9
|
onError?: IListener<Error | unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits, IComponentLogger } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import { IAudioTrack, IBaseTrack, IVideoTrack } from '../player/types';
|
|
4
4
|
interface IConstraints<T extends IBaseTrack> {
|
|
5
5
|
container?: IRectangle;
|
|
@@ -15,6 +15,7 @@ interface IConstraints<T extends IBaseTrack> {
|
|
|
15
15
|
droppedVideoMaxQualityLimit?: ExactVideoQuality;
|
|
16
16
|
stallsVideoMaxQualityLimit?: ExactVideoQuality;
|
|
17
17
|
stallsPredictedThroughput?: Kbps;
|
|
18
|
+
abrLogger: IComponentLogger;
|
|
18
19
|
panelSize?: IRectangle;
|
|
19
20
|
}
|
|
20
21
|
export declare class TrackHistory<T extends IBaseTrack> {
|
|
@@ -26,6 +27,6 @@ export declare class TrackHistory<T extends IBaseTrack> {
|
|
|
26
27
|
}
|
|
27
28
|
export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
|
|
28
29
|
export declare const getMinPossibleAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
|
|
29
|
-
export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, panelSize, }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
30
|
-
export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, stallsPredictedThroughput, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
30
|
+
export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, abrLogger, panelSize, }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
31
|
+
export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, stallsPredictedThroughput, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
31
32
|
export {};
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { IVideoTrack, PredefinedQualityLimits } from '../player/types';
|
|
2
2
|
import { ExactVideoQuality, Nullable, QualityLimits } from '@vkontakte/videoplayer-shared';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Params = {
|
|
4
|
+
limits: QualityLimits;
|
|
5
|
+
highQualityLimit: ExactVideoQuality;
|
|
6
|
+
trafficSavingLimit: ExactVideoQuality;
|
|
7
|
+
};
|
|
8
|
+
export declare function getQualityLimitsPredefinedType({ limits, highQualityLimit, trafficSavingLimit, }: Params): PredefinedQualityLimits;
|
|
9
|
+
type HighQualityEnabled = {
|
|
10
|
+
limits?: QualityLimits;
|
|
11
|
+
highQualityLimit: ExactVideoQuality;
|
|
12
|
+
trafficSavingLimit: ExactVideoQuality;
|
|
13
|
+
};
|
|
14
|
+
export declare function isHighQualityEnabled({ limits, highQualityLimit, trafficSavingLimit }: HighQualityEnabled): boolean;
|
|
15
|
+
type LimitsValidParams = {
|
|
16
|
+
limits?: QualityLimits;
|
|
17
|
+
highestAvailableQuality: Nullable<ExactVideoQuality>;
|
|
18
|
+
lowestAvailableQuality: Nullable<ExactVideoQuality>;
|
|
19
|
+
};
|
|
5
20
|
type LimitsAsHeightValidParams = {
|
|
6
21
|
limits?: {
|
|
7
22
|
min?: number;
|
|
@@ -10,7 +25,7 @@ type LimitsAsHeightValidParams = {
|
|
|
10
25
|
highestAvailableHeight: Nullable<number>;
|
|
11
26
|
lowestAvailableHeight: Nullable<number>;
|
|
12
27
|
};
|
|
13
|
-
export declare function areLimitsInvalid(limits
|
|
28
|
+
export declare function areLimitsInvalid({ limits, highestAvailableQuality, lowestAvailableQuality }: LimitsValidParams): boolean | (null | undefined);
|
|
14
29
|
/**
|
|
15
30
|
* Проверяем лимиты качества, когда указана высота качества.
|
|
16
31
|
*/
|
|
@@ -2,6 +2,9 @@ import { ISmoothedValue, IParams } from '../../utils/smoothedValue/types';
|
|
|
2
2
|
import { IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
export declare abstract class BaseSmoothedValue implements ISmoothedValue {
|
|
4
4
|
private prevReported;
|
|
5
|
+
private rawSeries$;
|
|
6
|
+
private smoothedSeries$;
|
|
7
|
+
private reportedSeries$;
|
|
5
8
|
protected smoothed: number;
|
|
6
9
|
protected pastMeasures: number[];
|
|
7
10
|
protected takenMeasures: number;
|
|
@@ -24,8 +24,12 @@ export type ITuningConfig = {
|
|
|
24
24
|
};
|
|
25
25
|
autoTrackSelection: {
|
|
26
26
|
bitrateFactorAtEmptyBuffer: number;
|
|
27
|
+
minBitrateFactorAtEmptyBuffer: number;
|
|
28
|
+
maxBitrateFactorAtEmptyBuffer: number;
|
|
27
29
|
bitrateAudioFactorAtEmptyBuffer: number;
|
|
28
30
|
bitrateFactorAtFullBuffer: number;
|
|
31
|
+
minBitrateFactorAtFullBuffer: number;
|
|
32
|
+
maxBitrateFactorAtFullBuffer: number;
|
|
29
33
|
bitrateAudioFactorAtFullBuffer: number;
|
|
30
34
|
minVideoAudioRatio: number;
|
|
31
35
|
minAvailableThroughputAudioRatio: number;
|
|
@@ -36,6 +40,8 @@ export type ITuningConfig = {
|
|
|
36
40
|
pixelRatioLogBase: number;
|
|
37
41
|
pixelRatioLogCoefficients: number[];
|
|
38
42
|
containerSizeFactor: number;
|
|
43
|
+
minContainerSizeFactor: number;
|
|
44
|
+
maxContainerSizeFactor: number;
|
|
39
45
|
lazyQualitySwitch: boolean;
|
|
40
46
|
minBufferToSwitchUp: number;
|
|
41
47
|
considerPlaybackRate: boolean;
|
|
@@ -46,6 +52,25 @@ export type ITuningConfig = {
|
|
|
46
52
|
trafficSavingLimit: ExactVideoQuality;
|
|
47
53
|
highQualityLimit: ExactVideoQuality;
|
|
48
54
|
};
|
|
55
|
+
stallsManager: {
|
|
56
|
+
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
57
|
+
stallDurationToBeCount: Milliseconds;
|
|
58
|
+
stallCountBeforeQualityDecrease: Milliseconds;
|
|
59
|
+
resetQualityRestrictionTimeout: Milliseconds;
|
|
60
|
+
ignoreStallsOnSeek: boolean;
|
|
61
|
+
stallsMetricsHistoryLength: number;
|
|
62
|
+
maxPossibleStallDuration: Milliseconds;
|
|
63
|
+
minTvtToBeCounted: Seconds;
|
|
64
|
+
maxTvtToBeCounted: Seconds;
|
|
65
|
+
targetStallsDurationPerTvt: number;
|
|
66
|
+
deviationStallsDurationPerTvt: number;
|
|
67
|
+
criticalStallsDurationPerTvt: number;
|
|
68
|
+
abrAdjustingSpeed: number;
|
|
69
|
+
emaAlpha: number;
|
|
70
|
+
useTotalStallsDurationPerTvt: boolean;
|
|
71
|
+
useAverageStallsDurationPerTvt: boolean;
|
|
72
|
+
useEmaStallsDurationPerTvt: boolean;
|
|
73
|
+
};
|
|
49
74
|
droppedFramesChecker: {
|
|
50
75
|
enabled: boolean;
|
|
51
76
|
percentLimit: number;
|
|
@@ -72,19 +97,10 @@ export type ITuningConfig = {
|
|
|
72
97
|
enableSubSegmentBufferFeeding: boolean;
|
|
73
98
|
bufferEmptinessTolerance: Milliseconds;
|
|
74
99
|
useFetchPriorityHints: boolean;
|
|
75
|
-
qualityLimitsOnStall: {
|
|
76
|
-
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
77
|
-
stallDurationToBeCount: Milliseconds;
|
|
78
|
-
stallCountBeforeQualityDecrease: Milliseconds;
|
|
79
|
-
resetQualityRestrictionTimeout: Milliseconds;
|
|
80
|
-
ignoreStallsOnSeek: boolean;
|
|
81
|
-
};
|
|
82
100
|
enableBaseUrlSupport: boolean;
|
|
83
101
|
maxSegmentRetryCount: number;
|
|
84
102
|
sourceOpenTimeout: number;
|
|
85
103
|
rejectOnSourceOpenTimeout: boolean;
|
|
86
|
-
pruneBufferInterval: number | null;
|
|
87
|
-
vktvAbrThrottle: number | null;
|
|
88
104
|
};
|
|
89
105
|
dashCmafLive: {
|
|
90
106
|
maxActiveLiveOffset: Milliseconds;
|