@vkontakte/videoplayer-core 2.0.162-dev.cd80d9e13.0 → 2.0.162-dev.ec26b2599.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.162-dev.cd80d9e13.0",
3
+ "version": "2.0.162-dev.ec26b2599.0",
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.91-dev.cd80d9e13.0"
45
+ "@vkontakte/videoplayer-shared": "1.0.91-dev.ec26b2599.0"
46
46
  }
47
47
  }
package/types/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { VERSION } from "./env";
2
2
  import type { IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek } from "./player/types";
3
- import { VideoFormat, Surface, PredefinedQualityLimits, VideoCodec } from "./player/types";
3
+ import type { VideoCodec } from "./player/types";
4
+ import { VideoFormat, Surface, PredefinedQualityLimits, VideoCodecName } from "./player/types";
4
5
  import Player from "./player/Player";
5
6
  import type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream } from "./player/types";
6
7
  import { PlaybackState, ChromecastState, HttpConnectionType } from "./player/types";
@@ -15,4 +16,4 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from "@
15
16
  */
16
17
  declare const SDK_VERSION: string;
17
18
  export type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, ExactVideoQuality, IRange, ISeekRequest, ICueSettings, PlaybackRate, IVideoStream, IAudioStream };
18
- export { Player, PlaybackState, ChromecastState, HttpConnectionType, Surface, Subscription, VideoFormat, VideoQuality, Observable, Subject, ValueSubject, VERSION, SDK_VERSION, PredefinedQualityLimits, VideoCodec };
19
+ export { Player, PlaybackState, ChromecastState, HttpConnectionType, Surface, Subscription, VideoFormat, VideoQuality, Observable, Subject, ValueSubject, VERSION, SDK_VERSION, PredefinedQualityLimits, VideoCodec, VideoCodecName };
@@ -66,6 +66,7 @@ export default class Player implements IPlayer {
66
66
  selectTextTrack(id: ITextTrack["id"] | undefined): IPlayer;
67
67
  setTextTrackCueSettings(settings: ICueSettings): IPlayer;
68
68
  setLiveLowLatency(isLowLatency: boolean): IPlayer;
69
+ setAdPreloadMode(enabled: boolean): IPlayer;
69
70
  setLooped(isLooped: boolean): IPlayer;
70
71
  toggleChromecast(): void;
71
72
  /**
@@ -64,6 +64,11 @@ export interface IPlayer {
64
64
  setTextTrackCueSettings(settings: ICueSettings): IPlayer;
65
65
  setLiveLowLatency(isLowLatency: boolean): IPlayer;
66
66
  /**
67
+ * Включает или выключает режим предзагрузки видео во время воспроизведения рекламы.
68
+ * Виртуальный буфер скачивает сегменты, но не добавляет их в нативный буфер
69
+ */
70
+ setAdPreloadMode(enabled: boolean): IPlayer;
71
+ /**
67
72
  * Включает или отключает Chromecast
68
73
  */
69
74
  toggleChromecast(): void;
@@ -326,10 +331,12 @@ export interface PlayerInfoValues {
326
331
  */
327
332
  isBuffering$: boolean;
328
333
  /**
329
- * Статус только нежелательной буферизации; возникает при опустошении буфера в процессе воспроизведения
334
+ * Состояние столла. Возникает по истечении stallIgnoreThreshold после старта нежелательной буферизации
335
+ * Статус только нежелательной буферизации возникает при опустошении буфера в процессе воспроизведения
330
336
  * и не возникает при начальном наполнении буфера или после перемотки
331
337
  */
332
338
  isStalled$: boolean;
339
+ stallStartTime$: Milliseconds;
333
340
  /**
334
341
  * Закончилось ли видео
335
342
  */
@@ -532,6 +539,10 @@ export interface IConfig {
532
539
  volumeMultiplier?: number;
533
540
  panelSize?: IRectangle;
534
541
  isMuted?: boolean;
542
+ /**
543
+ * Нужно ли recoverableError обрабатывать как ошибку провайдера или будет снаружи обрабатываться.
544
+ */
545
+ handleNetworkRecoverableErrorAsProviderError?: boolean;
535
546
  }
536
547
  export interface ISources {
537
548
  [VideoFormat.MPEG]?: IMpegSource;
@@ -599,12 +610,16 @@ export declare enum VideoFormat {
599
610
  HLS_LIVE_CMAF = "HLS_LIVE_CMAF",
600
611
  WEB_RTC_LIVE = "WEB_RTC_LIVE"
601
612
  }
602
- export declare enum VideoCodec {
613
+ export declare enum VideoCodecName {
603
614
  AV1 = "av1",
604
615
  VP9 = "vp9",
605
616
  AVC1 = "avc1",
606
617
  HEV1 = "hev1"
607
618
  }
619
+ export interface VideoCodec {
620
+ name: VideoCodecName;
621
+ hdr: boolean;
622
+ }
608
623
  export declare enum AudioCodec {
609
624
  OPUS = "opus",
610
625
  MP4A = "mp4a"
@@ -63,5 +63,6 @@ export default abstract class BaseDashProvider implements IProvider {
63
63
  protected init3DScene: (init: CommonInit) => void;
64
64
  protected destroy3DScene: () => void;
65
65
  protected playIfAllowed(): void;
66
+ setAdPreloadMode(enabled: boolean): void;
66
67
  destroy(): void;
67
68
  }
@@ -36,6 +36,7 @@ export interface IVirtualBufferManager<T extends Segment = Segment> {
36
36
  getMutexInfo(): string;
37
37
  setTarget(time: Milliseconds): void;
38
38
  setPreloadOnly(preloadOnly: boolean): void;
39
+ setAdPreloadMode(enabled: boolean): void;
39
40
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
40
41
  calculateDurationFromSegments(): Milliseconds;
41
42
  getActiveSegmentProgress(): VideoSegmentLoadProgress | undefined;
@@ -32,6 +32,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
32
32
  protected bufferPlaybackQueue: IBufferPlaybackQueueItem<T>[];
33
33
  protected downloadingBufferItems: IBufferPlaybackQueueItem<T>[];
34
34
  protected preloadOnly: boolean;
35
+ protected adPreloadMode: boolean;
35
36
  protected forwardBufferTarget: Milliseconds;
36
37
  protected failedDownloads: number;
37
38
  protected lastDataObtainedTimestampMs: Milliseconds;
@@ -76,6 +77,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
76
77
  get lastDataObtainedTimestamp(): Milliseconds;
77
78
  setTarget(time: Milliseconds): void;
78
79
  setPreloadOnly(preloadOnly: boolean): void;
80
+ setAdPreloadMode(enabled: boolean): void;
79
81
  destroy(): void;
80
82
  protected forceSwitchCondition(oldRepresentation: Representation, newRepresentation: Representation): boolean;
81
83
  protected clearBuffer(): Promise<void>;
@@ -92,6 +92,7 @@ export declare abstract class BasePlayer {
92
92
  getCodecs(): Manifest["codecs"] | undefined;
93
93
  setBufferTarget(time: Milliseconds): void;
94
94
  setPreloadOnly(preloadOnly: boolean): void;
95
+ setAdPreloadMode(enabled: boolean): void;
95
96
  stop(): void;
96
97
  destroy(): void;
97
98
  updateSourceDurationFromSegments(): void;
@@ -15,6 +15,7 @@ interface IParams extends IProviderDependencies {
15
15
  volumeMultiplier?: number;
16
16
  panelSize?: IRectangle;
17
17
  skipVideoElVolumeSync$: ValueSubject<boolean>;
18
+ handleNetworkRecoverableErrorAsProviderError?: boolean;
18
19
  }
19
20
  export default class ProviderContainer implements IProviderContainer {
20
21
  current$: IValueSubject<IProviderEntry>;
@@ -40,6 +41,7 @@ export default class ProviderContainer implements IProviderContainer {
40
41
  constructor(params: IParams);
41
42
  init(): void;
42
43
  destroy(): void;
44
+ setAdPreloadMode(enabled: boolean): void;
43
45
  private initProvider;
44
46
  private reinitProvider;
45
47
  private switchToNextProvider;
@@ -13,6 +13,7 @@ export interface IProviderContainer {
13
13
  providerOutput: IProviderOutput;
14
14
  init(): void;
15
15
  destroy(): void;
16
+ setAdPreloadMode(enabled: boolean): void;
16
17
  }
17
18
  export type IProviderEntry = {
18
19
  type: VideoFormat;
@@ -1,4 +1,5 @@
1
- import { VideoFormat, VideoCodec, AudioCodec } from "../../../player/types";
1
+ import type { VideoCodec } from "../../../player/types";
2
+ import { VideoFormat, VideoCodecName, AudioCodec } from "../../../player/types";
2
3
  import { type ITuningConfig } from "../../../utils/tuningConfig";
3
4
  type VodFormat = VideoFormat.MPEG | VideoFormat.DASH_SEP | VideoFormat.DASH_WEBM | VideoFormat.DASH_WEBM_AV1 | VideoFormat.DASH_STREAMS | VideoFormat.DASH_ONDEMAND | VideoFormat.HLS | VideoFormat.HLS_FMP4 | VideoFormat.HLS_ONDEMAND;
4
5
  type Constraints = Pick<ITuningConfig, "webmCodec" | "androidPreferredFormat" | "iosPreferredFormat" | "preferCMAF" | "preferWebRTC" | "preferMultiStream">;
@@ -15,7 +16,13 @@ type AllLiveFormats = [LiveFormat, LiveFormat, LiveFormat, LiveFormat, LiveForma
15
16
  export declare const getLiveFormatsPriority: ({ androidPreferredFormat, preferCMAF, preferWebRTC }: Constraints) => AllLiveFormats;
16
17
  export declare const getChromeCastFormatsPriority: (live: boolean) => VideoFormat[];
17
18
  export declare const selectCodec: (codecs: Set<string>) => string | undefined;
18
- export declare const filterAvailableVideoCodecs: (codecs: string[]) => VideoCodec[];
19
+ type CodecStream = {
20
+ codecs: string;
21
+ hdr?: boolean;
22
+ };
23
+ export declare const filterAvailableVideoCodecs: (streams: CodecStream[], { preferHdr }: {
24
+ preferHdr: boolean;
25
+ }) => VideoCodec[];
19
26
  export declare const filterAvailableAudioCodecs: (codecs: string[]) => AudioCodec[];
20
- export declare const convertCodecName: <T extends VideoCodec | AudioCodec>(codec: string) => T;
27
+ export declare const convertCodecName: <T extends VideoCodecName | AudioCodec>(codec: string) => T;
21
28
  export {};
@@ -1,4 +1,4 @@
1
- import type { VideoCodec, VideoFormat } from "../player/types";
1
+ import type { VideoCodecName, VideoFormat } from "../player/types";
2
2
  import { WebmCodecStrategy } from "../enums/WebmCodecStrategy";
3
3
  import { AndroidPreferredFormat } from "../enums/AndroidPreferredFormat";
4
4
  import { IOSPreferredFormat } from "../enums/IOSPreferredFormat";
@@ -36,6 +36,7 @@ export type ITuningConfig = {
36
36
  initialThroughput: Kbps;
37
37
  measureNonSegmentRequests: boolean;
38
38
  smallSampleMinDuration: Milliseconds;
39
+ cacheThresholdSize: Milliseconds;
39
40
  rttPenaltyRequestSize: Byte;
40
41
  streamMinSampleSize: Byte;
41
42
  streamMinSampleTime: Milliseconds;
@@ -208,7 +209,7 @@ export type ITuningConfig = {
208
209
  budgetFactor: number;
209
210
  fallbackSegmentDurationMs: Milliseconds;
210
211
  };
211
- videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodec][];
212
+ videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodecName][];
212
213
  filterOnDemandQualityList: boolean;
213
214
  dashMaxTvVideoQuality: boolean;
214
215
  };
@@ -286,7 +287,17 @@ export type ITuningConfig = {
286
287
  useDelayedPlaybackHangupWithData: boolean;
287
288
  playbackHangupNoDataThreshold: Milliseconds;
288
289
  endGapTolerance: Milliseconds;
290
+ /**
291
+ * Время после перехода в состояние buffering, когда мы считаем что происходит stall
292
+ */
289
293
  stallIgnoreThreshold: Milliseconds;
294
+ /**
295
+ * Стратегия записи столлов
296
+ * verbose - записываем всё
297
+ * exclude-threshold - записываем столлы длинее stallIgnoreThreshold, но вычитаем длину stallIgnoreThreshold
298
+ * include-threshold - записываем столлы длинее stallIgnoreThreshold
299
+ */
300
+ stallHandlingStrategy: "verbose" | "exclude-threshold" | "include-threshold";
290
301
  gapWatchdogInterval: Milliseconds;
291
302
  requestQuick: boolean;
292
303
  /** @deprecated HLS.js удалён, флаг ничего не делает */