@vkontakte/videoplayer-core 2.0.150-dev.4e3741f9.0 → 2.0.150-dev.59e8de7f.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 (34) hide show
  1. package/es2015.cjs +52 -52
  2. package/es2015.esm.js +48 -48
  3. package/es2018.cjs +41 -41
  4. package/es2018.esm.js +44 -44
  5. package/es2024.cjs +58 -58
  6. package/es2024.esm.js +58 -58
  7. package/esnext.cjs +58 -58
  8. package/esnext.esm.js +58 -58
  9. package/evergreen.esm.js +46 -46
  10. package/package.json +2 -2
  11. package/types/index.d.ts +1 -0
  12. package/types/player/Player.d.ts +3 -2
  13. package/types/player/types.d.ts +21 -1
  14. package/types/providers/DashProvider/lib/fetcher.d.ts +20 -1
  15. package/types/providers/DashProvider/lib/player.d.ts +3 -1
  16. package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +20 -1
  17. package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +3 -1
  18. package/types/providers/types.d.ts +3 -1
  19. package/types/providers/utils/videoStreamRepresentaionsFilter.d.ts +4 -0
  20. package/types/utils/tuningConfig.d.ts +4 -5
  21. package/types/providers/DashProviderNew/baseDashProvider.d.ts +0 -61
  22. package/types/providers/DashProviderNew/consts.d.ts +0 -3
  23. package/types/providers/DashProviderNew/index.d.ts +0 -2
  24. package/types/providers/DashProviderNew/lib/ElementSizeManager.d.ts +0 -19
  25. package/types/providers/DashProviderNew/lib/LiveTextManager.d.ts +0 -23
  26. package/types/providers/DashProviderNew/lib/buffer.d.ts +0 -130
  27. package/types/providers/DashProviderNew/lib/fetcher.d.ts +0 -64
  28. package/types/providers/DashProviderNew/lib/player.d.ts +0 -107
  29. package/types/providers/DashProviderNew/lib/sourceBufferBufferedDiff.d.ts +0 -19
  30. package/types/providers/DashProviderNew/lib/sourceBufferTaskQueue.d.ts +0 -20
  31. package/types/providers/DashProviderNew/lib/types.d.ts +0 -29
  32. package/types/providers/DashProviderNew/lib/utils.d.ts +0 -24
  33. package/types/providers/DashProviderNew/newDashCmafLiveProvider.d.ts +0 -8
  34. package/types/providers/DashProviderNew/newDashProvider.d.ts +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.150-dev.4e3741f9.0",
3
+ "version": "2.0.150-dev.59e8de7f.0",
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.79-dev.4e3741f9.0"
57
+ "@vkontakte/videoplayer-shared": "1.0.79-dev.59e8de7f.0"
58
58
  }
59
59
  }
package/types/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources,
5
5
  import type { IOptionalTuningConfig } from './utils/tuningConfig';
6
6
  export { clientChecker, isMobile } from './utils/ClientChecker';
7
7
  export { areValidLiveRecordSources } from './utils/videoFormat';
8
+ export { WebmCodecStrategy } from './enums/WebmCodecStrategy';
8
9
  import type { ISubscription, IUnsubscriber, IEmitter, IObservable, IValueObservable, IValue, IOperator, IListener, ILogEntry, IRange, ExactVideoQuality } from '@vkontakte/videoplayer-shared';
9
10
  import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@vkontakte/videoplayer-shared';
10
11
  /**
@@ -1,6 +1,6 @@
1
1
  import { IOptionalTuningConfig } from '../utils/tuningConfig';
2
2
  import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality, ITracer } from '@vkontakte/videoplayer-shared';
3
- import { ChromecastState, HttpConnectionType, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
3
+ import { ChromecastState, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
4
4
  import { IPlayerOptions } from '../utils/playerOptions';
5
5
  export default class Player implements IPlayer {
6
6
  private subscription;
@@ -67,6 +67,8 @@ export default class Player implements IPlayer {
67
67
  hostname$: ValueSubject<string | undefined>;
68
68
  httpConnectionType$: ValueSubject<HttpConnectionType | undefined>;
69
69
  httpConnectionReused$: ValueSubject<boolean | undefined>;
70
+ httpConnectionMetrics$: ValueSubject<HttpConnectionMetrics | undefined>;
71
+ httpDownloadMetrics$: ValueSubject<HttpDownloadMetrics | undefined>;
70
72
  surface$: ValueSubject<Surface>;
71
73
  chromecastState$: ValueSubject<ChromecastState>;
72
74
  chromecastDeviceName$: ValueSubject<string | undefined>;
@@ -117,7 +119,6 @@ export default class Player implements IPlayer {
117
119
  };
118
120
  experimental: {
119
121
  element$: ValueSubject<HTMLVideoElement | undefined>;
120
- tuningConfigName$: ValueSubject<string[]>;
121
122
  enableDebugTelemetry$: ValueSubject<boolean>;
122
123
  dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
123
124
  getCurrentTime$: ValueSubject<null>;
@@ -77,7 +77,6 @@ export interface IPlayer {
77
77
  * Может быть видеоэлементом, iframe и вообще чем угодно в общем случае.
78
78
  */
79
79
  element$: IValueObservable<HTMLVideoElement | undefined>;
80
- tuningConfigName$: IValueSubject<string[]>;
81
80
  enableDebugTelemetry$: IValueSubject<boolean>;
82
81
  dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
83
82
  /** функция вычисления текущей позиции проигрывания из под провадера (если расчет нестандартный) */
@@ -418,6 +417,14 @@ export interface IPlayerInfo {
418
417
  * Было ли переиспользовано последнее HTTP соединение
419
418
  */
420
419
  httpConnectionReused$: IValueObservable<boolean | undefined>;
420
+ /**
421
+ * Дополнительные данные-метрики по HTTP соединению
422
+ */
423
+ httpConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
424
+ /**
425
+ * Данные по загрузке по сети
426
+ */
427
+ httpDownloadMetrics$: IValueObservable<HttpDownloadMetrics | undefined>;
421
428
  /**
422
429
  * Состояние подключения Chromecast
423
430
  */
@@ -619,6 +626,19 @@ export declare enum HttpConnectionType {
619
626
  HTTP2 = "http2",
620
627
  QUIC = "quic"
621
628
  }
629
+ export interface HttpConnectionMetrics {
630
+ dnsResolveTime: number;
631
+ tcpHandshakeTime: number;
632
+ tlsHandshakeTime: number;
633
+ totalConnectTime: number;
634
+ url: string;
635
+ networkType: string;
636
+ }
637
+ export interface HttpDownloadMetrics {
638
+ bytes: number;
639
+ speed: number;
640
+ url: string;
641
+ }
622
642
  export declare enum SeekOperationState {
623
643
  None = "none",
624
644
  Requested = "requested",
@@ -1,7 +1,16 @@
1
- import { HttpConnectionType } from '../../../player/types';
1
+ import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from '../../../player/types';
2
2
  import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
3
3
  import { Byte, IValueSubject, ISubject, Milliseconds, IRange, ITracer, IError } from '@vkontakte/videoplayer-shared';
4
4
  import { CommonInit, GenericContainerParser, Segment, SegmentReference } from '../../../providers/utils/parsers/types';
5
+ declare global {
6
+ interface Navigator {
7
+ connection: {
8
+ effectiveType: string;
9
+ downlink: number;
10
+ rtt: number;
11
+ };
12
+ }
13
+ }
5
14
  export declare enum RangeMethod {
6
15
  HEADER = 0,
7
16
  PARAM = 1
@@ -45,14 +54,24 @@ export declare class Fetcher {
45
54
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
46
55
  lastConnectionReused$: IValueSubject<boolean | undefined>;
47
56
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
57
+ lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
58
+ lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
48
59
  recoverableError$: ISubject<IError>;
49
60
  error$: ISubject<IError>;
50
61
  private abortAllController;
51
62
  private readonly subscription;
52
63
  private compatibilityMode;
53
64
  private useEnableSubtitlesParam;
65
+ private performanceObserver;
66
+ private pendingConnectionMetrics;
54
67
  constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
55
68
  private onHeadersReceived;
69
+ private setupPerformanceObserver;
70
+ private processPerformanceResourceTiming;
71
+ private estimateNetworkType;
72
+ private extractConnectionMetrics;
73
+ private findMatchingRequest;
74
+ private trackRequestStart;
56
75
  fetchManifest: (param_0: string) => Promise<string | null | undefined>;
57
76
  fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
58
77
  fetchRepresentation(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, fetchParams: FetchParams): Promise<RepresentationFetchResult | null>;
@@ -1,4 +1,4 @@
1
- import { HttpConnectionType, VideoCodec } from '../../../player/types';
1
+ import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from '../../../player/types';
2
2
  import { LiveStreamStatus } from './types';
3
3
  import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from '../../../providers/utils/parsers/types';
4
4
  import StateMachine from '../../../utils/StateMachine/StateMachine';
@@ -50,6 +50,8 @@ export declare class Player {
50
50
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
51
51
  lastConnectionReused$: IValueSubject<boolean | undefined>;
52
52
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
53
+ lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
54
+ lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
53
55
  currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
54
56
  private timeoutSourceOpenId;
55
57
  isLive$: IValueSubject<boolean>;
@@ -1,7 +1,16 @@
1
- import { HttpConnectionType } from '../../../player/types';
1
+ import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics } from '../../../player/types';
2
2
  import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
3
3
  import { Byte, IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
4
4
  import { CommonInit, GenericContainerParser, Segment, SegmentReference } from '../../../providers/utils/parsers/types';
5
+ declare global {
6
+ interface Navigator {
7
+ connection: {
8
+ effectiveType: string;
9
+ downlink: number;
10
+ rtt: number;
11
+ };
12
+ }
13
+ }
5
14
  export declare enum RangeMethod {
6
15
  HEADER = 0,
7
16
  PARAM = 1
@@ -44,14 +53,24 @@ export declare class Fetcher {
44
53
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
45
54
  lastConnectionReused$: IValueSubject<boolean | undefined>;
46
55
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
56
+ lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
57
+ lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
47
58
  recoverableError$: ISubject<IError>;
48
59
  error$: ISubject<IError>;
49
60
  private abortAllController;
50
61
  private subscription;
51
62
  private compatibilityMode;
52
63
  private useEnableSubtitlesParam;
64
+ private performanceObserver;
65
+ private pendingConnectionMetrics;
53
66
  constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
54
67
  private onHeadersReceived;
68
+ private setupPerformanceObserver;
69
+ private processResourceTiming;
70
+ private estimateNetworkType;
71
+ private extractConnectionMetrics;
72
+ private findMatchingRequest;
73
+ private trackRequestStart;
55
74
  fetchManifest: (param_0: string) => Promise<string | null | undefined>;
56
75
  fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
57
76
  fetchRepresentation<T extends Segment>(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, priority?: Priority): Promise<RepresentationFetchResult<T> | null | undefined>;
@@ -1,4 +1,4 @@
1
- import { IHLSSource, HttpConnectionType, VideoCodec } from '../../../../player/types';
1
+ import { IHLSSource, HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec } from '../../../../player/types';
2
2
  import { LiveStreamStatus } from '../types';
3
3
  import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from '../../../../providers/utils/parsers/types';
4
4
  import StateMachine from '../../../../utils/StateMachine/StateMachine';
@@ -45,6 +45,8 @@ export declare abstract class BasePlayer {
45
45
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
46
46
  lastConnectionReused$: IValueSubject<boolean | undefined>;
47
47
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
48
+ lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
49
+ lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
48
50
  currentLiveTextRepresentation$: IValueSubject<TextRepresentation | null>;
49
51
  private timeoutSourceOpenId;
50
52
  isLive$: IValueSubject<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { ITuningConfig } from '../utils/tuningConfig';
2
2
  import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger, ITracer, IRectangle } from '@vkontakte/videoplayer-shared';
3
3
  import { IChromecastInitializer } from '../providers/ChromecastProvider/ChromecastInitializer/types';
4
- import { HttpConnectionType, VideoCodec, AudioCodec, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
4
+ import { HttpConnectionType, HttpConnectionMetrics, HttpDownloadMetrics, VideoCodec, AudioCodec, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
5
5
  import { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackState, PlaybackRate } from '../player/types';
6
6
  import { IStateMachine } from '../utils/StateMachine/types';
7
7
  import ThroughputEstimator from '../utils/ThroughputEstimator';
@@ -80,6 +80,8 @@ export interface IProviderOutput {
80
80
  hostname$: IValueSubject<string | undefined>;
81
81
  httpConnectionType$: IValueSubject<HttpConnectionType | undefined>;
82
82
  httpConnectionReused$: IValueSubject<boolean | undefined>;
83
+ httpConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
84
+ httpDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
83
85
  element$: IValueSubject<HTMLVideoElement | undefined>;
84
86
  elementVisible$: IValueSubject<boolean>;
85
87
  availableSources$: IValueSubject<ISources | undefined>;
@@ -0,0 +1,4 @@
1
+ import { ITuningConfig } from '../../utils/tuningConfig';
2
+ import { Manifest } from './parsers/types';
3
+ /** @mutates streams.video */
4
+ export declare const applyVideoStreamRepresentaionsFilter: (streams: Manifest["streams"], videoStreamRepresentaionsFilter: ITuningConfig["dash"]["videoStreamRepresentaionsFilter"]) => void;
@@ -4,7 +4,8 @@ import { AndroidPreferredFormat } from '../enums/AndroidPreferredFormat';
4
4
  import { IOSPreferredFormat } from '../enums/IOSPreferredFormat';
5
5
  import { Byte, type ExactVideoQuality, Milliseconds, RecursivePartial, Seconds, VideoQuality } from '@vkontakte/videoplayer-shared';
6
6
  export type ITuningConfig = {
7
- configName: string[];
7
+ /** @deprecated */
8
+ configName?: string[];
8
9
  throughputEstimator: {
9
10
  type: 'TwoEma' | 'EmaAndMa';
10
11
  emaAlphaSlow: number;
@@ -123,6 +124,7 @@ export type ITuningConfig = {
123
124
  ignoreNetworkErrorsOnLoadInit: boolean;
124
125
  bufferTolerance: Milliseconds;
125
126
  actionTimeShiftFromSegment: Milliseconds;
127
+ videoStreamRepresentaionsFilter: [VideoQuality, number][];
126
128
  };
127
129
  dashCmafLive: {
128
130
  externalStopControl: boolean;
@@ -202,7 +204,6 @@ export type ITuningConfig = {
202
204
  useHlsJs: boolean;
203
205
  useNativeHLSTextTracks: boolean;
204
206
  useNewSwitchTo: boolean;
205
- useNewDashProvider: boolean;
206
207
  useDashProviderVirtual: boolean;
207
208
  useDashProviderVirtualMobile: boolean;
208
209
  useNewAutoSelectVideoTrack: boolean;
@@ -270,7 +271,5 @@ export type ITuningConfig = {
270
271
  logDashLiveDebug?: boolean;
271
272
  useInvalidBufferFix?: boolean;
272
273
  };
273
- export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
274
- configName: ITuningConfig['configName'];
275
- };
274
+ export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
276
275
  export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
@@ -1,61 +0,0 @@
1
- import { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack, VideoCodec } from '../../player/types';
2
- import { IProviderSubscriptionInfo, ProviderState } from './lib/types';
3
- import { CommonInit, Representation, Stream } from '../../providers/utils/parsers/types';
4
- import { IProvider, IProviderParams } from '../../providers/types';
5
- import { IObservableVideo } from '../../providers/utils/HTMLVideoElement/observable';
6
- import { TrackHistory } from '../../utils/autoSelectTrack';
7
- import { IStateMachine } from '../../utils/StateMachine/types';
8
- import { ISubscription, ITracer, Milliseconds } from '@vkontakte/videoplayer-shared';
9
- import { Player } from './lib/player';
10
- import { Scene3D } from '../../utils/3d/Scene3D';
11
- import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
12
- import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
13
- import StallsManager from '../../providers/utils/StallsManager';
14
- import { ElementSizeManager } from './lib/ElementSizeManager';
15
- type IParams = IProviderParams<IDashURLSource> & {
16
- sourceHls?: IHLSSource;
17
- forceVideoCodec?: VideoCodec;
18
- };
19
- export default abstract class BaseDashProvider implements IProvider {
20
- scene3D: Scene3D | undefined;
21
- protected subscription: ISubscription;
22
- protected videoState: IStateMachine<ProviderState>;
23
- protected video: HTMLVideoElement;
24
- protected observableVideo: IObservableVideo | null;
25
- protected player: Player;
26
- protected params: IParams;
27
- protected tracer: ITracer;
28
- protected textTracksManager: TextTrackManager;
29
- protected droppedFramesManager: DroppedFramesManager;
30
- protected stallsManager: StallsManager;
31
- protected elementSizeManager: ElementSizeManager;
32
- protected videoTracksMap: Map<IVideoTrack, {
33
- stream: Stream;
34
- representation: Representation;
35
- }>;
36
- protected audioTracksMap: Map<IAudioTrack, {
37
- stream: Stream;
38
- representation: Representation;
39
- }>;
40
- protected textTracksMap: Map<IInternalTextTrack, {
41
- stream: Stream;
42
- representation: Representation;
43
- }>;
44
- protected videoStreamsMap: Map<Stream, IVideoTrack[]>;
45
- protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
46
- protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
47
- protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
48
- private readonly selectedRepresentations;
49
- constructor(params: IParams);
50
- protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
51
- protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
52
- protected subscribe(): void;
53
- protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
54
- protected prepare(manifestOffset?: number): void;
55
- protected syncPlayback: () => undefined;
56
- protected init3DScene: (init: CommonInit) => void;
57
- protected destroy3DScene: () => void;
58
- protected playIfAllowed(): void;
59
- destroy(): void;
60
- }
61
- export {};
@@ -1,3 +0,0 @@
1
- export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
- export declare const DASH_STALL_UPDATE_INTERVAL_MS = 50;
3
- export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 2000;
@@ -1,2 +0,0 @@
1
- export { default as NewDashProvider } from './newDashProvider';
2
- export { default as NewDashCmafLiveProvider } from './newDashCmafLiveProvider';
@@ -1,19 +0,0 @@
1
- import { IObservableVideo } from '../../../providers/utils/HTMLVideoElement/observable';
2
- import { IListener, IRectangle, ISubscription, ValueSubject } from '@vkontakte/videoplayer-shared';
3
- interface ConnectParams {
4
- video: HTMLVideoElement;
5
- observableVideo: IObservableVideo;
6
- }
7
- export declare class ElementSizeManager {
8
- private readonly subscription;
9
- private readonly pipSize$;
10
- private readonly videoSize$;
11
- private readonly elementSize$;
12
- private pictureInPictureWindowRemoveEventListener;
13
- connect({ observableVideo, video }: ConnectParams): void;
14
- getValue(): IRectangle<number> | undefined;
15
- subscribe(listener: IListener<IRectangle<number> | undefined>, error?: IListener<Error | unknown>): ISubscription;
16
- getObservable(): ValueSubject<IRectangle<number> | undefined>;
17
- destroy(): void;
18
- }
19
- export {};
@@ -1,23 +0,0 @@
1
- import { IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
2
- import { Dependencies } from './buffer';
3
- import { Manifest, Stream, TextRepresentation } from '../../../providers/utils/parsers/types';
4
- export declare class LiveTextManager {
5
- currentRepresentation$: IValueSubject<TextRepresentation | null>;
6
- private readonly maxRepresentations;
7
- private representationsCursor;
8
- private representations;
9
- private readonly getCurrentPosition;
10
- private currentSegment;
11
- constructor(streams: Stream[], deps: Pick<Dependencies, 'getCurrentPosition'>);
12
- updateLive(manifest: Manifest | null): void;
13
- seekLive(streams?: Stream[]): void;
14
- maintain(currentPosition?: Milliseconds | undefined): void;
15
- destroy(): void;
16
- /**
17
- * @todo support multi-streams
18
- * @see https://jira.mvk.com/browse/VP-2420
19
- */
20
- private processStreams;
21
- static isSupported(streams?: Stream[]): boolean;
22
- private static filterRepresentations;
23
- }
@@ -1,130 +0,0 @@
1
- import { ITuningConfig } from '../../../utils/tuningConfig';
2
- import { IError, IRange, ISubject, IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
3
- import type { Fetcher } from './fetcher';
4
- import { CommonInit, Manifest, Representation, Stream, StreamKind } from '../../../providers/utils/parsers/types';
5
- export interface Dependencies {
6
- fetcher: Fetcher;
7
- tuning: ITuningConfig;
8
- getCurrentPosition: () => Milliseconds | undefined;
9
- isActiveLowLatency: () => boolean;
10
- compatibilityMode?: boolean;
11
- manifest: Manifest | null;
12
- }
13
- export interface Gap extends IRange<Milliseconds> {
14
- representation: Representation['id'];
15
- /**
16
- * дырки, которые не нужно удалять при парсинге буфера (те `detectGapsWhenIdle`).
17
- * те, например, которые были обнаружены при парсинге сегментов из манифеста.
18
- *
19
- * в функции `detectGapsWhenIdle` мы сравниваем ранее найденные дырки с данными буфера,
20
- * проблема в том, что не смотря на то, что буфер может показать, что как будто дырки нет,
21
- * по факту, найденная в манифесте дырка, скорее всего, никуда не делась и это приведет к зависанию видео.
22
- */
23
- persistent: boolean;
24
- }
25
- export declare class BufferManager {
26
- currentLiveSegmentServerLatency$: IValueSubject<number>;
27
- currentLowLatencySegmentLength$: IValueSubject<number>;
28
- currentSegmentLength$: IValueSubject<number>;
29
- onLastSegment$: IValueSubject<boolean>;
30
- fullyBuffered$: IValueSubject<boolean>;
31
- playingRepresentation$: IValueSubject<Representation['id'] | undefined>;
32
- playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
33
- error$: ISubject<IError>;
34
- gaps: Gap[];
35
- private subscription;
36
- private kind;
37
- private initData;
38
- private parsedInitData;
39
- private representations;
40
- private segments;
41
- private allInitsLoaded;
42
- private activeSegments;
43
- private mediaSource;
44
- private playingRepresentationId;
45
- private downloadingRepresentationId;
46
- private switchingToRepresentationId;
47
- private sourceBuffer;
48
- private downloadAbortController;
49
- private switchAbortController;
50
- private destroyAbortController;
51
- private useSmartRepresentationSwitch;
52
- private readonly getCurrentPosition;
53
- private readonly isActiveLowLatency;
54
- private tuning;
55
- private forwardBufferTarget;
56
- private fetcher;
57
- private bufferLimit;
58
- private sourceBufferTaskQueue;
59
- private gapDetectionIdleCallback;
60
- private initLoadIdleCallback;
61
- private failedDownloads;
62
- private baseUrls;
63
- private baseUrlsIndex;
64
- private compatibilityMode;
65
- private preloadOnly;
66
- private isLive;
67
- private liveUpdateSegmentIndex;
68
- private liveInitialAdditionalOffset;
69
- private isSeekingLive;
70
- private index;
71
- private lastDataObtainedTimestampMs;
72
- private loadByteRangeSegmentsTimeoutId;
73
- private sourceBufferBufferedDiff;
74
- constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
75
- startWith: (param_0: string) => Promise<void | undefined>;
76
- switchToWithPreviousAbort(newRepresentationId: Representation['id'], dropBuffer?: boolean): void;
77
- switchTo: (param_0: string, param_1: boolean | undefined) => Promise<void | undefined>;
78
- switchToOld: (param_0: string, param_1: boolean | undefined) => Promise<void | undefined>;
79
- warmUpMediaSource(): void;
80
- abort(): Promise<boolean>;
81
- maintain(currentPosition?: Milliseconds | undefined): void;
82
- get lastDataObtainedTimestamp(): number;
83
- private searchGaps;
84
- private getActualLiveStartingSegments;
85
- getLiveSegmentsToLoadState(manifest: Manifest | null): IRange<Milliseconds> | undefined;
86
- seekLive: (param_0: Stream[]) => Promise<void | undefined>;
87
- updateLive(manifest: Manifest | null): void;
88
- proceedLowLatencyLive(): void;
89
- setSmartRepresentationSwitch(state: boolean): void;
90
- private updateLowLatencyLiveIfNeeded;
91
- findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
92
- setTarget(time: Milliseconds): void;
93
- setPreloadOnly(preloadOnly: boolean): void;
94
- destroy(): void;
95
- private selectForwardBufferSegments;
96
- private selectForwardBufferSegmentsLive;
97
- private selectForwardBufferSegmentsRecord;
98
- private loadSegments;
99
- private loadTemplateSegment;
100
- private updateRepresentationsBaseUrlIfNeeded;
101
- private loadByteRangeSegments;
102
- private prepareByteRangeFetchSegmentParams;
103
- private prepareTemplateFetchSegmentParams;
104
- private abortActiveSegments;
105
- private onSomeTemplateDataLoaded;
106
- /**
107
- * Закидываем в буфер сегменты атомарнее чем сегмент целиком. Например, по боксам в мпеге и по блокам в вебме.
108
- * Таким образом не ждём его полной загрузки и готовы играть его намного быстрее
109
- * @param dataView – данные, размер буфера – весь запрос
110
- * @param globalFrom – Отступ dataView от начала файла, совпадает с отсупами сегментов
111
- * @param loaded – Объём загруженных в dataView данных (всё что больше – пока нули)
112
- * @private
113
- */
114
- private onSomeByteRangesDataLoaded;
115
- private onSegmentFullyAppended;
116
- private abortSegment;
117
- private loadNextInit;
118
- private loadInit;
119
- private dropBuffer;
120
- private pruneBuffer;
121
- private abortBuffer;
122
- getDebugBufferState(): IRange<Milliseconds> | undefined;
123
- getBufferedTo(): number | null;
124
- getForwardBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
125
- private detectGaps;
126
- private detectGapsWhenIdle;
127
- private checkEjectedSegments;
128
- private handleAsyncError;
129
- calculateDurationFromSegments(): number;
130
- }
@@ -1,64 +0,0 @@
1
- import { HttpConnectionType } from '../../../player/types';
2
- import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
3
- import { Byte, IValueSubject, ISubject, Milliseconds, IRange, ITracer, IError } from '@vkontakte/videoplayer-shared';
4
- import { CommonInit, GenericContainerParser, Segment, SegmentReference } from '../../../providers/utils/parsers/types';
5
- export declare enum RangeMethod {
6
- HEADER = 0,
7
- PARAM = 1
8
- }
9
- export interface IParams {
10
- throughputEstimator?: ThroughputEstimator;
11
- requestQuic: boolean;
12
- compatibilityMode?: boolean;
13
- tracer: ITracer;
14
- useEnableSubtitlesParam?: boolean;
15
- }
16
- export type Priority = 'high' | 'low' | 'auto';
17
- export interface FetchParamsWithUrl extends FetchParams {
18
- url: string;
19
- }
20
- export interface FetchParams {
21
- range?: IRange<Byte>;
22
- rangeMethod?: RangeMethod;
23
- onProgress?: (dataView: DataView, loaded: number) => void;
24
- onProgressTasks?: Promise<void>[];
25
- signal?: AbortSignal;
26
- priority?: Priority;
27
- measureThroughput?: boolean;
28
- isLowLatency?: boolean;
29
- bufferOptimisation?: boolean;
30
- }
31
- export type RepresentationFetchResult = {
32
- init: CommonInit | null;
33
- segments: Segment[];
34
- dataView: DataView;
35
- };
36
- export declare class Fetcher {
37
- private throughputEstimator;
38
- private requestQuic;
39
- private tracer;
40
- manifestRequested$: ISubject<void>;
41
- firstBytesManifest$: ISubject<void>;
42
- firstBytesRequested$: ISubject<void>;
43
- firstBytesReceived$: ISubject<void>;
44
- lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
45
- lastConnectionReused$: IValueSubject<boolean | undefined>;
46
- lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
47
- recoverableError$: ISubject<IError>;
48
- error$: ISubject<IError>;
49
- private abortAllController;
50
- private compatibilityMode;
51
- private useEnableSubtitlesParam;
52
- private readonly subscription;
53
- constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
54
- private onHeadersReceived;
55
- fetchManifest: (param_0: string) => Promise<string | null | undefined>;
56
- fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
57
- fetchRepresentation(segmentReference: SegmentReference, parser: GenericContainerParser<unknown>, priority?: Priority): Promise<RepresentationFetchResult | null>;
58
- destroy(): void;
59
- private fetchByteRangeRepresentation;
60
- private fetchTemplateRepresentation;
61
- private doFetch;
62
- private unsubscribeAbortSubscription;
63
- }
64
- export declare const suppressAbort: (e: Error | unknown) => void | never;