@vkontakte/videoplayer-core 2.0.160-dev.fa864e67.0 → 2.0.160

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.160-dev.fa864e67.0",
3
+ "version": "2.0.160",
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.89-dev.fa864e67.0"
45
+ "@vkontakte/videoplayer-shared": "1.0.89"
46
46
  }
47
47
  }
@@ -18,6 +18,7 @@ type IParams = IProviderParams<IDashURLSource> & {
18
18
  sourceHls?: IHLSSource;
19
19
  forceVideoCodec?: VideoCodec;
20
20
  failedVideoTrack?: Nullable<IVideoTrack>;
21
+ isOnDemand?: boolean;
21
22
  };
22
23
  export default abstract class BaseDashProvider implements IProvider {
23
24
  scene3D: Scene3D | undefined;
@@ -22,6 +22,9 @@ export interface IParams {
22
22
  compatibilityMode?: boolean;
23
23
  tracer: ITracer;
24
24
  useEnableSubtitlesParam?: boolean;
25
+ handleExtendedNetworkErrorsSet?: boolean;
26
+ useUrlCacheMechanism?: boolean;
27
+ measureNonSegmentRequests?: boolean;
25
28
  }
26
29
  export type Priority = "high" | "low" | "auto";
27
30
  export interface FetchParamsWithUrl extends FetchParams {
@@ -38,6 +41,7 @@ export interface FetchParams {
38
41
  isLowLatency?: boolean;
39
42
  bufferOptimisation?: boolean;
40
43
  ignoreNetworkErrors?: boolean;
44
+ urlCacheMechanismEnabled?: boolean;
41
45
  }
42
46
  export type RepresentationFetchResult = {
43
47
  init: CommonInit | null;
@@ -63,9 +67,13 @@ export declare class Fetcher {
63
67
  private readonly subscription;
64
68
  private compatibilityMode;
65
69
  private useEnableSubtitlesParam;
70
+ private useUrlCacheMechanism;
71
+ private measureNonSegmentRequests;
72
+ private startupPhase;
66
73
  private performanceObserver;
67
74
  private pendingConnectionMetrics;
68
- constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
75
+ private handleExtendedNetworkErrorsSet;
76
+ constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
69
77
  private onHeadersReceived;
70
78
  private setupPerformanceObserver;
71
79
  private processPerformanceResourceTiming;
@@ -19,6 +19,7 @@ export interface Params {
19
19
  compatibilityMode?: boolean;
20
20
  forceVideoCodec?: VideoCodec;
21
21
  tracer: ITracer;
22
+ isOnDemand: boolean;
22
23
  }
23
24
  export declare class Player {
24
25
  private element;
@@ -81,6 +82,7 @@ export declare class Player {
81
82
  private stallWatchdogSubscription;
82
83
  private livePauseWatchdogSubscription;
83
84
  private liveWasInterrupted;
85
+ private isOnDemand;
84
86
  private destroyController;
85
87
  constructor(params: Params);
86
88
  initManifest: ReturnType<typeof abortable<[HTMLVideoElement, string, number]>>;
@@ -0,0 +1,9 @@
1
+ import type { IError, ISubject } from "@vkontakte/videoplayer-shared";
2
+ type Params = {
3
+ txtCode: string;
4
+ error$: ISubject<IError>;
5
+ recoverableError$: ISubject<IError>;
6
+ httpCode?: number | undefined;
7
+ };
8
+ export declare const processNetworkErrors: ({ txtCode, error$, recoverableError$, httpCode }: Params) => void;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ export type CacheManager = {
2
+ get: () => Promise<Response | null>;
3
+ set: (response: Response) => void;
4
+ };
5
+ /**
6
+ * Пытаемся добиться кэширования вызовов.
7
+ * Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
8
+ * Из за этого обрабатываем кэш вручную.
9
+ */
10
+ export declare const createCacheManager: (url: string) => Promise<CacheManager>;
11
+ export declare function canUseCacheApi(): boolean;
12
+ export declare function normalizeUrl(url: string): string;
13
+ /**
14
+ * Проверяет, не просрочен ли кэшированный ответ
15
+ */
16
+ export declare function isResponseExpired(response: Response): boolean;
17
+ export declare function cloneResponse(response: Response, url: string): Response;
18
+ /**
19
+ * Извлекает expires из оригинального URL (параметр expires1)
20
+ * Предполагается, что expires1 — timestamp в секундах
21
+ */
22
+ export declare function getExpiresFromUrl(url: string): number;
23
+ export declare const dropUrlsCache: () => Promise<void>;
@@ -18,6 +18,7 @@ type IParams = IProviderParams<IDashURLSource> & {
18
18
  sourceHls?: IHLSSource;
19
19
  forceVideoCodec?: VideoCodec;
20
20
  failedVideoTrack?: Nullable<IVideoTrack>;
21
+ isOnDemand?: boolean;
21
22
  };
22
23
  export default abstract class BaseDashProvider implements IProvider {
23
24
  scene3D: Scene3D | undefined;
@@ -22,6 +22,9 @@ export interface IParams {
22
22
  compatibilityMode?: boolean;
23
23
  tracer: ITracer;
24
24
  useEnableSubtitlesParam?: boolean;
25
+ handleExtendedNetworkErrorsSet?: boolean;
26
+ useUrlCacheMechanism?: boolean;
27
+ measureNonSegmentRequests?: boolean;
25
28
  }
26
29
  export type Priority = "high" | "low" | "auto";
27
30
  export interface FetchParamsWithUrl extends FetchParams {
@@ -37,6 +40,7 @@ export interface FetchParams {
37
40
  measureThroughput?: boolean;
38
41
  isLowLatency?: boolean;
39
42
  bufferOptimisation?: boolean;
43
+ urlCacheMechanismEnabled?: boolean;
40
44
  }
41
45
  export type RepresentationFetchResult<T extends Segment> = {
42
46
  initMetadata: CommonInit | null;
@@ -62,9 +66,13 @@ export declare class Fetcher {
62
66
  private subscription;
63
67
  private compatibilityMode;
64
68
  private useEnableSubtitlesParam;
69
+ private useUrlCacheMechanism;
70
+ private measureNonSegmentRequests;
71
+ private startupPhase;
65
72
  private performanceObserver;
66
73
  private pendingConnectionMetrics;
67
- constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
74
+ private handleExtendedNetworkErrorsSet;
75
+ constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam, handleExtendedNetworkErrorsSet, useUrlCacheMechanism, measureNonSegmentRequests }: IParams);
68
76
  private onHeadersReceived;
69
77
  private setupPerformanceObserver;
70
78
  private processResourceTiming;
@@ -70,6 +70,7 @@ export declare abstract class BasePlayer {
70
70
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
71
71
  fetcherRecoverableError$: Subject<IError>;
72
72
  fetcherError$: Subject<IError>;
73
+ private isOnDemand;
73
74
  protected constructor(params: Params);
74
75
  protected abstract prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
75
76
  protected abstract setSourceDuration(): void;
@@ -14,4 +14,5 @@ export interface Params {
14
14
  compatibilityMode?: boolean;
15
15
  forceVideoCodec?: VideoCodec;
16
16
  tracer: ITracer;
17
+ isOnDemand?: boolean;
17
18
  }
@@ -0,0 +1,9 @@
1
+ import type { IError, ISubject } from "@vkontakte/videoplayer-shared";
2
+ type Params = {
3
+ txtCode: string;
4
+ error$: ISubject<IError>;
5
+ recoverableError$: ISubject<IError>;
6
+ httpCode?: number | undefined;
7
+ };
8
+ export declare const processNetworkErrors: ({ txtCode, error$, recoverableError$, httpCode }: Params) => void;
9
+ export {};
@@ -0,0 +1,22 @@
1
+ export type CacheManager = {
2
+ get: () => Promise<Response | null>;
3
+ set: (response: Response) => Promise<void>;
4
+ };
5
+ /**
6
+ * Пытаемся добиться кэширования вызовов.
7
+ * Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
8
+ * Из за этого обрабатываем кэш вручную.
9
+ */
10
+ export declare const createCacheManager: (url: string) => Promise<CacheManager>;
11
+ export declare function canUseCacheApi(): boolean;
12
+ export declare function normalizeUrl(url: string): string;
13
+ /**
14
+ * Проверяет, не просрочен ли кэшированный ответ
15
+ */
16
+ export declare function isResponseExpired(response: Response): boolean;
17
+ export declare function cloneResponse(response: Response, url: string): Response;
18
+ /**
19
+ * Извлекает expires из оригинального URL (параметр expires1)
20
+ * Предполагается, что expires1 — timestamp в секундах
21
+ */
22
+ export declare function getExpiresFromUrl(url: string): number;
@@ -1,6 +1,8 @@
1
1
  import type { IHLSSource } from "../../player/types";
2
2
  import type { IProvider, IProviderParams } from "../types";
3
- type Params = IProviderParams<IHLSSource>;
3
+ type Params = IProviderParams<IHLSSource> & {
4
+ isOnDemand: boolean;
5
+ };
4
6
  export default class HlsProvider implements IProvider {
5
7
  private subscription;
6
8
  private volumeSubscription;
@@ -19,7 +19,11 @@ interface IParams extends IProviderDependencies {
19
19
  export default class ProviderContainer implements IProviderContainer {
20
20
  current$: IValueSubject<IProviderEntry>;
21
21
  providerError$: ISubject<IError>;
22
- noAvailableProvidersError$: ISubject<VideoFormat | undefined>;
22
+ noAvailableProvidersError$: ISubject<{
23
+ forced?: VideoFormat;
24
+ input: VideoFormat[];
25
+ supported: VideoFormat[];
26
+ }>;
23
27
  volumeMultiplierError$: ISubject<IError>;
24
28
  providerOutput: IProviderOutput;
25
29
  private subscription;
@@ -4,7 +4,11 @@ import type { IProvider, IProviderOutput } from "../types";
4
4
  export interface IProviderContainer {
5
5
  current$: IValueObservable<IProviderEntry>;
6
6
  providerError$: ISubject<IError>;
7
- noAvailableProvidersError$: ISubject<VideoFormat | undefined>;
7
+ noAvailableProvidersError$: ISubject<{
8
+ forced?: VideoFormat;
9
+ input: VideoFormat[];
10
+ supported: VideoFormat[];
11
+ }>;
8
12
  volumeMultiplierError$: ISubject<IError>;
9
13
  providerOutput: IProviderOutput;
10
14
  init(): void;
@@ -3,9 +3,11 @@ export interface IStatefulIterator<T> {
3
3
  getValue(): T;
4
4
  isCompleted(): boolean;
5
5
  isLast(): boolean;
6
+ all(): T[];
6
7
  }
7
8
  export declare class StatefulIterator<T> implements IStatefulIterator<T> {
8
9
  private readonly length;
10
+ private array;
9
11
  private index;
10
12
  private iterator;
11
13
  private current;
@@ -14,4 +16,5 @@ export declare class StatefulIterator<T> implements IStatefulIterator<T> {
14
16
  getValue(): T;
15
17
  isCompleted(): boolean;
16
18
  isLast(): boolean;
19
+ all(): T[];
17
20
  }
@@ -19,7 +19,7 @@ declare class ThroughputEstimator {
19
19
  */
20
20
  addRawThroughput(rate: Kbps): void;
21
21
  addRawRtt(time: Milliseconds): void;
22
- private static sanityCheck;
22
+ private sanityCheck;
23
23
  private static load;
24
24
  }
25
25
  export default ThroughputEstimator;
@@ -2,7 +2,7 @@ import type { VideoCodec, 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";
5
- import type { Byte, Milliseconds, RecursivePartial, Seconds } from "@vkontakte/videoplayer-shared";
5
+ import type { Byte, Kbps, Milliseconds, RecursivePartial, Seconds } from "@vkontakte/videoplayer-shared";
6
6
  import { type ExactVideoQuality, VideoQuality } from "@vkontakte/videoplayer-shared";
7
7
  import { AudioRuleName, VideoRuleName } from "../providers/utils/Abr/types";
8
8
  export type ITuningConfig = {
@@ -33,6 +33,9 @@ export type ITuningConfig = {
33
33
  basisTrendChangeCount: number;
34
34
  changeThreshold: number;
35
35
  useBrowserEstimation: boolean;
36
+ initialThroughput: Kbps;
37
+ measureNonSegmentRequests: boolean;
38
+ smallSampleMinDuration: Milliseconds;
36
39
  rttPenaltyRequestSize: Byte;
37
40
  streamMinSampleSize: Byte;
38
41
  streamMinSampleTime: Milliseconds;
@@ -158,6 +161,7 @@ export type ITuningConfig = {
158
161
  useFailoverHostsOnAllProviderCrash: boolean;
159
162
  videoTrackBanAfterProviderFail: Milliseconds;
160
163
  videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodec][];
164
+ filterOnDemandQualityList: boolean;
161
165
  };
162
166
  dashCmafLive: {
163
167
  externalStopControl: boolean;
@@ -238,6 +242,7 @@ export type ITuningConfig = {
238
242
  requestQuick: boolean;
239
243
  /** @deprecated HLS.js удалён, флаг ничего не делает */
240
244
  useHlsJs: boolean;
245
+ disableHlsOnDesktop: boolean;
241
246
  useNativeHLSTextTracks: boolean;
242
247
  useNewSwitchTo: boolean;
243
248
  alwaysAbortPreviousSwitch: boolean;
@@ -321,6 +326,23 @@ export type ITuningConfig = {
321
326
  * (Скорее всего имеет смысл включить такой же флаг в настройках ui)
322
327
  */
323
328
  reuseOwnVideoElement?: boolean;
329
+ /**
330
+ * Обрабатываем все сетевые ошибки, которые приходят с бэка.
331
+ * на http 500 не падаем в краш.
332
+ */
333
+ handleExtendedNetworkErrorsSet?: boolean;
334
+ /**
335
+ * Кэшируем ответы от сервера руками, так как из за динамичесокй природы некоторых параметров в урле
336
+ * браузер это не может сделать.
337
+ */
338
+ useUrlCacheMechanism?: boolean;
339
+ /**
340
+ * Очищаем кэш урлов при падение провайдера.
341
+ */
342
+ dropUrlCacheWhenProviderCrashed?: boolean;
343
+ hls: {
344
+ filterOnDemandQualityList: boolean;
345
+ };
324
346
  };
325
347
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
326
348
  export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
@@ -1,4 +1,4 @@
1
1
  import { type ISources, VideoFormat } from "../player/types";
2
- export declare const filterAvailableFormats: (formats: VideoFormat[]) => VideoFormat[];
2
+ export declare const filterAvailableFormats: (formats: VideoFormat[], disableHlsOnDesktop?: boolean) => VideoFormat[];
3
3
  export declare const isLiveFormat: (format: VideoFormat) => boolean;
4
- export declare const areValidLiveRecordSources: (sources: ISources) => boolean;
4
+ export declare const areValidLiveRecordSources: (sources: ISources, disableHlsOnDesktop?: boolean) => boolean;