@vkontakte/videoplayer-core 2.0.126-dev.2bdf3b93.0 → 2.0.126-dev.3f94cfc5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.126-dev.2bdf3b93.0",
3
+ "version": "2.0.126-dev.3f94cfc5.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.54-dev.ba2dd100.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.54-dev.94e7ac0b.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VERSION } from './env';
2
- import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek, Surface } from './player/types';
2
+ import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek, Surface, PredefinedQualityLimits } from './player/types';
3
3
  import Player from './player/Player';
4
4
  import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, ChromecastState, HttpConnectionType, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream } from './player/types';
5
5
  import type { IOptionalTuningConfig } from './utils/tuningConfig';
@@ -9,4 +9,4 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@
9
9
  * @deprecated
10
10
  */
11
11
  declare const SDK_VERSION: string;
12
- export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, Surface, Subscription, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, VideoFormat, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, VideoQuality, ExactVideoQuality, Observable, Subject, ValueSubject, IRange, ISeekRequest, ICueSettings, VERSION, SDK_VERSION, PlaybackRate, IVideoStream, IAudioStream, };
12
+ export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, Surface, Subscription, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, VideoFormat, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, VideoQuality, ExactVideoQuality, Observable, Subject, ValueSubject, IRange, ISeekRequest, ICueSettings, VERSION, SDK_VERSION, PlaybackRate, IVideoStream, IAudioStream, PredefinedQualityLimits, };
@@ -1,6 +1,6 @@
1
1
  import { IOptionalTuningConfig } from '../utils/tuningConfig';
2
2
  import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality, ITracer } from '@vkontakte/videoplayer-shared';
3
- import { ChromecastState, HttpConnectionType, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, StartEnd, Surface, VideoFormat } from './types';
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;
6
6
  private domContainer;
@@ -34,6 +34,7 @@ export default class Player implements IPlayer {
34
34
  isAutoQualityEnabled$: ValueSubject<boolean>;
35
35
  autoQualityLimitingAvailable$: ValueSubject<boolean>;
36
36
  autoQualityLimits$: ValueSubject<QualityLimits>;
37
+ predefinedQualityLimitType$: ValueSubject<PredefinedQualityLimits>;
37
38
  availableAudioStreams$: ValueSubject<IAudioStream[]>;
38
39
  currentAudioStream$: ValueSubject<IVideoStream | undefined>;
39
40
  availableAudioTracks$: ValueSubject<import("./types").IBaseTrack[]>;
@@ -126,6 +127,7 @@ export default class Player implements IPlayer {
126
127
  setQuality(quality: VideoQuality): IPlayer;
127
128
  setAutoQuality(enable: boolean): IPlayer;
128
129
  setAutoQualityLimits(limits: QualityLimits): IPlayer;
130
+ setPredefinedQualityLimits(type: PredefinedQualityLimits): this;
129
131
  setPlaybackRate(playbackRate: PlaybackRate): IPlayer;
130
132
  setExternalTextTracks(tracks: Omit<IExternalTextTrack, 'type'>[]): IPlayer;
131
133
  selectTextTrack(id: ITextTrack['id'] | undefined): IPlayer;
@@ -38,6 +38,10 @@ export interface IPlayer {
38
38
  setQuality(quality: VideoQuality): IPlayer;
39
39
  setAutoQuality(enable: boolean): IPlayer;
40
40
  setAutoQualityLimits(limit: QualityLimits): IPlayer;
41
+ /**
42
+ * Установить предопределенные настройки лимитов.
43
+ */
44
+ setPredefinedQualityLimits(type: PredefinedQualityLimits): IPlayer;
41
45
  startCameraManualRotation(mx: number, my: number): IPlayer;
42
46
  stopCameraManualRotation(immediate: boolean): IPlayer;
43
47
  moveCameraFocusPX(mx: Pixel, my: Pixel, dt: number): IPlayer;
@@ -262,6 +266,10 @@ export interface IPlayerInfo {
262
266
  * Текущие лимиты авто-качества
263
267
  */
264
268
  autoQualityLimits$: IValueObservable<QualityLimits>;
269
+ /**
270
+ * Отображает тип лимитов по качеству.
271
+ */
272
+ predefinedQualityLimitType$: IValueObservable<PredefinedQualityLimits>;
265
273
  /**
266
274
  * Текущая скорость воспроизведения
267
275
  */
@@ -570,4 +578,9 @@ export declare enum Surface {
570
578
  PIP = "pip",
571
579
  INVISIBLE = "invisible"
572
580
  }
581
+ export declare enum PredefinedQualityLimits {
582
+ TRAFFIC_SAVING = "traffic_saving",
583
+ HIGH_QUALITY = "high_quality",
584
+ UNKNOWN = "unknown"
585
+ }
573
586
  export {};
@@ -21,10 +21,14 @@ interface IParams {
21
21
  };
22
22
  logger: (...args: any[]) => void;
23
23
  }
24
+ type AutoQualityLimits = {
25
+ max?: number;
26
+ min?: number;
27
+ };
24
28
  export default class LiveDashPlayer {
25
29
  private paused;
26
30
  private autoQuality;
27
- private maxAutoQuality;
31
+ private autoQualityLimits;
28
32
  private buffering;
29
33
  private destroyed;
30
34
  private videoPlayStarted;
@@ -53,7 +57,7 @@ export default class LiveDashPlayer {
53
57
  * switch to auto quality
54
58
  */
55
59
  setAutoQualityEnabled(enabled: boolean): void;
56
- setMaxAutoQuality(height: number | undefined): void;
60
+ setAutoQualityLimits(limits: AutoQualityLimits | undefined): void;
57
61
  /**
58
62
  * switch quality by name
59
63
  */
@@ -112,4 +112,5 @@ export declare class BufferManager {
112
112
  private detectGaps;
113
113
  private detectGapsWhenIdle;
114
114
  private checkEjectedSegments;
115
+ private handleAsyncError;
115
116
  }
@@ -43,14 +43,14 @@ export declare class Player {
43
43
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
44
44
  currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
45
45
  isLive$: IValueSubject<boolean>;
46
+ isActiveLive$: IValueSubject<boolean>;
47
+ isLowLatency$: IValueSubject<boolean>;
46
48
  liveDuration$: IValueSubject<Milliseconds>;
47
49
  liveAvailabilityStartTime$: IValueSubject<Seconds | undefined>;
48
50
  bufferLength$: IValueSubject<Milliseconds>;
49
51
  liveLatency$: IValueSubject<Milliseconds | undefined>;
50
52
  liveLoadBufferLength$: IValueSubject<Milliseconds>;
51
53
  livePositionFromPlayer$: IValueSubject<number>;
52
- isLowLatency$: IValueSubject<boolean>;
53
- isActiveLowLatency$: IValueSubject<boolean>;
54
54
  currentStallDuration$: IValueSubject<Milliseconds>;
55
55
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
56
56
  private liveBuffer;
@@ -1,5 +1,5 @@
1
1
  import { ITuningConfig } from '../../../utils/tuningConfig';
2
- type Constraints = Pick<ITuningConfig, 'audioVideoSyncRate'>;
3
- export declare const allocate: (container: HTMLElement, { audioVideoSyncRate }: Constraints) => HTMLVideoElement;
2
+ type Constraints = Pick<ITuningConfig, 'audioVideoSyncRate' | 'disableYandexPiP'>;
3
+ export declare const allocate: (container: HTMLElement, { audioVideoSyncRate, disableYandexPiP }: Constraints) => HTMLVideoElement;
4
4
  export declare const dispose: (element: HTMLVideoElement) => void;
5
5
  export {};
@@ -0,0 +1,38 @@
1
+ import { IVideoTrack, PredefinedQualityLimits } from '../player/types';
2
+ import { ExactVideoQuality, Nullable, QualityLimits } from '@vkontakte/videoplayer-shared';
3
+ type Params = {
4
+ limits: QualityLimits;
5
+ highQualityLimit: ExactVideoQuality;
6
+ trafficSavingLimit: ExactVideoQuality;
7
+ };
8
+ export declare function getQualityLimitsPredefinedType({ limits, highQualityLimit, trafficSavingLimit, }: Params): PredefinedQualityLimits;
9
+ type HighQualityEnabled = {
10
+ limits?: QualityLimits;
11
+ highQualityLimit: ExactVideoQuality;
12
+ trafficSavingLimit: ExactVideoQuality;
13
+ };
14
+ export declare function isHighQualityEnabled({ limits, highQualityLimit, trafficSavingLimit }: HighQualityEnabled): boolean;
15
+ type LimitsValidParams = {
16
+ limits?: QualityLimits;
17
+ highestAvailableQuality: Nullable<ExactVideoQuality>;
18
+ lowestAvailableQuality: Nullable<ExactVideoQuality>;
19
+ };
20
+ type LimitsAsHeightValidParams = {
21
+ limits?: {
22
+ min?: number;
23
+ max?: number;
24
+ };
25
+ highestAvailableHeight: Nullable<number>;
26
+ lowestAvailableHeight: Nullable<number>;
27
+ };
28
+ export declare function areLimitsInvalid({ limits, highestAvailableQuality, lowestAvailableQuality }: LimitsValidParams): boolean | (null | undefined);
29
+ /**
30
+ * Проверяем лимиты качества, когда указана высота качества.
31
+ */
32
+ export declare function areLimitsInvalidInHeights({ limits, highestAvailableHeight, lowestAvailableHeight }: LimitsAsHeightValidParams): boolean | (null | undefined);
33
+ type TrackFitsLimitsParams = {
34
+ limits: QualityLimits;
35
+ track: IVideoTrack;
36
+ };
37
+ export declare function trackFitsLimits({ limits, track }: TrackFitsLimitsParams): boolean;
38
+ export {};
@@ -43,6 +43,8 @@ export type ITuningConfig = {
43
43
  trackCooldownDecreaseQuality: Milliseconds;
44
44
  backgroundVideoQualityLimit: VideoQuality;
45
45
  activeVideoAreaThreshold: number;
46
+ trafficSavingLimit: ExactVideoQuality;
47
+ highQualityLimit: ExactVideoQuality;
46
48
  };
47
49
  droppedFramesChecker: {
48
50
  enabled: boolean;
@@ -192,6 +194,10 @@ export type ITuningConfig = {
192
194
  * попробуем получить следующий сегмент субтитров
193
195
  */
194
196
  hlsLiveNewTextManagerDownloadThreshold: Milliseconds;
197
+ /**
198
+ * Отключает яндексовскую магию с пипом.
199
+ */
200
+ disableYandexPiP?: boolean;
195
201
  };
196
202
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
197
203
  configName: ITuningConfig['configName'];