@vkontakte/videoplayer-core 2.0.123-dev.c995f51b.0 → 2.0.123-dev.d53feee8.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 +29 -27
- package/es2015.esm.js +29 -27
- package/es2018.cjs.js +27 -25
- package/es2018.esm.js +25 -23
- package/esnext.cjs.js +27 -25
- package/esnext.esm.js +27 -25
- package/evergreen.esm.js +23 -21
- package/package.json +2 -2
- package/types/player/Player.d.ts +1 -2
- package/types/player/types.d.ts +2 -4
- package/types/providers/ChromecastProvider/ChromecastInitializer/index.d.ts +8 -7
- package/types/providers/DashProvider/lib/buffer.d.ts +3 -1
- package/types/providers/DashProvider/lib/fetcher.d.ts +1 -4
- package/types/providers/DashProvider/lib/player.d.ts +2 -4
- package/types/providers/DashProvider/lib/sourceBufferTaskQueue.d.ts +1 -0
- package/types/providers/HlsLiveProvider/LiveTextManager.d.ts +39 -0
- package/types/providers/HlsLiveProvider/index.d.ts +2 -0
- package/types/providers/HlsProvider/manifestDataExtractor.d.ts +1 -1
- package/types/providers/types.d.ts +1 -2
- package/types/providers/utils/HTMLVideoElement/TextTrackManager.d.ts +2 -0
- package/types/providers/utils/StallsManager.d.ts +1 -0
- package/types/utils/buffer/isSourceBufferValid.d.ts +3 -0
- package/types/utils/tuningConfig.d.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.123-dev.
|
|
3
|
+
"version": "2.0.123-dev.d53feee8.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": "1.0.52-dev.
|
|
52
|
+
"@vkontakte/videoplayer-shared": "1.0.52-dev.7d7546b4.0",
|
|
53
53
|
"hls.js": "~1.4.7"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -88,7 +88,6 @@ export default class Player implements IPlayer {
|
|
|
88
88
|
watchCoverageLive$: Subject<StartEnd<number>>;
|
|
89
89
|
managedError$: Subject<IError>;
|
|
90
90
|
fatalError$: Subject<IError>;
|
|
91
|
-
fetcherRecoverableError$: Subject<IError>;
|
|
92
91
|
ended$: Subject<void>;
|
|
93
92
|
looped$: Subject<number>;
|
|
94
93
|
seeked$: Subject<void>;
|
|
@@ -99,13 +98,13 @@ export default class Player implements IPlayer {
|
|
|
99
98
|
firstFrame$: Subject<number>;
|
|
100
99
|
canplay$: Subject<number>;
|
|
101
100
|
log$: Subject<ILogEntry>;
|
|
102
|
-
fetcherError$: Subject<IError>;
|
|
103
101
|
};
|
|
104
102
|
experimental: {
|
|
105
103
|
element$: ValueSubject<HTMLVideoElement | undefined>;
|
|
106
104
|
tuningConfigName$: ValueSubject<string[]>;
|
|
107
105
|
enableDebugTelemetry$: ValueSubject<boolean>;
|
|
108
106
|
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
107
|
+
getCurrentTime$: ValueSubject<null>;
|
|
109
108
|
};
|
|
110
109
|
constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
|
|
111
110
|
initVideo(config: IConfig): IPlayer;
|
package/types/player/types.d.ts
CHANGED
|
@@ -71,6 +71,8 @@ export interface IPlayer {
|
|
|
71
71
|
tuningConfigName$: IValueSubject<string[]>;
|
|
72
72
|
enableDebugTelemetry$: IValueSubject<boolean>;
|
|
73
73
|
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
74
|
+
/** функция вычисления текущей позиции проигрывания из под провадера (если расчет нестандартный) */
|
|
75
|
+
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
@@ -187,10 +189,6 @@ export interface IPlayerEvents {
|
|
|
187
189
|
* Логи для отладки
|
|
188
190
|
*/
|
|
189
191
|
log$: IObservable<ILogEntry>;
|
|
190
|
-
/**
|
|
191
|
-
* Ошибки запроса данных, которые должны полечится перезапуском плеера
|
|
192
|
-
*/
|
|
193
|
-
fetcherRecoverableError$: IObservable<IError>;
|
|
194
192
|
}
|
|
195
193
|
export interface IPlayerInfo {
|
|
196
194
|
/**
|
|
@@ -9,14 +9,15 @@ interface IParams {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export declare class ChromecastInitializer implements IChromecastInitializer {
|
|
12
|
-
connection$: IValueSubject<IChromecastConnection | undefined>;
|
|
13
|
-
castState$: IValueSubject<ChromecastState>;
|
|
14
|
-
errorEvent$: ISubject<IError>;
|
|
12
|
+
readonly connection$: IValueSubject<IChromecastConnection | undefined>;
|
|
13
|
+
readonly castState$: IValueSubject<ChromecastState>;
|
|
14
|
+
readonly errorEvent$: ISubject<IError>;
|
|
15
15
|
contentId?: string;
|
|
16
|
-
private realCastState$;
|
|
17
|
-
private subscription;
|
|
18
|
-
private log;
|
|
19
|
-
private params;
|
|
16
|
+
private readonly realCastState$;
|
|
17
|
+
private readonly subscription;
|
|
18
|
+
private readonly log;
|
|
19
|
+
private readonly params;
|
|
20
|
+
private isDestroyed;
|
|
20
21
|
constructor(params: IParams);
|
|
21
22
|
connect(): void;
|
|
22
23
|
disconnect(): void;
|
|
@@ -15,6 +15,7 @@ export interface Gap extends IRange<Milliseconds> {
|
|
|
15
15
|
}
|
|
16
16
|
export declare class BufferManager {
|
|
17
17
|
currentLiveSegmentServerLatency$: IValueSubject<number>;
|
|
18
|
+
currentLowLatencySegmentLength$: IValueSubject<number>;
|
|
18
19
|
currentSegmentLength$: IValueSubject<number>;
|
|
19
20
|
onLastSegment$: IValueSubject<boolean>;
|
|
20
21
|
fullyBuffered$: IValueSubject<boolean>;
|
|
@@ -64,7 +65,8 @@ export declare class BufferManager {
|
|
|
64
65
|
switchTo(newRepresentationId: Representation['id'], dropBuffer?: boolean): void | Promise<void | undefined>;
|
|
65
66
|
switchToNew(newRepresentationId: Representation['id'], dropBuffer?: boolean): void;
|
|
66
67
|
switchToOld: (param_0: string, param_1: boolean | undefined) => Promise<void | undefined>;
|
|
67
|
-
|
|
68
|
+
warmUpMediaSource(): void;
|
|
69
|
+
abort(): Promise<boolean>;
|
|
68
70
|
maintain(currentPosition?: Milliseconds | undefined): void;
|
|
69
71
|
get lastDataObtainedTimestamp(): number;
|
|
70
72
|
private searchGaps;
|
|
@@ -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,
|
|
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,
|
|
@@ -39,8 +39,6 @@ export declare class Fetcher {
|
|
|
39
39
|
lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
40
40
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
41
41
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
42
|
-
recoverableError$: Subject<IError>;
|
|
43
|
-
error$: Subject<IError>;
|
|
44
42
|
private abortAllController;
|
|
45
43
|
private subscription;
|
|
46
44
|
private compatibilityMode;
|
|
@@ -53,6 +51,5 @@ export declare class Fetcher {
|
|
|
53
51
|
destroy(): void;
|
|
54
52
|
private fetchByteRangeRepresentation;
|
|
55
53
|
private fetchTemplateRepresentation;
|
|
56
|
-
private doFetch;
|
|
57
54
|
}
|
|
58
55
|
export declare const suppressAbort: (e: Error | unknown) => void | never;
|
|
@@ -3,7 +3,7 @@ import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation }
|
|
|
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, ITracer, IValueSubject, Milliseconds, Seconds
|
|
6
|
+
import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Seconds } from '@vkontakte/videoplayer-shared';
|
|
7
7
|
export declare enum State {
|
|
8
8
|
NONE = "none",
|
|
9
9
|
MANIFEST_READY = "manifest_ready",
|
|
@@ -53,8 +53,6 @@ export declare class Player {
|
|
|
53
53
|
isActiveLowLatency$: IValueSubject<boolean>;
|
|
54
54
|
currentStallDuration$: IValueSubject<Milliseconds>;
|
|
55
55
|
videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
|
|
56
|
-
fetcherRecoverableError$: Subject<IError>;
|
|
57
|
-
fetcherError$: Subject<IError>;
|
|
58
56
|
private liveBuffer;
|
|
59
57
|
private isUpdatingLive;
|
|
60
58
|
private isJumpGapAfterSeekLive;
|
|
@@ -71,7 +69,7 @@ export declare class Player {
|
|
|
71
69
|
initRepresentations: (param_0: string, param_1: string | undefined, param_2: import("../../../player/types").URLSource | undefined) => Promise<void | undefined>;
|
|
72
70
|
initBuffer(): void;
|
|
73
71
|
switchRepresentation(kind: StreamKind, id: Representation['id'], dropBuffer?: boolean): Promise<void>;
|
|
74
|
-
seek(requestedPosition: Milliseconds, forcePrecise: boolean): void
|
|
72
|
+
seek(requestedPosition: Milliseconds, forcePrecise: boolean): Promise<void>;
|
|
75
73
|
stop(): void;
|
|
76
74
|
setBufferTarget(time: Milliseconds): void;
|
|
77
75
|
getStreams(): Manifest['streams'] | undefined;
|
|
@@ -6,6 +6,7 @@ declare class SourceBufferTaskQueue {
|
|
|
6
6
|
private queue;
|
|
7
7
|
private currentTask;
|
|
8
8
|
private destroyed;
|
|
9
|
+
private abortRequested;
|
|
9
10
|
constructor(buffer: SourceBuffer);
|
|
10
11
|
append(data: BufferSource, signal?: AbortSignal): Promise<boolean>;
|
|
11
12
|
remove(from: Milliseconds, to: Milliseconds, signal?: AbortSignal): Promise<boolean>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IInternalTextTrack } from '../../player/types';
|
|
2
|
+
import { IValueSubject, Milliseconds, IError, ISubject } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import { HLSManifestData } from '../HlsProvider/manifestDataExtractor';
|
|
4
|
+
type FetchManifestData = (url: string, init?: RequestInit) => Promise<HLSManifestData>;
|
|
5
|
+
export declare class LiveTextManager {
|
|
6
|
+
private readonly params;
|
|
7
|
+
private readonly subscription;
|
|
8
|
+
private readonly abortControllers;
|
|
9
|
+
/** в случае перемотки будет сохранена актуальная ссылка "наконечника" стрима */
|
|
10
|
+
private prepareUrl;
|
|
11
|
+
private currentTextTrackData;
|
|
12
|
+
availableTextTracks$: IValueSubject<IInternalTextTrack[] | null>;
|
|
13
|
+
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
14
|
+
error$: ISubject<IError>;
|
|
15
|
+
constructor(liveTime$: IValueSubject<Milliseconds | undefined>, video: HTMLVideoElement, fetchManifestData: FetchManifestData, sourceUrl: string, downloadThreshold: number);
|
|
16
|
+
destroy(): void;
|
|
17
|
+
/**
|
|
18
|
+
* одноименный метод из провайдера, который дергаем на перемотке,
|
|
19
|
+
* чтобы синхронизировать субтитры с видео\аудио дорожками
|
|
20
|
+
*/
|
|
21
|
+
prepare(url: string): Promise<void>;
|
|
22
|
+
/** тут, на самом деле, мы получаем ссылку на плейлисты для текстовых треков */
|
|
23
|
+
processTextTracks(textTracks: IInternalTextTrack[], baseUrl: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* @todo - пока только с 1 стримом работает
|
|
26
|
+
*/
|
|
27
|
+
private parseTextTracks;
|
|
28
|
+
/** парсим плейлист и получаем список треков */
|
|
29
|
+
private parsePlaylist;
|
|
30
|
+
/** забирает значение (value) строки в плейлисте */
|
|
31
|
+
private extractPlaylistRowValue;
|
|
32
|
+
/** обновляет ссылку на текущий сегмент субтитров для UI */
|
|
33
|
+
private processLiveTime;
|
|
34
|
+
/** догружает актуальные сабы */
|
|
35
|
+
private fetchNextManifestData;
|
|
36
|
+
private fetchManifestData;
|
|
37
|
+
private error;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -13,6 +13,7 @@ export default class HlsLiveProvider implements IProvider {
|
|
|
13
13
|
private video;
|
|
14
14
|
private params;
|
|
15
15
|
private textTracksManager;
|
|
16
|
+
private liveTextManager;
|
|
16
17
|
private masterManifest;
|
|
17
18
|
private manifests$;
|
|
18
19
|
private maxSeekBackTime$;
|
|
@@ -26,5 +27,6 @@ export default class HlsLiveProvider implements IProvider {
|
|
|
26
27
|
private playIfAllowed;
|
|
27
28
|
private seek;
|
|
28
29
|
private syncPlayback;
|
|
30
|
+
private generateLiveUrl;
|
|
29
31
|
}
|
|
30
32
|
export {};
|
|
@@ -17,5 +17,5 @@ type ExtractHLSManifestDataConfig = {
|
|
|
17
17
|
manifestRetryInterval: number;
|
|
18
18
|
manifestRetryMaxInterval: number;
|
|
19
19
|
};
|
|
20
|
-
declare const extractHLSManifestData: (masterManifestUrl: string, baseUrl: string | undefined, config: ExtractHLSManifestDataConfig) => Promise<HLSManifestData>;
|
|
20
|
+
declare const extractHLSManifestData: (masterManifestUrl: string, baseUrl: string | undefined, config: ExtractHLSManifestDataConfig, init?: RequestInit) => Promise<HLSManifestData>;
|
|
21
21
|
export default extractHLSManifestData;
|
|
@@ -80,8 +80,6 @@ export interface IProviderOutput {
|
|
|
80
80
|
willSeekEvent$: ISubject<void>;
|
|
81
81
|
seekedEvent$: ISubject<void>;
|
|
82
82
|
error$: ISubject<IError>;
|
|
83
|
-
fetcherRecoverableError$: ISubject<IError>;
|
|
84
|
-
fetcherError$: ISubject<IError>;
|
|
85
83
|
warning$: ISubject<IWarning>;
|
|
86
84
|
endedEvent$: ISubject<void>;
|
|
87
85
|
loopedEvent$: ISubject<Seconds>;
|
|
@@ -94,4 +92,5 @@ export interface IProviderOutput {
|
|
|
94
92
|
inPiP$: IValueSubject<boolean>;
|
|
95
93
|
inFullscreen$: IValueSubject<boolean>;
|
|
96
94
|
playbackState$: IValueSubject<PlaybackState | string>;
|
|
95
|
+
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
97
96
|
}
|
|
@@ -14,6 +14,8 @@ declare class TextTrackManager {
|
|
|
14
14
|
private subscription;
|
|
15
15
|
private externalTracks;
|
|
16
16
|
private internalTracks;
|
|
17
|
+
private baseURL?;
|
|
18
|
+
constructor(baseURL?: string);
|
|
17
19
|
connect(video: HTMLVideoElement, desiredState: Pick<IDesiredState, 'externalTextTracks' | 'internalTextTracks' | 'currentTextTrack' | 'textTrackCuesSettings'>, providerOutput: Pick<IProviderOutput, 'availableTextTracks$' | 'currentTextTrack$' | 'error$'>): void;
|
|
18
20
|
private subscribe;
|
|
19
21
|
private applyCueSettings;
|
|
@@ -25,6 +25,7 @@ declare class StallsManager {
|
|
|
25
25
|
private predictedThroughputWithoutData;
|
|
26
26
|
private qualityRestrictionTimer;
|
|
27
27
|
private subscription;
|
|
28
|
+
severeStallOccurred$: IValueSubject<boolean>;
|
|
28
29
|
connect(data: IConnectData): void;
|
|
29
30
|
get videoMaxQualityLimit(): ExactVideoQuality | undefined;
|
|
30
31
|
get predictedThroughput(): Kbps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VideoFormat } from '../player/types';
|
|
2
2
|
import { WebmCodecStrategy } from '../enums/WebmCodecStrategy';
|
|
3
3
|
import { AndroidPreferredFormat } from '../enums/AndroidPreferredFormat';
|
|
4
|
-
import { Byte, type ExactVideoQuality, Milliseconds, RecursivePartial, VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
4
|
+
import { Byte, type ExactVideoQuality, Milliseconds, RecursivePartial, Seconds, VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
5
5
|
export type ITuningConfig = {
|
|
6
6
|
configName: string[];
|
|
7
7
|
throughputEstimator: {
|
|
@@ -70,7 +70,6 @@ export type ITuningConfig = {
|
|
|
70
70
|
bufferEmptinessTolerance: Milliseconds;
|
|
71
71
|
useFetchPriorityHints: boolean;
|
|
72
72
|
qualityLimitsOnStall: {
|
|
73
|
-
stallDurationBeforeQualityDecrease: Milliseconds;
|
|
74
73
|
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
75
74
|
stallCountBeforeQualityDecrease: Milliseconds;
|
|
76
75
|
resetQualityRestrictionTimeout: Milliseconds;
|
|
@@ -84,6 +83,7 @@ export type ITuningConfig = {
|
|
|
84
83
|
normalizedLiveMinBufferSize: Milliseconds;
|
|
85
84
|
normalizedActualBufferOffset: Milliseconds;
|
|
86
85
|
offsetCalculationError: Milliseconds;
|
|
86
|
+
maxLiveDuration: Seconds;
|
|
87
87
|
lowLatency: {
|
|
88
88
|
maxTargetOffset: Milliseconds;
|
|
89
89
|
maxTargetOffsetDeviation: Milliseconds;
|
|
@@ -184,7 +184,13 @@ export type ITuningConfig = {
|
|
|
184
184
|
ignoreAudioRendererError: boolean;
|
|
185
185
|
useEnableSubtitlesParam: boolean;
|
|
186
186
|
useOldMSEDetection: boolean;
|
|
187
|
+
useHlsLiveNewTextManager: boolean;
|
|
187
188
|
exposeInternalsToGlobal: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* за какое время до конца текущих скачанных субтитров
|
|
191
|
+
* попробуем получить следующий сегмент субтитров
|
|
192
|
+
*/
|
|
193
|
+
hlsLiveNewTextManagerDownloadThreshold: Milliseconds;
|
|
188
194
|
};
|
|
189
195
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
|
|
190
196
|
configName: ITuningConfig['configName'];
|