@vkontakte/videoplayer-core 2.0.163-dev.5254e12e1.0 → 2.0.163-dev.5f4dee4ba.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 (38) hide show
  1. package/es2015.cjs +47 -38
  2. package/es2015.esm.js +47 -38
  3. package/esnext.cjs +41 -32
  4. package/esnext.esm.js +41 -32
  5. package/evergreen.esm.js +41 -32
  6. package/package.json +2 -2
  7. package/types/player/Player.d.ts +2 -2
  8. package/types/player/types.d.ts +2 -25
  9. package/types/player/utils/selectContainer.d.ts +3 -0
  10. package/types/providers/ChromecastProvider/types.d.ts +1 -1
  11. package/types/providers/DashLiveProvider/DashLiveProvider.d.ts +1 -1
  12. package/types/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +1 -1
  13. package/types/providers/DashProvider/baseDashProvider.d.ts +6 -2
  14. package/types/providers/DashProvider/lib/player.d.ts +3 -2
  15. package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +6 -2
  16. package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +4 -3
  17. package/types/providers/HlsLiveProvider/index.d.ts +1 -1
  18. package/types/providers/HlsProvider/index.d.ts +1 -1
  19. package/types/providers/MpegProvider/index.d.ts +1 -1
  20. package/types/providers/ProviderContainer/index.d.ts +2 -2
  21. package/types/providers/WebRTCLiveProvider/WebRTCLiveProvider.d.ts +1 -1
  22. package/types/providers/types.d.ts +4 -10
  23. package/types/providers/utils/Abr/rules/video/downloadTimeRule.d.ts +15 -0
  24. package/types/providers/utils/Abr/rules/video/tvDisabledVideoTrackRule.d.ts +9 -0
  25. package/types/providers/utils/Abr/types.d.ts +7 -3
  26. package/types/providers/utils/Abr/utils.d.ts +3 -1
  27. package/types/providers/utils/HTMLVideoElement/destroy.d.ts +1 -1
  28. package/types/providers/utils/HTMLVideoElement/forcePlay.d.ts +1 -1
  29. package/types/providers/utils/HTMLVideoElement/observable.d.ts +1 -2
  30. package/types/providers/utils/HTMLVideoElement/pool.d.ts +2 -3
  31. package/types/providers/utils/canPlay.d.ts +3 -0
  32. package/types/providers/utils/syncDesiredState.d.ts +3 -3
  33. package/types/utils/buffer/dynamicBufferTarget.d.ts +10 -0
  34. package/types/utils/changePlaybackRate.d.ts +1 -1
  35. package/types/utils/tuningConfig.d.ts +17 -0
  36. package/types/player/utils/extractEmbeddableAllocation.d.ts +0 -3
  37. package/types/providers/utils/createAllocationResolution.d.ts +0 -3
  38. package/types/utils/buffer/getPlayedTime.d.ts +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.163-dev.5254e12e1.0",
3
+ "version": "2.0.163-dev.5f4dee4ba.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.92-dev.5254e12e1.0"
45
+ "@vkontakte/videoplayer-shared": "1.0.92-dev.5f4dee4ba.0"
46
46
  }
47
47
  }
@@ -1,6 +1,6 @@
1
1
  import type { IOptionalTuningConfig } from "../utils/tuningConfig";
2
- import type { ILogEntry, ITracer, QualityLimits, Seconds, VideoQuality } from "@vkontakte/videoplayer-shared";
3
- import { type IAudioStream, type IConfig, type ICueSettings, type IExternalTextTrack, type IPlayer, type ITextTrack, type IVideoStream, type PlaybackRate, type PlayerEventsImpl, type PlayerExperimentalImpl, type PlayerInfoImpl, PredefinedQualityLimits } from "./types";
2
+ import type { ILogEntry, Seconds, QualityLimits, VideoQuality, ITracer } from "@vkontakte/videoplayer-shared";
3
+ import { type IAudioStream, type IConfig, type ICueSettings, type IExternalTextTrack, type IPlayer, type ITextTrack, type IVideoStream, type PlaybackRate, PredefinedQualityLimits, type PlayerInfoImpl, type PlayerEventsImpl, type PlayerExperimentalImpl } from "./types";
4
4
  import type { IPlayerOptions } from "../utils/playerOptions";
5
5
  export default class Player implements IPlayer {
6
6
  private readonly subscription;
@@ -1,4 +1,4 @@
1
- import type { IError, ILogEntry, IObservable, IRectangle, IValueObservable, IValueSubject, Kbps, Milliseconds, QualityLimits, Seconds, Subject, ValueSubject, VideoQuality } from "@vkontakte/videoplayer-shared";
1
+ import type { IObservable, IValueObservable, IValueSubject, ILogEntry, Kbps, Milliseconds, Seconds, IRectangle, IError, QualityLimits, VideoQuality, Subject, ValueSubject } from "@vkontakte/videoplayer-shared";
2
2
  import type { Pixel } from "../utils/3d/types";
3
3
  import type { dump } from "../utils/playbackTelemetry";
4
4
  export interface StartEnd<Unit extends number> {
@@ -251,7 +251,6 @@ export interface PlayerInfoValues {
251
251
  * default value: `Infinity`
252
252
  */
253
253
  duration$: Seconds;
254
- playedTime$: Seconds;
255
254
  muted$: boolean;
256
255
  volume$: number;
257
256
  availableVideoStreams$: IVideoStream[];
@@ -528,9 +527,7 @@ export interface IVolumeState {
528
527
  muted: boolean;
529
528
  }
530
529
  export interface IConfig {
531
- /** @deprecated */
532
- container?: string | HTMLElement;
533
- readonly allocation?: TAnyAllocation;
530
+ container: string | HTMLElement;
534
531
  sources: ISources;
535
532
  meta?: IMetadata;
536
533
  failoverHosts?: string[];
@@ -542,26 +539,6 @@ export interface IConfig {
542
539
  */
543
540
  handleNetworkRecoverableErrorAsProviderError?: boolean;
544
541
  }
545
- export type TAllocationParent = string | HTMLElement;
546
- export type TAllocationSelf = HTMLAudioElement;
547
- export interface IAllocation<Parent extends TAllocationParent = TAllocationParent> {
548
- readonly strategy: string;
549
- readonly parent?: Parent;
550
- readonly self?: TAllocationSelf;
551
- }
552
- export interface IEmbeddableAllocation<Parent extends TAllocationParent = TAllocationParent> extends IAllocation<Parent> {
553
- readonly strategy: "embeddable";
554
- readonly parent: Parent;
555
- readonly self?: never;
556
- }
557
- export type IStringifiedEmbeddableAllocation = IEmbeddableAllocation<string>;
558
- export type IDirectEmbeddableAllocation = IEmbeddableAllocation<HTMLElement>;
559
- export interface IPersonalAllocation extends IAllocation {
560
- readonly strategy: "personal";
561
- readonly self: TAllocationSelf;
562
- readonly parent?: never;
563
- }
564
- export type TAnyAllocation = IStringifiedEmbeddableAllocation | IDirectEmbeddableAllocation | IPersonalAllocation;
565
542
  export interface ISources {
566
543
  [VideoFormat.MPEG]?: IMpegSource;
567
544
  [VideoFormat.DASH]?: IDashURLSource;
@@ -0,0 +1,3 @@
1
+ import type { IConfig } from "../types";
2
+ declare const _default: (config: IConfig) => HTMLElement;
3
+ export default _default;
@@ -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 Omit<IProviderParams<ISources>, "skipVideoElVolumeSync$" | "allocation"> {
4
+ export interface IParams extends Omit<IProviderParams<ISources>, "skipVideoElVolumeSync$"> {
5
5
  meta: IMetadata;
6
6
  format: VideoFormat;
7
7
  connection: IChromecastConnection;
@@ -11,7 +11,7 @@ type Params = IProviderParams<IDashURLSource> & {
11
11
  export default class DashLiveProvider implements IProvider {
12
12
  private subscription;
13
13
  private volumeSubscription;
14
- private readonly allocation;
14
+ private video;
15
15
  private videoState;
16
16
  private dash;
17
17
  private representations$;
@@ -5,7 +5,7 @@ import { IRepresentation, State } from "../types";
5
5
  import { Subject } from "@vkontakte/videoplayer-shared";
6
6
  import { PlaybackState } from "../../../player/types";
7
7
  interface IParams {
8
- videoElement: HTMLMediaElement;
8
+ videoElement: HTMLVideoElement;
9
9
  videoState: IStateMachine<State>;
10
10
  playbackState: IStateMachine<PlaybackState>;
11
11
  liveOffset: ILiveOffset;
@@ -2,7 +2,7 @@ import type { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVide
2
2
  import type { IProviderSubscriptionInfo } from "./lib/types";
3
3
  import { ProviderState } from "./lib/types";
4
4
  import type { CommonInit, Representation, Stream } from "../utils/parsers/types";
5
- import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
5
+ import type { IProvider, IProviderParams } from "../types";
6
6
  import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
7
7
  import { TrackHistory } from "../../utils/autoSelectTrack";
8
8
  import type { IStateMachine } from "../../utils/StateMachine/types";
@@ -26,7 +26,7 @@ export default abstract class BaseDashProvider implements IProvider {
26
26
  protected subscription: ISubscription;
27
27
  protected volumeSubscription: ISubscription;
28
28
  protected videoState: IStateMachine<ProviderState>;
29
- protected readonly allocation: IProviderAllocationResolution;
29
+ protected video: HTMLVideoElement;
30
30
  protected observableVideo: IObservableVideo | null;
31
31
  protected player: Player;
32
32
  protected params: IParams;
@@ -57,6 +57,10 @@ export default abstract class BaseDashProvider implements IProvider {
57
57
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
58
58
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
59
59
  protected subscribe(): void;
60
+ private syncBufferTarget;
61
+ private resolveAudioBufferTargetMs;
62
+ private resolveBufferTargetMs;
63
+ private getCurrentVideoBitrateKbps;
60
64
  protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
61
65
  protected prepare(manifestOffset?: number): void;
62
66
  protected syncPlayback: () => void;
@@ -89,7 +89,7 @@ export declare class Player {
89
89
  private dashMaxTvVideoQuality;
90
90
  private destroyController;
91
91
  constructor(params: Params);
92
- initManifest: ReturnType<typeof abortable<[HTMLMediaElement, string, number]>>;
92
+ initManifest: ReturnType<typeof abortable<[HTMLVideoElement, string, number]>>;
93
93
  updateManifest: ReturnType<typeof abortable<[], Manifest | null>>;
94
94
  setSmartRepresentationSwitch(state: boolean): void;
95
95
  seekLive(nextOffset: Milliseconds): Promise<void>;
@@ -106,7 +106,8 @@ export declare class Player {
106
106
  getForwardBufferRepresentations(kind: Exclude<StreamKind, StreamKind.TEXT>): Map<Representation["id"], Segment[]> | undefined;
107
107
  getActiveVideoSegmentProgress(): VideoSegmentLoadProgress | undefined;
108
108
  getMpdVideoSegmentDuration(): Milliseconds | undefined;
109
- setBufferTarget(time: Milliseconds): void;
109
+ setBufferTarget(videoTarget: Milliseconds, audioTarget: Milliseconds): void;
110
+ getVideoForwardBufferDuration(): Milliseconds;
110
111
  getStreams(): Manifest["streams"] | undefined;
111
112
  getCodecs(): Manifest["codecs"] | undefined;
112
113
  setPreloadOnly(preloadOnly: boolean): void;
@@ -2,7 +2,7 @@ import type { IAudioTrack, IBaseTrack, IDashURLSource, IHLSSource, IInternalText
2
2
  import type { IProviderSubscriptionInfo } from "./lib/types";
3
3
  import { ProviderState } from "./lib/types";
4
4
  import type { CommonInit, Representation, Stream } from "../utils/parsers/types";
5
- import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
5
+ import type { IProvider, IProviderParams } from "../types";
6
6
  import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
7
7
  import { TrackHistory } from "../../utils/autoSelectTrack";
8
8
  import type { IStateMachine } from "../../utils/StateMachine/types";
@@ -26,7 +26,7 @@ export default abstract class BaseDashProvider implements IProvider {
26
26
  protected subscription: ISubscription;
27
27
  protected volumeSubscription: ISubscription;
28
28
  protected videoState: IStateMachine<ProviderState>;
29
- protected readonly allocation: IProviderAllocationResolution;
29
+ protected video: HTMLVideoElement;
30
30
  protected observableVideo: IObservableVideo | null;
31
31
  protected player: BasePlayer;
32
32
  protected params: IParams;
@@ -57,6 +57,10 @@ export default abstract class BaseDashProvider implements IProvider {
57
57
  protected abstract getPlayer(): BasePlayer;
58
58
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
59
59
  protected subscribe(): void;
60
+ private syncBufferTarget;
61
+ private resolveAudioBufferTargetMs;
62
+ private resolveBufferTargetMs;
63
+ private getCurrentVideoBitrateKbps;
60
64
  protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
61
65
  protected prepare(manifestOffset?: number): void;
62
66
  protected syncPlayback: () => void;
@@ -14,7 +14,7 @@ import type { Params } from "./types";
14
14
  import { State } from "./types";
15
15
  import { NativeBufferManager } from "../buffer/nativeBufferManager";
16
16
  export declare abstract class BasePlayer {
17
- protected element: HTMLMediaElement | null;
17
+ protected element: HTMLVideoElement | null;
18
18
  protected manifestUrlString: string;
19
19
  protected source: MediaSource | null;
20
20
  protected manifest: Manifest | null;
@@ -80,7 +80,7 @@ export declare abstract class BasePlayer {
80
80
  protected abstract setSourceInitDuration(): void;
81
81
  protected abstract restoreAfterDeepStall(): Promise<void>;
82
82
  initRepresentations: ReturnType<typeof abortable<[Representation["id"], Representation["id"] | undefined, IHLSSource | undefined]>>;
83
- initManifest(element: HTMLMediaElement, manifestBaseUrlString: string, offset: number): Promise<void>;
83
+ initManifest(element: HTMLVideoElement, manifestBaseUrlString: string, offset: number): Promise<void>;
84
84
  initBuffer(): void;
85
85
  switchRepresentation(kind: StreamKind, id: Representation["id"], mode: SwithRepresentationMode): Promise<void>;
86
86
  seek(requestedPosition: Milliseconds, forcePrecise?: boolean): Promise<void>;
@@ -91,7 +91,8 @@ export declare abstract class BasePlayer {
91
91
  get isStreamEnded(): boolean;
92
92
  getStreams(): Manifest["streams"] | undefined;
93
93
  getCodecs(): Manifest["codecs"] | undefined;
94
- setBufferTarget(time: Milliseconds): void;
94
+ setBufferTarget(videoTarget: Milliseconds, audioTarget: Milliseconds): void;
95
+ getVideoForwardBufferDuration(): Milliseconds;
95
96
  setPreloadOnly(preloadOnly: boolean): void;
96
97
  stop(): void;
97
98
  destroy(): void;
@@ -12,7 +12,7 @@ export default class HlsLiveProvider implements IProvider {
12
12
  private subscription;
13
13
  private volumeSubscription;
14
14
  private videoState;
15
- private readonly allocation;
15
+ private video;
16
16
  private params;
17
17
  private textTracksManager;
18
18
  private liveTextManager;
@@ -7,7 +7,7 @@ export default class HlsProvider implements IProvider {
7
7
  private subscription;
8
8
  private volumeSubscription;
9
9
  private videoState;
10
- private readonly allocation;
10
+ private video;
11
11
  private params;
12
12
  private textTracksManager;
13
13
  private masterManifest;
@@ -5,7 +5,7 @@ export default class MpegProvider implements IProvider {
5
5
  private subscription;
6
6
  private volumeSubscription;
7
7
  private videoState;
8
- private readonly allocation;
8
+ private video;
9
9
  private trackUrls;
10
10
  private params;
11
11
  private textTracksManager;
@@ -3,10 +3,10 @@ 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
5
  import { ValueSubject } from "@vkontakte/videoplayer-shared";
6
- import type { IDesiredState, IProviderDependencies, IProviderOutput, TProviderAllocation } from "../types";
6
+ import type { IDesiredState, IProviderDependencies, IProviderOutput } from "../types";
7
7
  import type { IProviderContainer, IProviderEntry } from "./types";
8
8
  interface IParams extends IProviderDependencies {
9
- allocation: TProviderAllocation;
9
+ container: HTMLElement;
10
10
  sources: ISources;
11
11
  meta: IMetadata;
12
12
  failoverHosts: string[];
@@ -10,7 +10,7 @@ export default class WebRTCLiveProvider implements IProvider {
10
10
  private readonly volumeSubscription;
11
11
  private readonly params;
12
12
  private log;
13
- private readonly allocation;
13
+ private video;
14
14
  private videoState;
15
15
  private liveStreamClient;
16
16
  private maxSeekBackTime$;
@@ -1,8 +1,8 @@
1
1
  import type { ITuningConfig } from "../utils/tuningConfig";
2
- import type { IComponentLogger, IError, ILogger, IRange, IRectangle, ISubject, ITracer, IValueSubject, IWarning, Milliseconds, QualityLimits, Seconds } from "@vkontakte/videoplayer-shared";
2
+ import type { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger, ITracer, IRectangle } from "@vkontakte/videoplayer-shared";
3
3
  import type { IChromecastInitializer } from "./ChromecastProvider/ChromecastInitializer/types";
4
- import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackRate, PlaybackState } from "../player/types";
5
- import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ICueSettings, IDirectEmbeddableAllocation, IPersonalAllocation, ISources, IVideoStream, SeekState, TAnyAllocation, VideoCodec } from "../player/types";
4
+ import type { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec, AudioCodec, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from "../player/types";
5
+ import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackState, PlaybackRate } from "../player/types";
6
6
  import type { IStateMachine } from "../utils/StateMachine/types";
7
7
  import type ThroughputEstimator from "../utils/ThroughputEstimator";
8
8
  import type { Scene3D } from "../utils/3d/Scene3D";
@@ -21,7 +21,7 @@ export interface IProviderDependencies {
21
21
  };
22
22
  }
23
23
  export interface IProviderParams<TSourceType> extends IProviderDependencies {
24
- readonly allocation: TProviderAllocation;
24
+ container: HTMLElement;
25
25
  source: TSourceType;
26
26
  desiredState: IDesiredState;
27
27
  output: IProviderOutput;
@@ -66,7 +66,6 @@ export type IDesiredState = { [K in keyof DesiredStateValues] : IStateMachine<De
66
66
  export interface IProviderOutput {
67
67
  position$: IValueSubject<Seconds>;
68
68
  duration$: IValueSubject<Seconds>;
69
- playedTime$: IValueSubject<Seconds>;
70
69
  volume$: IValueSubject<IVolumeState>;
71
70
  currentVideoSegmentLength$: IValueSubject<number>;
72
71
  currentAudioSegmentLength$: IValueSubject<number>;
@@ -130,8 +129,3 @@ export interface IProviderOutput {
130
129
  playbackState$: IValueSubject<PlaybackState | string>;
131
130
  getCurrentTime$: IValueSubject<(() => number) | null>;
132
131
  }
133
- export type TProviderAllocation = Extract<TAnyAllocation, IDirectEmbeddableAllocation | IPersonalAllocation>;
134
- export interface IProviderAllocationResolution {
135
- readonly target: HTMLMediaElement;
136
- readonly video: HTMLVideoElement | null;
137
- }
@@ -0,0 +1,15 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "../../types";
2
+ import type { IVideoTrack } from "../../../../../player/types";
3
+ import type { Kbps, Milliseconds } from "@vkontakte/videoplayer-shared";
4
+ import { LimitAboveRule } from "../limitAboveRule";
5
+ import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
6
+ type DownloadTimeLogsArgs = [estimatedThroughput: Kbps, forwardBufferDuration: Milliseconds, simulatedFinalBufferMs: Milliseconds | null];
7
+ export declare class DownloadTimeRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, DownloadTimeLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
8
+ constructor(phaseConfig: RulePhaseConfig);
9
+ execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
10
+ private buildReferenceTimeline;
11
+ private resolveLookaheadCount;
12
+ private simulate;
13
+ protected createLogMessage(selectedTrack: IVideoTrack, estimatedThroughput: Kbps, forwardBufferDuration: Milliseconds, simulatedFinalBufferMs: Milliseconds | null): string;
14
+ }
15
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "../../types";
2
+ import type { IVideoTrack } from "../../../../../player/types";
3
+ import { LimitAboveRule } from "../limitAboveRule";
4
+ import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
5
+ export declare class TvDisabledVideoTrackRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
6
+ constructor(phaseConfig: RulePhaseConfig);
7
+ execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
8
+ protected createLogMessage(selectedTrack: IVideoTrack): string;
9
+ }
@@ -16,12 +16,14 @@ export declare enum VideoRuleName {
16
16
  Bola = "bola_rule",
17
17
  FitsContainer = "fits_container_rule",
18
18
  FailedVideoTrack = "failed_video_track_rule",
19
+ TvDisabledVideoTrack = "tv_disabled_video_track_rule",
19
20
  Stalls = "stalls_rule",
20
21
  LowerLimit = "lower_limit_rule",
21
22
  UpperLimit = "upper_limit_rule",
22
23
  Throughput = "throughput_rule",
23
24
  AbandonRequest = "abandon_request_rule",
24
- InsufficientBuffer = "insufficient_buffer_rule"
25
+ InsufficientBuffer = "insufficient_buffer_rule",
26
+ DownloadTime = "download_time_rule"
25
27
  }
26
28
  export declare enum AudioRuleName {
27
29
  MinAudioForVideo = "min_audio_for_video_rule",
@@ -39,6 +41,7 @@ export interface IUpdatableAbrManagerContext {
39
41
  desiredVideoTrack: Nullable<IVideoTrack>;
40
42
  limits: QualityLimits;
41
43
  forwardBufferHealth?: number;
44
+ forwardBufferTarget: Milliseconds;
42
45
  forwardVideoBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
43
46
  forwardAudioBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
44
47
  forwardBufferDuration?: Milliseconds;
@@ -55,7 +58,7 @@ export interface IInitAbrManagerContext {
55
58
  throughput$: IValueSubject<Kbps>;
56
59
  rtt$: IValueSubject<Milliseconds>;
57
60
  throughputVariance$?: IValueSubject<number>;
58
- element: HTMLMediaElement;
61
+ element: HTMLVideoElement;
59
62
  failedVideoTrack: Nullable<IVideoTrack>;
60
63
  abrLogger: IComponentLogger;
61
64
  panelSize?: IRectangle;
@@ -63,7 +66,7 @@ export interface IInitAbrManagerContext {
63
66
  export interface IVideoElementAbrManagerContext {
64
67
  observableVideo: IObservableVideo;
65
68
  elementVisible$: IValueSubject<boolean>;
66
- elementSizeManager?: ElementSizeManager;
69
+ elementSizeManager: ElementSizeManager;
67
70
  }
68
71
  export interface IVideoTracksContext {
69
72
  videoTracksAsc: IVideoTrack[];
@@ -119,6 +122,7 @@ export interface IVideoAbrContext extends IBaseAbrControllerContext {
119
122
  container: Nullable<IRectangle>;
120
123
  panelSize: Nullable<IRectangle>;
121
124
  forwardBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
125
+ forwardBufferTarget: Milliseconds;
122
126
  limits: QualityLimits;
123
127
  visible: boolean;
124
128
  severeStallOccurred: boolean;
@@ -1,5 +1,7 @@
1
- import type { Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
1
+ import type { Kbps, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
2
2
  import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../../../player/types";
3
+ import type { Segment } from "../parsers/types";
4
+ export declare const computeForwardBitrate: (segments: Nullable<Segment[]>) => Kbps;
3
5
  export declare const bufferToPlaybackMs: (contentMs: Milliseconds | undefined, playbackRate: number) => Milliseconds;
4
6
  export declare enum CompareTrack {
5
7
  Descending = -1,
@@ -1 +1 @@
1
- export declare const destroy: (video: HTMLMediaElement, clearVideoElementInnerHTML: boolean) => void;
1
+ export declare const destroy: (video: HTMLVideoElement, clearVideoElementInnerHTML: boolean) => void;
@@ -4,5 +4,5 @@
4
4
  * @param {Function} soundNotAllowedCallback - колбэк, который вызовется если нам не разрешили играть со звуком
5
5
  * @return {Promise}<boolean> - получилось начать воспроизведение
6
6
  */
7
- declare const _default: (video: HTMLMediaElement, soundNotAllowedCallback?: () => void) => Promise<boolean>;
7
+ declare const _default: (video: HTMLVideoElement, soundNotAllowedCallback?: () => void) => Promise<boolean>;
8
8
  export default _default;
@@ -12,7 +12,6 @@ export interface IObservableVideo {
12
12
  progress$: IObservable<undefined>;
13
13
  timeUpdate$: IObservable<Seconds>;
14
14
  durationChange$: IObservable<Seconds>;
15
- playedTime$: IObservable<Seconds>;
16
15
  loadStart$: IObservable<void>;
17
16
  loadedMetadata$: IObservable<undefined>;
18
17
  loadedData$: IObservable<undefined>;
@@ -26,4 +25,4 @@ export interface IObservableVideo {
26
25
  leavePip$: IObservable<PictureInPictureEvent>;
27
26
  destroy: () => void;
28
27
  }
29
- export declare const observe: (video: HTMLMediaElement) => IObservableVideo;
28
+ export declare const observe: (video: HTMLVideoElement) => IObservableVideo;
@@ -1,7 +1,6 @@
1
1
  import type { ITuningConfig } from "../../../utils/tuningConfig";
2
- export type AllocateConstraints = Pick<ITuningConfig, "audioVideoSyncRate" | "disableYandexPiP" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
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;
5
- export declare const initializeAudio: (element: HTMLAudioElement) => HTMLAudioElement;
6
- export declare const dispose: (element: HTMLMediaElement, constraints: DisposeConstraints) => void;
5
+ export declare const dispose: (videoElement: HTMLVideoElement, { keepVideoElement, clearVideoElementInnerHTML, reuseOwnVideoElement }: DisposeConstraints) => void;
7
6
  export {};
@@ -0,0 +1,3 @@
1
+ import type { ITuningConfig } from "../../utils/tuningConfig";
2
+ import type { Stream } from "./parsers/types";
3
+ export declare const filterStreams: (streams: Stream[], videoElement: HTMLVideoElement, canPlayTypeRestriction: ITuningConfig["dash"]["checkRepresentationCanPlayType"]) => Stream[];
@@ -6,9 +6,9 @@ declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | unde
6
6
  changed$?: IObservable<Value | undefined>;
7
7
  onError?: IListener<Error | unknown>;
8
8
  }) => ISubscription;
9
- export declare const syncVideoLooped: (video: HTMLMediaElement, desiredState: IStateMachine<boolean>, onError?: IListener<Error | unknown>) => ISubscription;
10
- export declare const syncVideoVolumeState: (video: HTMLMediaElement, desiredState: IStateMachine<IVolumeState>, changed$: IObservable<IVolumeState>, onError?: IListener<Error | unknown>, params?: {
9
+ export declare const syncVideoLooped: (video: HTMLVideoElement, desiredState: IStateMachine<boolean>, onError?: IListener<Error | unknown>) => ISubscription;
10
+ export declare const syncVideoVolumeState: (video: HTMLVideoElement, desiredState: IStateMachine<IVolumeState>, changed$: IObservable<IVolumeState>, onError?: IListener<Error | unknown>, params?: {
11
11
  skipVideoElVolumeSync$: IValueSubject<boolean>;
12
12
  }) => ISubscription;
13
- export declare const syncVideoPlaybackRate: (video: HTMLMediaElement, desiredState: IStateMachine<PlaybackRate>, changed$: IObservable<PlaybackRate>, onError?: IListener<Error | unknown>) => ISubscription;
13
+ export declare const syncVideoPlaybackRate: (video: HTMLVideoElement, desiredState: IStateMachine<PlaybackRate>, changed$: IObservable<PlaybackRate>, onError?: IListener<Error | unknown>) => ISubscription;
14
14
  export default syncDesiredState;
@@ -0,0 +1,10 @@
1
+ import type { Kbps, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
2
+ import type { ITuningConfig } from "../tuningConfig";
3
+ type DynamicBufferTargetConfig = ITuningConfig["dash"]["dynamicBufferTarget"];
4
+ export interface IDynamicBufferTargetState {
5
+ throughputKbps: Kbps;
6
+ currentBitrateKbps: Nullable<Kbps>;
7
+ baseTargetMs: Milliseconds;
8
+ }
9
+ export declare const computeDynamicBufferTarget: (state: IDynamicBufferTargetState, config: DynamicBufferTargetConfig) => Milliseconds;
10
+ export {};
@@ -1,2 +1,2 @@
1
1
  import type { Nullable } from "@vkontakte/videoplayer-shared";
2
- export declare const changePlaybackRate: (element: Nullable<HTMLMediaElement>, targetPlaybackRate: number) => void;
2
+ export declare const changePlaybackRate: (element: Nullable<HTMLVideoElement>, targetPlaybackRate: number) => void;
@@ -132,6 +132,8 @@ export type ITuningConfig = {
132
132
  forwardBufferTargetAuto: Milliseconds;
133
133
  forwardBufferTargetManual: Milliseconds;
134
134
  forwardBufferTargetPreload: Milliseconds;
135
+ audioBufferAheadOfVideoMs: Milliseconds;
136
+ useDynamicBufferTarget: boolean;
135
137
  seekBiasInTheEnd: Milliseconds;
136
138
  maxSegmentDurationLeftToSelectNextSegment: Milliseconds;
137
139
  minSafeBufferThreshold: number;
@@ -209,9 +211,24 @@ export type ITuningConfig = {
209
211
  budgetFactor: number;
210
212
  fallbackSegmentDurationMs: Milliseconds;
211
213
  };
214
+ dynamicBufferTarget: {
215
+ maxMs: Milliseconds;
216
+ optimisticHeadroomLow: number;
217
+ optimisticHeadroomHigh: number;
218
+ weakThroughputLowKbps: Kbps;
219
+ weakThroughputHighKbps: Kbps;
220
+ maxFactor: number;
221
+ };
212
222
  videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodecName][];
213
223
  filterOnDemandQualityList: boolean;
214
224
  dashMaxTvVideoQuality: boolean;
225
+ checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
226
+ downloadTime: {
227
+ minLookaheadSegments: number;
228
+ safetyFactor: number;
229
+ bootstrapBufferMs: Milliseconds;
230
+ demandTolerance: number;
231
+ };
215
232
  };
216
233
  dashCmafLive: {
217
234
  externalStopControl: boolean;
@@ -1,3 +0,0 @@
1
- import type { IConfig, IDirectEmbeddableAllocation } from "../types";
2
- declare const _default: (config: IConfig) => IDirectEmbeddableAllocation | null;
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { IProviderAllocationResolution, TProviderAllocation } from "../types";
2
- import { type AllocateConstraints } from "./HTMLVideoElement/pool";
3
- export declare function resolveAllocation(allocation: TProviderAllocation, constraints: AllocateConstraints): IProviderAllocationResolution;
@@ -1,3 +0,0 @@
1
- import type { Seconds } from "@vkontakte/videoplayer-shared";
2
- declare const _default: (ranges: TimeRanges) => Seconds;
3
- export default _default;