@vkontakte/videoplayer-core 2.0.166-dev.f2a56450b.0 → 2.0.166

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.166-dev.f2a56450b.0",
3
+ "version": "2.0.166",
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.95-dev.f2a56450b.0"
45
+ "@vkontakte/videoplayer-shared": "1.0.95"
46
46
  }
47
47
  }
@@ -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;
@@ -126,7 +87,6 @@ export default class Player implements IPlayer {
126
87
  private initDebugTelemetry;
127
88
  private initTracerSubscription;
128
89
  private initWakeLock;
129
- private initRenderingRecovery;
130
90
  private setVideoTrackIdByQuality;
131
91
  private getActiveLiveDelay;
132
92
  private isNotActiveTabCase;
@@ -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;
@@ -455,10 +449,6 @@ export interface PlayerInfoValues {
455
449
  */
456
450
  availableSources$: ISources | undefined;
457
451
  /**
458
- * Признак того; что сейчас проигрывается 3D-видео
459
- */
460
- is3DVideo$: boolean;
461
- /**
462
452
  * Длина видео сегмента
463
453
  */
464
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 { CommonInit, Representation, Stream } from "../utils/parsers/types";
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 { CommonInit, Representation, Stream } from "../utils/parsers/types";
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
  }
@@ -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;
@@ -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
  * Дополнительные дорожки субтитров подключаемые извне
@@ -126,7 +122,6 @@ export interface IProviderOutput {
126
122
  soundProhibitedEvent$: ISubject<void>;
127
123
  canplay$: ISubject<void>;
128
124
  severeStallOccurred$: ISubject<boolean>;
129
- is3DVideo$: ISubject<boolean>;
130
125
  inPiP$: IValueSubject<boolean>;
131
126
  inFullscreen$: IValueSubject<boolean>;
132
127
  playbackState$: IValueSubject<PlaybackState | string>;
@@ -181,9 +181,9 @@ export type ITuningConfig = {
181
181
  minNativeBufferSize: Milliseconds;
182
182
  removeTimeShiftFromSegment: Milliseconds;
183
183
  tickMaintainInterval: Milliseconds;
184
+ tickMaintainThrottle: Milliseconds;
184
185
  minSafeBufferToPlay: Milliseconds;
185
186
  useBufferHoldingOnlyOnStall: boolean;
186
- useAbortResetNativeBufferMutex: boolean;
187
187
  useNewAbr: boolean;
188
188
  useAbrPhases: boolean;
189
189
  abrVideoRules: VideoRuleName[];
@@ -335,6 +335,16 @@ export type ITuningConfig = {
335
335
  useDashProviderVirtualMobile: boolean;
336
336
  useNewAutoSelectVideoTrack: boolean;
337
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;
338
348
  isAudioDisabled: boolean;
339
349
  /**
340
350
  * Разрешает ядру автостарт только если страница, на которой находится плеер активна
@@ -346,13 +356,6 @@ export type ITuningConfig = {
346
356
  * использует requestAnimationFrame
347
357
  */
348
358
  autoplayOnlyIfVisible: boolean;
349
- /**
350
- * Восстанавливает отрисовку <video> при возврате из фоновой вкладки.
351
- * WebKit на скрытых вкладках останавливает композитинг кадра и не всегда
352
- * возобновляет его сам — после детекта «залипшего» кадра делается микросик
353
- * в текущую позицию, заставляющий декодер переинициализировать текстуру.
354
- */
355
- recoverRenderingOnTabVisible: boolean;
356
359
  dynamicImportTimeout: Milliseconds;
357
360
  maxPlaybackTransitionInterval: Milliseconds;
358
361
  providerErrorLimit: number;
@@ -363,24 +366,6 @@ export type ITuningConfig = {
363
366
  webrtc: {
364
367
  connectionRetryMaxNumber: number;
365
368
  };
366
- spherical: {
367
- enabled: boolean;
368
- fov: {
369
- x: number;
370
- y: number;
371
- };
372
- orientation?: {
373
- x: number;
374
- y: number;
375
- z: number;
376
- };
377
- rotationSpeed: number;
378
- maxYawAngle: number;
379
- rotationSpeedCorrection: number;
380
- degreeToPixelCorrection: number;
381
- speedFadeTime: Milliseconds;
382
- speedFadeThreshold: Milliseconds;
383
- };
384
369
  useVolumeMultiplier: boolean;
385
370
  ignoreAudioRendererError: boolean;
386
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
- }
@@ -1,132 +0,0 @@
1
- import type { Degree, Pixel, Scene3DParams, Vector2D, Vector3D } from "./types";
2
- /**
3
- * Класс описывающий 3D сцену - канву на которой будет рисоваться проекция
4
- */
5
- export declare class Scene3D {
6
- private container;
7
- private sourceVideoElement;
8
- private canvas;
9
- private gl;
10
- private params;
11
- private frameWidth;
12
- private frameHeight;
13
- private viewportWidth;
14
- private viewportHeight;
15
- private videoInitialized;
16
- private program;
17
- private videoTexture;
18
- private vertexBuffer;
19
- private textureMappingBuffer;
20
- private camera;
21
- private cameraRotationManager;
22
- private videoElementDataLoadedFn;
23
- private renderFn;
24
- private active;
25
- constructor(container: HTMLElement, sourceVideoElement: HTMLVideoElement, params: Scene3DParams);
26
- /**
27
- * Запускает отрисовку сцены
28
- */
29
- play(): void;
30
- /**
31
- * Останавливает отрисовку сцены
32
- */
33
- stop(): void;
34
- /**
35
- * Запускает режим постоянного вращение камеры согласно переданным коэффициентам угловых скоростей
36
- * Базовая величина скорости задается в конфиге
37
- * Итоговая скорость будет равна произведению базовой скорости и переданного коэффициента
38
- * Принимает как положительные так и отрицательные значения (для противоположного вращения)
39
- */
40
- startCameraManualRotation(mx: number, my: number): void;
41
- /**
42
- * Останавливает режим постоянного вращение камеры
43
- */
44
- stopCameraManualRotation(immediate?: boolean): void;
45
- /**
46
- * Перемещает точку фокуса камеры на заданный угол
47
- */
48
- turnCamera(dx: Degree, dy: Degree): void;
49
- /**
50
- * Перемещает точку фокуса камеры на заданный угол
51
- */
52
- pointCameraTo(dx: Degree, dy: Degree): void;
53
- /**
54
- * Преобразовывает экранные координаты в градусы в соответствии с текущим полем обзора
55
- */
56
- pixelToDegree(vector: Vector2D<Pixel>): Vector2D<Degree>;
57
- /**
58
- * Возвращает текущую ориентацию камеры
59
- */
60
- getCameraRotation(): Vector3D;
61
- /**
62
- * Захват камеры - переход в ручное управление
63
- */
64
- holdCamera(): void;
65
- /**
66
- * Возвращает управление внутренним алгоритмам
67
- */
68
- releaseCamera(): void;
69
- /**
70
- * Уничтожает сцену
71
- */
72
- destroy(): void;
73
- /**
74
- * Устанавливает размер "экрана"
75
- */
76
- setViewportSize(vpx: number, vpy: number): void;
77
- /**
78
- * Обработчик события загрузки данных на видеоэлементе
79
- */
80
- private onDataLoadedHandler;
81
- /**
82
- * Запускает режим отрисовки
83
- */
84
- private doPlay;
85
- /**
86
- * Основная функция отрисовки
87
- *
88
- * @param ts - ms from page load
89
- */
90
- private render;
91
- /**
92
- * Создает шейдер
93
- */
94
- private createShader;
95
- /**
96
- * Создает webGL програму
97
- */
98
- private createProgram;
99
- /**
100
- * Создает текстуру
101
- */
102
- private createTexture;
103
- /**
104
- * Обновляет текстуру
105
- * Считывает текущий кадр из видео
106
- */
107
- private updateTexture;
108
- /**
109
- * Создает буфер вершин плоскости с учетом поправки на отношение сторон
110
- */
111
- private createVertexBuffer;
112
- /**
113
- * Создает буффер маппинга текстуры
114
- */
115
- private createTextureMappingBuffer;
116
- /**
117
- * Рассчитывает положение текстуры на плоскости
118
- */
119
- private calculateTexturePosition;
120
- /**
121
- * Обновляет значения в буффере маппинга текстуры
122
- */
123
- private updateTextureMappingBuffer;
124
- /**
125
- * Обновляет кэш различных размеров
126
- */
127
- private updateFrameSize;
128
- /**
129
- * Создает канву для сцены
130
- */
131
- createCanvas(): HTMLCanvasElement;
132
- }
@@ -1,25 +0,0 @@
1
- import type { Milliseconds } from "@vkontakte/videoplayer-shared";
2
- export interface Vector3D<T = number> {
3
- x: T;
4
- y: T;
5
- z: T;
6
- }
7
- export interface Vector2D<T = number> {
8
- x: T;
9
- y: T;
10
- }
11
- export type Pixel = number;
12
- export type Degree = number;
13
- export type DegreePerSecond = number;
14
- export interface CameraRotationManagerParams {
15
- rotationSpeed: DegreePerSecond;
16
- maxYawAngle: Degree;
17
- speedFadeTime: Milliseconds;
18
- speedFadeThreshold: Milliseconds;
19
- degreeToPixelCorrection: number;
20
- rotationSpeedCorrection: number;
21
- }
22
- export interface Scene3DParams extends CameraRotationManagerParams {
23
- fov: Vector2D;
24
- orientation: Vector3D;
25
- }