@vkontakte/videoplayer-core 2.0.161-dev.e4f30602d.0 → 2.0.161-dev.e774e8df3.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.161-dev.e4f30602d.0",
3
+ "version": "2.0.161-dev.e774e8df3.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.90-dev.e4f30602d.0"
45
+ "@vkontakte/videoplayer-shared": "1.0.90-dev.e774e8df3.0"
46
46
  }
47
47
  }
@@ -33,6 +33,7 @@ export declare class BufferManager {
33
33
  playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
34
34
  error$: ISubject<IError>;
35
35
  gaps: Gap[];
36
+ updateEnd$: IValueSubject<void>;
36
37
  private subscription;
37
38
  private kind;
38
39
  private initData;
@@ -115,4 +115,6 @@ export declare class Player {
115
115
  * Возвращает duration в милисекундах.
116
116
  */
117
117
  calculateDurationFromSegments(): number;
118
+ private isAnyBufferUpdating;
119
+ updateSourceDurationFromSegments(): void;
118
120
  }
@@ -1,6 +1,7 @@
1
- import type { IError, IRange, ISubject, Milliseconds } from "@vkontakte/videoplayer-shared";
1
+ import type { IError, IRange, ISubject, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
2
2
  export declare class NativeBufferManager {
3
3
  error$: ISubject<IError>;
4
+ updateEnd$: IValueSubject<void>;
4
5
  private mediaSource;
5
6
  private sourceBuffer;
6
7
  private sourceBufferTaskQueue;
@@ -32,10 +32,11 @@ export interface IVirtualBufferManager<T extends Segment = Segment> {
32
32
  getForwardBufferRepresentations(currentPosition?: Milliseconds): Map<Representation["id"], T[]>;
33
33
  getForwardPlaybackBufferDuration(currentPosition?: Milliseconds): Milliseconds;
34
34
  getPlaybackBufferState(): IRange<Milliseconds> | null;
35
+ getMutexInfo(): string;
35
36
  setTarget(time: Milliseconds): void;
36
37
  setPreloadOnly(preloadOnly: boolean): void;
37
38
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
38
- calculateDurationFromSegments(representationId: Representation["id"]): Milliseconds;
39
+ calculateDurationFromSegments(): Milliseconds;
39
40
  destroy(): void;
40
41
  get lastDataObtainedTimestamp(): Milliseconds;
41
42
  }
@@ -59,7 +59,6 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
59
59
  startWith: ReturnType<typeof abortable<[Representation["id"]]>>;
60
60
  switchTo(newRepresentationId: Representation["id"], mode?: SwithRepresentationMode): Promise<void>;
61
61
  protected getSwitchWithAbort(): ReturnType<typeof abortable<[Representation["id"], SwithRepresentationMode], void>>;
62
- switchToOld: ReturnType<typeof abortable<[Representation["id"], boolean | undefined], void>>;
63
62
  prepareSeek(): Promise<void>;
64
63
  seek(position: Milliseconds | undefined): Promise<void>;
65
64
  maintain(currentPosition?: Milliseconds | undefined): Promise<void>;
@@ -69,7 +68,8 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
69
68
  abort(): Promise<void>;
70
69
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
71
70
  getRepresentationInitialTime(): Seconds;
72
- calculateDurationFromSegments(representationId: Representation["id"]): Milliseconds;
71
+ getMutexInfo(): string;
72
+ calculateDurationFromSegments(): Milliseconds;
73
73
  get lastDataObtainedTimestamp(): Milliseconds;
74
74
  setTarget(time: Milliseconds): void;
75
75
  setPreloadOnly(preloadOnly: boolean): void;
@@ -73,7 +73,7 @@ export declare abstract class BasePlayer {
73
73
  private isOnDemand;
74
74
  protected constructor(params: Params);
75
75
  protected abstract prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
76
- protected abstract setSourceDuration(): void;
76
+ protected abstract setSourceInitDuration(): void;
77
77
  protected abstract restoreAfterDeepStall(stallTraceAttributes: Record<string, number>): Promise<void>;
78
78
  initRepresentations: ReturnType<typeof abortable<[Representation["id"], Representation["id"] | undefined, IHLSSource | undefined]>>;
79
79
  initManifest(element: HTMLVideoElement, manifestBaseUrlString: string, offset: number): Promise<void>;
@@ -82,7 +82,6 @@ export declare abstract class BasePlayer {
82
82
  seek(requestedPosition: Milliseconds, forcePrecise?: boolean): Promise<void>;
83
83
  warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
84
84
  getForwardBufferRepresentations(kind: Exclude<StreamKind, StreamKind.TEXT>): Map<Representation["id"], Segment[]> | undefined;
85
- calculateDurationFromSegments(representationId: Representation["id"]): Milliseconds;
86
85
  get isStreamEnded(): boolean;
87
86
  getStreams(): Manifest["streams"] | undefined;
88
87
  getCodecs(): Manifest["codecs"] | undefined;
@@ -90,6 +89,9 @@ export declare abstract class BasePlayer {
90
89
  setPreloadOnly(preloadOnly: boolean): void;
91
90
  stop(): void;
92
91
  destroy(): void;
92
+ updateSourceDurationFromSegments(): void;
93
+ calculateDurationFromBuffersSegments(): Milliseconds;
94
+ private isAnyBufferUpdating;
93
95
  protected get isStreamNotOpen(): boolean;
94
96
  protected reinitDecoderIfNeeded(force?: boolean): Promise<void>;
95
97
  protected stallWatchdogIntervalCallback(): Promise<void>;
@@ -18,7 +18,7 @@ export declare class LivePlayer extends BasePlayer {
18
18
  initBuffer(): void;
19
19
  protected forcePositionToRepresentationInitialTime(): Promise<void>;
20
20
  protected tick(): Promise<void>;
21
- protected setSourceDuration(): void;
21
+ protected setSourceInitDuration(): void;
22
22
  protected isStallExceeded(timeInWaiting: Milliseconds): boolean;
23
23
  protected restoreAfterDeepStall(stallTraceAttributes: Record<string, number>): Promise<void>;
24
24
  protected updateManifest(): Promise<Manifest | null>;
@@ -4,7 +4,7 @@ export declare class Player extends BasePlayer {
4
4
  constructor(params: Params);
5
5
  protected prepareManifestUrlString(manifestBaseUrlString: string, _offset: number): string;
6
6
  protected initRepresentationSubscriptions(): void;
7
- protected setSourceDuration(): void;
7
+ protected setSourceInitDuration(): void;
8
8
  protected restoreAfterDeepStall(stallTraceAttributes: Record<string, number>): Promise<void>;
9
9
  protected initDisableStallWatchdogSubscription(): void;
10
10
  protected initEndOfVideoSubscription(): void;
@@ -18,7 +18,7 @@ export default class HlsProvider implements IProvider {
18
18
  private subscribe;
19
19
  destroy(): void;
20
20
  private prepare;
21
- private playIfAllowed;
21
+ protected playIfAllowed(): void;
22
22
  private seek;
23
23
  private syncPlayback;
24
24
  }
@@ -13,7 +13,7 @@ export default class MpegProvider implements IProvider {
13
13
  private subscribe;
14
14
  destroy(): void;
15
15
  private prepare;
16
- private playIfAllowed;
16
+ protected playIfAllowed(): void;
17
17
  private seek;
18
18
  private syncPlayback;
19
19
  private handleQualityLimitTransition;
@@ -12,4 +12,6 @@ export default class AbrController<
12
12
  updateContext(context: C): void;
13
13
  autoSelectTrack(): T;
14
14
  private selectTrackBasedOnHistory;
15
+ /** при переключении аудио стрима очищаем историю для предотвращения залипания в `onCooldown` */
16
+ historyReset(): void;
15
17
  }
@@ -20,6 +20,8 @@ declare class ThroughputEstimator {
20
20
  addRawThroughput(rate: Kbps): void;
21
21
  addRawRtt(time: Milliseconds): void;
22
22
  private sanityCheck;
23
- private static load;
23
+ private static loadStored;
24
+ private static writeStored;
25
+ private static validateStored;
24
26
  }
25
27
  export default ThroughputEstimator;
@@ -45,6 +45,24 @@ export type ITuningConfig = {
45
45
  continuesByteSequenceInterval: Milliseconds;
46
46
  maxLastEvaluationTimeout: Milliseconds;
47
47
  };
48
+ /**
49
+ * TTL + проверка типа сети для кешированного throughput из localStorage.
50
+ * При включении: если сохранённое значение старше storedThroughputTtlMs
51
+ * или тип сети изменился (Wi-Fi→3G) — значение отбрасывается.
52
+ * Предотвращает старт в 4K при переходе с Wi-Fi на мобильную сеть.
53
+ *
54
+ * При OFF (дефолт): читаем/пишем как до фикса — plain number в legacy-ключ
55
+ * one_video_*. Это даёт безопасный rollback JS-версии без потери данных.
56
+ * При ON: новый формат (JSON с timestamp+networkType) → новый ключ vk_uvp_*.
57
+ */
58
+ useThroughputTtl: boolean;
59
+ /**
60
+ * Срок жизни кешированного throughput (мс). По умолчанию 4 часа.
61
+ * После истечения TTL значение из localStorage игнорируется —
62
+ * используется browser estimation или initialThroughput.
63
+ * Применимо только при useThroughputTtl=true.
64
+ */
65
+ storedThroughputTtlMs: Milliseconds;
48
66
  };
49
67
  autoTrackSelection: {
50
68
  bitrateFactorAtEmptyBuffer: number;
@@ -130,6 +148,8 @@ export type ITuningConfig = {
130
148
  useNewRepresentationSwitch: boolean;
131
149
  useDelayedRepresentationSwitch: boolean;
132
150
  useSmartRepresentationSwitch: boolean;
151
+ seekStallExitPolicy: boolean;
152
+ mutexStallExitPolicy: boolean;
133
153
  useFetchPriorityHints: boolean;
134
154
  useAbortMSEFix: boolean;
135
155
  enableBaseUrlSupport: boolean;
@@ -343,9 +363,17 @@ export type ITuningConfig = {
343
363
  * Очищаем кэш урлов при падение провайдера.
344
364
  */
345
365
  dropUrlCacheWhenProviderCrashed?: boolean;
366
+ /**
367
+ * При смене/реините провайдера игнорируем результат того, смогло видео заиграть или нет.
368
+ */
369
+ ignoreForcePlayResultWhenProviderChanged?: boolean;
346
370
  hls: {
347
371
  filterOnDemandQualityList: boolean;
348
372
  };
373
+ /**
374
+ * Устанавливаем длительность видео на основе последнего сегмента.
375
+ */
376
+ useDurationFromSegments: boolean;
349
377
  };
350
378
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
351
379
  export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;