@vkontakte/videoplayer-core 2.0.165 → 2.0.166-beta.1
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 +41 -41
- package/es2015.esm.js +41 -41
- package/esnext.cjs +35 -35
- package/esnext.esm.js +34 -34
- package/evergreen.esm.js +35 -35
- package/package.json +2 -2
- package/types/player/Player.d.ts +0 -39
- package/types/player/types.d.ts +2 -10
- package/types/providers/DashProvider/baseDashProvider.d.ts +1 -5
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +1 -5
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +1 -0
- package/types/providers/ProviderContainer/Mayday/MaydayService.d.ts +21 -0
- package/types/providers/ProviderContainer/Mayday/MaydayStatistics.d.ts +25 -0
- package/types/providers/ProviderContainer/Mayday/createHeuristicDeps.d.ts +3 -0
- package/types/providers/ProviderContainer/Mayday/heuristics/FetcherErrorHeuristic.d.ts +9 -0
- package/types/providers/ProviderContainer/Mayday/heuristics/IHeuristic.d.ts +7 -0
- package/types/providers/ProviderContainer/Mayday/heuristics/MediaErrorHeuristic.d.ts +9 -0
- package/types/providers/ProviderContainer/Mayday/index.d.ts +6 -0
- package/types/providers/ProviderContainer/Mayday/types.d.ts +53 -0
- package/types/providers/ProviderContainer/index.d.ts +6 -1
- package/types/providers/types.d.ts +2 -5
- package/types/providers/utils/HTMLVideoElement/DroppedFramesManager.d.ts +10 -0
- package/types/providers/utils/HTMLVideoElement/observable.d.ts +3 -1
- package/types/utils/tuningConfig.d.ts +17 -19
- package/types/utils/3d/Camera3D.d.ts +0 -14
- package/types/utils/3d/CameraRotationManager.d.ts +0 -62
- package/types/utils/3d/Scene3D.d.ts +0 -132
- package/types/utils/3d/types.d.ts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.166-beta.1",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"**/*.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vkontakte/videoplayer-shared": "1.0.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.95-beta.1"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -74,48 +74,9 @@ export default class Player implements IPlayer {
|
|
|
74
74
|
setLiveLowLatency(isLowLatency: boolean): IPlayer;
|
|
75
75
|
setLooped(isLooped: boolean): IPlayer;
|
|
76
76
|
toggleChromecast(): void;
|
|
77
|
-
/**
|
|
78
|
-
* Starts 3D-camera constant rotation
|
|
79
|
-
* Base rotation speed is provided through the tuning config
|
|
80
|
-
*
|
|
81
|
-
* @param mx - camera X rotation speed multiplier
|
|
82
|
-
* @param my - camera Y rotation speed multiplier
|
|
83
|
-
*
|
|
84
|
-
* 1 - positive direction
|
|
85
|
-
* 0.5 - half speed in positive direction
|
|
86
|
-
* 0 - no rotation
|
|
87
|
-
* -1 negative direction
|
|
88
|
-
* -2 double speed in negative direction
|
|
89
|
-
*
|
|
90
|
-
* Limitations:
|
|
91
|
-
* When camera reaches angles 180 or -180 in vertical direction it stops.
|
|
92
|
-
* z-axis is frozen for now
|
|
93
|
-
*
|
|
94
|
-
* Set all zeroes to stop the camera rotation
|
|
95
|
-
* startCameraManualRotation(0, 0);
|
|
96
|
-
*/
|
|
97
|
-
startCameraManualRotation(mx: number, my: number): this;
|
|
98
|
-
/**
|
|
99
|
-
* Rotates 3d-camera to given angles relative to current position
|
|
100
|
-
*/
|
|
101
|
-
stopCameraManualRotation(immediate?: boolean): this;
|
|
102
|
-
/**
|
|
103
|
-
* Rotates 3d-camera to given angles relative to current position
|
|
104
|
-
* using mouse deltas and scene fov
|
|
105
|
-
*/
|
|
106
|
-
moveCameraFocusPX(dxpx: number, dypx: number): this;
|
|
107
|
-
/**
|
|
108
|
-
* "Holds" camera so that it can not perform movement without manual control
|
|
109
|
-
*/
|
|
110
|
-
holdCamera(): this;
|
|
111
|
-
/**
|
|
112
|
-
* "Releases" the camera so that it can move using its internal logic
|
|
113
|
-
*/
|
|
114
|
-
releaseCamera(): this;
|
|
115
77
|
getExactTime(): Seconds;
|
|
116
78
|
getExactLiveTime(): Seconds;
|
|
117
79
|
getAllLogs(): ILogEntry[];
|
|
118
|
-
private getScene3D;
|
|
119
80
|
private setIntrinsicVideoSize;
|
|
120
81
|
private initDesiredStateSubscriptions;
|
|
121
82
|
private initProviderContainerSubscription;
|
package/types/player/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { IError, ILogEntry, IObservable, IRectangle, IValueObservable, IValueSubject, Kbps, Milliseconds, QualityLimits, Seconds, Subject, ValueSubject, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
import type { Pixel } from "../utils/3d/types";
|
|
3
2
|
import type { dump } from "../utils/playbackTelemetry";
|
|
4
3
|
export interface StartEnd<Unit extends number> {
|
|
5
4
|
start: Unit;
|
|
@@ -54,11 +53,6 @@ export interface IPlayer {
|
|
|
54
53
|
* Установить предопределенные настройки лимитов.
|
|
55
54
|
*/
|
|
56
55
|
setPredefinedQualityLimits(type: PredefinedQualityLimits): IPlayer;
|
|
57
|
-
startCameraManualRotation(mx: number, my: number): IPlayer;
|
|
58
|
-
stopCameraManualRotation(immediate: boolean): IPlayer;
|
|
59
|
-
moveCameraFocusPX(mx: Pixel, my: Pixel, dt: number): IPlayer;
|
|
60
|
-
holdCamera(): IPlayer;
|
|
61
|
-
releaseCamera(): IPlayer;
|
|
62
56
|
setPlaybackRate(playbackRate: PlaybackRate): IPlayer;
|
|
63
57
|
setLooped(isLooped: boolean): IPlayer;
|
|
64
58
|
setExternalTextTracks(tracks: Omit<IExternalTextTrack, "type">[]): IPlayer;
|
|
@@ -328,6 +322,8 @@ export interface PlayerInfoValues {
|
|
|
328
322
|
* default value: `undefined`
|
|
329
323
|
*/
|
|
330
324
|
currentNativeBuffer$: StartEnd<Seconds> | undefined;
|
|
325
|
+
/** Суммарная длительность всех буферизованных диапазонов в миллисекундах */
|
|
326
|
+
totalBufferDuration$: Milliseconds | undefined;
|
|
331
327
|
/**
|
|
332
328
|
* Статус буферизации видео. true если буфер пустой и воспроизведение прервано
|
|
333
329
|
* В отличии от isStalled показывает и буферизации на старте и после перемотки
|
|
@@ -453,10 +449,6 @@ export interface PlayerInfoValues {
|
|
|
453
449
|
*/
|
|
454
450
|
availableSources$: ISources | undefined;
|
|
455
451
|
/**
|
|
456
|
-
* Признак того; что сейчас проигрывается 3D-видео
|
|
457
|
-
*/
|
|
458
|
-
is3DVideo$: boolean;
|
|
459
|
-
/**
|
|
460
452
|
* Длина видео сегмента
|
|
461
453
|
*/
|
|
462
454
|
currentVideoSegmentLength$: number;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack, VideoCodec } from "../../player/types";
|
|
2
2
|
import type { IProviderSubscriptionInfo } from "./lib/types";
|
|
3
3
|
import { ProviderState } from "./lib/types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Representation, Stream } from "../utils/parsers/types";
|
|
5
5
|
import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
|
|
6
6
|
import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
|
|
7
7
|
import { TrackHistory } from "../../utils/autoSelectTrack";
|
|
8
8
|
import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
9
9
|
import type { ExactVideoQuality, ISubscription, ITracer, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
10
10
|
import { Player } from "./lib/player";
|
|
11
|
-
import { Scene3D } from "../../utils/3d/Scene3D";
|
|
12
11
|
import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
|
|
13
12
|
import TextTrackManager from "../utils/HTMLVideoElement/TextTrackManager";
|
|
14
13
|
import StallsManager from "../utils/StallsManager";
|
|
@@ -22,7 +21,6 @@ type IParams = IProviderParams<IDashURLSource> & {
|
|
|
22
21
|
dashMaxTvVideoQuality?: Nullable<ExactVideoQuality>;
|
|
23
22
|
};
|
|
24
23
|
export default abstract class BaseDashProvider implements IProvider {
|
|
25
|
-
scene3D: Scene3D | undefined;
|
|
26
24
|
protected subscription: ISubscription;
|
|
27
25
|
protected volumeSubscription: ISubscription;
|
|
28
26
|
protected videoState: IStateMachine<ProviderState>;
|
|
@@ -64,8 +62,6 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
64
62
|
protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
|
|
65
63
|
protected prepare(manifestOffset?: number): void;
|
|
66
64
|
protected syncPlayback: () => void;
|
|
67
|
-
protected init3DScene: (init: CommonInit) => void;
|
|
68
|
-
protected destroy3DScene: () => void;
|
|
69
65
|
protected playIfAllowed(): void;
|
|
70
66
|
destroy(): void;
|
|
71
67
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { IAudioTrack, IBaseTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack, VideoCodec } from "../../player/types";
|
|
2
2
|
import type { IProviderSubscriptionInfo } from "./lib/types";
|
|
3
3
|
import { ProviderState } from "./lib/types";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Representation, Stream } from "../utils/parsers/types";
|
|
5
5
|
import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
|
|
6
6
|
import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
|
|
7
7
|
import { TrackHistory } from "../../utils/autoSelectTrack";
|
|
8
8
|
import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
9
9
|
import type { ExactVideoQuality, ISubscription, ITracer, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
10
|
-
import { Scene3D } from "../../utils/3d/Scene3D";
|
|
11
10
|
import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
|
|
12
11
|
import TextTrackManager from "../utils/HTMLVideoElement/TextTrackManager";
|
|
13
12
|
import StallsManager from "../utils/StallsManager";
|
|
@@ -22,7 +21,6 @@ type IParams = IProviderParams<IDashURLSource> & {
|
|
|
22
21
|
dashMaxTvVideoQuality?: Nullable<ExactVideoQuality>;
|
|
23
22
|
};
|
|
24
23
|
export default abstract class BaseDashProvider implements IProvider {
|
|
25
|
-
scene3D: Scene3D | undefined;
|
|
26
24
|
protected subscription: ISubscription;
|
|
27
25
|
protected volumeSubscription: ISubscription;
|
|
28
26
|
protected videoState: IStateMachine<ProviderState>;
|
|
@@ -64,8 +62,6 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
64
62
|
protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
|
|
65
63
|
protected prepare(manifestOffset?: number): void;
|
|
66
64
|
protected syncPlayback: () => void;
|
|
67
|
-
protected init3DScene: (init: CommonInit) => void;
|
|
68
|
-
protected destroy3DScene: () => void;
|
|
69
65
|
protected playIfAllowed(): void;
|
|
70
66
|
destroy(): void;
|
|
71
67
|
}
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
87
87
|
protected loadInits(): Promise<void>;
|
|
88
88
|
protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
89
89
|
protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
90
|
+
private isMaintainNativeBufferMutexActive;
|
|
90
91
|
protected maintainNativeBuffer(): Promise<void>;
|
|
91
92
|
protected maintainPlaybackBuffer(position: Milliseconds): Promise<void>;
|
|
92
93
|
protected actualizeLastSegmentInfo(currentPosition: Milliseconds): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IError } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IMaydayDeps, IRecommendation } from "./types";
|
|
3
|
+
export declare class MaydayService {
|
|
4
|
+
private deps;
|
|
5
|
+
private heuristics;
|
|
6
|
+
private tracer;
|
|
7
|
+
private providerFailures;
|
|
8
|
+
private failoverUrlIndex;
|
|
9
|
+
constructor(deps: IMaydayDeps);
|
|
10
|
+
get currentFailoverUrlIndex(): number | undefined;
|
|
11
|
+
getRecommendation(error: IError): IRecommendation;
|
|
12
|
+
private validateRecommendation;
|
|
13
|
+
private hasAvailableFailoverHost;
|
|
14
|
+
/**
|
|
15
|
+
* Если рекомендаций от эвристик нету, то идем по общему сценарию.
|
|
16
|
+
*/
|
|
17
|
+
private computeFallbackRecommendation;
|
|
18
|
+
private applyStateChange;
|
|
19
|
+
reset(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IObservable, IValueSubject } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import { PlaybackState } from "../../../player/types";
|
|
3
|
+
import type { IReinitHistory } from "./types";
|
|
4
|
+
interface IMaydayStatisticsDeps {
|
|
5
|
+
firstFrameEvent$: IObservable<void>;
|
|
6
|
+
playbackState$: IValueSubject<PlaybackState | string>;
|
|
7
|
+
}
|
|
8
|
+
export declare class MaydayStatistics {
|
|
9
|
+
private deps;
|
|
10
|
+
private providerInitiatedAt;
|
|
11
|
+
private reinitTimestamps;
|
|
12
|
+
private reinitReachedPlaying;
|
|
13
|
+
private playingStartTime;
|
|
14
|
+
private accumulatedPlayingTime;
|
|
15
|
+
private firstFrameReceived;
|
|
16
|
+
private subscription;
|
|
17
|
+
constructor(deps: IMaydayStatisticsDeps);
|
|
18
|
+
recordReinit(): void;
|
|
19
|
+
recordProviderSwitch(): void;
|
|
20
|
+
getInitiatedAt(): number;
|
|
21
|
+
getAccumulatedPlayingTime(): number;
|
|
22
|
+
getReinitHistory(): IReinitHistory;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IError } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IRecommendation, IHeuristicDeps } from "../types";
|
|
3
|
+
import type { IHeuristic } from "./IHeuristic";
|
|
4
|
+
export declare class FetcherErrorHeuristic implements IHeuristic {
|
|
5
|
+
private _deps;
|
|
6
|
+
static readonly heuristicName = "FetcherErrorHeuristic";
|
|
7
|
+
constructor(_deps: IHeuristicDeps);
|
|
8
|
+
analyze(error: IError): IRecommendation | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IError } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { IRecommendation, IHeuristicDeps } from "../types";
|
|
3
|
+
import type { IHeuristic } from "./IHeuristic";
|
|
4
|
+
export declare class MediaErrorHeuristic implements IHeuristic {
|
|
5
|
+
private deps;
|
|
6
|
+
static readonly heuristicName = "MediaErrorHeuristic";
|
|
7
|
+
constructor(deps: IHeuristicDeps);
|
|
8
|
+
analyze(error: IError): IRecommendation | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MaydayService } from "./MaydayService";
|
|
2
|
+
export type { IMaydayDeps, IFallbackContext, IRecommendation, RecoveryAction } from "./types";
|
|
3
|
+
export type { IHeuristic } from "./heuristics/IHeuristic";
|
|
4
|
+
export { MediaErrorHeuristic } from "./heuristics/MediaErrorHeuristic";
|
|
5
|
+
export { FetcherErrorHeuristic } from "./heuristics/FetcherErrorHeuristic";
|
|
6
|
+
export { MaydayStatistics } from "./MaydayStatistics";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { IVideoTrack, IVideoStream, IAudioStream } from "../../../player/types";
|
|
2
|
+
import type { IValueSubject, Milliseconds, Seconds, IRange, ITracer } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
4
|
+
export interface IFallbackContext {
|
|
5
|
+
hasProviderStarted: boolean;
|
|
6
|
+
canSwitchCodec: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IReinitHistory {
|
|
9
|
+
reachedPlaying: boolean[];
|
|
10
|
+
deltas: number[];
|
|
11
|
+
}
|
|
12
|
+
export interface IMaydayProviderOutput {
|
|
13
|
+
position$: IValueSubject<number>;
|
|
14
|
+
currentVideoTrack$: IValueSubject<IVideoTrack | undefined>;
|
|
15
|
+
totalBufferDuration$: IValueSubject<Milliseconds | undefined>;
|
|
16
|
+
currentNativeBuffer$: IValueSubject<IRange<Seconds> | undefined>;
|
|
17
|
+
bufferRangeCount$: IValueSubject<number | undefined>;
|
|
18
|
+
availableVideoStreams$: IValueSubject<IVideoStream[]>;
|
|
19
|
+
currentAudioStream$: IValueSubject<IAudioStream | undefined>;
|
|
20
|
+
}
|
|
21
|
+
export interface IMaydayDeps {
|
|
22
|
+
tuning: ITuningConfig;
|
|
23
|
+
failoverHosts: string[];
|
|
24
|
+
providerOutput: IMaydayProviderOutput;
|
|
25
|
+
maydayStatistics: {
|
|
26
|
+
getInitiatedAt: () => number;
|
|
27
|
+
getReinitHistory: () => IReinitHistory;
|
|
28
|
+
getAccumulatedPlayingTime: () => number;
|
|
29
|
+
};
|
|
30
|
+
getFallbackContext: () => IFallbackContext;
|
|
31
|
+
tracer: ITracer;
|
|
32
|
+
}
|
|
33
|
+
export interface IHeuristicDeps {
|
|
34
|
+
tuning: ITuningConfig;
|
|
35
|
+
getFallbackContext: () => IFallbackContext;
|
|
36
|
+
tracer: ITracer;
|
|
37
|
+
getPosition: () => number;
|
|
38
|
+
getCurrentVideoTrack: () => IVideoTrack | undefined;
|
|
39
|
+
getInitiatedAt: () => number;
|
|
40
|
+
getBufferLength: () => number;
|
|
41
|
+
getBufferAhead: () => number;
|
|
42
|
+
getBufferRangeCount: () => number;
|
|
43
|
+
getReinitHistory: () => IReinitHistory;
|
|
44
|
+
getAccumulatedPlayingTime: () => number;
|
|
45
|
+
getVideoCodec: () => string | undefined;
|
|
46
|
+
getAudioCodec: () => string | undefined;
|
|
47
|
+
getVisibilityState: () => DocumentVisibilityState | undefined;
|
|
48
|
+
}
|
|
49
|
+
export type RecoveryAction = "reinit" | "failover_host" | "switch_codec" | "switch_provider";
|
|
50
|
+
export interface IRecommendation {
|
|
51
|
+
action: RecoveryAction;
|
|
52
|
+
reason: string;
|
|
53
|
+
}
|
|
@@ -34,11 +34,14 @@ export default class ProviderContainer implements IProviderContainer {
|
|
|
34
34
|
private log;
|
|
35
35
|
private tracer;
|
|
36
36
|
private params;
|
|
37
|
-
private
|
|
37
|
+
private currentProviderStarted;
|
|
38
38
|
private currentFailedVideoTrack;
|
|
39
39
|
private volumeMultiplierManager;
|
|
40
40
|
private dashMaxTvVideoQuality;
|
|
41
|
+
private mayday;
|
|
42
|
+
private maydayStatistics;
|
|
41
43
|
constructor(params: IParams);
|
|
44
|
+
private getFallbackContext;
|
|
42
45
|
init(): void;
|
|
43
46
|
destroy(): void;
|
|
44
47
|
private initProvider;
|
|
@@ -46,6 +49,8 @@ export default class ProviderContainer implements IProviderContainer {
|
|
|
46
49
|
private switchToNextProvider;
|
|
47
50
|
private switchToNextVideoCodec;
|
|
48
51
|
private destroyProvider;
|
|
52
|
+
private handleMaydayRecommendation;
|
|
53
|
+
private applyErrorSideEffects;
|
|
49
54
|
private createProvider;
|
|
50
55
|
private createScreenProvider;
|
|
51
56
|
private createChromecastProvider;
|
|
@@ -5,10 +5,7 @@ import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, I
|
|
|
5
5
|
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState, VideoCodec } from "../player/types";
|
|
6
6
|
import type { IStateMachine } from "../utils/StateMachine/types";
|
|
7
7
|
import type ThroughputEstimator from "../utils/ThroughputEstimator";
|
|
8
|
-
import type { Scene3D } from "../utils/3d/Scene3D";
|
|
9
|
-
import type { Vector2D } from "../utils/3d/types";
|
|
10
8
|
export interface IProvider {
|
|
11
|
-
scene3D?: Scene3D;
|
|
12
9
|
destroy(): void;
|
|
13
10
|
}
|
|
14
11
|
export interface IProviderDependencies {
|
|
@@ -33,7 +30,6 @@ export interface DesiredStateValues {
|
|
|
33
30
|
audioStream: IAudioStream | undefined;
|
|
34
31
|
autoVideoTrackLimits: QualityLimits;
|
|
35
32
|
autoVideoTrackSwitching: boolean;
|
|
36
|
-
cameraOrientation: Vector2D;
|
|
37
33
|
currentTextTrack: ITextTrack["id"] | undefined;
|
|
38
34
|
/**
|
|
39
35
|
* Дополнительные дорожки субтитров подключаемые извне
|
|
@@ -87,6 +83,8 @@ export interface IProviderOutput {
|
|
|
87
83
|
canChangePlaybackSpeed$: IValueSubject<boolean | undefined>;
|
|
88
84
|
currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
|
|
89
85
|
currentNativeBuffer$: IValueSubject<IRange<Seconds> | undefined>;
|
|
86
|
+
totalBufferDuration$: IValueSubject<Milliseconds | undefined>;
|
|
87
|
+
bufferRangeCount$: IValueSubject<number | undefined>;
|
|
90
88
|
videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds | undefined>;
|
|
91
89
|
isBuffering$: IValueSubject<boolean>;
|
|
92
90
|
isLive$: IValueSubject<boolean | undefined>;
|
|
@@ -124,7 +122,6 @@ export interface IProviderOutput {
|
|
|
124
122
|
soundProhibitedEvent$: ISubject<void>;
|
|
125
123
|
canplay$: ISubject<void>;
|
|
126
124
|
severeStallOccurred$: ISubject<boolean>;
|
|
127
|
-
is3DVideo$: ISubject<boolean>;
|
|
128
125
|
inPiP$: IValueSubject<boolean>;
|
|
129
126
|
inFullscreen$: IValueSubject<boolean>;
|
|
130
127
|
playbackState$: IValueSubject<PlaybackState | string>;
|
|
@@ -12,6 +12,12 @@ interface IConnectData {
|
|
|
12
12
|
playing$: IObservable<undefined>;
|
|
13
13
|
pause$: IObservable<undefined>;
|
|
14
14
|
}
|
|
15
|
+
interface IDecoderMetrics {
|
|
16
|
+
totalVideoFrames: number;
|
|
17
|
+
droppedVideoFrames: number;
|
|
18
|
+
droppedPercent: number;
|
|
19
|
+
stalledFrames: number;
|
|
20
|
+
}
|
|
15
21
|
declare class DroppedFramesManager {
|
|
16
22
|
onDroopedVideoFramesLimit$: Subject<void>;
|
|
17
23
|
private subscription;
|
|
@@ -32,6 +38,10 @@ declare class DroppedFramesManager {
|
|
|
32
38
|
connect(data: IConnectData): void;
|
|
33
39
|
destroy(): void;
|
|
34
40
|
get droppedVideoMaxQualityLimit(): ExactVideoQuality | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Получить текущие метрики декодера
|
|
43
|
+
*/
|
|
44
|
+
getMetrics(): IDecoderMetrics;
|
|
35
45
|
private subscribe;
|
|
36
46
|
private handleChangeVideoQuality;
|
|
37
47
|
private onChangeQuality;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Seconds, IRange, IObservable, IError, IValueObservable } from "@vkontakte/videoplayer-shared";
|
|
1
|
+
import type { Seconds, IRange, IObservable, IError, IValueObservable, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import type { IVolumeState, PlaybackRate } from "../../../player/types";
|
|
3
3
|
export interface IObservableVideo {
|
|
4
4
|
playing$: IObservable<undefined>;
|
|
@@ -18,6 +18,8 @@ export interface IObservableVideo {
|
|
|
18
18
|
loadedData$: IObservable<undefined>;
|
|
19
19
|
isBuffering$: IObservable<boolean>;
|
|
20
20
|
currentBuffer$: IObservable<IRange<Seconds>>;
|
|
21
|
+
totalBufferDuration$: IObservable<Milliseconds>;
|
|
22
|
+
bufferRangeCount$: IObservable<number>;
|
|
21
23
|
volumeState$: IObservable<IVolumeState>;
|
|
22
24
|
playbackRateState$: IObservable<PlaybackRate>;
|
|
23
25
|
inPiP$: IValueObservable<boolean>;
|
|
@@ -8,6 +8,12 @@ import { AudioRuleName, VideoRuleName } from "../providers/utils/Abr/types";
|
|
|
8
8
|
export type ITuningConfig = {
|
|
9
9
|
/** @deprecated */
|
|
10
10
|
configName?: string[];
|
|
11
|
+
mayday: {
|
|
12
|
+
/** Порог суммарного времени проигрывания, при котором провайдер считается нестабильным после реинита (MediaError#3) */
|
|
13
|
+
playingUnstableThresholdMs: Milliseconds;
|
|
14
|
+
/** Список имён включённых эвристик. Пустой массив = все эвристики выключены */
|
|
15
|
+
heuristics: string[];
|
|
16
|
+
};
|
|
11
17
|
/**
|
|
12
18
|
* Если true, внутренний video элемент не будет уничтожаться при реините провайдера
|
|
13
19
|
* и при создании нового экземляра Player.
|
|
@@ -175,9 +181,9 @@ export type ITuningConfig = {
|
|
|
175
181
|
minNativeBufferSize: Milliseconds;
|
|
176
182
|
removeTimeShiftFromSegment: Milliseconds;
|
|
177
183
|
tickMaintainInterval: Milliseconds;
|
|
184
|
+
tickMaintainThrottle: Milliseconds;
|
|
178
185
|
minSafeBufferToPlay: Milliseconds;
|
|
179
186
|
useBufferHoldingOnlyOnStall: boolean;
|
|
180
|
-
useAbortResetNativeBufferMutex: boolean;
|
|
181
187
|
useNewAbr: boolean;
|
|
182
188
|
useAbrPhases: boolean;
|
|
183
189
|
abrVideoRules: VideoRuleName[];
|
|
@@ -329,6 +335,16 @@ export type ITuningConfig = {
|
|
|
329
335
|
useDashProviderVirtualMobile: boolean;
|
|
330
336
|
useNewAutoSelectVideoTrack: boolean;
|
|
331
337
|
useSafariEndlessRequestBugfix: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Ручка для фикса сброса playbackRate при перемотке live-трансляции на Safari.
|
|
340
|
+
*
|
|
341
|
+
* На WebKit/Safari в момент applying seek video.currentTime может кратко отдавать
|
|
342
|
+
* неверное значение (например, 0). Без фикса это проходит в условие
|
|
343
|
+
* atLiveDurationEdge и tap сбрасывает playbackRate в 1, перетирая пользовательскую скорость.
|
|
344
|
+
* С фиксом позиция берётся из optimisticPosition (seek target во время seek), и ложного
|
|
345
|
+
* срабатывания не происходит. Для VOD нейтрально (isLive=false).
|
|
346
|
+
*/
|
|
347
|
+
useSafariOptimisticPositionForLiveEdgeBugfix: boolean;
|
|
332
348
|
isAudioDisabled: boolean;
|
|
333
349
|
/**
|
|
334
350
|
* Разрешает ядру автостарт только если страница, на которой находится плеер активна
|
|
@@ -350,24 +366,6 @@ export type ITuningConfig = {
|
|
|
350
366
|
webrtc: {
|
|
351
367
|
connectionRetryMaxNumber: number;
|
|
352
368
|
};
|
|
353
|
-
spherical: {
|
|
354
|
-
enabled: boolean;
|
|
355
|
-
fov: {
|
|
356
|
-
x: number;
|
|
357
|
-
y: number;
|
|
358
|
-
};
|
|
359
|
-
orientation?: {
|
|
360
|
-
x: number;
|
|
361
|
-
y: number;
|
|
362
|
-
z: number;
|
|
363
|
-
};
|
|
364
|
-
rotationSpeed: number;
|
|
365
|
-
maxYawAngle: number;
|
|
366
|
-
rotationSpeedCorrection: number;
|
|
367
|
-
degreeToPixelCorrection: number;
|
|
368
|
-
speedFadeTime: Milliseconds;
|
|
369
|
-
speedFadeThreshold: Milliseconds;
|
|
370
|
-
};
|
|
371
369
|
useVolumeMultiplier: boolean;
|
|
372
370
|
ignoreAudioRendererError: boolean;
|
|
373
371
|
useEnableSubtitlesParam: boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Degree, Vector2D, Vector3D } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Модель камеры трехмерной сцены
|
|
4
|
-
*/
|
|
5
|
-
export declare class Camera3D {
|
|
6
|
-
fov: Vector2D<Degree>;
|
|
7
|
-
/**
|
|
8
|
-
* x: Degree; // yaw (around vertical Y axis)
|
|
9
|
-
* y: Degree; // pitch (around horizontal X axis)
|
|
10
|
-
* z: Degree; // roll (around normal Z axis)
|
|
11
|
-
*/
|
|
12
|
-
orientation: Vector3D<Degree>;
|
|
13
|
-
constructor(fov: Vector2D<Degree>, orientation: Vector3D<Degree>);
|
|
14
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { Camera3D } from "./Camera3D";
|
|
2
|
-
import type { DegreePerSecond, CameraRotationManagerParams, Degree, Vector3D } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* Класс управляющий вращением камеры
|
|
5
|
-
*/
|
|
6
|
-
export declare class CameraRotationManager {
|
|
7
|
-
private options;
|
|
8
|
-
private camera;
|
|
9
|
-
private rotating;
|
|
10
|
-
private fading;
|
|
11
|
-
private lastTickTS;
|
|
12
|
-
private lastCameraTurn;
|
|
13
|
-
private lastCameraTurnTS;
|
|
14
|
-
private fadeStartSpeed;
|
|
15
|
-
private fadeCorrection;
|
|
16
|
-
private fadeTime;
|
|
17
|
-
rotationSpeed: Vector3D<DegreePerSecond>;
|
|
18
|
-
constructor(camera: Camera3D, options: CameraRotationManagerParams);
|
|
19
|
-
/**
|
|
20
|
-
* Поворот камеры из текущего положения на заданное количество градусов
|
|
21
|
-
*/
|
|
22
|
-
turnCamera(dx?: Degree, dy?: Degree, dz?: Degree): void;
|
|
23
|
-
/**
|
|
24
|
-
* Поворот камеры в заданное положение
|
|
25
|
-
*/
|
|
26
|
-
pointCameraTo(x?: Degree, y?: Degree, z?: Degree): void;
|
|
27
|
-
/**
|
|
28
|
-
* Устанавливает угловые скорости по осям
|
|
29
|
-
* Если скорость для оси не задана будет использована ее текущая скорость
|
|
30
|
-
*/
|
|
31
|
-
setRotationSpeed(sx?: DegreePerSecond, sy?: DegreePerSecond, sz?: DegreePerSecond): void;
|
|
32
|
-
/**
|
|
33
|
-
* Start permanent rotation
|
|
34
|
-
*/
|
|
35
|
-
startRotation(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Выставляет нулевую скорость, что приводит к плавной остановке
|
|
38
|
-
* при передаче поднятого флага останавливает движение мгновенно
|
|
39
|
-
*/
|
|
40
|
-
stopRotation(immediate?: boolean): void;
|
|
41
|
-
/**
|
|
42
|
-
* "Толкает" камеру для плавного затухания при наличии остаточного "крутящего момента"
|
|
43
|
-
*/
|
|
44
|
-
onCameraRelease(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Запускает режим затухания
|
|
47
|
-
*/
|
|
48
|
-
private startFading;
|
|
49
|
-
/**
|
|
50
|
-
* Останавливает режим затухания
|
|
51
|
-
*/
|
|
52
|
-
private stopFading;
|
|
53
|
-
/**
|
|
54
|
-
* Ограничивает угол поворота по вертикальной оси
|
|
55
|
-
*/
|
|
56
|
-
private limitCameraRotationY;
|
|
57
|
-
/**
|
|
58
|
-
* Рассчитывает положение камеры согласно текущей скорости с эмуляцией инерции
|
|
59
|
-
* @param time - ms from page load
|
|
60
|
-
*/
|
|
61
|
-
tick(time: number): void;
|
|
62
|
-
}
|