@vkontakte/videoplayer-core 2.0.150-dev.746fd284.0 → 2.0.150-dev.c3ccf026.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.150-dev.746fd284.0",
3
+ "version": "2.0.150-dev.c3ccf026.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.746fd284.0"
57
+ "@vkontakte/videoplayer-shared": "1.0.79-dev.c3ccf026.0"
58
58
  }
59
59
  }
@@ -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,4 +1,4 @@
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';
@@ -45,14 +45,24 @@ export declare class Fetcher {
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
  recoverableError$: ISubject<IError>;
49
51
  error$: ISubject<IError>;
50
52
  private abortAllController;
51
53
  private readonly subscription;
52
54
  private compatibilityMode;
53
55
  private useEnableSubtitlesParam;
56
+ private performanceObserver;
57
+ private pendingConnectionMetrics;
54
58
  constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
55
59
  private onHeadersReceived;
60
+ private setupPerformanceObserver;
61
+ private processPerformanceResourceTiming;
62
+ private estimateNetworkType;
63
+ private extractConnectionMetrics;
64
+ private findMatchingRequest;
65
+ private trackRequestStart;
56
66
  fetchManifest: (param_0: string) => Promise<string | null | undefined>;
57
67
  fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
58
68
  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,4 +1,4 @@
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';
@@ -44,14 +44,24 @@ export declare class Fetcher {
44
44
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
45
45
  lastConnectionReused$: IValueSubject<boolean | undefined>;
46
46
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
47
+ lastConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
48
+ lastDownloadMetrics$: IValueSubject<HttpDownloadMetrics | undefined>;
47
49
  recoverableError$: ISubject<IError>;
48
50
  error$: ISubject<IError>;
49
51
  private abortAllController;
50
52
  private subscription;
51
53
  private compatibilityMode;
52
54
  private useEnableSubtitlesParam;
55
+ private performanceObserver;
56
+ private pendingMetrics;
53
57
  constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
54
58
  private onHeadersReceived;
59
+ private setupPerformanceObserver;
60
+ private processResourceTiming;
61
+ private estimateNetworkType;
62
+ private extractConnectionMetrics;
63
+ private findMatchingRequest;
64
+ private trackRequestStart;
55
65
  fetchManifest: (param_0: string) => Promise<string | null | undefined>;
56
66
  fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
57
67
  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>;
@@ -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;
@@ -269,7 +270,5 @@ export type ITuningConfig = {
269
270
  logDashLiveDebug?: boolean;
270
271
  useInvalidBufferFix?: boolean;
271
272
  };
272
- export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
273
- configName: ITuningConfig['configName'];
274
- };
273
+ export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
275
274
  export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;