@vkontakte/videoplayer-core 2.0.108-dev.ce9f9a29.0 → 2.0.108-dev.f2d9491a.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 +42 -21
- package/es2015.esm.js +42 -21
- package/es2018.cjs.js +42 -21
- package/es2018.esm.js +40 -19
- package/esnext.cjs.js +42 -21
- package/esnext.esm.js +42 -21
- package/evergreen.esm.js +42 -21
- package/package.json +2 -2
- package/types/player/Player.d.ts +6 -4
- package/types/player/types.d.ts +5 -6
- package/types/providers/DashProvider/baseDashProvider.d.ts +5 -3
- package/types/providers/DashProvider/lib/buffer.d.ts +1 -1
- package/types/providers/DashProvider/lib/fetcher.d.ts +4 -2
- package/types/providers/DashProvider/lib/player.d.ts +4 -1
- package/types/providers/ProviderContainer/index.d.ts +1 -0
- package/types/providers/types.d.ts +2 -1
- package/types/utils/autoSelectTrack.d.ts +29 -0
- package/types/utils/tuningConfig.d.ts +5 -0
- package/types/utils/autoSelectVideoTrack.d.ts +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.108-dev.
|
|
3
|
+
"version": "2.0.108-dev.f2d9491a.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"**/*.d.ts"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vkontakte/videoplayer-shared": "
|
|
52
|
+
"@vkontakte/videoplayer-shared": "1.0.40-dev.2129b4c2.0",
|
|
53
53
|
"hls.js": "~1.4.7"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { IOptionalTuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
3
|
-
import { ChromecastState, HttpConnectionType, IAudioStream,
|
|
2
|
+
import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality, ITracer } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import { ChromecastState, HttpConnectionType, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, 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
9
|
private logger;
|
|
10
|
+
private tracer;
|
|
10
11
|
private abrLogger;
|
|
11
12
|
private config;
|
|
12
13
|
private tuning;
|
|
@@ -32,7 +33,7 @@ export default class Player implements IPlayer {
|
|
|
32
33
|
autoQualityLimits$: ValueSubject<QualityLimits>;
|
|
33
34
|
availableAudioStreams$: ValueSubject<IAudioStream[]>;
|
|
34
35
|
currentAudioStream$: ValueSubject<IVideoStream | undefined>;
|
|
35
|
-
availableAudioTracks$: ValueSubject<
|
|
36
|
+
availableAudioTracks$: ValueSubject<import("./types").IBaseTrack[]>;
|
|
36
37
|
isAudioAvailable$: ValueSubject<boolean>;
|
|
37
38
|
currentPlaybackRate$: ValueSubject<number>;
|
|
38
39
|
currentBuffer$: ValueSubject<StartEnd<number>>;
|
|
@@ -99,7 +100,7 @@ export default class Player implements IPlayer {
|
|
|
99
100
|
enableDebugTelemetry$: ValueSubject<boolean>;
|
|
100
101
|
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
101
102
|
};
|
|
102
|
-
constructor(tuning?: IOptionalTuningConfig);
|
|
103
|
+
constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
|
|
103
104
|
initVideo(config: IConfig): IPlayer;
|
|
104
105
|
destroy(): void;
|
|
105
106
|
prepare(): IPlayer;
|
|
@@ -174,6 +175,7 @@ export default class Player implements IPlayer {
|
|
|
174
175
|
private setStartingVideoTrack;
|
|
175
176
|
private initLogs;
|
|
176
177
|
private initDebugTelemetry;
|
|
178
|
+
private initTracerSubscription;
|
|
177
179
|
private initWakeLock;
|
|
178
180
|
private setVideoTrackIdByQuality;
|
|
179
181
|
private getActiveLiveDelay;
|
package/types/player/types.d.ts
CHANGED
|
@@ -475,10 +475,12 @@ export interface IVideoStream {
|
|
|
475
475
|
codec?: string;
|
|
476
476
|
label?: string;
|
|
477
477
|
}
|
|
478
|
-
export interface
|
|
478
|
+
export interface IBaseTrack {
|
|
479
479
|
id: string;
|
|
480
|
-
quality: VideoQuality;
|
|
481
480
|
bitrate?: Kbps;
|
|
481
|
+
}
|
|
482
|
+
export interface IVideoTrack extends IBaseTrack {
|
|
483
|
+
quality: VideoQuality;
|
|
482
484
|
size?: IRectangle;
|
|
483
485
|
fps?: number;
|
|
484
486
|
}
|
|
@@ -489,10 +491,7 @@ export interface IAudioStream {
|
|
|
489
491
|
codec?: string;
|
|
490
492
|
isDefault?: boolean;
|
|
491
493
|
}
|
|
492
|
-
export
|
|
493
|
-
id: string;
|
|
494
|
-
bitrate?: Kbps;
|
|
495
|
-
}
|
|
494
|
+
export type IAudioTrack = IBaseTrack;
|
|
496
495
|
interface ITextTrackBase {
|
|
497
496
|
type: 'external' | 'internal';
|
|
498
497
|
id: string;
|
|
@@ -2,9 +2,9 @@ import { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrac
|
|
|
2
2
|
import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, Stream } from './lib/types';
|
|
3
3
|
import { IProvider, IProviderParams } from '../../providers/types';
|
|
4
4
|
import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
|
|
5
|
-
import { TrackHistory } from '../../utils/
|
|
5
|
+
import { TrackHistory } from '../../utils/autoSelectTrack';
|
|
6
6
|
import { IStateMachine } from '../../utils/StateMachine/types';
|
|
7
|
-
import { IRectangle, ISubscription, Milliseconds, ValueSubject } from '@vkontakte/videoplayer-shared';
|
|
7
|
+
import { IRectangle, ISubscription, Milliseconds, ValueSubject, ITracer } from '@vkontakte/videoplayer-shared';
|
|
8
8
|
import { Player } from './lib/player';
|
|
9
9
|
import { ILiveOffset } from '../utils/LiveOffset/types';
|
|
10
10
|
import { Scene3D } from '../../utils/3d/Scene3D';
|
|
@@ -19,6 +19,7 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
19
19
|
protected video: HTMLVideoElement;
|
|
20
20
|
protected player: Player;
|
|
21
21
|
protected params: IParams;
|
|
22
|
+
protected tracer: ITracer;
|
|
22
23
|
protected elementSize$: ValueSubject<IRectangle<number> | undefined>;
|
|
23
24
|
protected textTracksManager: TextTrackManager;
|
|
24
25
|
protected droppedFramesManager: DroppedFramesManager;
|
|
@@ -36,7 +37,8 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
36
37
|
}>;
|
|
37
38
|
protected videoStreamsMap: Map<Stream, IVideoTrack[]>;
|
|
38
39
|
protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
|
|
39
|
-
protected videoTrackSwitchHistory: TrackHistory
|
|
40
|
+
protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
|
|
41
|
+
protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
|
|
40
42
|
protected textTracks: {
|
|
41
43
|
track: IInternalTextTrack;
|
|
42
44
|
representation: Representation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ITuningConfig } from '../../../utils/tuningConfig';
|
|
2
2
|
import { IError, IRange, ISubject, IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import type { Fetcher } from './fetcher';
|
|
4
|
-
import { CommonInit, Manifest, Representation,
|
|
4
|
+
import { CommonInit, Manifest, Representation, StreamKind, Stream } from './types';
|
|
5
5
|
export interface Dependencies {
|
|
6
6
|
fetcher: Fetcher;
|
|
7
7
|
tuning: ITuningConfig;
|
|
@@ -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 } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import { Byte, IValueSubject, Milliseconds, IRange, ITracer } 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
|
}
|
|
14
15
|
export type Priority = 'high' | 'low' | 'auto';
|
|
15
16
|
export interface FetchParamsWithUrl extends FetchParams {
|
|
@@ -33,13 +34,14 @@ export type RepresentationFetchResult = {
|
|
|
33
34
|
export declare class Fetcher {
|
|
34
35
|
private throughputEstimator;
|
|
35
36
|
private requestQuic;
|
|
37
|
+
private tracer;
|
|
36
38
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
37
39
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
38
40
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
39
41
|
private abortAllController;
|
|
40
42
|
private subscription;
|
|
41
43
|
private compatibilityMode;
|
|
42
|
-
constructor({ throughputEstimator, requestQuic, compatibilityMode }: IParams);
|
|
44
|
+
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode }: IParams);
|
|
43
45
|
private onHeadersReceived;
|
|
44
46
|
fetchManifest: (param_0: string) => Promise<string | null | undefined>;
|
|
45
47
|
fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
|
|
@@ -3,7 +3,7 @@ import { CommonInit, Manifest, Representation, StreamKind } from './types';
|
|
|
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, Seconds } from '@vkontakte/videoplayer-shared';
|
|
6
|
+
import { IError, ISubject, IValueSubject, Milliseconds, Seconds, ITracer } from '@vkontakte/videoplayer-shared';
|
|
7
7
|
import { ISmoothedValue } from '../../../utils/smoothedValue/types';
|
|
8
8
|
export declare enum State {
|
|
9
9
|
NONE = "none",
|
|
@@ -15,6 +15,7 @@ export interface Params {
|
|
|
15
15
|
throughputEstimator: ThroughputEstimator;
|
|
16
16
|
tuning: ITuningConfig;
|
|
17
17
|
compatibilityMode?: boolean;
|
|
18
|
+
tracer: ITracer;
|
|
18
19
|
}
|
|
19
20
|
export declare class Player {
|
|
20
21
|
private element;
|
|
@@ -22,6 +23,7 @@ export declare class Player {
|
|
|
22
23
|
private source;
|
|
23
24
|
private manifest;
|
|
24
25
|
private tuning;
|
|
26
|
+
private tracer;
|
|
25
27
|
private videoBufferManager;
|
|
26
28
|
private audioBufferManager;
|
|
27
29
|
private bufferManagers;
|
|
@@ -69,6 +71,7 @@ export declare class Player {
|
|
|
69
71
|
getStreams(): Manifest['streams'] | undefined;
|
|
70
72
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
71
73
|
destroy(): void;
|
|
74
|
+
private initTracerSubscription;
|
|
72
75
|
private normolizeLiveOffset;
|
|
73
76
|
private tick;
|
|
74
77
|
private updateLive;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger, ITracer } 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';
|
|
@@ -16,6 +16,7 @@ export interface IProviderDependencies {
|
|
|
16
16
|
throughputEstimator: ThroughputEstimator;
|
|
17
17
|
chromecastInitializer: IChromecastInitializer;
|
|
18
18
|
logger: ILogger;
|
|
19
|
+
tracer: ITracer;
|
|
19
20
|
abrLogger: IComponentLogger;
|
|
20
21
|
};
|
|
21
22
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
|
+
import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits, IComponentLogger } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import { IAudioTrack, IBaseTrack, IVideoTrack } from '../player/types';
|
|
4
|
+
interface IConstraints<T extends IBaseTrack> {
|
|
5
|
+
container?: IRectangle;
|
|
6
|
+
throughput?: Kbps;
|
|
7
|
+
tuning: ITuningConfig['autoTrackSelection'];
|
|
8
|
+
limits?: QualityLimits;
|
|
9
|
+
reserve?: Kbps;
|
|
10
|
+
playbackRate?: number;
|
|
11
|
+
forwardBufferHealth?: number;
|
|
12
|
+
current?: T;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
history?: TrackHistory<T>;
|
|
15
|
+
droppedVideoMaxQualityLimit?: ExactVideoQuality;
|
|
16
|
+
abrLogger: IComponentLogger;
|
|
17
|
+
}
|
|
18
|
+
export declare class TrackHistory<T extends IBaseTrack> {
|
|
19
|
+
last: T | undefined;
|
|
20
|
+
history: Record<IBaseTrack['id'], Milliseconds>;
|
|
21
|
+
recordSelection(track: T): void;
|
|
22
|
+
recordSwitch(track: T | undefined): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
|
|
26
|
+
export declare const getMinPossibleAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
|
|
27
|
+
export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, throughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, abrLogger, }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
28
|
+
export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { throughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
29
|
+
export {};
|
|
@@ -24,7 +24,11 @@ export type ITuningConfig = {
|
|
|
24
24
|
};
|
|
25
25
|
autoTrackSelection: {
|
|
26
26
|
bitrateFactorAtEmptyBuffer: number;
|
|
27
|
+
bitrateAudioFactorAtEmptyBuffer: number;
|
|
27
28
|
bitrateFactorAtFullBuffer: number;
|
|
29
|
+
bitrateAudioFactorAtFullBuffer: number;
|
|
30
|
+
minVideoAudioRatio: number;
|
|
31
|
+
minAvailableThroughputAudioRatio: number;
|
|
28
32
|
limitByContainer: boolean;
|
|
29
33
|
usePixelRatio: boolean;
|
|
30
34
|
containerSizeFactor: number;
|
|
@@ -134,6 +138,7 @@ export type ITuningConfig = {
|
|
|
134
138
|
useManagedMediaSource: boolean;
|
|
135
139
|
useNewPruneBufferStrategy: boolean;
|
|
136
140
|
useNewPartialSegmentFeeding: boolean;
|
|
141
|
+
useSeparateAudioVideoABR: boolean;
|
|
137
142
|
isAudioDisabled: boolean;
|
|
138
143
|
autoplayOnlyInActiveTab: boolean;
|
|
139
144
|
dynamicImportTimeout: Milliseconds;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits, IComponentLogger } from '@vkontakte/videoplayer-shared';
|
|
3
|
-
import { IVideoTrack } from '../player/types';
|
|
4
|
-
export interface Constraints {
|
|
5
|
-
container?: IRectangle;
|
|
6
|
-
throughput?: Kbps;
|
|
7
|
-
tuning: ITuningConfig['autoTrackSelection'];
|
|
8
|
-
limits?: QualityLimits;
|
|
9
|
-
reserve?: Kbps;
|
|
10
|
-
playbackRate?: number;
|
|
11
|
-
forwardBufferHealth?: number;
|
|
12
|
-
current?: IVideoTrack;
|
|
13
|
-
history?: TrackHistory;
|
|
14
|
-
droppedVideoMaxQualityLimit?: ExactVideoQuality;
|
|
15
|
-
abrLogger: IComponentLogger;
|
|
16
|
-
}
|
|
17
|
-
export declare class TrackHistory {
|
|
18
|
-
last: IVideoTrack | undefined;
|
|
19
|
-
history: Record<IVideoTrack['id'], Milliseconds>;
|
|
20
|
-
recordSelection(track: IVideoTrack): void;
|
|
21
|
-
recordSwitch(track: IVideoTrack): void;
|
|
22
|
-
clear(): void;
|
|
23
|
-
}
|
|
24
|
-
export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
|
|
25
|
-
declare const autoSelectVideoTrack: (tracks: IVideoTrack[], { container, throughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, droppedVideoMaxQualityLimit, abrLogger, }: Constraints) => IVideoTrack;
|
|
26
|
-
export default autoSelectVideoTrack;
|