@vkontakte/videoplayer-core 2.0.156-dev.fa4486263.0 → 2.0.156

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.
Files changed (54) hide show
  1. package/es2015.cjs +109 -19
  2. package/es2015.esm.js +110 -20
  3. package/es2018.cjs +109 -19
  4. package/es2018.esm.js +109 -19
  5. package/es2024.cjs +109 -19
  6. package/es2024.esm.js +110 -20
  7. package/esnext.cjs +109 -19
  8. package/esnext.esm.js +110 -20
  9. package/evergreen.esm.js +103 -13
  10. package/package.json +2 -2
  11. package/types/player/Player.d.ts +3 -2
  12. package/types/player/types.d.ts +6 -2
  13. package/types/providers/ChromecastPresentationApiProvider/types.d.ts +1 -1
  14. package/types/providers/ChromecastProvider/types.d.ts +1 -1
  15. package/types/providers/DashLiveProvider/DashLiveProvider.d.ts +1 -0
  16. package/types/providers/DashProvider/baseDashProvider.d.ts +4 -1
  17. package/types/providers/DashProvider/lib/buffer.d.ts +3 -1
  18. package/types/providers/DashProvider/lib/player.d.ts +2 -1
  19. package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +11 -8
  20. package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +5 -3
  21. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +11 -4
  22. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/byteRangeVirtualBufferManager.d.ts +1 -1
  23. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/templateVirtualBufferManager.d.ts +1 -1
  24. package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +1 -1
  25. package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +3 -2
  26. package/types/providers/HlsLiveProvider/index.d.ts +1 -0
  27. package/types/providers/HlsProvider/index.d.ts +1 -0
  28. package/types/providers/MpegProvider/index.d.ts +1 -0
  29. package/types/providers/ProviderContainer/index.d.ts +2 -0
  30. package/types/providers/ProviderContainer/utils/playbackHangup.d.ts +5 -2
  31. package/types/providers/WebRTCLiveProvider/WebRTCLiveProvider.d.ts +1 -0
  32. package/types/providers/types.d.ts +2 -0
  33. package/types/providers/utils/Abr/abrController.d.ts +15 -0
  34. package/types/providers/utils/Abr/abrManager.d.ts +18 -0
  35. package/types/providers/utils/Abr/controllers/stallsController.d.ts +33 -0
  36. package/types/providers/utils/Abr/rules/audio/audioThroughputRule.d.ts +12 -0
  37. package/types/providers/utils/Abr/rules/audio/minAudioForVideoRule.d.ts +11 -0
  38. package/types/providers/utils/Abr/rules/baseRule.d.ts +19 -0
  39. package/types/providers/utils/Abr/rules/limitAboveRule.d.ts +11 -0
  40. package/types/providers/utils/Abr/rules/limitBelowRule.d.ts +11 -0
  41. package/types/providers/utils/Abr/rules/video/bufferRule.d.ts +11 -0
  42. package/types/providers/utils/Abr/rules/video/fitsContainerRule.d.ts +14 -0
  43. package/types/providers/utils/Abr/rules/video/lowerLimitRule.d.ts +12 -0
  44. package/types/providers/utils/Abr/rules/video/stallsRule.d.ts +18 -0
  45. package/types/providers/utils/Abr/rules/video/throughputRule.d.ts +12 -0
  46. package/types/providers/utils/Abr/rules/video/upperLimitRule.d.ts +12 -0
  47. package/types/providers/utils/Abr/trackHistory.d.ts +9 -0
  48. package/types/providers/utils/Abr/types.d.ts +105 -0
  49. package/types/providers/utils/Abr/utils.d.ts +13 -0
  50. package/types/providers/{DashProvider/lib → utils/HTMLVideoElement}/ElementSizeManager.d.ts +1 -1
  51. package/types/providers/utils/HTMLVideoElement/pool.d.ts +4 -3
  52. package/types/providers/utils/syncDesiredState.d.ts +4 -2
  53. package/types/utils/tuningConfig.d.ts +24 -2
  54. package/types/providers/DashProviderVirtual/lib/ElementSizeManager.d.ts +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.156-dev.fa4486263.0",
3
+ "version": "2.0.156",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer core library based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -54,6 +54,6 @@
54
54
  "**/*.d.ts"
55
55
  ],
56
56
  "dependencies": {
57
- "@vkontakte/videoplayer-shared": "1.0.85-dev.fa4486263.0"
57
+ "@vkontakte/videoplayer-shared": "1.0.85"
58
58
  }
59
59
  }
@@ -107,6 +107,7 @@ interface PlayerExperimentalImpl {
107
107
  enableDebugTelemetry$: ValueSubject<boolean>;
108
108
  dumpTelemetry: typeof dump;
109
109
  getCurrentTime$: ValueSubject<(() => number) | null>;
110
+ skipVideoElVolumeSync$: ValueSubject<boolean>;
110
111
  }
111
112
  export default class Player implements IPlayer {
112
113
  private subscription;
@@ -148,8 +149,8 @@ export default class Player implements IPlayer {
148
149
  * @param percent: number [0, 1];
149
150
  */
150
151
  seekPercent(percent: number): IPlayer;
151
- setVolume(percent: number, desiredMuted?: boolean): IPlayer;
152
- setMuted(muted: boolean, forced?: boolean): IPlayer;
152
+ setVolume(percent: number, desiredMuted?: boolean, skipVideoElVolumeSync?: boolean): IPlayer;
153
+ setMuted(muted: boolean, forced?: boolean, skipVideoElVolumeSync?: boolean): IPlayer;
153
154
  setVideoStream(stream: IVideoStream): IPlayer;
154
155
  setAudioStream(stream: IAudioStream): IPlayer;
155
156
  setQuality(quality: VideoQuality): IPlayer;
@@ -30,14 +30,17 @@ export interface IPlayer {
30
30
  seekPercent(percent: number): IPlayer;
31
31
  /**
32
32
  * @param percent: number [0; 1]
33
+ * @param muted Флаг, отражающий нужно ли сделать мьют.
34
+ * @param skipVideoElVolumeSync Флаг, который не меняет громкость у видеоэлемента
33
35
  */
34
- setVolume(percent: number, muted?: boolean): IPlayer;
36
+ setVolume(percent: number, muted?: boolean, skipVideoElVolumeSync?: boolean): IPlayer;
35
37
  /**
36
38
  * @param muted Флаг, отражающий нужно ли сделать мьют.
37
39
  * @param forced Флаг, который игнорирует внутренние механики простановки mute значения
38
40
  * и ставит то значение, которое передали в функцию.
41
+ * @param skipVideoElVolumeSync Флаг, который не меняет громкость у видеоэлемента
39
42
  */
40
- setMuted(muted: boolean, forced?: boolean): IPlayer;
43
+ setMuted(muted: boolean, forced?: boolean, skipVideoElVolumeSync?: boolean): IPlayer;
41
44
  setAudioStream(stream: IVideoStream): IPlayer;
42
45
  setVideoStream(stream: IVideoStream): IPlayer;
43
46
  setQuality(quality: VideoQuality): IPlayer;
@@ -483,6 +486,7 @@ export interface IConfig {
483
486
  failoverHosts?: string[];
484
487
  volumeMultiplier?: number;
485
488
  panelSize?: IRectangle;
489
+ isMuted?: boolean;
486
490
  }
487
491
  export interface ISources {
488
492
  [VideoFormat.MPEG]?: IMpegSource;
@@ -16,7 +16,7 @@ export declare enum PlayerState {
16
16
  export interface IChromecastPresentationApiInitializer extends IChromecastInitializer {
17
17
  chromecastConnector?: ChromecastPresentationApiConnector;
18
18
  }
19
- export interface IParams extends Omit<IParamsChromecastProvider, "connection"> {
19
+ export interface IParams extends Omit<IParamsChromecastProvider, "connection" | "skipVideoElVolumeSync$"> {
20
20
  chromecastConnector: ChromecastPresentationApiConnector;
21
21
  }
22
22
  /**
@@ -1,7 +1,7 @@
1
1
  import type { IMetadata, ISources, VideoFormat } from "../../player/types";
2
2
  import type { IProviderParams } from "../types";
3
3
  import type { IChromecastConnection } from "./ChromecastInitializer/types";
4
- export interface IParams extends IProviderParams<ISources> {
4
+ export interface IParams extends Omit<IProviderParams<ISources>, "skipVideoElVolumeSync$"> {
5
5
  meta: IMetadata;
6
6
  format: VideoFormat;
7
7
  connection: IChromecastConnection;
@@ -10,6 +10,7 @@ type Params = IProviderParams<IDashURLSource> & {
10
10
  };
11
11
  export default class DashLiveProvider implements IProvider {
12
12
  private subscription;
13
+ private volumeSubscription;
13
14
  private video;
14
15
  private videoState;
15
16
  private dash;
@@ -12,7 +12,8 @@ import { Scene3D } from "../../utils/3d/Scene3D";
12
12
  import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
13
13
  import TextTrackManager from "../utils/HTMLVideoElement/TextTrackManager";
14
14
  import StallsManager from "../utils/StallsManager";
15
- import { ElementSizeManager } from "./lib/ElementSizeManager";
15
+ import { AbrManager } from "../utils/Abr/abrManager";
16
+ import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
16
17
  type IParams = IProviderParams<IDashURLSource> & {
17
18
  sourceHls?: IHLSSource;
18
19
  forceVideoCodec?: VideoCodec;
@@ -20,6 +21,7 @@ type IParams = IProviderParams<IDashURLSource> & {
20
21
  export default abstract class BaseDashProvider implements IProvider {
21
22
  scene3D: Scene3D | undefined;
22
23
  protected subscription: ISubscription;
24
+ protected volumeSubscription: ISubscription;
23
25
  protected videoState: IStateMachine<ProviderState>;
24
26
  protected video: HTMLVideoElement;
25
27
  protected observableVideo: IObservableVideo | null;
@@ -30,6 +32,7 @@ export default abstract class BaseDashProvider implements IProvider {
30
32
  protected droppedFramesManager: DroppedFramesManager;
31
33
  protected stallsManager: StallsManager;
32
34
  protected elementSizeManager: ElementSizeManager;
35
+ protected abrManager: AbrManager;
33
36
  protected videoTracksMap: Map<IVideoTrack, {
34
37
  stream: Stream;
35
38
  representation: Representation;
@@ -2,7 +2,7 @@ import type { ITuningConfig } from "../../../utils/tuningConfig";
2
2
  import type { IError, IRange, ISubject, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
3
3
  import { abortable } from "@vkontakte/videoplayer-shared";
4
4
  import type { Fetcher } from "./fetcher";
5
- import type { CommonInit, Manifest, Representation, Stream, StreamKind } from "../../utils/parsers/types";
5
+ import type { CommonInit, Manifest, Representation, Segment, Stream, StreamKind } from "../../utils/parsers/types";
6
6
  export interface Dependencies {
7
7
  fetcher: Fetcher;
8
8
  tuning: ITuningConfig;
@@ -41,6 +41,7 @@ export declare class BufferManager {
41
41
  private segments;
42
42
  private allInitsLoaded;
43
43
  private activeSegments;
44
+ private forwardBufferRepresentations;
44
45
  private mediaSource;
45
46
  private playingRepresentationId;
46
47
  private downloadingRepresentationId;
@@ -122,6 +123,7 @@ export declare class BufferManager {
122
123
  private abortBuffer;
123
124
  getDebugBufferState(): IRange<Milliseconds> | undefined;
124
125
  getForwardBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
126
+ getForwardBufferRepresentations(currentPosition?: Milliseconds | undefined): Map<Representation["id"], Segment[]>;
125
127
  private detectGaps;
126
128
  private detectGapsWhenIdle;
127
129
  private checkEjectedSegments;
@@ -1,6 +1,6 @@
1
1
  import type { IHLSSource, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from "../../../player/types";
2
2
  import { LiveStreamStatus } from "./types";
3
- import type { CommonInit, Manifest, Representation, TextRepresentation } from "../../utils/parsers/types";
3
+ import type { CommonInit, Manifest, Representation, Segment, TextRepresentation } from "../../utils/parsers/types";
4
4
  import { StreamKind } from "../../utils/parsers/types";
5
5
  import StateMachine from "../../../utils/StateMachine/StateMachine";
6
6
  import type ThroughputEstimator from "../../../utils/ThroughputEstimator";
@@ -97,6 +97,7 @@ export declare class Player {
97
97
  warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
98
98
  get isStreamEnded(): boolean;
99
99
  stop(): void;
100
+ getForwardBufferRepresentations(kind: Exclude<StreamKind, StreamKind.TEXT>): Map<Representation["id"], Segment[]> | undefined;
100
101
  setBufferTarget(time: Milliseconds): void;
101
102
  getStreams(): Manifest["streams"] | undefined;
102
103
  getCodecs(): Manifest["codecs"] | undefined;
@@ -1,7 +1,7 @@
1
- import type { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack, VideoCodec } from "../../player/types";
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, IProviderParams } from "../types";
6
6
  import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
7
7
  import { TrackHistory } from "../../utils/autoSelectTrack";
@@ -11,8 +11,9 @@ import { Scene3D } from "../../utils/3d/Scene3D";
11
11
  import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
12
12
  import TextTrackManager from "../utils/HTMLVideoElement/TextTrackManager";
13
13
  import StallsManager from "../utils/StallsManager";
14
- import { ElementSizeManager } from "./lib/ElementSizeManager";
14
+ import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
15
15
  import type { BasePlayer } from "./lib/player/basePlayer";
16
+ import { AbrManager } from "../utils/Abr/abrManager";
16
17
  type IParams = IProviderParams<IDashURLSource> & {
17
18
  sourceHls?: IHLSSource;
18
19
  forceVideoCodec?: VideoCodec;
@@ -20,6 +21,7 @@ type IParams = IProviderParams<IDashURLSource> & {
20
21
  export default abstract class BaseDashProvider implements IProvider {
21
22
  scene3D: Scene3D | undefined;
22
23
  protected subscription: ISubscription;
24
+ protected volumeSubscription: ISubscription;
23
25
  protected videoState: IStateMachine<ProviderState>;
24
26
  protected video: HTMLVideoElement;
25
27
  protected observableVideo: IObservableVideo | null;
@@ -30,6 +32,7 @@ export default abstract class BaseDashProvider implements IProvider {
30
32
  protected droppedFramesManager: DroppedFramesManager;
31
33
  protected stallsManager: StallsManager;
32
34
  protected elementSizeManager: ElementSizeManager;
35
+ protected abrManager: AbrManager;
33
36
  protected videoTracksMap: Map<IVideoTrack, {
34
37
  stream: Stream;
35
38
  representation: Representation;
@@ -45,7 +48,7 @@ export default abstract class BaseDashProvider implements IProvider {
45
48
  protected videoStreamsMap: Map<Stream, IVideoTrack[]>;
46
49
  protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
47
50
  protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
48
- protected audioTrackSwitchHistory: TrackHistory<IAudioTrack>;
51
+ protected audioTrackSwitchHistory: TrackHistory<IBaseTrack>;
49
52
  constructor(params: IParams);
50
53
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
51
54
  protected abstract getPlayer(): BasePlayer;
@@ -53,9 +56,9 @@ export default abstract class BaseDashProvider implements IProvider {
53
56
  protected subscribe(): void;
54
57
  protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
55
58
  protected prepare(manifestOffset?: number): void;
56
- protected syncPlayback: () => void;
57
- protected init3DScene: (init: CommonInit) => void;
58
- protected destroy3DScene: () => void;
59
- protected playIfAllowed(): void;
59
+ protected syncPlayback;
60
+ protected init3DScene;
61
+ protected destroy3DScene;
62
+ protected playIfAllowed();
60
63
  destroy(): void;
61
64
  }
@@ -12,7 +12,7 @@ export interface Dependencies {
12
12
  getCurrentStallDuration(): Milliseconds;
13
13
  isActiveLowLatency(): boolean;
14
14
  }
15
- export interface IVirtualBufferManager {
15
+ export interface IVirtualBufferManager<T extends Segment = Segment> {
16
16
  error$: ISubject<IError>;
17
17
  playingRepresentation$: IValueSubject<Representation["id"] | undefined>;
18
18
  playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
@@ -20,9 +20,11 @@ export interface IVirtualBufferManager {
20
20
  onLastSegment$: IValueSubject<boolean>;
21
21
  fullyBuffered$: IValueSubject<boolean>;
22
22
  startWith(representationId: Representation["id"]): Promise<void | undefined>;
23
- seek(currentPosition: Milliseconds | undefined): Promise<void>;
24
- maintain(currentPosition: Milliseconds | undefined): Promise<void>;
23
+ prepareSeek(): Promise<void>;
24
+ seek(position: Milliseconds): Promise<void>;
25
+ maintain(currentPosition?: Milliseconds | undefined): Promise<void>;
25
26
  switchTo(newRepresentationId: Representation["id"], isAuto: boolean | undefined): Promise<void | undefined>;
27
+ getForwardBufferRepresentations(currentPosition?: Milliseconds): Map<Representation["id"], T[]>;
26
28
  getForwardPlaybackBufferDuration(currentPosition?: Milliseconds): Milliseconds;
27
29
  getPlaybackBufferState(): IRange<Milliseconds> | null;
28
30
  setTarget(time: Milliseconds): void;
@@ -6,7 +6,7 @@ import type { Byte, IError, IRange, ISubject, IValueSubject, Milliseconds, Secon
6
6
  import { abortable, Subscription } from "@vkontakte/videoplayer-shared";
7
7
  import type { NativeBufferManager } from "../nativeBufferManager";
8
8
  import type { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackParams, IVirtualBufferManager } from "../types";
9
- export declare abstract class BaseVirtualBufferManager<T extends Segment> implements IVirtualBufferManager {
9
+ export declare abstract class BaseVirtualBufferManager<T extends Segment> implements IVirtualBufferManager<T> {
10
10
  error$: ISubject<IError>;
11
11
  playingRepresentation$: IValueSubject<Representation["id"] | undefined>;
12
12
  playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
@@ -25,6 +25,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
25
25
  protected initDataPromises: Map<Representation["id"], Promise<RepresentationFetchResult<T> | null | undefined>>;
26
26
  protected idleCallbacks: Map<Representation["id"], number>;
27
27
  protected parsedInitData: Map<Representation["id"], CommonInit>;
28
+ protected forwardBufferRepresentations: Map<Representation["id"], T[]>;
28
29
  protected segments: Map<Representation["id"], T[]>;
29
30
  protected containerParser: ContainerParser;
30
31
  protected bufferPlaybackQueue: IBufferPlaybackQueueItem<T>[];
@@ -42,7 +43,9 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
42
43
  protected bufferClearingMutex: boolean;
43
44
  protected abortNativeBufferMutex: boolean;
44
45
  protected switchMutex: boolean;
46
+ protected seekMutex: boolean;
45
47
  protected destroyAbortController: AbortController;
48
+ protected switchAbortController: AbortController;
46
49
  protected downloadAbortController: AbortController;
47
50
  protected subscription: Subscription;
48
51
  protected readonly getCurrentPosition: () => Milliseconds | undefined;
@@ -54,9 +57,13 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
54
57
  protected abstract onSomeDataLoaded(data: ISomeDataLoadedCallbackParams<T>): Promise<void>;
55
58
  protected abstract updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
56
59
  startWith: ReturnType<typeof abortable<[Representation["id"]]>>;
57
- switchTo: ReturnType<typeof abortable<[Representation["id"], boolean | undefined], void>>;
60
+ switchTo(newRepresentationId: Representation["id"], isAuto: boolean | undefined): Promise<void>;
61
+ protected getSwitchWithAbort(): ReturnType<typeof abortable<[Representation["id"], boolean | undefined], void>>;
62
+ switchToOld: ReturnType<typeof abortable<[Representation["id"], boolean | undefined], void>>;
63
+ prepareSeek(): Promise<void>;
58
64
  seek(position: Milliseconds): Promise<void>;
59
65
  maintain(currentPosition?: Milliseconds | undefined): Promise<void>;
66
+ getForwardBufferRepresentations(currentPosition?: Milliseconds | undefined): Map<Representation["id"], T[]>;
60
67
  getForwardPlaybackBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
61
68
  getPlaybackBufferState(): IRange<Milliseconds> | null;
62
69
  abort(): Promise<void>;
@@ -72,7 +79,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
72
79
  protected abortDownload(): void;
73
80
  protected abortDownloadingItems(): void;
74
81
  protected abortNativeBuffer(): Promise<boolean>;
75
- protected loadInits(startingRepresentation: Representation): Promise<void>;
82
+ protected loadInits(): Promise<void>;
76
83
  protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
77
84
  protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
78
85
  protected maintainNativeBuffer(): Promise<void>;
@@ -80,7 +87,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
80
87
  protected actualizeLastSegmentInfo(currentPosition: Milliseconds): void;
81
88
  protected selectDownloadingItems(position: Milliseconds, segments: T[]): IBufferPlaybackQueueItem<T>[];
82
89
  protected processCachedItems(): Promise<void>;
83
- protected withinInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>, tolerance?: Milliseconds): boolean;
90
+ protected withinInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>, leftTolerance?: Milliseconds, rightTolerance?: Milliseconds): boolean;
84
91
  protected withinAppendInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>): boolean;
85
92
  protected withinRemoveInterval(currentPosition: Milliseconds | undefined, { to }: IRange<Milliseconds>): boolean;
86
93
  protected waitExponentialDownloadDelay: ReturnType<typeof abortable>;
@@ -3,7 +3,7 @@ import type { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackPar
3
3
  import type { ByteRangeSegment, Representation, StreamKind } from "../../../../utils/parsers/types";
4
4
  import type { NativeBufferManager } from "../nativeBufferManager";
5
5
  import type { FetchParamsWithUrl, Priority } from "../../fetcher";
6
- export declare class ByteRangeVirtualBufferManager extends BaseVirtualBufferManager<ByteRangeSegment> implements IVirtualBufferManager {
6
+ export declare class ByteRangeVirtualBufferManager extends BaseVirtualBufferManager<ByteRangeSegment> implements IVirtualBufferManager<ByteRangeSegment> {
7
7
  constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
8
8
  protected loadItems(itemsToLoad: IBufferPlaybackQueueItem<ByteRangeSegment>[], representation: Representation, priority?: Priority): Promise<void>;
9
9
  protected selectItemsToLoad(): IBufferPlaybackQueueItem<ByteRangeSegment>[];
@@ -3,7 +3,7 @@ import type { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackPar
3
3
  import type { TemplateSegment, Representation, StreamKind } from "../../../../utils/parsers/types";
4
4
  import type { NativeBufferManager } from "../nativeBufferManager";
5
5
  import type { FetchParamsWithUrl, Priority } from "../../fetcher";
6
- export declare class TemplateVirtualBufferManager extends BaseVirtualBufferManager<TemplateSegment> implements IVirtualBufferManager {
6
+ export declare class TemplateVirtualBufferManager extends BaseVirtualBufferManager<TemplateSegment> implements IVirtualBufferManager<TemplateSegment> {
7
7
  constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
8
8
  protected loadItems(itemsToLoad: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation, priority?: Priority): Promise<void>;
9
9
  protected selectItemsToLoad(): IBufferPlaybackQueueItem<TemplateSegment>[];
@@ -74,7 +74,7 @@ export declare class Fetcher {
74
74
  private trackRequestStart;
75
75
  fetchManifest: ReturnType<typeof abortable<[string], string | null>>;
76
76
  fetch: ReturnType<typeof abortable<[string, FetchParams], ArrayBuffer | null>>;
77
- fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, priority?: Priority): Promise<RepresentationFetchResult<T> | null | undefined>;
77
+ fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, dowbloadAbortSignal: AbortSignal, priority?: Priority): Promise<RepresentationFetchResult<T> | null | undefined>;
78
78
  destroy(): void;
79
79
  private fetchByteRangeRepresentation;
80
80
  private fetchTemplateRepresentation;
@@ -1,6 +1,6 @@
1
- import type { IHLSSource, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from "../../../../player/types";
1
+ import type { HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IHLSSource, VideoCodec } from "../../../../player/types";
2
2
  import type { LiveStreamStatus } from "../types";
3
- import type { CommonInit, Manifest, Representation, TextRepresentation } from "../../../utils/parsers/types";
3
+ import type { CommonInit, Manifest, Representation, Segment, TextRepresentation } from "../../../utils/parsers/types";
4
4
  import { StreamKind } from "../../../utils/parsers/types";
5
5
  import StateMachine from "../../../../utils/StateMachine/StateMachine";
6
6
  import type ThroughputEstimator from "../../../../utils/ThroughputEstimator";
@@ -79,6 +79,7 @@ export declare abstract class BasePlayer {
79
79
  switchRepresentation(kind: StreamKind, id: Representation["id"], isAuto?: boolean): Promise<void>;
80
80
  seek(requestedPosition: Milliseconds, forcePrecise?: boolean): Promise<void>;
81
81
  warmUpMediaSourceIfNeeded(position?: Milliseconds | undefined): void;
82
+ getForwardBufferRepresentations(kind: Exclude<StreamKind, StreamKind.TEXT>): Map<Representation["id"], Segment[]> | undefined;
82
83
  calculateDurationFromSegments(representationId: Representation["id"]): Milliseconds;
83
84
  get isStreamEnded(): boolean;
84
85
  getStreams(): Manifest["streams"] | undefined;
@@ -10,6 +10,7 @@ type Params = IProviderParams<IHLSLiveSource> & {
10
10
  };
11
11
  export default class HlsLiveProvider implements IProvider {
12
12
  private subscription;
13
+ private volumeSubscription;
13
14
  private videoState;
14
15
  private video;
15
16
  private params;
@@ -3,6 +3,7 @@ import type { IProvider, IProviderParams } from "../types";
3
3
  type Params = IProviderParams<IHLSSource>;
4
4
  export default class HlsProvider implements IProvider {
5
5
  private subscription;
6
+ private volumeSubscription;
6
7
  private videoState;
7
8
  private video;
8
9
  private params;
@@ -3,6 +3,7 @@ import type { IProvider, IProviderParams } from "../types";
3
3
  type Params = IProviderParams<IMpegSource>;
4
4
  export default class MpegProvider implements IProvider {
5
5
  private subscription;
6
+ private volumeSubscription;
6
7
  private videoState;
7
8
  private video;
8
9
  private trackUrls;
@@ -2,6 +2,7 @@ import type { IMetadata, ISources } from "../../player/types";
2
2
  import { VideoFormat } from "../../player/types";
3
3
  import type { ITuningConfig } from "../../utils/tuningConfig";
4
4
  import type { IError, ISubject, IValueSubject, IRectangle } from "@vkontakte/videoplayer-shared";
5
+ import { ValueSubject } from "@vkontakte/videoplayer-shared";
5
6
  import type { IDesiredState, IProviderDependencies, IProviderOutput } from "../types";
6
7
  import type { IProviderContainer, IProviderEntry } from "./types";
7
8
  interface IParams extends IProviderDependencies {
@@ -13,6 +14,7 @@ interface IParams extends IProviderDependencies {
13
14
  tuning: ITuningConfig;
14
15
  volumeMultiplier?: number;
15
16
  panelSize?: IRectangle;
17
+ skipVideoElVolumeSync$: ValueSubject<boolean>;
16
18
  }
17
19
  export default class ProviderContainer implements IProviderContainer {
18
20
  current$: IValueSubject<IProviderEntry>;
@@ -1,13 +1,16 @@
1
1
  import type { IProviderEntry } from "../types";
2
- import type { IObservable } from "@vkontakte/videoplayer-shared";
2
+ import type { IObservable, Milliseconds } from "@vkontakte/videoplayer-shared";
3
3
  import { Observable } from "@vkontakte/videoplayer-shared";
4
4
  import type { IStateMachine } from "../../../utils/StateMachine/types";
5
- import type { PlaybackState } from "../../../player/types";
5
+ import { PlaybackState } from "../../../player/types";
6
6
  interface IParams {
7
7
  desiredPlaybackState$: IStateMachine<PlaybackState>;
8
8
  position$: IObservable<number>;
9
9
  providerChanged$: IObservable<IProviderEntry>;
10
+ videoLastDataObtainedTimestamp$: IObservable<Milliseconds | undefined>;
10
11
  maxTransitionInterval: number;
12
+ playbackHangupNoDataThreshold: Milliseconds;
13
+ useDelayedPlaybackHangupWithData: boolean;
11
14
  }
12
15
  declare const _default: (params: IParams) => Observable<string>;
13
16
  export default _default;
@@ -7,6 +7,7 @@ import type { URLSource } from "../../player/types";
7
7
  */
8
8
  export default class WebRTCLiveProvider implements IProvider {
9
9
  private readonly subscription;
10
+ private readonly volumeSubscription;
10
11
  private readonly params;
11
12
  private log;
12
13
  private video;
@@ -27,6 +27,7 @@ export interface IProviderParams<TSourceType> extends IProviderDependencies {
27
27
  output: IProviderOutput;
28
28
  tuning: ITuningConfig;
29
29
  panelSize?: IRectangle;
30
+ skipVideoElVolumeSync$: IValueSubject<boolean>;
30
31
  }
31
32
  export interface IDesiredState {
32
33
  playbackState: IStateMachine<PlaybackState>;
@@ -69,6 +70,7 @@ export interface IProviderOutput {
69
70
  canChangePlaybackSpeed$: IValueSubject<boolean | undefined>;
70
71
  currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
71
72
  currentNativeBuffer$: IValueSubject<IRange<Seconds> | undefined>;
73
+ videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds | undefined>;
72
74
  isBuffering$: IValueSubject<boolean>;
73
75
  isLive$: IValueSubject<boolean | undefined>;
74
76
  isLiveEnded$: IValueSubject<boolean | null>;
@@ -0,0 +1,15 @@
1
+ import type { IAbrController, IAbrRule, IBaseAbrControllerContext } from "./types";
2
+ import type { IBaseTrack } from "../../../player/types";
3
+ export default class AbrController<
4
+ T extends IBaseTrack,
5
+ C extends IBaseAbrControllerContext
6
+ > implements IAbrController<T> {
7
+ private history;
8
+ private rules;
9
+ private context;
10
+ init(rules: IAbrRule<T, C>[]);
11
+ destroy(): void;
12
+ updateContext(context: C): void;
13
+ autoSelectTrack(): T;
14
+ private selectTrackBasedOnHistory;
15
+ }
@@ -0,0 +1,18 @@
1
+ import type { IAudioTrack, IVideoTrack } from "../../../player/types";
2
+ import type { IInitAbrManagerContext, IUpdatableAbrManagerContext } from "./types";
3
+ import { StreamKind } from "../parsers/types";
4
+ export declare class AbrManager {
5
+ private stallsController;
6
+ private videoAbrController;
7
+ private audioAbrController;
8
+ private subscription;
9
+ private lastVideoTrackSelected$;
10
+ private context;
11
+ init(context: IInitAbrManagerContext): void;
12
+ updateContext(updateContext: IUpdatableAbrManagerContext): void;
13
+ autoSelectTrack<T extends IVideoTrack | IAudioTrack>(kind: Exclude<StreamKind, StreamKind.TEXT>): T;
14
+ destroy(): void;
15
+ private initVideoElementAbrContext;
16
+ private updateTracksIfneeded;
17
+ private isTracksDifferent;
18
+ }
@@ -0,0 +1,33 @@
1
+ import type { IObservable, IValueSubject, Milliseconds } from "@vkontakte/videoplayer-shared";
2
+ import type { ITuningConfig } from "../../../../utils/tuningConfig";
3
+ import type { IVideoTrack } from "../../../../player/types";
4
+ import type { IObservableVideo } from "../../HTMLVideoElement/observable";
5
+ interface IConnectData {
6
+ videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
7
+ lastVideoTrackSelected$: IValueSubject<IVideoTrack | undefined>;
8
+ rtt$: IValueSubject<Milliseconds>;
9
+ isSeeked$: IObservable<boolean>;
10
+ observableVideo: IObservableVideo;
11
+ currentStallDuration$: IValueSubject<Milliseconds>;
12
+ tuning: ITuningConfig["stallsManager"];
13
+ }
14
+ export declare class StallsController {
15
+ private currentStallDuration$;
16
+ private videoLastDataObtainedTimestamp$;
17
+ private isSeeked$;
18
+ private rtt$;
19
+ private tuning;
20
+ private lastUniqueVideoTrackSelectedTimestamp;
21
+ private lastUniqueVideoTrackSelected;
22
+ private providerStartWatchingTimestamp;
23
+ private subscription;
24
+ severeStallOccurred$: IValueSubject<boolean>;
25
+ totalStallsCount$: IValueSubject<number>;
26
+ currentVideoTrackStallsCount$: IValueSubject<number>;
27
+ sumStallsDuration$: IValueSubject<Milliseconds>;
28
+ lastStallDuration$: IValueSubject<Milliseconds>;
29
+ init(data: IConnectData): void;
30
+ destroy(): void;
31
+ private updateStallData;
32
+ }
33
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IAudioAbrContext, RuleConfidence } from "../../types";
2
+ import type { IAudioTrack, IVideoTrack } from "../../../../../player/types";
3
+ import { LimitAboveRule } from "../limitAboveRule";
4
+ import type { Kbps } from "@vkontakte/videoplayer-shared";
5
+ import type { ITuningConfig } from "../../../../../utils/tuningConfig";
6
+ type AudioThroughputLogsArgs = [forwardBufferHealth: number | undefined, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, tuning: ITuningConfig];
7
+ export declare class AudioThroughputRule extends LimitAboveRule<IAudioTrack, IAudioAbrContext, AudioThroughputLogsArgs> implements IAbrRule<IAudioTrack, IAudioAbrContext> {
8
+ constructor(confidence: RuleConfidence);
9
+ execute(context: IAudioAbrContext): IAbrRuleResolution<IAudioTrack>;
10
+ protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferHealth: number | undefined, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, tuning: ITuningConfig): string;
11
+ }
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IAudioAbrContext, RuleConfidence } from "../../types";
2
+ import type { IAudioTrack, IVideoTrack } from "../../../../../player/types";
3
+ import { LimitBelowRule } from "../limitBelowRule";
4
+ import type { ITuningConfig } from "../../../../../utils/tuningConfig";
5
+ type MinAudioForVideoLogsArgs = [lastVideoTrackSelected: IVideoTrack | undefined, tuning: ITuningConfig];
6
+ export declare class MinAudioForVideoRule extends LimitBelowRule<IAudioTrack, IAudioAbrContext, MinAudioForVideoLogsArgs> implements IAbrRule<IAudioTrack, IAudioAbrContext> {
7
+ constructor(confidence: RuleConfidence);
8
+ execute(context: IAudioAbrContext): IAbrRuleResolution<IAudioTrack>;
9
+ protected createLogMessage(selectedTrack: IVideoTrack, lastVideoTrackSelected: IVideoTrack | undefined, tuning: ITuningConfig): string;
10
+ }
11
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IBaseAbrControllerContext, RuleConfidence, RuleType } from "../types";
2
+ import type { IBaseTrack } from "../../../../player/types";
3
+ import { Subscription } from "@vkontakte/videoplayer-shared";
4
+ export declare abstract class BaseRule<
5
+ T extends IBaseTrack,
6
+ C extends IBaseAbrControllerContext,
7
+ LogsArgs extends unknown[]
8
+ > implements IAbrRule<T, C> {
9
+ protected subscription: Subscription;
10
+ protected confidence: RuleConfidence;
11
+ protected type: RuleType;
12
+ protected name: string;
13
+ constructor(confidence: RuleConfidence);
14
+ init(): void;
15
+ destroy(): void;
16
+ abstract execute(context: C): IAbrRuleResolution<T>;
17
+ protected createResolution(selectedTrack: T, ...params: LogsArgs): IAbrRuleResolution<T>;
18
+ protected abstract createLogMessage(selectedTrack: T, ...params: LogsArgs): string;
19
+ }
@@ -0,0 +1,11 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IBaseAbrControllerContext, RuleConfidence } from "../types";
2
+ import type { IBaseTrack } from "../../../../player/types";
3
+ import { BaseRule } from "./baseRule";
4
+ export declare abstract class LimitAboveRule<
5
+ T extends IBaseTrack,
6
+ C extends IBaseAbrControllerContext,
7
+ LogsArgs extends unknown[] = unknown[]
8
+ > extends BaseRule<T, C, LogsArgs> implements IAbrRule<T, C> {
9
+ constructor(confidence: RuleConfidence);
10
+ abstract execute(context: C): IAbrRuleResolution<T>;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IBaseAbrControllerContext, RuleConfidence } from "../types";
2
+ import type { IBaseTrack } from "../../../../player/types";
3
+ import { BaseRule } from "./baseRule";
4
+ export declare abstract class LimitBelowRule<
5
+ T extends IBaseTrack,
6
+ C extends IBaseAbrControllerContext,
7
+ LogsArgs extends unknown[] = unknown[]
8
+ > extends BaseRule<T, C, LogsArgs> implements IAbrRule<T, C> {
9
+ constructor(confidence: RuleConfidence);
10
+ abstract execute(context: C): IAbrRuleResolution<T>;
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
+ import type { IVideoTrack } from "../../../../../player/types";
3
+ import { LimitAboveRule } from "../limitAboveRule";
4
+ import type { ITuningConfig } from "../../../../../utils/tuningConfig";
5
+ type BufferRuleLogsArgs = [currentVideoTrack: IVideoTrack | undefined, lastVideoTrackSelected: IVideoTrack | undefined, forwardBufferHealth: number | undefined, abrTuning: ITuningConfig["autoTrackSelection"]];
6
+ export declare class BufferRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, BufferRuleLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
7
+ constructor(confidence: RuleConfidence);
8
+ execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
9
+ protected createLogMessage(selectedTrack: IVideoTrack, currentVideoTrack: IVideoTrack | undefined, lastVideoTrackSelected: IVideoTrack | undefined, forwardBufferHealth: number | undefined, abrTuning: ITuningConfig["autoTrackSelection"]): string;
10
+ }
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
+ import type { IVideoTrack } from "../../../../../player/types";
3
+ import type { IRectangle } from "@vkontakte/videoplayer-shared";
4
+ import { LimitAboveRule } from "../limitAboveRule";
5
+ import type { ITuningConfig } from "../../../../../utils/tuningConfig";
6
+ type IContainerSizeLimit = IRectangle;
7
+ type FitsContainerLogsArgs = [containerSizeLimit: IContainerSizeLimit | undefined, containerSizeFactor: number, abrTuning: ITuningConfig["autoTrackSelection"]];
8
+ export declare class FitsContainerRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, FitsContainerLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
9
+ constructor(confidence: RuleConfidence);
10
+ execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
11
+ protected createLogMessage(selectedTrack: IVideoTrack, containerSizeLimit: IContainerSizeLimit | undefined, containerSizeFactor: number, abrTuning: ITuningConfig["autoTrackSelection"]): string;
12
+ private getContainerSizeLimit;
13
+ }
14
+ export {};