@vkontakte/videoplayer-core 2.0.161 → 2.0.162-beta.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.
Files changed (111) hide show
  1. package/es2015.cjs +60 -34
  2. package/es2015.esm.js +71 -45
  3. package/esnext.cjs +60 -34
  4. package/esnext.esm.js +60 -34
  5. package/evergreen.esm.js +60 -34
  6. package/package.json +2 -2
  7. package/types/index.d.ts +12 -11
  8. package/types/player/Player.d.ts +2 -2
  9. package/types/player/types.d.ts +15 -4
  10. package/types/player/utils/defaults.d.ts +2 -2
  11. package/types/player/utils/optimisticPosition.d.ts +2 -2
  12. package/types/player/utils/selectContainer.d.ts +1 -1
  13. package/types/providers/ChromecastPresentationApiProvider/ChromecastPresentationApiInitializer.d.ts +1 -1
  14. package/types/providers/ChromecastProvider/ChromecastInitializer/index.d.ts +1 -1
  15. package/types/providers/ChromecastProvider/ChromecastInitializer/types.d.ts +1 -1
  16. package/types/providers/ChromecastProvider/types.d.ts +1 -1
  17. package/types/providers/DashLiveProvider/DashLiveProvider.d.ts +2 -2
  18. package/types/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +3 -3
  19. package/types/providers/DashProvider/baseDashProvider.d.ts +13 -12
  20. package/types/providers/DashProvider/lib/LiveTextManager.d.ts +1 -1
  21. package/types/providers/DashProvider/lib/buffer.d.ts +6 -3
  22. package/types/providers/DashProvider/lib/fetcher.d.ts +3 -3
  23. package/types/providers/DashProvider/lib/player.d.ts +12 -7
  24. package/types/providers/DashProvider/lib/types.d.ts +3 -3
  25. package/types/providers/DashProvider/lib/utils.d.ts +3 -3
  26. package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +15 -14
  27. package/types/providers/DashProviderVirtual/dashCmafLiveProvider.d.ts +1 -1
  28. package/types/providers/DashProviderVirtual/dashProvider.d.ts +1 -1
  29. package/types/providers/DashProviderVirtual/lib/LiveTextManager.d.ts +2 -2
  30. package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +7 -3
  31. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +9 -6
  32. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/byteRangeVirtualBufferManager.d.ts +5 -5
  33. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/liveVirtualBuffer.d.ts +5 -5
  34. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/templateVirtualBufferManager.d.ts +5 -5
  35. package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/virtualBufferFactory.d.ts +3 -3
  36. package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +3 -3
  37. package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +14 -10
  38. package/types/providers/DashProviderVirtual/lib/player/livePlayer.d.ts +8 -8
  39. package/types/providers/DashProviderVirtual/lib/player/player.d.ts +2 -2
  40. package/types/providers/DashProviderVirtual/lib/player/types.d.ts +5 -4
  41. package/types/providers/DashProviderVirtual/lib/types.d.ts +3 -3
  42. package/types/providers/DashProviderVirtual/lib/utils.d.ts +4 -4
  43. package/types/providers/HlsLiveProvider/LiveTextManager.d.ts +1 -1
  44. package/types/providers/HlsLiveProvider/index.d.ts +3 -3
  45. package/types/providers/HlsProvider/index.d.ts +2 -2
  46. package/types/providers/HlsProvider/manifestDataExtractor.d.ts +1 -1
  47. package/types/providers/MpegProvider/index.d.ts +1 -1
  48. package/types/providers/ProviderContainer/index.d.ts +5 -3
  49. package/types/providers/ProviderContainer/types.d.ts +1 -1
  50. package/types/providers/ProviderContainer/utils/formatsSupport.d.ts +11 -4
  51. package/types/providers/ProviderContainer/utils/playbackHangup.d.ts +3 -3
  52. package/types/providers/WebRTCLiveProvider/WebRTCLiveClient.d.ts +1 -1
  53. package/types/providers/WebRTCLiveProvider/WebRTCLiveProvider.d.ts +2 -2
  54. package/types/providers/types.d.ts +8 -8
  55. package/types/providers/utils/Abr/abrController.d.ts +8 -5
  56. package/types/providers/utils/Abr/abrManager.d.ts +5 -3
  57. package/types/providers/utils/Abr/controllers/abrPhaseController.d.ts +17 -0
  58. package/types/providers/utils/Abr/controllers/stallsController.d.ts +2 -2
  59. package/types/providers/utils/Abr/rules/audio/audioThroughputRule.d.ts +6 -5
  60. package/types/providers/utils/Abr/rules/audio/minAudioForVideoRule.d.ts +6 -5
  61. package/types/providers/utils/Abr/rules/audioRuleFactory.d.ts +5 -5
  62. package/types/providers/utils/Abr/rules/baseRule.d.ts +10 -6
  63. package/types/providers/utils/Abr/rules/limitAboveRule.d.ts +5 -4
  64. package/types/providers/utils/Abr/rules/limitBelowRule.d.ts +5 -4
  65. package/types/providers/utils/Abr/rules/video/abandonRequestRule.d.ts +12 -0
  66. package/types/providers/utils/Abr/rules/video/bolaRule.d.ts +31 -0
  67. package/types/providers/utils/Abr/rules/video/bufferRule.d.ts +10 -5
  68. package/types/providers/utils/Abr/rules/video/failedVideoTrackRule.d.ts +6 -5
  69. package/types/providers/utils/Abr/rules/video/fitsContainerRule.d.ts +6 -5
  70. package/types/providers/utils/Abr/rules/video/insufficientBufferRule.d.ts +15 -0
  71. package/types/providers/utils/Abr/rules/video/lowerLimitRule.d.ts +5 -4
  72. package/types/providers/utils/Abr/rules/video/stallsRule.d.ts +6 -5
  73. package/types/providers/utils/Abr/rules/video/throughputRule.d.ts +8 -7
  74. package/types/providers/utils/Abr/rules/video/upperLimitRule.d.ts +5 -4
  75. package/types/providers/utils/Abr/rules/videoRuleFactory.d.ts +4 -3
  76. package/types/providers/utils/Abr/trackHistory.d.ts +1 -1
  77. package/types/providers/utils/Abr/types.d.ts +34 -8
  78. package/types/providers/utils/Abr/utils.d.ts +3 -2
  79. package/types/providers/utils/HTMLVideoElement/DroppedFramesManager.d.ts +3 -3
  80. package/types/providers/utils/HTMLVideoElement/ElementSizeManager.d.ts +1 -1
  81. package/types/providers/utils/HTMLVideoElement/TextTrackManager.d.ts +2 -2
  82. package/types/providers/utils/HTMLVideoElement/observable.d.ts +1 -1
  83. package/types/providers/utils/HTMLVideoElement/pool.d.ts +1 -1
  84. package/types/providers/utils/StallsManager.d.ts +2 -2
  85. package/types/providers/utils/extractConnectionHeaders.d.ts +1 -1
  86. package/types/providers/utils/parsers/types.d.ts +2 -1
  87. package/types/providers/utils/syncDesiredState.d.ts +2 -2
  88. package/types/providers/utils/syncPlaybackState.d.ts +2 -2
  89. package/types/providers/utils/videoStreamRepresentaionsFilter.d.ts +1 -1
  90. package/types/utils/3d/Camera3D.d.ts +1 -1
  91. package/types/utils/3d/CameraRotationManager.d.ts +2 -2
  92. package/types/utils/3d/Scene3D.d.ts +1 -1
  93. package/types/utils/ClientChecker/services/AudioChecker.d.ts +1 -1
  94. package/types/utils/ClientChecker/services/BrowserChecker.d.ts +2 -2
  95. package/types/utils/ClientChecker/services/DeviceChecker.d.ts +3 -3
  96. package/types/utils/ClientChecker/services/DisplayChecker.d.ts +1 -1
  97. package/types/utils/ClientChecker/services/VideoChecker.d.ts +2 -2
  98. package/types/utils/ThroughputEstimator.d.ts +2 -1
  99. package/types/utils/VolumeMultiplierManager/VolumeMultiplierManager.d.ts +2 -2
  100. package/types/utils/autoSelectTrack.d.ts +2 -2
  101. package/types/utils/dashMaxTvVideoQuality.d.ts +7 -0
  102. package/types/utils/qualityLimits.d.ts +2 -2
  103. package/types/utils/setStateWithSubscribe.d.ts +1 -1
  104. package/types/utils/smoothedValue/baseSmoothedValue.d.ts +2 -1
  105. package/types/utils/smoothedValue/emaAndMaSmoothedValue.d.ts +2 -2
  106. package/types/utils/smoothedValue/emaTopExtremumValue.d.ts +2 -2
  107. package/types/utils/smoothedValue/smoothedValueFactory.d.ts +2 -2
  108. package/types/utils/smoothedValue/twoEmaSmoothedValue.d.ts +2 -2
  109. package/types/utils/smoothedValue/types.d.ts +1 -0
  110. package/types/utils/tuningConfig.d.ts +45 -6
  111. package/types/utils/videoFormat.d.ts +1 -1
@@ -0,0 +1,15 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IRuleInitContext, IVideoAbrContext } from "#/providers/utils/Abr/types";
2
+ import type { IVideoTrack } from "#/player/types";
3
+ import type { Milliseconds } from "@vkontakte/videoplayer-shared";
4
+ import { LimitAboveRule } from "#/providers/utils/Abr/rules/limitAboveRule";
5
+ import type { RulePhaseConfig } from "#/providers/utils/Abr/controllers/abrPhaseController";
6
+ type LogsArgs = [forwardBufferDuration: Milliseconds | undefined, thresholdMs: Milliseconds, triggered: boolean, suppressedByGrace: boolean];
7
+ export declare class InsufficientBufferRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, LogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
8
+ private lastPlaybackResetAtMs;
9
+ constructor(phaseConfig: RulePhaseConfig);
10
+ init(initContext: IRuleInitContext): void;
11
+ execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
12
+ private selectThroughputAwareFallback;
13
+ protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferDuration: Milliseconds | undefined, thresholdMs: Milliseconds, triggered: boolean, suppressedByGrace: boolean): string;
14
+ }
15
+ export {};
@@ -1,11 +1,12 @@
1
- import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
- import type { IVideoTrack } from "../../../../../player/types";
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "#/providers/utils/Abr/types";
2
+ import type { IVideoTrack } from "#/player/types";
3
3
  import type { Nullable, QualityLimits } from "@vkontakte/videoplayer-shared";
4
4
  import { type ExactVideoQuality } from "@vkontakte/videoplayer-shared";
5
- import { LimitBelowRule } from "../limitBelowRule";
5
+ import { LimitBelowRule } from "#/providers/utils/Abr/rules/limitBelowRule";
6
+ import type { RulePhaseConfig } from "#/providers/utils/Abr/controllers/abrPhaseController";
6
7
  type LowerLimitLogsArgs = [limitsAreInvalid: boolean, lowestAvailableQuality: Nullable<ExactVideoQuality>, highestAvailableQuality: Nullable<ExactVideoQuality>, limits: QualityLimits];
7
8
  export declare class LowerLimitRule extends LimitBelowRule<IVideoTrack, IVideoAbrContext, LowerLimitLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
8
- constructor(confidence: RuleConfidence);
9
+ constructor(phaseConfig: RulePhaseConfig);
9
10
  execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
10
11
  protected createLogMessage(selectedTrack: IVideoTrack, limitsAreInvalid: boolean, lowestAvailableQuality: Nullable<ExactVideoQuality>, highestAvailableQuality: Nullable<ExactVideoQuality>, limits: QualityLimits): string;
11
12
  }
@@ -1,8 +1,9 @@
1
- import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
- import type { IVideoTrack } from "../../../../../player/types";
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "#/providers/utils/Abr/types";
2
+ import type { IVideoTrack } from "#/player/types";
3
3
  import type { Kbps, Nullable } from "@vkontakte/videoplayer-shared";
4
- import { LimitAboveRule } from "../limitAboveRule";
5
- import type { ITuningConfig } from "../../../../../utils/tuningConfig";
4
+ import { LimitAboveRule } from "#/providers/utils/Abr/rules/limitAboveRule";
5
+ import type { ITuningConfig } from "#/utils/tuningConfig";
6
+ import type { RulePhaseConfig } from "#/providers/utils/Abr/controllers/abrPhaseController";
6
7
  type StallLogsArgs = [forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, tuning: ITuningConfig];
7
8
  export declare class StallsRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, StallLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
8
9
  private severeStallOccurred;
@@ -10,7 +11,7 @@ export declare class StallsRule extends LimitAboveRule<IVideoTrack, IVideoAbrCon
10
11
  private lastStallDurationRestriction;
11
12
  private maxQualityLimitOnStall;
12
13
  private predictedThroughputWithoutData;
13
- constructor(confidence: RuleConfidence);
14
+ constructor(phaseConfig: RulePhaseConfig);
14
15
  execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
15
16
  protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, tuning: ITuningConfig): string;
16
17
  private updateStallQualityLimits;
@@ -1,12 +1,13 @@
1
- import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
- import type { IVideoTrack } from "../../../../../player/types";
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "#/providers/utils/Abr/types";
2
+ import type { IVideoTrack } from "#/player/types";
3
3
  import type { Kbps, Nullable } from "@vkontakte/videoplayer-shared";
4
- import { LimitAboveRule } from "../limitAboveRule";
5
- import type { ITuningConfig } from "../../../../../utils/tuningConfig";
6
- type ThroughputLogsArgs = [forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, tuning: ITuningConfig];
4
+ import { LimitAboveRule } from "#/providers/utils/Abr/rules/limitAboveRule";
5
+ import type { ITuningConfig } from "#/utils/tuningConfig";
6
+ import { AbrPhase, type RulePhaseConfig } from "#/providers/utils/Abr/controllers/abrPhaseController";
7
+ type ThroughputLogsArgs = [forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, phase: AbrPhase | undefined, tuning: ITuningConfig];
7
8
  export declare class ThroughputRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, ThroughputLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
8
- constructor(confidence: RuleConfidence);
9
+ constructor(phaseConfig: RulePhaseConfig);
9
10
  execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
10
- protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, tuning: ITuningConfig): string;
11
+ protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferHealth: Nullable<number>, playbackRate: number, reserve: Kbps, playbackRateFactor: number, bitrateFactor: number, estimatedThroughput: Kbps, phase: AbrPhase | undefined, tuning: ITuningConfig): string;
11
12
  }
12
13
  export {};
@@ -1,8 +1,9 @@
1
- import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleConfidence } from "../../types";
2
- import type { IVideoTrack } from "../../../../../player/types";
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "#/providers/utils/Abr/types";
2
+ import type { IVideoTrack } from "#/player/types";
3
3
  import type { Nullable, QualityLimits, VideoQuality } from "@vkontakte/videoplayer-shared";
4
4
  import { type ExactVideoQuality } from "@vkontakte/videoplayer-shared";
5
- import { LimitAboveRule } from "../limitAboveRule";
5
+ import { LimitAboveRule } from "#/providers/utils/Abr/rules/limitAboveRule";
6
+ import type { RulePhaseConfig } from "#/providers/utils/Abr/controllers/abrPhaseController";
6
7
  type UpperLimitsLogsArgs = [limitsAreInvalid: boolean, lowestAvailableQuality: Nullable<ExactVideoQuality>, highestAvailableQuality: Nullable<ExactVideoQuality>, visible: boolean, limits: QualityLimits, backgroundVideoQualityLimit: VideoQuality, effectiveType: string | undefined, connectionDataQualityLimit: ExactVideoQuality | undefined];
7
8
  /**
8
9
  * Правило верхнего ограничения качества в авто-ABR. Из списка `videoTracksDesc`
@@ -60,7 +61,7 @@ type UpperLimitsLogsArgs = [limitsAreInvalid: boolean, lowestAvailableQuality: N
60
61
  * `LowerLimitRule` (поле `limits.min` здесь не используется).
61
62
  */
62
63
  export declare class UpperLimitsRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, UpperLimitsLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
63
- constructor(confidence: RuleConfidence);
64
+ constructor(phaseConfig: RulePhaseConfig);
64
65
  execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
65
66
  protected createLogMessage(selectedTrack: IVideoTrack, limitsAreInvalid: boolean, lowestAvailableQuality: Nullable<ExactVideoQuality>, highestAvailableQuality: Nullable<ExactVideoQuality>, visible: boolean, limits: QualityLimits, backgroundVideoQualityLimit: VideoQuality, effectiveType: string | undefined, connectionDataQualityLimit: ExactVideoQuality | undefined): string;
66
67
  private getConnection;
@@ -1,6 +1,7 @@
1
- import type { IVideoTrack } from "../../../../player/types";
1
+ import type { IVideoTrack } from "#/player/types";
2
2
  import type { IAbrRule, IVideoAbrContext } from "../types";
3
- import { RuleConfidence, VideoRuleName } from "../types";
3
+ import { VideoRuleName } from "../types";
4
+ import { type RulePhaseConfig } from "../controllers/abrPhaseController";
4
5
  export declare class VideoRuleFactory {
5
- static createRule(ruleName: VideoRuleName, confidence?: RuleConfidence): IAbrRule<IVideoTrack, IVideoAbrContext>;
6
+ static createRule(ruleName: VideoRuleName, phaseConfig?: RulePhaseConfig): IAbrRule<IVideoTrack, IVideoAbrContext>;
6
7
  }
@@ -1,4 +1,4 @@
1
- import type { IBaseTrack } from "../../../player/types";
1
+ import type { IBaseTrack } from "#/player/types";
2
2
  import type { Milliseconds } from "@vkontakte/videoplayer-shared";
3
3
  export declare class TrackHistory<T extends IBaseTrack> {
4
4
  last: T | undefined;
@@ -1,22 +1,27 @@
1
- import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../../../player/types";
2
- import type { IComponentLogger, IObservable, IRectangle, IValueSubject, Kbps, Milliseconds, Nullable, QualityLimits } from "@vkontakte/videoplayer-shared";
3
- import type { ITuningConfig } from "../../../utils/tuningConfig";
4
- import type { Representation, Segment } from "../parsers/types";
1
+ import type { IAudioTrack, IBaseTrack, IVideoTrack } from "#/player/types";
2
+ import type { Byte, IComponentLogger, IObservable, IRectangle, IValueSubject, Kbps, Milliseconds, Nullable, QualityLimits } from "@vkontakte/videoplayer-shared";
3
+ import type { ITuningConfig } from "#/utils/tuningConfig";
4
+ import type { Representation, Segment } from "#/providers/utils/parsers/types";
5
5
  import type { ElementSizeManager } from "../HTMLVideoElement/ElementSizeManager";
6
6
  import type { IObservableVideo } from "../HTMLVideoElement/observable";
7
+ import type { AbrPhase } from "#/providers/utils/Abr/controllers/abrPhaseController";
7
8
  export declare enum RuleConfidence {
8
9
  Low = 0,
9
10
  Normal = 1,
10
11
  High = 2
11
12
  }
12
13
  export declare enum VideoRuleName {
14
+ /** @deprecated Заменено на `Bola` + `InsufficientBuffer` в фазовой архитектуре ABR. */
13
15
  Buffer = "buffer_rule",
16
+ Bola = "bola_rule",
14
17
  FitsContainer = "fits_container_rule",
15
18
  FailedVideoTrack = "failed_video_track_rule",
16
19
  Stalls = "stalls_rule",
17
20
  LowerLimit = "lower_limit_rule",
18
21
  UpperLimit = "upper_limit_rule",
19
- Throughput = "throughput_rule"
22
+ Throughput = "throughput_rule",
23
+ AbandonRequest = "abandon_request_rule",
24
+ InsufficientBuffer = "insufficient_buffer_rule"
20
25
  }
21
26
  export declare enum AudioRuleName {
22
27
  MinAudioForVideo = "min_audio_for_video_rule",
@@ -36,6 +41,11 @@ export interface IUpdatableAbrManagerContext {
36
41
  forwardBufferHealth?: number;
37
42
  forwardVideoBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
38
43
  forwardAudioBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
44
+ forwardBufferDuration?: Milliseconds;
45
+ videoSegmentLoadProgress?: VideoSegmentLoadProgress;
46
+ isLive?: boolean;
47
+ remainingDurationMs?: Milliseconds;
48
+ mpdSegmentDurationMs?: Milliseconds;
39
49
  }
40
50
  export interface IInitAbrManagerContext {
41
51
  tuning: ITuningConfig;
@@ -44,6 +54,7 @@ export interface IInitAbrManagerContext {
44
54
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
45
55
  throughput$: IValueSubject<Kbps>;
46
56
  rtt$: IValueSubject<Milliseconds>;
57
+ throughputVariance$?: IValueSubject<number>;
47
58
  element: HTMLVideoElement;
48
59
  failedVideoTrack: Nullable<IVideoTrack>;
49
60
  abrLogger: IComponentLogger;
@@ -70,19 +81,21 @@ export interface IAbrRuleResolution<T extends IBaseTrack> {
70
81
  name: string;
71
82
  logMessage: string;
72
83
  }
84
+ export interface IRuleInitContext extends IInitAbrManagerContext {}
73
85
  export interface IAbrRule<
74
86
  T extends IBaseTrack,
75
87
  C extends IBaseAbrControllerContext
76
88
  > {
77
- init(initContext: IInitAbrManagerContext): void;
89
+ readonly activePhases: ReadonlySet<AbrPhase>;
90
+ init(initContext: IRuleInitContext): void;
78
91
  destroy(): void;
79
92
  execute(context: C): IAbrRuleResolution<T>;
80
93
  }
81
94
  export interface IAbrController<T extends IBaseTrack> {
82
- init(rules: IAbrRule<T, IBaseAbrControllerContext>[], initContext: IInitAbrManagerContext): void;
95
+ init(rules: IAbrRule<T, IBaseAbrControllerContext>[], initContext: IRuleInitContext): void;
83
96
  destroy(): void;
84
97
  updateContext(context: IBaseAbrControllerContext): void;
85
- autoSelectTrack(): T;
98
+ autoSelectTrack(rules?: IAbrRule<T, IBaseAbrControllerContext>[]): T;
86
99
  }
87
100
  export interface IBaseAbrControllerContext extends IVideoTracksContext {
88
101
  currentVideoTrack: Nullable<IVideoTrack>;
@@ -92,8 +105,16 @@ export interface IBaseAbrControllerContext extends IVideoTracksContext {
92
105
  estimatedThroughput: Kbps;
93
106
  reserve: Kbps;
94
107
  forwardBufferHealth: Nullable<number>;
108
+ forwardBufferDuration: Milliseconds | undefined;
95
109
  playbackRate: number;
110
+ throughputVariance: number;
96
111
  }
112
+ export type VideoSegmentLoadProgress = {
113
+ startedAtMs: Milliseconds;
114
+ loadedBytes: Byte;
115
+ totalBytes: Byte | undefined;
116
+ segmentDurationMs: Milliseconds;
117
+ };
97
118
  export interface IVideoAbrContext extends IBaseAbrControllerContext {
98
119
  container: Nullable<IRectangle>;
99
120
  panelSize: Nullable<IRectangle>;
@@ -102,6 +123,11 @@ export interface IVideoAbrContext extends IBaseAbrControllerContext {
102
123
  visible: boolean;
103
124
  severeStallOccurred: boolean;
104
125
  lastStallDuration: Milliseconds;
126
+ videoSegmentLoadProgress?: VideoSegmentLoadProgress;
127
+ remainingDurationMs: Milliseconds | undefined;
128
+ isLive: boolean;
129
+ mpdSegmentDurationMs: Milliseconds | undefined;
130
+ phase?: AbrPhase;
105
131
  }
106
132
  export type IAudioAbrContext = IBaseAbrControllerContext & IAudioTracksContext;
107
133
  export declare const isAudioAbrContext: (context: IBaseAbrControllerContext) => context is IAudioAbrContext;
@@ -1,5 +1,6 @@
1
- import type { Nullable } from "@vkontakte/videoplayer-shared";
2
- import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../../../player/types";
1
+ import type { Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
2
+ import type { IAudioTrack, IBaseTrack, IVideoTrack } from "#/player/types";
3
+ export declare const bufferToPlaybackMs: (contentMs: Milliseconds | undefined, playbackRate: number) => Milliseconds;
3
4
  export declare enum CompareTrack {
4
5
  Descending = -1,
5
6
  Ascending = 1
@@ -1,8 +1,8 @@
1
1
  import type { ILogger, IObservable } from "@vkontakte/videoplayer-shared";
2
2
  import { type ExactVideoQuality, Subject } from "@vkontakte/videoplayer-shared";
3
- import type { ITuningConfig } from "../../../utils/tuningConfig";
4
- import type { IVideoTrack } from "../../../player/types";
5
- import type { IStateMachine } from "../../../utils/StateMachine/types";
3
+ import type { ITuningConfig } from "#/utils/tuningConfig";
4
+ import type { IVideoTrack } from "#/player/types";
5
+ import type { IStateMachine } from "#/utils/StateMachine/types";
6
6
  interface IConnectData {
7
7
  logger: ILogger;
8
8
  video: HTMLVideoElement;
@@ -1,4 +1,4 @@
1
- import type { IObservableVideo } from "./observable";
1
+ import type { IObservableVideo } from "#/providers/utils/HTMLVideoElement/observable";
2
2
  import type { IListener, IRectangle, ISubscription, IValueSubject } from "@vkontakte/videoplayer-shared";
3
3
  interface ConnectParams {
4
4
  video: HTMLVideoElement;
@@ -1,5 +1,5 @@
1
- import type { IExternalTextTrack, IInternalTextTrack, ITextTrack } from "../../../player/types";
2
- import type { IDesiredState, IProviderOutput } from "../../types";
1
+ import type { IExternalTextTrack, IInternalTextTrack, ITextTrack } from "#/player/types";
2
+ import type { IDesiredState, IProviderOutput } from "#/providers/types";
3
3
  /**
4
4
  * TODO: сейчас externalTextTracks и internalTextTracks записываются в availableTextTracks отсюда
5
5
  * нужно будет выпилить этот класс за исключением этой логики,
@@ -1,5 +1,5 @@
1
1
  import type { Seconds, IRange, IObservable, IError, IValueObservable } from "@vkontakte/videoplayer-shared";
2
- import type { IVolumeState, PlaybackRate } from "../../../player/types";
2
+ import type { IVolumeState, PlaybackRate } from "#/player/types";
3
3
  export interface IObservableVideo {
4
4
  playing$: IObservable<undefined>;
5
5
  pause$: IObservable<undefined>;
@@ -1,4 +1,4 @@
1
- import type { ITuningConfig } from "../../../utils/tuningConfig";
1
+ import type { ITuningConfig } from "#/utils/tuningConfig";
2
2
  type AllocateConstraints = Pick<ITuningConfig, "audioVideoSyncRate" | "disableYandexPiP" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
3
3
  type DisposeConstraints = Pick<ITuningConfig, "keepVideoElement" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
4
4
  export declare const allocate: (container: HTMLElement, { audioVideoSyncRate, disableYandexPiP, clearVideoElementInnerHTML, reuseOwnVideoElement }: AllocateConstraints) => HTMLVideoElement;
@@ -1,6 +1,6 @@
1
1
  import type { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps, Seconds } from "@vkontakte/videoplayer-shared";
2
- import type { IVideoTrack } from "../../player/types";
3
- import type { ITuningConfig } from "../../utils/tuningConfig";
2
+ import type { IVideoTrack } from "#/player/types";
3
+ import type { ITuningConfig } from "#/utils/tuningConfig";
4
4
  interface IConnectData {
5
5
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
6
6
  throughput$: IValueSubject<number>;
@@ -1,4 +1,4 @@
1
- import { HttpConnectionType } from "../../player/types";
1
+ import { HttpConnectionType } from "#/player/types";
2
2
  declare const _default: (headers: Headers) => {
3
3
  type: HttpConnectionType | undefined;
4
4
  reused: boolean | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { Byte, IRange, Kbps, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
2
- import type { IVideoStream, VideoCodec, AudioCodec } from "../../../player/types";
2
+ import type { IVideoStream, VideoCodec, AudioCodec } from "#/player/types";
3
3
  export declare enum StreamKind {
4
4
  VIDEO = "video",
5
5
  AUDIO = "audio",
@@ -116,6 +116,7 @@ export interface Stream {
116
116
  label?: string;
117
117
  codecs: string;
118
118
  mime: string;
119
+ channels?: number;
119
120
  representations: Representation[];
120
121
  }
121
122
  export interface Manifest {
@@ -1,6 +1,6 @@
1
1
  import type { IListener, IObservable, ISubscription, IValueSubject } from "@vkontakte/videoplayer-shared";
2
- import type { IVolumeState, PlaybackRate } from "../../player/types";
3
- import type { IStateMachine } from "../../utils/StateMachine/types";
2
+ import type { IVolumeState, PlaybackRate } from "#/player/types";
3
+ import type { IStateMachine } from "#/utils/StateMachine/types";
4
4
  declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | undefined>, get: () => Value | undefined, set: (value: Value | undefined) => void, { equal, changed$, onError }?: {
5
5
  equal?: (a: Value | undefined, b: Value | undefined) => boolean;
6
6
  changed$?: IObservable<Value | undefined>;
@@ -1,4 +1,4 @@
1
- import type { IStateMachine } from "../../utils/StateMachine/types";
2
- import type { PlaybackState } from "../../player/types";
1
+ import type { IStateMachine } from "#/utils/StateMachine/types";
2
+ import type { PlaybackState } from "#/player/types";
3
3
  declare const _default: (playbackState: IStateMachine<PlaybackState>, value: PlaybackState, ignoreCurrentTransition?: boolean) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import type { ITuningConfig } from "../../utils/tuningConfig";
1
+ import type { ITuningConfig } from "#/utils/tuningConfig";
2
2
  import type { Manifest, Representation } from "./parsers/types";
3
3
  /** @mutates streams.video */
4
4
  export declare const markVideoStreamRepresentaionsFilter: (streams: Manifest["streams"], videoStreamRepresentaionsFilter: ITuningConfig["dash"]["videoStreamRepresentaionsFilter"]) => void;
@@ -1,4 +1,4 @@
1
- import type { Degree, Vector2D, Vector3D } from "./types";
1
+ import type { Degree, Vector2D, Vector3D } from "#/utils/3d/types";
2
2
  /**
3
3
  * Модель камеры трехмерной сцены
4
4
  */
@@ -1,5 +1,5 @@
1
- import type { Camera3D } from "./Camera3D";
2
- import type { DegreePerSecond, CameraRotationManagerParams, Degree, Vector3D } from "./types";
1
+ import type { Camera3D } from "#/utils/3d/Camera3D";
2
+ import type { DegreePerSecond, CameraRotationManagerParams, Degree, Vector3D } from "#/utils/3d/types";
3
3
  /**
4
4
  * Класс управляющий вращением камеры
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { Degree, Pixel, Scene3DParams, Vector2D, Vector3D } from "./types";
1
+ import type { Degree, Pixel, Scene3DParams, Vector2D, Vector3D } from "#/utils/3d/types";
2
2
  /**
3
3
  * Класс описывающий 3D сцену - канву на которой будет рисоваться проекция
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { Checker } from "../types/checker";
1
+ import type { Checker } from "#/utils/ClientChecker/types/checker";
2
2
  export declare const mp3Mime = "audio/mpeg";
3
3
  export declare class AudioChecker implements Checker {
4
4
  private _audio;
@@ -1,5 +1,5 @@
1
- import { CurrentClientBrowser } from "../types/currentClientBrowser";
2
- import type { Checker } from "../types/checker";
1
+ import { CurrentClientBrowser } from "#/utils/ClientChecker/types/currentClientBrowser";
2
+ import type { Checker } from "#/utils/ClientChecker/types/checker";
3
3
  export declare class BrowserChecker implements Checker {
4
4
  private _current;
5
5
  private _current_version;
@@ -1,6 +1,6 @@
1
- import { CurrentClientDevice } from "../types/currentClientDevice";
2
- import type { DisplayChecker } from "./DisplayChecker";
3
- import type { Checker } from "../types/checker";
1
+ import { CurrentClientDevice } from "#/utils/ClientChecker/types/currentClientDevice";
2
+ import type { DisplayChecker } from "#/utils/ClientChecker/services/DisplayChecker";
3
+ import type { Checker } from "#/utils/ClientChecker/types/checker";
4
4
  export interface OS {
5
5
  name: string;
6
6
  version: string;
@@ -1,4 +1,4 @@
1
- import type { Checker } from "../types/checker";
1
+ import type { Checker } from "#/utils/ClientChecker/types/checker";
2
2
  export { isMobile } from "../utils/isMobile";
3
3
  export declare class DisplayChecker implements Checker {
4
4
  private _maxTouchPoints;
@@ -1,7 +1,7 @@
1
- import { VideoFormat } from "../../../player/types";
1
+ import { VideoFormat } from "#/player/types";
2
2
  import type { DeviceChecker } from "./DeviceChecker";
3
3
  import type { BrowserChecker } from "./BrowserChecker";
4
- import type { Checker } from "../types/checker";
4
+ import type { Checker } from "#/utils/ClientChecker/types/checker";
5
5
  type Protocols = {
6
6
  mms: boolean;
7
7
  mse: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { Byte, Kbps, Milliseconds, IValueSubject } from "@vkontakte/videoplayer-shared";
2
- import type { ITuningConfig } from "./tuningConfig";
2
+ import type { ITuningConfig } from "#/utils/tuningConfig";
3
3
  declare class ThroughputEstimator {
4
4
  private throughput;
5
5
  private rtt;
@@ -20,6 +20,7 @@ declare class ThroughputEstimator {
20
20
  addRawThroughput(rate: Kbps): void;
21
21
  addRawRtt(time: Milliseconds): void;
22
22
  private sanityCheck;
23
+ get throughputVariance$(): IValueSubject<number>;
23
24
  private static loadStored;
24
25
  private static writeStored;
25
26
  private static validateStored;
@@ -1,6 +1,6 @@
1
1
  import type { IError, ISubject, IValueSubject } from "@vkontakte/videoplayer-shared";
2
- import type { IProviderOutput } from "../../providers/types";
3
- import type { IProviderEntry } from "../../providers/ProviderContainer/types";
2
+ import type { IProviderOutput } from "#/providers/types";
3
+ import type { IProviderEntry } from "#/providers/ProviderContainer/types";
4
4
  export declare class VolumeMultiplierManager {
5
5
  private providerOutput;
6
6
  private provider$;
@@ -1,7 +1,7 @@
1
- import type { ITuningConfig } from "./tuningConfig";
1
+ import type { ITuningConfig } from "#/utils/tuningConfig";
2
2
  import type { Kbps, Milliseconds, IRectangle, QualityLimits, IComponentLogger, Nullable } from "@vkontakte/videoplayer-shared";
3
3
  import { type ExactVideoQuality } from "@vkontakte/videoplayer-shared";
4
- import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../player/types";
4
+ import type { IAudioTrack, IBaseTrack, IVideoTrack } from "#/player/types";
5
5
  interface IConstraints<T extends IBaseTrack> {
6
6
  container?: IRectangle;
7
7
  estimatedThroughput?: Kbps;
@@ -0,0 +1,7 @@
1
+ import { VideoFormat } from "#/player/types";
2
+ import type { Manifest } from "#/providers/utils/parsers/types";
3
+ import type { ExactVideoQuality, IError } from "@vkontakte/videoplayer-shared";
4
+ import { VideoQuality } from "@vkontakte/videoplayer-shared";
5
+ export declare const getDashMaxTvVideoQuality: (e: IError, videoFormat?: VideoFormat, currentQuality?: VideoQuality) => ExactVideoQuality | null;
6
+ /** @mutates streams.video */
7
+ export declare const markDashMaxTvVideoQuality: (streams: Manifest["streams"], dashMaxTvVideoQuality: ExactVideoQuality) => void;
@@ -1,5 +1,5 @@
1
- import type { IVideoTrack } from "../player/types";
2
- import { PredefinedQualityLimits } from "../player/types";
1
+ import type { IVideoTrack } from "#/player/types";
2
+ import { PredefinedQualityLimits } from "#/player/types";
3
3
  import type { ExactVideoQuality, Nullable, QualityLimits } from "@vkontakte/videoplayer-shared";
4
4
  export declare function getQualityLimitsPredefinedType(limits: QualityLimits, highQualityLimit: ExactVideoQuality, trafficSavingLimit: ExactVideoQuality): PredefinedQualityLimits;
5
5
  type LimitsAsHeightValidParams = {
@@ -1,5 +1,5 @@
1
1
  import type { IValueSubject } from "@vkontakte/videoplayer-shared";
2
- import type { IStateMachine } from "./StateMachine/types";
2
+ import type { IStateMachine } from "#/utils/StateMachine/types";
3
3
  export declare const setStateWithSubscribe: <
4
4
  State,
5
5
  Value
@@ -1,4 +1,4 @@
1
- import type { ISmoothedValue, IParams } from "./types";
1
+ import type { ISmoothedValue, IParams } from "#/utils/smoothedValue/types";
2
2
  import type { IValueSubject } from "@vkontakte/videoplayer-shared";
3
3
  export declare abstract class BaseSmoothedValue implements ISmoothedValue {
4
4
  private prevReported;
@@ -12,6 +12,7 @@ export declare abstract class BaseSmoothedValue implements ISmoothedValue {
12
12
  protected params: IParams;
13
13
  smoothed$: IValueSubject<number>;
14
14
  debounced$: IValueSubject<number>;
15
+ varianceCoefficient$: IValueSubject<number>;
15
16
  constructor(params: IParams);
16
17
  protected abstract updateSmoothedValue(value: number): void;
17
18
  next(value: number): void;
@@ -1,5 +1,5 @@
1
- import type { IEmaAndMaParams } from "./types";
2
- import { BaseSmoothedValue } from "./baseSmoothedValue";
1
+ import type { IEmaAndMaParams } from "#/utils/smoothedValue/types";
2
+ import { BaseSmoothedValue } from "#/utils/smoothedValue/baseSmoothedValue";
3
3
  export declare class EmaAndMaSmoothedValue extends BaseSmoothedValue {
4
4
  private emaSmoothed;
5
5
  constructor(params: IEmaAndMaParams);
@@ -1,5 +1,5 @@
1
- import { BaseSmoothedValue } from "./baseSmoothedValue";
2
- import type { IEmaTopExtremumParams } from "./types";
1
+ import { BaseSmoothedValue } from "#/utils/smoothedValue/baseSmoothedValue";
2
+ import type { IEmaTopExtremumParams } from "#/utils/smoothedValue/types";
3
3
  export declare class EmaTopExtremumValue extends BaseSmoothedValue {
4
4
  private readonly extremumInterval;
5
5
  private furtherValues;
@@ -1,5 +1,5 @@
1
- import type { ITuningConfig } from "../tuningConfig";
2
- import type { ISmoothedValue } from "./types";
1
+ import type { ITuningConfig } from "#/utils/tuningConfig";
2
+ import type { ISmoothedValue } from "#/utils/smoothedValue/types";
3
3
  export declare class SmoothedValueFactory {
4
4
  static getSmoothedValue(initialThroughput: number, fastDirection: 1 | -1, tuning: ITuningConfig["throughputEstimator"]): ISmoothedValue;
5
5
  static getLiveBufferSmoothedValue(initialBufferLength: number, tuning: ITuningConfig["dashCmafLive"]["lowLatency"]["bufferEstimator"]): ISmoothedValue;
@@ -1,5 +1,5 @@
1
- import type { ITwoEmaParams } from "./types";
2
- import { BaseSmoothedValue } from "./baseSmoothedValue";
1
+ import type { ITwoEmaParams } from "#/utils/smoothedValue/types";
2
+ import { BaseSmoothedValue } from "#/utils/smoothedValue/baseSmoothedValue";
3
3
  export declare class TwoEmaSmoothedValue extends BaseSmoothedValue {
4
4
  private slow;
5
5
  private fast;
@@ -22,5 +22,6 @@ export interface IEmaTopExtremumParams extends IParams {
22
22
  export interface ISmoothedValue {
23
23
  smoothed$: IValueSubject<number>;
24
24
  debounced$: IValueSubject<number>;
25
+ varianceCoefficient$: IValueSubject<number>;
25
26
  next(value: number): void;
26
27
  }