@vkontakte/videoplayer-core 2.0.129-dev.5e5f68f7.0 → 2.0.129-dev.86319bf0.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.129-dev.5e5f68f7.0",
3
+ "version": "2.0.129-dev.86319bf0.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.57-dev.71da56af.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.57-dev.d189c01d.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
@@ -1,11 +1,14 @@
1
1
  import { IOptionalTuningConfig } from '../utils/tuningConfig';
2
- import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality } from '@vkontakte/videoplayer-shared';
2
+ import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality, ITracer } from '@vkontakte/videoplayer-shared';
3
3
  import { ChromecastState, HttpConnectionType, IAudioStream, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, PredefinedQualityLimits, StartEnd, Surface, VideoFormat } from './types';
4
4
  export default class Player implements IPlayer {
5
5
  private subscription;
6
6
  private domContainer;
7
7
  private providerContainer?;
8
8
  private chromecastInitializer;
9
+ private logger;
10
+ private tracer;
11
+ private abrLogger;
9
12
  private config;
10
13
  private tuning;
11
14
  private throughputEstimator;
@@ -106,9 +109,10 @@ export default class Player implements IPlayer {
106
109
  element$: ValueSubject<HTMLVideoElement | undefined>;
107
110
  tuningConfigName$: ValueSubject<string[]>;
108
111
  enableDebugTelemetry$: ValueSubject<boolean>;
112
+ dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
109
113
  getCurrentTime$: ValueSubject<null>;
110
114
  };
111
- constructor(tuning?: IOptionalTuningConfig);
115
+ constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
112
116
  initVideo(config: IConfig): IPlayer;
113
117
  destroy(): void;
114
118
  prepare(): IPlayer;
@@ -175,6 +179,7 @@ export default class Player implements IPlayer {
175
179
  */
176
180
  releaseCamera(): this;
177
181
  getExactTime(): Seconds;
182
+ getAllLogs(): ILogEntry[];
178
183
  private getScene3D;
179
184
  private setIntrinsicVideoSize;
180
185
  private initDesiredStateSubscriptions;
@@ -182,7 +187,9 @@ export default class Player implements IPlayer {
182
187
  private initChromecastSubscription;
183
188
  private initStartingVideoTrack;
184
189
  private setStartingVideoTrack;
190
+ private initLogs;
185
191
  private initDebugTelemetry;
192
+ private initTracerSubscription;
186
193
  private initWakeLock;
187
194
  private setVideoTrackIdByQuality;
188
195
  private getActiveLiveDelay;
@@ -62,6 +62,10 @@ export interface IPlayer {
62
62
  * Может быть точнее, чем `info.position$` в промежутках между timeupdate
63
63
  */
64
64
  getExactTime(): number;
65
+ /**
66
+ * Возвращает все логи с момента инициализации плеера
67
+ */
68
+ getAllLogs(): ILogEntry[];
65
69
  experimental: {
66
70
  /**
67
71
  * Элемент, который сейчас вставлен в container.
@@ -70,6 +74,7 @@ export interface IPlayer {
70
74
  element$: IValueObservable<HTMLVideoElement | undefined>;
71
75
  tuningConfigName$: IValueSubject<string[]>;
72
76
  enableDebugTelemetry$: IValueSubject<boolean>;
77
+ dumpTelemetry: (receiver: (value: Record<string, any>) => void) => void;
73
78
  /** функция вычисления текущей позиции проигрывания из под провадера (если расчет нестандартный) */
74
79
  getCurrentTime$: IValueSubject<(() => number) | null>;
75
80
  };
@@ -1,9 +1,12 @@
1
- import { ISubject, IValueSubject, IError } from '@vkontakte/videoplayer-shared';
1
+ import { ISubject, IValueSubject, ILogger, IError } from '@vkontakte/videoplayer-shared';
2
2
  import { ChromecastState } from '../../../player/types';
3
3
  import { IChromecastConnection, IChromecastInitializer } from './types';
4
4
  interface IParams {
5
5
  receiverApplicationId?: string;
6
6
  isDisabled?: boolean;
7
+ dependencies: {
8
+ logger: ILogger;
9
+ };
7
10
  }
8
11
  export declare class ChromecastInitializer implements IChromecastInitializer {
9
12
  readonly connection$: IValueSubject<IChromecastConnection | undefined>;
@@ -12,6 +15,7 @@ export declare class ChromecastInitializer implements IChromecastInitializer {
12
15
  contentId?: string;
13
16
  private readonly realCastState$;
14
17
  private readonly subscription;
18
+ private readonly log;
15
19
  private readonly params;
16
20
  private isDestroyed;
17
21
  constructor(params: IParams);
@@ -11,6 +11,7 @@ export default class ChromecastProvider implements IProvider {
11
11
  private loadMediaTimeoutSubscription;
12
12
  private videoState;
13
13
  private params;
14
+ private log;
14
15
  constructor(params: IParams);
15
16
  destroy(): void;
16
17
  private subscribe;
@@ -26,6 +27,7 @@ export default class ChromecastProvider implements IProvider {
26
27
  private createMediaInfo;
27
28
  private createLoadRequest;
28
29
  private loadMedia;
30
+ private logRemoteEvent;
29
31
  private syncPlayback;
30
32
  }
31
33
  export {};
@@ -22,6 +22,7 @@ export default class DashLiveProvider implements IProvider {
22
22
  private maxSeekBackTime$;
23
23
  private zeroTime$;
24
24
  private liveOffset;
25
+ private log;
25
26
  private params;
26
27
  constructor(params: Params);
27
28
  destroy(): void;
@@ -9,7 +9,8 @@ export default class FilesFetcher {
9
9
  private TIMEOUT;
10
10
  private BITRATE_ESTIMATOR;
11
11
  private MAX_PARALLEL_REQUESTS;
12
- constructor(RETRY_COUNT: number, TIMEOUT: number, BITRATE_ESTIMATOR: any, MAX_PARALLEL_REQUESTS: number);
12
+ private logger;
13
+ constructor(RETRY_COUNT: number, TIMEOUT: number, BITRATE_ESTIMATOR: any, MAX_PARALLEL_REQUESTS: number, logger: (...args: any[]) => void);
13
14
  private limitCompleteCount;
14
15
  private _sendRequest;
15
16
  private _getParallelRequestCount;
@@ -19,6 +19,7 @@ interface IParams {
19
19
  manifestRetryMaxInterval: number;
20
20
  manifestRetryMaxCount: number;
21
21
  };
22
+ logger: (...args: any[]) => void;
22
23
  }
23
24
  type AutoQualityLimits = {
24
25
  max?: number;
@@ -15,9 +15,12 @@
15
15
  * active time = (1.1 - 1.0) + (0.5 - 0.2) = 0.4
16
16
  * throughput = total size / active time = 6500 bytes/sec
17
17
  */
18
+ type ILogger = (...args: any[]) => void;
18
19
  export default class ThroughputEstimator {
19
20
  private intervals;
20
21
  private currentRate;
22
+ private logger;
23
+ constructor(logger: ILogger);
21
24
  private _updateRate;
22
25
  private _createInterval;
23
26
  private _doMergeIntervals;
@@ -27,3 +30,4 @@ export default class ThroughputEstimator {
27
30
  addInterval(timeStart: number, timeEnd: number, bytes: number): boolean;
28
31
  getBitRate(): number;
29
32
  }
33
+ export {};
@@ -3,7 +3,7 @@ import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, S
3
3
  import { IProvider, IProviderParams } from '../../providers/types';
4
4
  import { TrackHistory } from '../../utils/autoSelectTrack';
5
5
  import { IStateMachine } from '../../utils/StateMachine/types';
6
- import { ISubscription, Milliseconds } from '@vkontakte/videoplayer-shared';
6
+ import { ISubscription, ITracer, Milliseconds } from '@vkontakte/videoplayer-shared';
7
7
  import { Player } from './lib/player';
8
8
  import { Scene3D } from '../../utils/3d/Scene3D';
9
9
  import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
@@ -20,6 +20,7 @@ export default abstract class BaseDashProvider implements IProvider {
20
20
  protected video: HTMLVideoElement;
21
21
  protected player: Player;
22
22
  protected params: IParams;
23
+ protected tracer: ITracer;
23
24
  protected textTracksManager: TextTrackManager;
24
25
  protected droppedFramesManager: DroppedFramesManager;
25
26
  protected stallsManager: StallsManager;
@@ -1,6 +1,6 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
2
  import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
3
- import { Byte, IValueSubject, Milliseconds, IRange, Subject, IError } from '@vkontakte/videoplayer-shared';
3
+ import { Byte, IValueSubject, Milliseconds, IRange, Subject, ITracer, IError } from '@vkontakte/videoplayer-shared';
4
4
  import { CommonInit, GenericContainerParser, Segment, SegmentReference } from './types';
5
5
  export declare enum RangeMethod {
6
6
  HEADER = 0,
@@ -10,6 +10,7 @@ export interface IParams {
10
10
  throughputEstimator?: ThroughputEstimator;
11
11
  requestQuic: boolean;
12
12
  compatibilityMode?: boolean;
13
+ tracer: ITracer;
13
14
  useEnableSubtitlesParam?: boolean;
14
15
  }
15
16
  export type Priority = 'high' | 'low' | 'auto';
@@ -34,6 +35,7 @@ export type RepresentationFetchResult = {
34
35
  export declare class Fetcher {
35
36
  private throughputEstimator;
36
37
  private requestQuic;
38
+ private tracer;
37
39
  lastConnectionType$: IValueSubject<HttpConnectionType | undefined>;
38
40
  lastConnectionReused$: IValueSubject<boolean | undefined>;
39
41
  lastRequestFirstBytes$: IValueSubject<Milliseconds | undefined>;
@@ -43,7 +45,7 @@ export declare class Fetcher {
43
45
  private subscription;
44
46
  private compatibilityMode;
45
47
  private useEnableSubtitlesParam;
46
- constructor({ throughputEstimator, requestQuic, compatibilityMode, useEnableSubtitlesParam }: IParams);
48
+ constructor({ throughputEstimator, requestQuic, tracer, compatibilityMode, useEnableSubtitlesParam }: IParams);
47
49
  private onHeadersReceived;
48
50
  fetchManifest: (param_0: string) => Promise<string | null | undefined>;
49
51
  fetch: (param_0: string, param_1: FetchParams) => Promise<ArrayBuffer | null | undefined>;
@@ -3,7 +3,7 @@ import { CommonInit, LiveStreamStatus, Manifest, Representation, StreamKind, Tex
3
3
  import StateMachine from '../../../utils/StateMachine/StateMachine';
4
4
  import type ThroughputEstimator from '../../../utils/ThroughputEstimator';
5
5
  import { ITuningConfig } from '../../../utils/tuningConfig';
6
- import { IError, ISubject, IValueSubject, Milliseconds, Subject } from '@vkontakte/videoplayer-shared';
6
+ import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Subject } from '@vkontakte/videoplayer-shared';
7
7
  export declare enum State {
8
8
  NONE = "none",
9
9
  MANIFEST_READY = "manifest_ready",
@@ -14,6 +14,7 @@ export interface Params {
14
14
  throughputEstimator: ThroughputEstimator;
15
15
  tuning: ITuningConfig;
16
16
  compatibilityMode?: boolean;
17
+ tracer: ITracer;
17
18
  }
18
19
  export declare class Player {
19
20
  private element;
@@ -21,6 +22,7 @@ export declare class Player {
21
22
  private source;
22
23
  private manifest;
23
24
  private tuning;
25
+ private tracer;
24
26
  private videoBufferManager;
25
27
  private audioBufferManager;
26
28
  private bufferManagers;
@@ -81,6 +83,7 @@ export declare class Player {
81
83
  getStreams(): Manifest['streams'] | undefined;
82
84
  setPreloadOnly(preloadOnly: boolean): void;
83
85
  destroy(): void;
86
+ private initTracerSubscription;
84
87
  private isManualDecreasePlaybackInLive;
85
88
  private normolizeLiveOffset;
86
89
  private tick;
@@ -21,6 +21,8 @@ export default class ProviderContainer implements IProviderContainer {
21
21
  private subscription;
22
22
  private screenFormatsIterator;
23
23
  private chromecastFormatsIterator;
24
+ private log;
25
+ private tracer;
24
26
  private params;
25
27
  private failoverIndex;
26
28
  private volumeMultiplierManager;
@@ -8,6 +8,7 @@ import { URLSource } from '../../player/types';
8
8
  export default class WebRTCLiveProvider implements IProvider {
9
9
  private readonly subscription;
10
10
  private readonly params;
11
+ private log;
11
12
  private video;
12
13
  private videoState;
13
14
  private liveStreamClient;
@@ -1,5 +1,5 @@
1
1
  import { ITuningConfig } from '../utils/tuningConfig';
2
- import { ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning } from '@vkontakte/videoplayer-shared';
2
+ import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger, ITracer } from '@vkontakte/videoplayer-shared';
3
3
  import { IChromecastInitializer } from '../providers/ChromecastProvider/ChromecastInitializer/types';
4
4
  import { HttpConnectionType, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
5
5
  import { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackState, PlaybackRate } from '../player/types';
@@ -15,6 +15,9 @@ export interface IProviderDependencies {
15
15
  dependencies: {
16
16
  throughputEstimator: ThroughputEstimator;
17
17
  chromecastInitializer: IChromecastInitializer;
18
+ logger: ILogger;
19
+ tracer: ITracer;
20
+ abrLogger: IComponentLogger;
18
21
  };
19
22
  }
20
23
  export interface IProviderParams<TSourceType> extends IProviderDependencies {
@@ -1,8 +1,9 @@
1
- import { type ExactVideoQuality, IObservable, Subject } from '@vkontakte/videoplayer-shared';
1
+ import { type ExactVideoQuality, ILogger, IObservable, Subject } from '@vkontakte/videoplayer-shared';
2
2
  import { ITuningConfig } from '../../../utils/tuningConfig';
3
3
  import { IVideoTrack } from '../../../player/types';
4
4
  import { IStateMachine } from '../../../utils/StateMachine/types';
5
5
  interface IConnectData {
6
+ logger: ILogger;
6
7
  video: HTMLVideoElement;
7
8
  tracks: IVideoTrack[];
8
9
  droppedFramesChecker: ITuningConfig['droppedFramesChecker'];
@@ -13,6 +14,7 @@ interface IConnectData {
13
14
  declare class DroppedFramesManager {
14
15
  onDroopedVideoFramesLimit$: Subject<void>;
15
16
  private subscription;
17
+ private log;
16
18
  private video;
17
19
  private droppedFramesChecker;
18
20
  private isAuto;
@@ -24,6 +24,5 @@ export interface IObservableVideo {
24
24
  inFullscreen$: IValueObservable<boolean>;
25
25
  enterPip$: IObservable<PictureInPictureEvent>;
26
26
  leavePip$: IObservable<PictureInPictureEvent>;
27
- destroy: () => void;
28
27
  }
29
28
  export declare const observe: (video: HTMLVideoElement) => IObservableVideo;
@@ -1,5 +1,5 @@
1
1
  import { ITuningConfig } from '../utils/tuningConfig';
2
- import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits } from '@vkontakte/videoplayer-shared';
2
+ import { Kbps, Milliseconds, IRectangle, type ExactVideoQuality, QualityLimits, IComponentLogger } from '@vkontakte/videoplayer-shared';
3
3
  import { IAudioTrack, IBaseTrack, IVideoTrack } from '../player/types';
4
4
  interface IConstraints<T extends IBaseTrack> {
5
5
  container?: IRectangle;
@@ -15,6 +15,7 @@ interface IConstraints<T extends IBaseTrack> {
15
15
  droppedVideoMaxQualityLimit?: ExactVideoQuality;
16
16
  stallsVideoMaxQualityLimit?: ExactVideoQuality;
17
17
  stallsPredictedThroughput?: Kbps;
18
+ abrLogger: IComponentLogger;
18
19
  }
19
20
  export declare class TrackHistory<T extends IBaseTrack> {
20
21
  last: T | undefined;
@@ -25,6 +26,6 @@ export declare class TrackHistory<T extends IBaseTrack> {
25
26
  }
26
27
  export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
27
28
  export declare const getMinPossibleAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
28
- export declare const autoSelectVideoTrack: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, }: IConstraints<IVideoTrack>) => IVideoTrack;
29
- export declare const autoSelectAudioTrackForVideo: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, stallsPredictedThroughput, }: 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;
30
31
  export {};
@@ -2,6 +2,9 @@ import { ISmoothedValue, IParams } from '../../utils/smoothedValue/types';
2
2
  import { IValueSubject } from '@vkontakte/videoplayer-shared';
3
3
  export declare abstract class BaseSmoothedValue implements ISmoothedValue {
4
4
  private prevReported;
5
+ private rawSeries$;
6
+ private smoothedSeries$;
7
+ private reportedSeries$;
5
8
  protected smoothed: number;
6
9
  protected pastMeasures: number[];
7
10
  protected takenMeasures: number;