@vkontakte/videoplayer-core 2.0.116-dev.d1ccc575.0 → 2.0.117-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.116-dev.d1ccc575.0",
3
+ "version": "2.0.117-beta.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer core library based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -49,7 +49,7 @@
49
49
  "**/*.d.ts"
50
50
  ],
51
51
  "dependencies": {
52
- "@vkontakte/videoplayer-shared": "1.0.48-dev.694b5b17.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.49-beta.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
@@ -16,6 +16,8 @@ export default class Player implements IPlayer {
16
16
  private initedAt;
17
17
  private hasLiveOffsetByPaused;
18
18
  private hasLiveOffsetByPausedTimer;
19
+ private explicitInitialQuality;
20
+ private wasSetStartedQuality;
19
21
  private desiredState;
20
22
  info: {
21
23
  playbackState$: ValueSubject<PlaybackState>;
@@ -125,6 +127,7 @@ export default class Player implements IPlayer {
125
127
  setExternalTextTracks(tracks: Omit<IExternalTextTrack, 'type'>[]): IPlayer;
126
128
  selectTextTrack(id: ITextTrack['id'] | undefined): IPlayer;
127
129
  setTextTrackCueSettings(settings: ICueSettings): IPlayer;
130
+ setLiveLowLatency(isLowLatency: boolean): IPlayer;
128
131
  setLooped(isLooped: boolean): IPlayer;
129
132
  toggleChromecast(): void;
130
133
  /**
@@ -48,6 +48,7 @@ export interface IPlayer {
48
48
  setExternalTextTracks(tracks: Omit<IExternalTextTrack, 'type'>[]): IPlayer;
49
49
  selectTextTrack(id: ITextTrack['id'] | undefined): IPlayer;
50
50
  setTextTrackCueSettings(settings: ICueSettings): IPlayer;
51
+ setLiveLowLatency(isLowLatency: boolean): IPlayer;
51
52
  /**
52
53
  * Включает или отключает Chromecast
53
54
  */
@@ -9,6 +9,7 @@ import { ILiveOffset } from '../utils/LiveOffset/types';
9
9
  import { Scene3D } from '../../utils/3d/Scene3D';
10
10
  import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
11
11
  import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
12
+ import StallsManager from '../../providers/utils/StallsManager';
12
13
  type IParams = IProviderParams<IDashURLSource> & {
13
14
  sourceHls?: IHLSSource;
14
15
  };
@@ -23,6 +24,7 @@ export default abstract class BaseDashProvider implements IProvider {
23
24
  protected elementSize$: ValueSubject<IRectangle<number> | undefined>;
24
25
  protected textTracksManager: TextTrackManager | null;
25
26
  protected droppedFramesManager: DroppedFramesManager;
27
+ protected stallsManager: StallsManager;
26
28
  protected videoTracksMap: Map<IVideoTrack, {
27
29
  stream: Stream;
28
30
  representation: Representation;
@@ -1,3 +1,3 @@
1
1
  export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
- export declare const DASH_STALL_UPDATE_INTERVAL_MS = 1000;
2
+ export declare const DASH_STALL_UPDATE_INTERVAL_MS = 50;
3
3
  export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 5000;
@@ -48,9 +48,11 @@ export declare class Player {
48
48
  bufferLength$: IValueSubject<Milliseconds>;
49
49
  liveLoadBufferLength$: IValueSubject<Milliseconds>;
50
50
  livePositionFromPlayer$: IValueSubject<number>;
51
+ isLowLatency$: IValueSubject<boolean>;
51
52
  isActiveLowLatency$: IValueSubject<boolean>;
53
+ currentStallDuration$: IValueSubject<Milliseconds>;
54
+ videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
52
55
  private liveEstimatedDelay;
53
- private timeInWaiting;
54
56
  private isUpdatingLive;
55
57
  private isJumpGapAfterSeekLive;
56
58
  private liveLastSeekOffset;
@@ -1,8 +1,9 @@
1
1
  import { VideoFormat } from '../../../player/types';
2
- import { ITuningConfig } from '../../../utils/tuningConfig';
2
+ import { type ITuningConfig } from '../../../utils/tuningConfig';
3
3
  export declare const nativeHlsSupported: boolean;
4
4
  export declare const getSupportedCodecs: () => string[];
5
- export declare const filterAvailableFormats: (formats: VideoFormat[], useHlsJs?: boolean, useManagedMediaSource?: boolean) => VideoFormat[];
5
+ type FilterConstraints = Pick<ITuningConfig, 'useHlsJs' | 'useManagedMediaSource' | 'useOldMSEDetection'>;
6
+ export declare const filterAvailableFormats: (formats: VideoFormat[], { useHlsJs, useManagedMediaSource, useOldMSEDetection }: FilterConstraints) => VideoFormat[];
6
7
  type VodFormat = VideoFormat.MPEG | VideoFormat.DASH_SEP | VideoFormat.DASH_WEBM | VideoFormat.DASH_WEBM_AV1 | VideoFormat.DASH_STREAMS | VideoFormat.DASH_ONDEMAND | VideoFormat.HLS | VideoFormat.HLS_ONDEMAND;
7
8
  type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' | 'preferCMAF' | 'preferWebRTC' | 'preferMultiStream'>;
8
9
  /**
@@ -33,6 +33,7 @@ export interface IDesiredState {
33
33
  volume: IStateMachine<IVolumeState>;
34
34
  playbackRate: IStateMachine<PlaybackRate>;
35
35
  isLooped: IStateMachine<boolean>;
36
+ isLowLatency: IStateMachine<boolean>;
36
37
  videoStream: IStateMachine<IVideoStream | undefined>;
37
38
  videoTrack: IStateMachine<IVideoTrack | undefined>;
38
39
  audioStream: IStateMachine<IAudioStream | undefined>;
@@ -0,0 +1,34 @@
1
+ import { ExactVideoQuality, IObservable, IValueSubject, Milliseconds, Kbps } from '@vkontakte/videoplayer-shared';
2
+ import { IVideoTrack } from '../../player/types';
3
+ import { ITuningConfig } from '../../utils/tuningConfig';
4
+ interface IConnectData {
5
+ videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
6
+ throughput$: IValueSubject<number>;
7
+ rtt$: IValueSubject<Milliseconds>;
8
+ isBuffering$: IObservable<boolean>;
9
+ isSeeked$: IObservable<boolean>;
10
+ currentStallDuration$: IObservable<Milliseconds>;
11
+ qualityLimitsOnStall: ITuningConfig['dash']['qualityLimitsOnStall'];
12
+ }
13
+ declare class StallsManager {
14
+ private currentStallDuration$;
15
+ private videoLastDataObtainedTimestamp$;
16
+ private throughput$;
17
+ private rtt$;
18
+ private qualityLimitsOnStall;
19
+ private isSeeked$;
20
+ private isBuffering$;
21
+ private currentStallsCount;
22
+ private maxQualityLimit;
23
+ private lastUniqueVideoTrackSelected;
24
+ private lastUniqueVideoTrackSelectedTimestamp;
25
+ private predictedThroughputWithoutData;
26
+ private qualityRestrictionTimer;
27
+ private subscription;
28
+ connect(data: IConnectData): void;
29
+ get videoMaxQualityLimit(): ExactVideoQuality | undefined;
30
+ get predictedThroughput(): Kbps;
31
+ set lastVideoTrackSelected(lastUniqueVideoTrackSelected: IVideoTrack);
32
+ destroy(): void;
33
+ }
34
+ export default StallsManager;
@@ -3,7 +3,7 @@ import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits,
3
3
  import { IAudioTrack, IBaseTrack, IVideoTrack } from '../player/types';
4
4
  interface IConstraints<T extends IBaseTrack> {
5
5
  container?: IRectangle;
6
- throughput?: Kbps;
6
+ estimatedThroughput?: Kbps;
7
7
  tuning: ITuningConfig['autoTrackSelection'];
8
8
  limits?: QualityLimits;
9
9
  reserve?: Kbps;
@@ -13,6 +13,8 @@ interface IConstraints<T extends IBaseTrack> {
13
13
  visible?: boolean;
14
14
  history?: TrackHistory<T>;
15
15
  droppedVideoMaxQualityLimit?: ExactVideoQuality;
16
+ stallsVideoMaxQualityLimit?: ExactVideoQuality;
17
+ stallsPredictedThroughput?: Kbps;
16
18
  abrLogger: IComponentLogger;
17
19
  }
18
20
  export declare class TrackHistory<T extends IBaseTrack> {
@@ -24,6 +26,6 @@ export declare class TrackHistory<T extends IBaseTrack> {
24
26
  }
25
27
  export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
26
28
  export declare const getMinPossibleAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
27
- export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, throughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, abrLogger, }: IConstraints<IVideoTrack>) => IVideoTrack;
28
- export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { throughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
29
+ export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, abrLogger, }: IConstraints<IVideoTrack>) => IVideoTrack;
30
+ export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, stallsPredictedThroughput, }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
29
31
  export {};
@@ -31,7 +31,10 @@ export type ITuningConfig = {
31
31
  minAvailableThroughputAudioRatio: number;
32
32
  limitByContainer: boolean;
33
33
  usePixelRatio: boolean;
34
- pixelRatioMultiplier: number;
34
+ /** @deprecated */
35
+ pixelRatioMultiplier?: number;
36
+ pixelRatioLogBase: number;
37
+ pixelRatioLogCoefficients: number[];
35
38
  containerSizeFactor: number;
36
39
  lazyQualitySwitch: boolean;
37
40
  minBufferToSwitchUp: number;
@@ -68,8 +71,14 @@ export type ITuningConfig = {
68
71
  useFetchPriorityHints: boolean;
69
72
  accumulationBufferStallSize: {
70
73
  shortVideoDuration: Milliseconds;
71
- shortVideoBufferStallSizeMs: Milliseconds;
72
- longVideoBufferStallSizeMs: Milliseconds;
74
+ shortVideoBufferStallSize: Milliseconds;
75
+ longVideoBufferStallSize: Milliseconds;
76
+ };
77
+ qualityLimitsOnStall: {
78
+ stallDurationBeforeQualityDecrease: Milliseconds;
79
+ stallDurationNoDataBeforeQualityDecrease: Milliseconds;
80
+ stallCountBeforeQualityDecrease: Milliseconds;
81
+ resetQualityRestrictionTimeout: Milliseconds;
73
82
  };
74
83
  enableBaseUrlSupport: boolean;
75
84
  maxSegmentRetryCount: number;
@@ -84,7 +93,7 @@ export type ITuningConfig = {
84
93
  maxTargetOffset: Milliseconds;
85
94
  maxTargetOffsetDeviation: Milliseconds;
86
95
  playbackCatchupSpeedup: number;
87
- isActive: boolean;
96
+ isActiveOnDefault: boolean;
88
97
  delayEstimator: {
89
98
  emaAlpha: number;
90
99
  changeThreshold: number;
@@ -180,6 +189,7 @@ export type ITuningConfig = {
180
189
  useVolumeMultiplier: boolean;
181
190
  ignoreAudioRendererError: boolean;
182
191
  useEnableSubtitlesParam: boolean;
192
+ useOldMSEDetection: boolean;
183
193
  };
184
194
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
185
195
  configName: ITuningConfig['configName'];