@vkontakte/videoplayer-core 2.0.129-dev.93c0f27a.0 → 2.0.129-dev.d16e5b92.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 +31 -31
- package/es2015.esm.js +30 -30
- package/es2018.cjs.js +29 -29
- package/es2018.esm.js +27 -27
- package/esnext.cjs.js +23 -23
- package/esnext.esm.js +20 -20
- package/evergreen.esm.js +24 -24
- package/package.json +2 -2
- package/types/player/Player.d.ts +8 -2
- package/types/player/types.d.ts +9 -1
- package/types/providers/DashProvider/baseDashProvider.d.ts +9 -4
- package/types/providers/DashProvider/lib/buffer.d.ts +1 -1
- package/types/providers/DashProvider/lib/player.d.ts +10 -5
- package/types/providers/ProviderContainer/index.d.ts +1 -1
- package/types/providers/ProviderContainer/types.d.ts +1 -0
- package/types/providers/types.d.ts +3 -1
- package/types/providers/utils/HTMLVideoElement/observable.d.ts +1 -0
- package/types/providers/utils/StallsManager.d.ts +2 -1
- package/types/utils/autoSelectTrack.d.ts +5 -0
- package/types/utils/tuningConfig.d.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.129-dev.
|
|
3
|
+
"version": "2.0.129-dev.d16e5b92.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.57-dev.1524525f.0",
|
|
53
53
|
"hls.js": "~1.4.7"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IOptionalTuningConfig } from '../utils/tuningConfig';
|
|
2
|
-
import { IError, ILogEntry, Seconds, Subject, ValueSubject,
|
|
2
|
+
import { IError, ILogEntry, ITracer, QualityLimits, Seconds, Subject, ValueSubject, VideoQuality } 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;
|
|
@@ -40,6 +40,7 @@ export default class Player implements IPlayer {
|
|
|
40
40
|
currentAudioStream$: ValueSubject<IVideoStream | undefined>;
|
|
41
41
|
availableAudioTracks$: ValueSubject<import("./types").IBaseTrack[]>;
|
|
42
42
|
isAudioAvailable$: ValueSubject<boolean>;
|
|
43
|
+
isAudioOnly$: ValueSubject<boolean>;
|
|
43
44
|
currentPlaybackRate$: ValueSubject<number>;
|
|
44
45
|
currentBuffer$: ValueSubject<StartEnd<number>>;
|
|
45
46
|
isBuffering$: ValueSubject<boolean>;
|
|
@@ -47,7 +48,7 @@ export default class Player implements IPlayer {
|
|
|
47
48
|
isEnded$: ValueSubject<boolean>;
|
|
48
49
|
isLooped$: ValueSubject<boolean>;
|
|
49
50
|
isLive$: ValueSubject<boolean | undefined>;
|
|
50
|
-
isLiveEnded$: ValueSubject<boolean |
|
|
51
|
+
isLiveEnded$: ValueSubject<boolean | undefined>;
|
|
51
52
|
canChangePlaybackSpeed$: ValueSubject<boolean | undefined>;
|
|
52
53
|
atLiveEdge$: ValueSubject<boolean | undefined>;
|
|
53
54
|
atLiveDurationEdge$: ValueSubject<boolean | undefined>;
|
|
@@ -113,6 +114,8 @@ export default class Player implements IPlayer {
|
|
|
113
114
|
getCurrentTime$: ValueSubject<null>;
|
|
114
115
|
};
|
|
115
116
|
constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
|
|
117
|
+
setAudioOnly(value: boolean): IPlayer;
|
|
118
|
+
isAudioOnly(): boolean;
|
|
116
119
|
initVideo(config: IConfig): IPlayer;
|
|
117
120
|
destroy(): void;
|
|
118
121
|
prepare(): IPlayer;
|
|
@@ -180,9 +183,12 @@ export default class Player implements IPlayer {
|
|
|
180
183
|
releaseCamera(): this;
|
|
181
184
|
getExactTime(): Seconds;
|
|
182
185
|
getAllLogs(): ILogEntry[];
|
|
186
|
+
private isAudioOnlyPossible;
|
|
183
187
|
private getScene3D;
|
|
184
188
|
private setIntrinsicVideoSize;
|
|
185
189
|
private initDesiredStateSubscriptions;
|
|
190
|
+
private readonly handleProviderWillSeek;
|
|
191
|
+
private readonly handleProviderSeekedEvent;
|
|
186
192
|
private initProviderContainerSubscription;
|
|
187
193
|
private initChromecastSubscription;
|
|
188
194
|
private initStartingVideoTrack;
|
package/types/player/types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface StartEnd<Unit extends number> {
|
|
|
7
7
|
export interface IPlayer {
|
|
8
8
|
info: IPlayerInfo;
|
|
9
9
|
events: IPlayerEvents;
|
|
10
|
+
setAudioOnly(value: boolean): IPlayer;
|
|
11
|
+
isAudioOnly(): boolean;
|
|
10
12
|
/**
|
|
11
13
|
* Инициализация видео
|
|
12
14
|
*/
|
|
@@ -256,6 +258,12 @@ export interface IPlayerInfo {
|
|
|
256
258
|
* default value: true
|
|
257
259
|
*/
|
|
258
260
|
isAudioAvailable$: IValueSubject<boolean>;
|
|
261
|
+
/**
|
|
262
|
+
* Режим "только звук"
|
|
263
|
+
*
|
|
264
|
+
* default value: false
|
|
265
|
+
*/
|
|
266
|
+
isAudioOnly$: IValueSubject<boolean>;
|
|
259
267
|
/**
|
|
260
268
|
* Реальное качество, в котором сейчас воспроизводится видео.
|
|
261
269
|
*
|
|
@@ -313,7 +321,7 @@ export interface IPlayerInfo {
|
|
|
313
321
|
/**
|
|
314
322
|
* Был ли завершен бесконечный стрим
|
|
315
323
|
*/
|
|
316
|
-
isLiveEnded$: IValueObservable<boolean |
|
|
324
|
+
isLiveEnded$: IValueObservable<boolean | undefined>;
|
|
317
325
|
/**
|
|
318
326
|
* Доступно ли ускоренное воспроизведении в лайв трансляции
|
|
319
327
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack } from '../../player/types';
|
|
1
|
+
import { IAudioTrack, IBaseTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack } from '../../player/types';
|
|
2
2
|
import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, Stream } from './lib/types';
|
|
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,
|
|
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';
|
|
@@ -40,12 +40,17 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
40
40
|
protected videoStreamsMap: Map<Stream, IVideoTrack[]>;
|
|
41
41
|
protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
|
|
42
42
|
protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
|
|
43
|
-
protected audioTrackSwitchHistory: TrackHistory<
|
|
43
|
+
protected audioTrackSwitchHistory: TrackHistory<IBaseTrack>;
|
|
44
44
|
constructor(params: IParams);
|
|
45
|
+
protected getDesiredAudioOnly(): boolean;
|
|
45
46
|
protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
46
47
|
protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
|
|
47
48
|
protected subscribe(): void;
|
|
48
|
-
protected
|
|
49
|
+
protected getForwardBufferHealth(isAuto: boolean): number;
|
|
50
|
+
protected selectVideoAudioRepresentations(): {
|
|
51
|
+
video?: Representation;
|
|
52
|
+
audio?: Representation;
|
|
53
|
+
};
|
|
49
54
|
protected prepare(manifestOffset?: number): void;
|
|
50
55
|
protected syncPlayback: () => undefined;
|
|
51
56
|
protected init3DScene: (init: CommonInit) => void;
|
|
@@ -108,7 +108,7 @@ export declare class BufferManager {
|
|
|
108
108
|
private pruneBuffer;
|
|
109
109
|
private abortBuffer;
|
|
110
110
|
getDebugBufferState(): IRange<Milliseconds> | undefined;
|
|
111
|
-
getForwardBufferDuration(): Milliseconds;
|
|
111
|
+
getForwardBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
|
|
112
112
|
private detectGaps;
|
|
113
113
|
private detectGapsWhenIdle;
|
|
114
114
|
private checkEjectedSegments;
|
|
@@ -23,10 +23,10 @@ export declare class Player {
|
|
|
23
23
|
private manifest;
|
|
24
24
|
private tuning;
|
|
25
25
|
private tracer;
|
|
26
|
-
private videoBufferManager
|
|
27
|
-
private audioBufferManager
|
|
26
|
+
private videoBufferManager?;
|
|
27
|
+
private audioBufferManager?;
|
|
28
28
|
private bufferManagers;
|
|
29
|
-
private liveTextManager
|
|
29
|
+
private liveTextManager?;
|
|
30
30
|
private throughputEstimator;
|
|
31
31
|
private subscription;
|
|
32
32
|
private representationSubscription;
|
|
@@ -42,7 +42,8 @@ export declare class Player {
|
|
|
42
42
|
lastConnectionReused$: IValueSubject<boolean | undefined>;
|
|
43
43
|
lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
|
|
44
44
|
currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
|
|
45
|
-
|
|
45
|
+
private timeoutSourceOpenId;
|
|
46
|
+
isLive$: IValueSubject<boolean | undefined>;
|
|
46
47
|
isActiveLive$: IValueSubject<boolean>;
|
|
47
48
|
isLowLatency$: IValueSubject<boolean>;
|
|
48
49
|
liveDuration$: IValueSubject<Milliseconds>;
|
|
@@ -66,15 +67,19 @@ export declare class Player {
|
|
|
66
67
|
private gapWatchdogSubscription;
|
|
67
68
|
private stallWatchdogSubscription;
|
|
68
69
|
private livePauseWatchdogSubscription;
|
|
70
|
+
private isAudioOnly;
|
|
69
71
|
private destroyController;
|
|
70
72
|
constructor(params: Params);
|
|
73
|
+
setAudioOnly(value: boolean): void;
|
|
71
74
|
initManifest: (param_0: HTMLVideoElement, param_1: string, param_2: number) => Promise<void | undefined>;
|
|
72
75
|
updateManifest: () => Promise<Manifest | null | undefined>;
|
|
73
76
|
seekLive(nextOffset: Milliseconds): Promise<void>;
|
|
74
|
-
initRepresentations: (param_0: string, param_1: string | undefined, param_2: import("../../../player/types").URLSource | undefined) => Promise<void | undefined>;
|
|
77
|
+
initRepresentations: (param_0: string | undefined, param_1: string | undefined, param_2: import("../../../player/types").URLSource | undefined) => Promise<void | undefined>;
|
|
75
78
|
initBuffer(): void;
|
|
76
79
|
switchRepresentation(kind: StreamKind, id: Representation['id'], dropBuffer?: boolean): Promise<void>;
|
|
77
80
|
seek(requestedPosition: Milliseconds, forcePrecise: boolean): Promise<void>;
|
|
81
|
+
warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
|
|
82
|
+
get isStreamEnded(): boolean;
|
|
78
83
|
stop(): void;
|
|
79
84
|
setBufferTarget(time: Milliseconds): void;
|
|
80
85
|
getStreams(): Manifest['streams'] | undefined;
|
|
@@ -30,7 +30,7 @@ export default class ProviderContainer implements IProviderContainer {
|
|
|
30
30
|
init(): void;
|
|
31
31
|
destroy(): void;
|
|
32
32
|
private initProvider;
|
|
33
|
-
|
|
33
|
+
reinitProvider(): void;
|
|
34
34
|
private switchToNextProvider;
|
|
35
35
|
private destroyProvider;
|
|
36
36
|
private createProvider;
|
|
@@ -44,6 +44,7 @@ export interface IDesiredState {
|
|
|
44
44
|
currentTextTrack: IStateMachine<ITextTrack['id'] | undefined>;
|
|
45
45
|
textTrackCuesSettings: IStateMachine<ICueSettings>;
|
|
46
46
|
cameraOrientation: IStateMachine<Vector2D>;
|
|
47
|
+
isAudioOnly: IStateMachine<boolean>;
|
|
47
48
|
}
|
|
48
49
|
export interface IProviderOutput {
|
|
49
50
|
position$: IValueSubject<Seconds>;
|
|
@@ -61,13 +62,14 @@ export interface IProviderOutput {
|
|
|
61
62
|
availableTextTracks$: IValueSubject<ITextTrack[]>;
|
|
62
63
|
currentTextTrack$: IValueSubject<ITextTrack['id'] | undefined>;
|
|
63
64
|
isAudioAvailable$: IValueSubject<boolean>;
|
|
65
|
+
isAudioOnlyAvailable$: IValueSubject<boolean>;
|
|
64
66
|
autoVideoTrackLimits$: IValueSubject<QualityLimits | undefined>;
|
|
65
67
|
autoVideoTrackLimitingAvailable$: IValueSubject<boolean>;
|
|
66
68
|
canChangePlaybackSpeed$: IValueSubject<boolean | undefined>;
|
|
67
69
|
currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
|
|
68
70
|
isBuffering$: IValueSubject<boolean>;
|
|
69
71
|
isLive$: IValueSubject<boolean | undefined>;
|
|
70
|
-
isLiveEnded$: IValueSubject<boolean |
|
|
72
|
+
isLiveEnded$: IValueSubject<boolean | undefined>;
|
|
71
73
|
isLowLatency$: IValueSubject<boolean | undefined>;
|
|
72
74
|
liveTime$: IValueSubject<Milliseconds | undefined>;
|
|
73
75
|
liveBufferTime$: IValueSubject<Milliseconds | undefined>;
|
|
@@ -6,6 +6,7 @@ export interface IObservableVideo {
|
|
|
6
6
|
canplay$: IObservable<undefined>;
|
|
7
7
|
ended$: IObservable<undefined>;
|
|
8
8
|
looped$: IObservable<Seconds>;
|
|
9
|
+
loopExpected$: IObservable<undefined>;
|
|
9
10
|
error$: IObservable<IError>;
|
|
10
11
|
seeked$: IObservable<undefined>;
|
|
11
12
|
seeking$: IObservable<undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps } from '@vkontakte/videoplayer-shared';
|
|
1
|
+
import { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps, Seconds } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { IVideoTrack } from '../../player/types';
|
|
3
3
|
import { ITuningConfig } from '../../utils/tuningConfig';
|
|
4
4
|
interface IConnectData {
|
|
@@ -7,6 +7,7 @@ interface IConnectData {
|
|
|
7
7
|
rtt$: IValueSubject<Milliseconds>;
|
|
8
8
|
isBuffering$: IObservable<boolean>;
|
|
9
9
|
isSeeked$: IObservable<boolean>;
|
|
10
|
+
looped$: IObservable<Seconds>;
|
|
10
11
|
currentStallDuration$: IObservable<Milliseconds>;
|
|
11
12
|
qualityLimitsOnStall: ITuningConfig['dash']['qualityLimitsOnStall'];
|
|
12
13
|
}
|
|
@@ -27,5 +27,10 @@ export declare class TrackHistory<T extends IBaseTrack> {
|
|
|
27
27
|
export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
|
|
28
28
|
export declare const getMinPossibleAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
|
|
29
29
|
export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, abrLogger, }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
30
|
+
/**
|
|
31
|
+
* Выбор аудио для режима "только звук"
|
|
32
|
+
* Просто берём лучшее качество
|
|
33
|
+
*/
|
|
34
|
+
export declare const autoSelectAudioTrack: (audioTracks: IAudioTrack[]) => IAudioTrack;
|
|
30
35
|
export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, stallsPredictedThroughput, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
31
36
|
export {};
|
|
@@ -61,6 +61,7 @@ export type ITuningConfig = {
|
|
|
61
61
|
forwardBufferTargetAuto: Milliseconds;
|
|
62
62
|
forwardBufferTargetManual: Milliseconds;
|
|
63
63
|
forwardBufferTargetPreload: Milliseconds;
|
|
64
|
+
seekBiasInTheEnd: Milliseconds;
|
|
64
65
|
maxSegmentDurationLeftToSelectNextSegment: Milliseconds;
|
|
65
66
|
minSafeBufferThreshold: number;
|
|
66
67
|
bufferPruningSafeZone: Milliseconds;
|
|
@@ -73,11 +74,15 @@ export type ITuningConfig = {
|
|
|
73
74
|
useFetchPriorityHints: boolean;
|
|
74
75
|
qualityLimitsOnStall: {
|
|
75
76
|
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
77
|
+
stallDurationToBeCount: Milliseconds;
|
|
76
78
|
stallCountBeforeQualityDecrease: Milliseconds;
|
|
77
79
|
resetQualityRestrictionTimeout: Milliseconds;
|
|
80
|
+
ignoreStallsOnSeek: boolean;
|
|
78
81
|
};
|
|
79
82
|
enableBaseUrlSupport: boolean;
|
|
80
83
|
maxSegmentRetryCount: number;
|
|
84
|
+
sourceOpenTimeout: number;
|
|
85
|
+
rejectOnSourceOpenTimeout: boolean;
|
|
81
86
|
};
|
|
82
87
|
dashCmafLive: {
|
|
83
88
|
maxActiveLiveOffset: Milliseconds;
|
|
@@ -141,6 +146,7 @@ export type ITuningConfig = {
|
|
|
141
146
|
stripRangeHeader: boolean;
|
|
142
147
|
flushShortLoopedBuffers: boolean;
|
|
143
148
|
insufficientBufferRuleMargin: Milliseconds;
|
|
149
|
+
seekNearDurationBias: Seconds;
|
|
144
150
|
dashSeekInSegmentDurationThreshold: Milliseconds;
|
|
145
151
|
dashSeekInSegmentAlwaysSeekDelta: Milliseconds;
|
|
146
152
|
endGapTolerance: Milliseconds;
|