@vkontakte/videoplayer-core 2.0.150-dev.f4d0e2c9.0 → 2.0.151-dev.0ce40db4.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 +37 -37
- package/es2015.esm.js +37 -37
- package/es2018.cjs +31 -31
- package/es2018.esm.js +36 -36
- package/es2024.cjs +33 -33
- package/es2024.esm.js +32 -32
- package/esnext.cjs +33 -33
- package/esnext.esm.js +32 -32
- package/evergreen.esm.js +42 -42
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
- package/types/player/Player.d.ts +3 -1
- package/types/player/types.d.ts +21 -0
- package/types/providers/DashProvider/lib/fetcher.d.ts +20 -1
- package/types/providers/DashProvider/lib/player.d.ts +3 -1
- package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +2 -1
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +3 -2
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +20 -1
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +4 -2
- package/types/providers/types.d.ts +3 -1
- package/types/providers/utils/videoStreamRepresentaionsFilter.d.ts +4 -0
- package/types/utils/tuningConfig.d.ts +5 -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.151-dev.0ce40db4.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"**/*.d.ts"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@vkontakte/videoplayer-shared": "1.0.
|
|
57
|
+
"@vkontakte/videoplayer-shared": "1.0.80-dev.0ce40db4.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources,
|
|
|
5
5
|
import type { IOptionalTuningConfig } from './utils/tuningConfig';
|
|
6
6
|
export { clientChecker, isMobile } from './utils/ClientChecker';
|
|
7
7
|
export { areValidLiveRecordSources } from './utils/videoFormat';
|
|
8
|
+
export { WebmCodecStrategy } from './enums/WebmCodecStrategy';
|
|
8
9
|
import type { ISubscription, IUnsubscriber, IEmitter, IObservable, IValueObservable, IValue, IOperator, IListener, ILogEntry, IRange, ExactVideoQuality } from '@vkontakte/videoplayer-shared';
|
|
9
10
|
import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
10
11
|
/**
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IOptionalTuningConfig } from '../utils/tuningConfig';
|
|
2
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, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
|
|
3
|
+
import { ChromecastState, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
|
|
4
4
|
import { IPlayerOptions } from '../utils/playerOptions';
|
|
5
5
|
export default class Player implements IPlayer {
|
|
6
6
|
private subscription;
|
|
@@ -67,6 +67,8 @@ export default class Player implements IPlayer {
|
|
|
67
67
|
hostname$: ValueSubject<string | undefined>;
|
|
68
68
|
httpConnectionType$: ValueSubject<HttpConnectionType | undefined>;
|
|
69
69
|
httpConnectionReused$: ValueSubject<boolean | undefined>;
|
|
70
|
+
httpConnectionMetrics$: ValueSubject<HttpConnectionMetrics | undefined>;
|
|
71
|
+
httpDownloadMetrics$: ValueSubject<HttpDownloadMetrics | undefined>;
|
|
70
72
|
surface$: ValueSubject<Surface>;
|
|
71
73
|
chromecastState$: ValueSubject<ChromecastState>;
|
|
72
74
|
chromecastDeviceName$: ValueSubject<string | undefined>;
|
package/types/player/types.d.ts
CHANGED
|
@@ -417,6 +417,14 @@ export interface IPlayerInfo {
|
|
|
417
417
|
* Было ли переиспользовано последнее HTTP соединение
|
|
418
418
|
*/
|
|
419
419
|
httpConnectionReused$: IValueObservable<boolean | undefined>;
|
|
420
|
+
/**
|
|
421
|
+
* Дополнительные данные-метрики по HTTP соединению
|
|
422
|
+
*/
|
|
423
|
+
httpConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
424
|
+
/**
|
|
425
|
+
* Данные по загрузке по сети
|
|
426
|
+
*/
|
|
427
|
+
httpDownloadMetrics$: IValueObservable<HttpDownloadMetrics | undefined>;
|
|
420
428
|
/**
|
|
421
429
|
* Состояние подключения Chromecast
|
|
422
430
|
*/
|
|
@@ -618,6 +626,19 @@ export declare enum HttpConnectionType {
|
|
|
618
626
|
HTTP2 = "http2",
|
|
619
627
|
QUIC = "quic"
|
|
620
628
|
}
|
|
629
|
+
export interface HttpConnectionMetrics {
|
|
630
|
+
dnsResolveTime: number;
|
|
631
|
+
tcpHandshakeTime: number;
|
|
632
|
+
tlsHandshakeTime: number;
|
|
633
|
+
totalConnectTime: number;
|
|
634
|
+
url: string;
|
|
635
|
+
networkType: string;
|
|
636
|
+
}
|
|
637
|
+
export interface HttpDownloadMetrics {
|
|
638
|
+
bytes: number;
|
|
639
|
+
speed: number;
|
|
640
|
+
url: string;
|
|
641
|
+
}
|
|
621
642
|
export declare enum SeekOperationState {
|
|
622
643
|
None = "none",
|
|
623
644
|
Requested = "requested",
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { HttpConnectionType } from '../../../player/types';
|
|
1
|
+
import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from '../../../player/types';
|
|
2
2
|
import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
|
|
3
3
|
import { Byte, IValueSubject, ISubject, Milliseconds, IRange, ITracer, IError } from '@vkontakte/videoplayer-shared';
|
|
4
4
|
import { CommonInit, GenericContainerParser, Segment, SegmentReference } from '../../../providers/utils/parsers/types';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Navigator {
|
|
7
|
+
connection: {
|
|
8
|
+
effectiveType: string;
|
|
9
|
+
downlink: number;
|
|
10
|
+
rtt: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
5
14
|
export declare enum RangeMethod {
|
|
6
15
|
HEADER = 0,
|
|
7
16
|
PARAM = 1
|
|
@@ -45,14 +54,24 @@ export declare class Fetcher {
|
|
|
45
54
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
46
55
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
47
56
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
57
|
+
lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
58
|
+
lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
|
|
48
59
|
recoverableError$: ISubject<IError>;
|
|
49
60
|
error$: ISubject<IError>;
|
|
50
61
|
private abortAllController;
|
|
51
62
|
private readonly subscription;
|
|
52
63
|
private compatibilityMode;
|
|
53
64
|
private useEnableSubtitlesParam;
|
|
65
|
+
private performanceObserver;
|
|
66
|
+
private pendingConnectionMetrics;
|
|
54
67
|
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
|
|
55
68
|
private onHeadersReceived;
|
|
69
|
+
private setupPerformanceObserver;
|
|
70
|
+
private processPerformanceResourceTiming;
|
|
71
|
+
private estimateNetworkType;
|
|
72
|
+
private extractConnectionMetrics;
|
|
73
|
+
private findMatchingRequest;
|
|
74
|
+
private trackRequestStart;
|
|
56
75
|
fetchManifest: (param_0: string) => Promise<string | null | undefined>;
|
|
57
76
|
fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
|
|
58
77
|
fetchRepresentation(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, fetchParams: FetchParams): Promise<RepresentationFetchResult | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpConnectionType, VideoCodec } from '../../../player/types';
|
|
1
|
+
import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from '../../../player/types';
|
|
2
2
|
import { LiveStreamStatus } from './types';
|
|
3
3
|
import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from '../../../providers/utils/parsers/types';
|
|
4
4
|
import StateMachine from '../../../utils/StateMachine/StateMachine';
|
|
@@ -50,6 +50,8 @@ export declare class Player {
|
|
|
50
50
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
51
51
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
52
52
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
53
|
+
lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
54
|
+
lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
|
|
53
55
|
currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
|
|
54
56
|
private timeoutSourceOpenId;
|
|
55
57
|
isLive$: IValueSubject<boolean>;
|
|
@@ -9,6 +9,7 @@ export interface Dependencies {
|
|
|
9
9
|
compatibilityMode?: boolean;
|
|
10
10
|
manifest: Manifest | null;
|
|
11
11
|
getCurrentPosition(): Milliseconds | undefined;
|
|
12
|
+
getCurrentStallDuration(): Milliseconds;
|
|
12
13
|
isActiveLowLatency(): boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface IVirtualBufferManager {
|
|
@@ -27,7 +28,7 @@ export interface IVirtualBufferManager {
|
|
|
27
28
|
setTarget(time: Milliseconds): void;
|
|
28
29
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
29
30
|
findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
|
|
30
|
-
calculateDurationFromSegments(): Milliseconds;
|
|
31
|
+
calculateDurationFromSegments(representationId: Representation['id']): Milliseconds;
|
|
31
32
|
destroy(): void;
|
|
32
33
|
get lastDataObtainedTimestamp(): Milliseconds;
|
|
33
34
|
}
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
CHANGED
|
@@ -44,7 +44,8 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
44
44
|
protected downloadAbortController: AbortController;
|
|
45
45
|
protected subscription: Subscription;
|
|
46
46
|
protected readonly getCurrentPosition: () => Milliseconds | undefined;
|
|
47
|
-
protected
|
|
47
|
+
protected readonly getCurrentStallDuration: () => Milliseconds | undefined;
|
|
48
|
+
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tuning, getCurrentPosition, getCurrentStallDuration, manifest }: Dependencies);
|
|
48
49
|
protected abstract loadItems(itemsToLoad: IBufferPlaybackQueueItem<T>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
49
50
|
protected abstract selectItemsToLoad(): IBufferPlaybackQueueItem<T>[];
|
|
50
51
|
protected abstract prepareFetchParams(items: IBufferPlaybackQueueItem<T>[], representation: Representation): FetchParamsWithUrl;
|
|
@@ -59,7 +60,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
59
60
|
abort(): Promise<void>;
|
|
60
61
|
findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
|
|
61
62
|
getRepresentationInitialTime(): Seconds;
|
|
62
|
-
calculateDurationFromSegments(): Milliseconds;
|
|
63
|
+
calculateDurationFromSegments(representationId: Representation['id']): Milliseconds;
|
|
63
64
|
get lastDataObtainedTimestamp(): Milliseconds;
|
|
64
65
|
setTarget(time: Milliseconds): void;
|
|
65
66
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { HttpConnectionType } from '../../../player/types';
|
|
1
|
+
import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from '../../../player/types';
|
|
2
2
|
import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
|
|
3
3
|
import { Byte, IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
4
4
|
import { CommonInit, GenericContainerParser, Segment, SegmentReference } from '../../../providers/utils/parsers/types';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Navigator {
|
|
7
|
+
connection: {
|
|
8
|
+
effectiveType: string;
|
|
9
|
+
downlink: number;
|
|
10
|
+
rtt: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
5
14
|
export declare enum RangeMethod {
|
|
6
15
|
HEADER = 0,
|
|
7
16
|
PARAM = 1
|
|
@@ -44,14 +53,24 @@ export declare class Fetcher {
|
|
|
44
53
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
45
54
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
46
55
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
56
|
+
lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
57
|
+
lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
|
|
47
58
|
recoverableError$: ISubject<IError>;
|
|
48
59
|
error$: ISubject<IError>;
|
|
49
60
|
private abortAllController;
|
|
50
61
|
private subscription;
|
|
51
62
|
private compatibilityMode;
|
|
52
63
|
private useEnableSubtitlesParam;
|
|
64
|
+
private performanceObserver;
|
|
65
|
+
private pendingConnectionMetrics;
|
|
53
66
|
constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
|
|
54
67
|
private onHeadersReceived;
|
|
68
|
+
private setupPerformanceObserver;
|
|
69
|
+
private processResourceTiming;
|
|
70
|
+
private estimateNetworkType;
|
|
71
|
+
private extractConnectionMetrics;
|
|
72
|
+
private findMatchingRequest;
|
|
73
|
+
private trackRequestStart;
|
|
55
74
|
fetchManifest: (param_0: string) => Promise<string | null | undefined>;
|
|
56
75
|
fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
|
|
57
76
|
fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, priority?: Priority): Promise<RepresentationFetchResult<T> | null | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHLSSource, HttpConnectionType, VideoCodec } from '../../../../player/types';
|
|
1
|
+
import { IHLSSource, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from '../../../../player/types';
|
|
2
2
|
import { LiveStreamStatus } from '../types';
|
|
3
3
|
import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from '../../../../providers/utils/parsers/types';
|
|
4
4
|
import StateMachine from '../../../../utils/StateMachine/StateMachine';
|
|
@@ -45,6 +45,8 @@ export declare abstract class BasePlayer {
|
|
|
45
45
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
46
46
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
47
47
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
48
|
+
lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
49
|
+
lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
|
|
48
50
|
currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
|
|
49
51
|
private timeoutSourceOpenId;
|
|
50
52
|
isLive$: IValueSubject<boolean>;
|
|
@@ -74,7 +76,7 @@ export declare abstract class BasePlayer {
|
|
|
74
76
|
switchRepresentation(kind: StreamKind, id: Representation['id'], isAuto?: boolean): Promise<void>;
|
|
75
77
|
seek(requestedPosition: Milliseconds, forcePrecise?: boolean): Promise<void>;
|
|
76
78
|
warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
|
|
77
|
-
calculateDurationFromSegments(): Milliseconds;
|
|
79
|
+
calculateDurationFromSegments(representationId: Representation['id']): Milliseconds;
|
|
78
80
|
get isStreamEnded(): boolean;
|
|
79
81
|
getStreams(): Manifest['streams'] | undefined;
|
|
80
82
|
getCodecs(): Manifest['codecs'] | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ITuningConfig } from '../utils/tuningConfig';
|
|
2
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
|
-
import { HttpConnectionType, VideoCodec, AudioCodec, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
|
|
4
|
+
import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec, AudioCodec, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
|
|
5
5
|
import { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackState, PlaybackRate } from '../player/types';
|
|
6
6
|
import { IStateMachine } from '../utils/StateMachine/types';
|
|
7
7
|
import ThroughputEstimator from '../utils/ThroughputEstimator';
|
|
@@ -80,6 +80,8 @@ export interface IProviderOutput {
|
|
|
80
80
|
hostname$: IValueSubject<string | undefined>;
|
|
81
81
|
httpConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
82
82
|
httpConnectionReused$: IValueSubject<boolean | undefined>;
|
|
83
|
+
httpConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
|
|
84
|
+
httpDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
|
|
83
85
|
element$: IValueSubject<HTMLVideoElement | undefined>;
|
|
84
86
|
elementVisible$: IValueSubject<boolean>;
|
|
85
87
|
availableSources$: IValueSubject<ISources | undefined>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ITuningConfig } from '../../utils/tuningConfig';
|
|
2
|
+
import { Manifest } from './parsers/types';
|
|
3
|
+
/** @mutates streams.video */
|
|
4
|
+
export declare const applyVideoStreamRepresentaionsFilter: (streams: Manifest["streams"], videoStreamRepresentaionsFilter: ITuningConfig["dash"]["videoStreamRepresentaionsFilter"]) => void;
|
|
@@ -124,6 +124,11 @@ export type ITuningConfig = {
|
|
|
124
124
|
ignoreNetworkErrorsOnLoadInit: boolean;
|
|
125
125
|
bufferTolerance: Milliseconds;
|
|
126
126
|
actionTimeShiftFromSegment: Milliseconds;
|
|
127
|
+
tickMaintainInterval: Milliseconds;
|
|
128
|
+
minSafeBufferToPlay: Milliseconds;
|
|
129
|
+
useBufferHoldingOnlyOnStall: boolean;
|
|
130
|
+
useNewStallExitPolicy: boolean;
|
|
131
|
+
videoStreamRepresentaionsFilter: [VideoQuality, number][];
|
|
127
132
|
};
|
|
128
133
|
dashCmafLive: {
|
|
129
134
|
externalStopControl: boolean;
|