@vkontakte/videoplayer-core 2.0.117-dev.d9cc3d97.0 → 2.0.118-beta.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 +26 -26
- package/es2015.esm.js +27 -27
- package/es2018.cjs.js +31 -31
- package/es2018.esm.js +28 -28
- package/esnext.cjs.js +24 -24
- package/esnext.esm.js +22 -22
- package/evergreen.esm.js +20 -21
- package/package.json +2 -2
- package/types/player/Player.d.ts +1 -1
- package/types/player/types.d.ts +5 -2
- package/types/providers/DashProvider/lib/buffer.d.ts +1 -3
- package/types/providers/DashProvider/lib/parsers/mpeg/boxes/uuid.d.ts +8 -3
- package/types/providers/DashProvider/lib/player.d.ts +2 -1
- package/types/providers/DashProvider/lib/types.d.ts +7 -1
- package/types/providers/DashProvider/lib/utils.d.ts +1 -1
- package/types/providers/HlsLiveProvider/index.d.ts +0 -2
- package/types/providers/HlsProvider/manifestDataExtractor.d.ts +1 -1
- package/types/providers/types.d.ts +1 -1
- package/types/utils/smoothedValue/smoothedValueFactory.d.ts +1 -1
- package/types/utils/tuningConfig.d.ts +1 -8
- package/types/providers/HlsLiveProvider/LiveTextManager.d.ts +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.118-beta.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
|
+
"@vkontakte/videoplayer-shared": "1.0.50-beta.0",
|
|
53
53
|
"hls.js": "~1.4.7"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export default class Player implements IPlayer {
|
|
|
49
49
|
atLiveDurationEdge$: ValueSubject<boolean | undefined>;
|
|
50
50
|
liveTime$: ValueSubject<number | undefined>;
|
|
51
51
|
liveBufferTime$: ValueSubject<number | undefined>;
|
|
52
|
+
liveLatency$: ValueSubject<number | undefined>;
|
|
52
53
|
currentFormat$: ValueSubject<VideoFormat | undefined>;
|
|
53
54
|
availableTextTracks$: ValueSubject<ITextTrack[]>;
|
|
54
55
|
currentTextTrack$: ValueSubject<string | undefined>;
|
|
@@ -102,7 +103,6 @@ export default class Player implements IPlayer {
|
|
|
102
103
|
tuningConfigName$: ValueSubject<string[]>;
|
|
103
104
|
enableDebugTelemetry$: ValueSubject<boolean>;
|
|
104
105
|
dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
|
|
105
|
-
getCurrentTime$: ValueSubject<null>;
|
|
106
106
|
};
|
|
107
107
|
constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
|
|
108
108
|
initVideo(config: IConfig): IPlayer;
|
package/types/player/types.d.ts
CHANGED
|
@@ -71,8 +71,6 @@ 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>;
|
|
76
74
|
};
|
|
77
75
|
}
|
|
78
76
|
/**
|
|
@@ -314,6 +312,10 @@ export interface IPlayerInfo {
|
|
|
314
312
|
* Буферное время текущего кадра
|
|
315
313
|
*/
|
|
316
314
|
liveBufferTime$: IValueObservable<Milliseconds | undefined>;
|
|
315
|
+
/**
|
|
316
|
+
* Задержка лайв стрима
|
|
317
|
+
*/
|
|
318
|
+
liveLatency$: IValueObservable<Milliseconds | undefined>;
|
|
317
319
|
/**
|
|
318
320
|
* Формат, в котором сейчас воспроизводится видео
|
|
319
321
|
*/
|
|
@@ -490,6 +492,7 @@ export interface IVideoTrack extends IBaseTrack {
|
|
|
490
492
|
quality: VideoQuality;
|
|
491
493
|
size?: IRectangle;
|
|
492
494
|
fps?: number;
|
|
495
|
+
streamId?: IVideoStream['id'];
|
|
493
496
|
}
|
|
494
497
|
export interface IAudioStream {
|
|
495
498
|
id: string;
|
|
@@ -14,6 +14,7 @@ export interface Gap extends IRange<Milliseconds> {
|
|
|
14
14
|
representation: Representation['id'];
|
|
15
15
|
}
|
|
16
16
|
export declare class BufferManager {
|
|
17
|
+
currentLiveSegmentServerLatency$: IValueSubject<number>;
|
|
17
18
|
currentSegmentLength$: IValueSubject<number>;
|
|
18
19
|
onLastSegment$: IValueSubject<boolean>;
|
|
19
20
|
fullyBuffered$: IValueSubject<boolean>;
|
|
@@ -51,7 +52,6 @@ export declare class BufferManager {
|
|
|
51
52
|
private baseUrlsIndex;
|
|
52
53
|
private compatibilityMode;
|
|
53
54
|
private preloadOnly;
|
|
54
|
-
private bufferAccumulation;
|
|
55
55
|
private isLive;
|
|
56
56
|
private liveUpdateSegmentIndex;
|
|
57
57
|
private liveInitialAdditionalOffset;
|
|
@@ -73,8 +73,6 @@ export declare class BufferManager {
|
|
|
73
73
|
seekLive: (param_0: Stream[] | undefined) => Promise<void | undefined>;
|
|
74
74
|
updateLive(manifest: Manifest | null): void;
|
|
75
75
|
proceedLowLatencyLive(): void;
|
|
76
|
-
startAccumulateBuffer(): void;
|
|
77
|
-
private resetAccumulateBufferAfterStall;
|
|
78
76
|
private updateLowLatencyLiveIfNeeded;
|
|
79
77
|
findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
|
|
80
78
|
setTarget(time: Milliseconds): void;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Box } from '../../../../../../providers/DashProvider/lib/parsers/mpeg/box';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
import { BoxParser } from '../../../../../../providers/DashProvider/lib/parsers/mpeg/BoxParser';
|
|
3
|
+
import { Milliseconds } from '@vkontakte/videoplayer-shared';
|
|
5
4
|
export declare class UuidBox extends Box {
|
|
5
|
+
serverDataReceivedTimestamp: Milliseconds;
|
|
6
|
+
serverDataPreparedTime: Milliseconds;
|
|
7
|
+
private readonly ondemandPrefix;
|
|
8
|
+
private readonly ondemandDataReceivedKey;
|
|
9
|
+
private readonly ondemandDataPreparedKey;
|
|
10
|
+
constructor(source: DataView, boxParser: BoxParser);
|
|
6
11
|
}
|
|
@@ -46,13 +46,14 @@ export declare class Player {
|
|
|
46
46
|
liveDuration$: IValueSubject<Milliseconds>;
|
|
47
47
|
liveAvailabilityStartTime$: IValueSubject<Seconds | undefined>;
|
|
48
48
|
bufferLength$: IValueSubject<Milliseconds>;
|
|
49
|
+
liveLatency$: IValueSubject<Milliseconds | undefined>;
|
|
49
50
|
liveLoadBufferLength$: IValueSubject<Milliseconds>;
|
|
50
51
|
livePositionFromPlayer$: IValueSubject<number>;
|
|
51
52
|
isLowLatency$: IValueSubject<boolean>;
|
|
52
53
|
isActiveLowLatency$: IValueSubject<boolean>;
|
|
53
54
|
currentStallDuration$: IValueSubject<Milliseconds>;
|
|
54
55
|
videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
|
|
55
|
-
private
|
|
56
|
+
private liveBuffer;
|
|
56
57
|
private isUpdatingLive;
|
|
57
58
|
private isJumpGapAfterSeekLive;
|
|
58
59
|
private liveLastSeekOffset;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Byte, Kbps, Milliseconds, IRange, IObservable, ISubject, IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { IDesiredState, IProviderOutput, IProviderParams } from '../../../providers/types';
|
|
3
3
|
import { IObservableVideo } from '../../../providers/utils/HTMLVideoElement/observable';
|
|
4
|
-
import { IDashURLSource } from '../../../player/types';
|
|
4
|
+
import { IDashURLSource, IVideoStream } from '../../../player/types';
|
|
5
5
|
export declare enum StreamKind {
|
|
6
6
|
VIDEO = "video",
|
|
7
7
|
AUDIO = "audio",
|
|
@@ -30,6 +30,7 @@ export interface Representation {
|
|
|
30
30
|
height: number;
|
|
31
31
|
fps?: number;
|
|
32
32
|
quality?: string;
|
|
33
|
+
streamId?: IVideoStream['id'];
|
|
33
34
|
}
|
|
34
35
|
export interface TextRepresentation extends Representation {
|
|
35
36
|
language: string;
|
|
@@ -37,6 +38,10 @@ export interface TextRepresentation extends Representation {
|
|
|
37
38
|
url: string;
|
|
38
39
|
isAuto: boolean;
|
|
39
40
|
}
|
|
41
|
+
export interface ServerLatencyTimestamps {
|
|
42
|
+
serverDataReceivedTimestamp?: Milliseconds;
|
|
43
|
+
serverDataPreparedTime?: Milliseconds;
|
|
44
|
+
}
|
|
40
45
|
export declare enum SegmentReferencingType {
|
|
41
46
|
BYTE_RANGE = "byteRange",
|
|
42
47
|
TEMPLATE = "template"
|
|
@@ -164,6 +169,7 @@ export type MpegInit = CommonInit;
|
|
|
164
169
|
export type WebmParser = GenericContainerParser<WebmInit>;
|
|
165
170
|
export type MpegParser = GenericContainerParser<MpegInit> & {
|
|
166
171
|
getChunkEndTime(data: DataView, timescale: number): Milliseconds;
|
|
172
|
+
getServerLatencyTimestamps(view: DataView): ServerLatencyTimestamps;
|
|
167
173
|
getTimescaleFromIndex(view: DataView): number | undefined;
|
|
168
174
|
};
|
|
169
175
|
export type ContainerParser = WebmParser | MpegParser;
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
export declare const representationToVideoTrack: ({ id, width, height, bitrate, fps, quality: qualityString }: Representation) => IVideoTrack | undefined;
|
|
3
|
+
export declare const representationToVideoTrack: ({ id, width, height, bitrate, fps, quality: qualityString, streamId }: Representation) => IVideoTrack | undefined;
|
|
4
4
|
export declare const representationToAudioTrack: ({ id, bitrate }: Representation) => IAudioTrack;
|
|
5
5
|
export declare const representationToTextTrack: ({ language, label }: Stream, { id, url, isAuto }: Representation & {
|
|
6
6
|
url: string;
|
|
@@ -13,7 +13,6 @@ export default class HlsLiveProvider implements IProvider {
|
|
|
13
13
|
private video;
|
|
14
14
|
private params;
|
|
15
15
|
private textTracksManager;
|
|
16
|
-
private liveTextManager;
|
|
17
16
|
private masterManifest;
|
|
18
17
|
private manifests$;
|
|
19
18
|
private maxSeekBackTime$;
|
|
@@ -27,6 +26,5 @@ export default class HlsLiveProvider implements IProvider {
|
|
|
27
26
|
private playIfAllowed;
|
|
28
27
|
private seek;
|
|
29
28
|
private syncPlayback;
|
|
30
|
-
private generateLiveUrl;
|
|
31
29
|
}
|
|
32
30
|
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
|
|
20
|
+
declare const extractHLSManifestData: (masterManifestUrl: string, baseUrl: string | undefined, config: ExtractHLSManifestDataConfig) => Promise<HLSManifestData>;
|
|
21
21
|
export default extractHLSManifestData;
|
|
@@ -70,6 +70,7 @@ export interface IProviderOutput {
|
|
|
70
70
|
isLowLatency$: IValueSubject<boolean | undefined>;
|
|
71
71
|
liveTime$: IValueSubject<Milliseconds | undefined>;
|
|
72
72
|
liveBufferTime$: IValueSubject<Milliseconds | undefined>;
|
|
73
|
+
liveLatency$: IValueSubject<Milliseconds | undefined>;
|
|
73
74
|
hostname$: IValueSubject<string | undefined>;
|
|
74
75
|
httpConnectionType$: IValueSubject<HttpConnectionType | undefined>;
|
|
75
76
|
httpConnectionReused$: IValueSubject<boolean | undefined>;
|
|
@@ -91,5 +92,4 @@ export interface IProviderOutput {
|
|
|
91
92
|
inPiP$: IValueSubject<boolean>;
|
|
92
93
|
inFullscreen$: IValueSubject<boolean>;
|
|
93
94
|
playbackState$: IValueSubject<PlaybackState | string>;
|
|
94
|
-
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
95
95
|
}
|
|
@@ -2,5 +2,5 @@ import { ITuningConfig } from '../../utils/tuningConfig';
|
|
|
2
2
|
import { ISmoothedValue } from '../../utils/smoothedValue/types';
|
|
3
3
|
export declare class SmoothedValueFactory {
|
|
4
4
|
static getSmoothedValue(initialThroughput: number, fastDirection: 1 | -1, tuning: ITuningConfig['throughputEstimator']): ISmoothedValue;
|
|
5
|
-
static
|
|
5
|
+
static getLiveBufferSmoothedValue(initialBufferLength: number, tuning: ITuningConfig['dashCmafLive']['lowLatency']['bufferEstimator']): ISmoothedValue;
|
|
6
6
|
}
|
|
@@ -69,11 +69,6 @@ export type ITuningConfig = {
|
|
|
69
69
|
enableSubSegmentBufferFeeding: boolean;
|
|
70
70
|
bufferEmptinessTolerance: Milliseconds;
|
|
71
71
|
useFetchPriorityHints: boolean;
|
|
72
|
-
accumulationBufferStallSize: {
|
|
73
|
-
shortVideoDuration: Milliseconds;
|
|
74
|
-
shortVideoBufferStallSize: Milliseconds;
|
|
75
|
-
longVideoBufferStallSize: Milliseconds;
|
|
76
|
-
};
|
|
77
72
|
qualityLimitsOnStall: {
|
|
78
73
|
stallDurationBeforeQualityDecrease: Milliseconds;
|
|
79
74
|
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
@@ -94,7 +89,7 @@ export type ITuningConfig = {
|
|
|
94
89
|
maxTargetOffsetDeviation: Milliseconds;
|
|
95
90
|
playbackCatchupSpeedup: number;
|
|
96
91
|
isActiveOnDefault: boolean;
|
|
97
|
-
|
|
92
|
+
bufferEstimator: {
|
|
98
93
|
emaAlpha: number;
|
|
99
94
|
changeThreshold: number;
|
|
100
95
|
deviationDepth: number;
|
|
@@ -153,7 +148,6 @@ export type ITuningConfig = {
|
|
|
153
148
|
useHlsJs: boolean;
|
|
154
149
|
useNativeHLSTextTracks: boolean;
|
|
155
150
|
useManagedMediaSource: boolean;
|
|
156
|
-
useNewPruneBufferStrategy: boolean;
|
|
157
151
|
useNewSwitchTo: boolean;
|
|
158
152
|
useSafariEndlessRequestBugfix: boolean;
|
|
159
153
|
isAudioDisabled: boolean;
|
|
@@ -190,7 +184,6 @@ export type ITuningConfig = {
|
|
|
190
184
|
ignoreAudioRendererError: boolean;
|
|
191
185
|
useEnableSubtitlesParam: boolean;
|
|
192
186
|
useOldMSEDetection: boolean;
|
|
193
|
-
useHlsLiveNewTextManager: boolean;
|
|
194
187
|
};
|
|
195
188
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
|
|
196
189
|
configName: ITuningConfig['configName'];
|
|
@@ -1,42 +0,0 @@
|
|
|
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 logger;
|
|
7
|
-
private readonly log;
|
|
8
|
-
private readonly params;
|
|
9
|
-
private readonly subscription;
|
|
10
|
-
private readonly abortControllers;
|
|
11
|
-
private readonly numberFormat;
|
|
12
|
-
/** в случае перемотки будет сохранена актуальная ссылка "наконечника" стрима */
|
|
13
|
-
private prepareUrl;
|
|
14
|
-
private currentTextTrackData;
|
|
15
|
-
availableTextTracks$: IValueSubject<IInternalTextTrack[] | null>;
|
|
16
|
-
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
17
|
-
error$: ISubject<IError>;
|
|
18
|
-
constructor(liveTime$: IValueSubject<Milliseconds | undefined>, video: HTMLVideoElement, fetchManifestData: FetchManifestData, sourceUrl: string);
|
|
19
|
-
destroy(): void;
|
|
20
|
-
/**
|
|
21
|
-
* одноименный метод из провайдера, который дергаем на перемотке,
|
|
22
|
-
* чтобы синхронизировать субтитры с видео\аудио дорожками
|
|
23
|
-
*/
|
|
24
|
-
prepare(url: string): Promise<void>;
|
|
25
|
-
/** тут, на самом деле, мы получаем ссылку на плейлисты для текстовых треков */
|
|
26
|
-
processTextTracks(textTracks: IInternalTextTrack[], baseUrl: string): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* @todo - пока только с 1 стримом работает
|
|
29
|
-
*/
|
|
30
|
-
private parseTextTracks;
|
|
31
|
-
/** парсим плейлист и получаем список треков */
|
|
32
|
-
private parsePlaylist;
|
|
33
|
-
/** забирает значение (value) строки в плейлисте */
|
|
34
|
-
private extractPlaylistRowValue;
|
|
35
|
-
/** обновляет ссылку на текущий сегмент субтитров для UI */
|
|
36
|
-
private processLiveTime;
|
|
37
|
-
/** догружает актуальные сабы */
|
|
38
|
-
private fetchNextManifestData;
|
|
39
|
-
private fetchManifestData;
|
|
40
|
-
private error;
|
|
41
|
-
}
|
|
42
|
-
export {};
|