@vkontakte/videoplayer-core 2.0.150-dev.f4d0e2c9.0 → 2.0.151-dev.ea826f67.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.f4d0e2c9.0",
3
+ "version": "2.0.151-dev.ea826f67.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.f4d0e2c9.0"
57
+ "@vkontakte/videoplayer-shared": "1.0.80-dev.ea826f67.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>;
@@ -417,6 +417,14 @@ export interface IPlayerInfo {
417
417
  * Было ли переиспользовано последнее HTTP соединение
418
418
  */
419
419
  httpConnectionReused$: IValueObservable<boolean | undefined>;
420
+ /**
421
+ * Дополнительные данные-метрики по HTTP соединению
422
+ */
423
+ httpConnectionMetrics$: IValueSubject<HttpConnectionMetrics | undefined>;
424
+ /**
425
+ * Данные по загрузке по сети
426
+ */
427
+ httpDownloadMetrics$: IValueObservable<HttpDownloadMetrics | undefined>;
420
428
  /**
421
429
  * Состояние подключения Chromecast
422
430
  */
@@ -618,6 +626,19 @@ export declare enum HttpConnectionType {
618
626
  HTTP2 = "http2",
619
627
  QUIC = "quic"
620
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
+ }
621
642
  export declare enum SeekOperationState {
622
643
  None = "none",
623
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;
@@ -124,6 +124,7 @@ export type ITuningConfig = {
124
124
  ignoreNetworkErrorsOnLoadInit: boolean;
125
125
  bufferTolerance: Milliseconds;
126
126
  actionTimeShiftFromSegment: Milliseconds;
127
+ videoStreamRepresentaionsFilter: [VideoQuality, number][];
127
128
  };
128
129
  dashCmafLive: {
129
130
  externalStopControl: boolean;