@vkontakte/videoplayer-core 2.0.128-dev.5bf6a1c3.0 → 2.0.128-dev.6321342e.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 (30) hide show
  1. package/es2015.cjs.js +26 -26
  2. package/es2015.esm.js +22 -22
  3. package/es2018.cjs.js +26 -26
  4. package/es2018.esm.js +22 -22
  5. package/esnext.cjs.js +29 -29
  6. package/esnext.esm.js +25 -25
  7. package/evergreen.esm.js +20 -20
  8. package/package.json +2 -2
  9. package/types/index.d.ts +1 -0
  10. package/types/player/Player.d.ts +7 -2
  11. package/types/player/types.d.ts +5 -1
  12. package/types/providers/DashProvider/baseDashProvider.d.ts +0 -2
  13. package/types/providers/DashProvider/consts.d.ts +1 -1
  14. package/types/providers/DashProvider/lib/player.d.ts +7 -4
  15. package/types/providers/DashProvider/lib/types.d.ts +13 -2
  16. package/types/providers/ProviderContainer/utils/formatsSupport.d.ts +0 -2
  17. package/types/providers/types.d.ts +1 -0
  18. package/types/utils/ClientChecker/ClientChecker.d.ts +22 -0
  19. package/types/utils/ClientChecker/index.d.ts +2 -0
  20. package/types/utils/ClientChecker/services/AudioChecker.d.ts +10 -0
  21. package/types/utils/ClientChecker/services/BrowserChecker.d.ts +13 -0
  22. package/types/utils/ClientChecker/services/DeviceChecker.d.ts +23 -0
  23. package/types/utils/ClientChecker/services/DisplayChecker.d.ts +22 -0
  24. package/types/utils/ClientChecker/services/VideoChecker.d.ts +45 -0
  25. package/types/utils/ClientChecker/types/checker.d.ts +3 -0
  26. package/types/utils/ClientChecker/types/currentClientBrowser.d.ts +12 -0
  27. package/types/utils/ClientChecker/types/currentClientDevice.d.ts +10 -0
  28. package/types/utils/ClientChecker/types/userAgentData.d.ts +33 -0
  29. package/types/utils/ClientChecker/utils/isMobile.d.ts +1 -0
  30. package/types/utils/tuningConfig.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.128-dev.5bf6a1c3.0",
3
+ "version": "2.0.128-dev.6321342e.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.56-dev.65054ff5.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.56-dev.c04c8475.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
package/types/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLS
3
3
  import Player from './player/Player';
4
4
  import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, ChromecastState, HttpConnectionType, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream } from './player/types';
5
5
  import type { IOptionalTuningConfig } from './utils/tuningConfig';
6
+ export { clientChecker, isMobile } from './utils/ClientChecker';
6
7
  import type { ISubscription, IUnsubscriber, IEmitter, IObservable, IValueObservable, IValue, IOperator, IListener, ILogEntry, IRange, ExactVideoQuality } from '@vkontakte/videoplayer-shared';
7
8
  import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@vkontakte/videoplayer-shared';
8
9
  /**
@@ -17,11 +17,12 @@ export default class Player implements IPlayer {
17
17
  private initedAt;
18
18
  private hasLiveOffsetByPaused;
19
19
  private hasLiveOffsetByPausedTimer;
20
+ private playerInited;
20
21
  private explicitInitialQuality;
21
22
  private wasSetStartedQuality;
22
23
  private desiredState;
23
24
  info: {
24
- playbackState$: ValueSubject<PlaybackState>;
25
+ playbackState$: ValueSubject<PlaybackState | undefined>;
25
26
  position$: ValueSubject<number>;
26
27
  duration$: ValueSubject<number>;
27
28
  muted$: ValueSubject<boolean>;
@@ -46,6 +47,7 @@ export default class Player implements IPlayer {
46
47
  isEnded$: ValueSubject<boolean>;
47
48
  isLooped$: ValueSubject<boolean>;
48
49
  isLive$: ValueSubject<boolean | undefined>;
50
+ isLiveEnded$: ValueSubject<boolean | null>;
49
51
  canChangePlaybackSpeed$: ValueSubject<boolean | undefined>;
50
52
  atLiveEdge$: ValueSubject<boolean | undefined>;
51
53
  atLiveDurationEdge$: ValueSubject<boolean | undefined>;
@@ -111,6 +113,7 @@ export default class Player implements IPlayer {
111
113
  getCurrentTime$: ValueSubject<null>;
112
114
  };
113
115
  constructor(tuning?: IOptionalTuningConfig, tracer?: ITracer);
116
+ private createProviderContainer;
114
117
  initVideo(config: IConfig): IPlayer;
115
118
  destroy(): void;
116
119
  prepare(): IPlayer;
@@ -186,9 +189,11 @@ export default class Player implements IPlayer {
186
189
  private initStartingVideoTrack;
187
190
  private setStartingVideoTrack;
188
191
  private initLogs;
189
- private initDebugTelemetry;
192
+ private initBasicDebugTelemetry;
193
+ private initProviderDebugTelemetry;
190
194
  private initTracerSubscription;
191
195
  private initWakeLock;
192
196
  private setVideoTrackIdByQuality;
193
197
  private getActiveLiveDelay;
198
+ private isNotActiveTabCase;
194
199
  }
@@ -207,7 +207,7 @@ export interface IPlayerInfo {
207
207
  * Оптимистичный статут плеера. Так например, значение будет равно Playing сразу после вызова play().
208
208
  * Фактическое состояние лучше отслеживать по событиям (например, playing$)
209
209
  */
210
- playbackState$: IValueObservable<PlaybackState>;
210
+ playbackState$: IValueObservable<PlaybackState | undefined>;
211
211
  /**
212
212
  * Текущая позиция.
213
213
  *
@@ -310,6 +310,10 @@ export interface IPlayerInfo {
310
310
  * Бесконечный ли стрим
311
311
  */
312
312
  isLive$: IValueObservable<boolean | undefined>;
313
+ /**
314
+ * Был ли завершен бесконечный стрим
315
+ */
316
+ isLiveEnded$: IValueObservable<boolean | null>;
313
317
  /**
314
318
  * Доступно ли ускоренное воспроизведении в лайв трансляции
315
319
  */
@@ -5,7 +5,6 @@ import { TrackHistory } from '../../utils/autoSelectTrack';
5
5
  import { IStateMachine } from '../../utils/StateMachine/types';
6
6
  import { ISubscription, Milliseconds, ITracer } from '@vkontakte/videoplayer-shared';
7
7
  import { Player } from './lib/player';
8
- import { ILiveOffset } from '../utils/LiveOffset/types';
9
8
  import { Scene3D } from '../../utils/3d/Scene3D';
10
9
  import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
11
10
  import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
@@ -42,7 +41,6 @@ export default abstract class BaseDashProvider implements IProvider {
42
41
  protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
43
42
  protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
44
43
  protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
45
- protected liveOffset?: ILiveOffset;
46
44
  constructor(params: IParams);
47
45
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
48
46
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
@@ -1,3 +1,3 @@
1
1
  export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
2
  export declare const DASH_STALL_UPDATE_INTERVAL_MS = 50;
3
- export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 5000;
3
+ export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 2000;
@@ -1,9 +1,9 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
- import { CommonInit, Manifest, Representation, StreamKind, TextRepresentation } from './types';
2
+ import { CommonInit, LiveStreamStatus, Manifest, Representation, StreamKind, TextRepresentation } from './types';
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, ITracer, IValueSubject, Milliseconds, Seconds, 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",
@@ -46,7 +46,9 @@ export declare class Player {
46
46
  isActiveLive$: IValueSubject<boolean>;
47
47
  isLowLatency$: IValueSubject<boolean>;
48
48
  liveDuration$: IValueSubject<Milliseconds>;
49
- liveAvailabilityStartTime$: IValueSubject<Seconds | undefined>;
49
+ liveSeekableDuration$: IValueSubject<Milliseconds>;
50
+ liveAvailabilityStartTime$: IValueSubject<Milliseconds>;
51
+ liveStreamStatus$: IValueSubject<LiveStreamStatus | undefined>;
50
52
  bufferLength$: IValueSubject<Milliseconds>;
51
53
  liveLatency$: IValueSubject<Milliseconds | undefined>;
52
54
  liveLoadBufferLength$: IValueSubject<Milliseconds>;
@@ -55,14 +57,15 @@ export declare class Player {
55
57
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
56
58
  fetcherRecoverableError$: Subject<IError>;
57
59
  fetcherError$: Subject<IError>;
60
+ private liveStreamEndTimestamp;
58
61
  private liveBuffer;
59
62
  private isUpdatingLive;
60
63
  private isJumpGapAfterSeekLive;
61
- private liveLastSeekOffset;
62
64
  private forceEnded$;
63
65
  private gapWatchdogActive;
64
66
  private gapWatchdogSubscription;
65
67
  private stallWatchdogSubscription;
68
+ private livePauseWatchdogSubscription;
66
69
  private destroyController;
67
70
  constructor(params: Params);
68
71
  initManifest: (param_0: HTMLVideoElement, param_1: string, param_2: number) => Promise<void | undefined>;
@@ -13,6 +13,11 @@ export declare enum LiveStatus {
13
13
  LiveForwardBuffering = "live_forward_buffering",
14
14
  None = "none"
15
15
  }
16
+ export declare enum LiveStreamStatus {
17
+ Active = "active",
18
+ UnexpectedlyDown = "unexpectedly_down",// Стрим в сети, но трансляция оборвалась из-за тех. проблем
19
+ Unpublished = "unpublished"
20
+ }
16
21
  export declare enum Profile {
17
22
  WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",// Такой указан в спеке
18
23
  WEBM_AS_IN_FFMPEG = "urn:webm:dash:profile:webm-on-demand:2012"
@@ -99,14 +104,20 @@ export interface Stream {
99
104
  mime: string;
100
105
  representations: Representation[];
101
106
  }
107
+ export interface LiveMetadata {
108
+ availabilityStartTime: Milliseconds;
109
+ publishTime: Milliseconds;
110
+ latestSegmentPublishTime: Milliseconds;
111
+ streamIsAlive: boolean;
112
+ streamIsUnpublished: boolean;
113
+ }
102
114
  export interface Manifest {
103
- dynamic: boolean;
104
- liveAvailabilityStartTime: Milliseconds | undefined;
105
115
  duration: Milliseconds | undefined;
106
116
  streams: {
107
117
  [key in StreamKind]: Stream[];
108
118
  };
109
119
  baseUrls: string[];
120
+ live?: LiveMetadata;
110
121
  }
111
122
  export declare enum ProjectionType {
112
123
  RECTANGULAR = 0,
@@ -1,7 +1,5 @@
1
1
  import { VideoFormat } from '../../../player/types';
2
2
  import { type ITuningConfig } from '../../../utils/tuningConfig';
3
- export declare const nativeHlsSupported: boolean;
4
- export declare const getSupportedCodecs: () => string[];
5
3
  type FilterConstraints = Pick<ITuningConfig, 'useHlsJs' | 'useManagedMediaSource' | 'useOldMSEDetection'>;
6
4
  export declare const filterAvailableFormats: (formats: VideoFormat[], { useHlsJs, useManagedMediaSource, useOldMSEDetection }: FilterConstraints) => VideoFormat[];
7
5
  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;
@@ -67,6 +67,7 @@ export interface IProviderOutput {
67
67
  currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
68
68
  isBuffering$: IValueSubject<boolean>;
69
69
  isLive$: IValueSubject<boolean | undefined>;
70
+ isLiveEnded$: IValueSubject<boolean | null>;
70
71
  isLowLatency$: IValueSubject<boolean | undefined>;
71
72
  liveTime$: IValueSubject<Milliseconds | undefined>;
72
73
  liveBufferTime$: IValueSubject<Milliseconds | undefined>;
@@ -0,0 +1,22 @@
1
+ import { BrowserChecker } from './services/BrowserChecker';
2
+ import { DeviceChecker } from './services/DeviceChecker';
3
+ import { DisplayChecker } from './services/DisplayChecker';
4
+ import { VideoChecker } from './services/VideoChecker';
5
+ import { AudioChecker } from './services/AudioChecker';
6
+ import { ValueSubject } from '@vkontakte/videoplayer-shared';
7
+ export declare class ClientChecker {
8
+ isInited$: ValueSubject<boolean>;
9
+ private _displayChecker;
10
+ private _deviceChecker;
11
+ private _browserChecker;
12
+ private _videoChecker;
13
+ private _audioChecker;
14
+ constructor();
15
+ get display(): DisplayChecker;
16
+ get device(): DeviceChecker;
17
+ get browser(): BrowserChecker;
18
+ get video(): VideoChecker;
19
+ get audio(): AudioChecker;
20
+ detect(): Promise<void>;
21
+ }
22
+ export declare const clientChecker: ClientChecker;
@@ -0,0 +1,2 @@
1
+ export { clientChecker } from './ClientChecker';
2
+ export { isMobile } from './utils/isMobile';
@@ -0,0 +1,10 @@
1
+ import { Checker } from '../../../utils/ClientChecker/types/checker';
2
+ export declare const mp3Mime = "audio/mpeg";
3
+ export declare class AudioChecker implements Checker {
4
+ private _audio;
5
+ private _containers;
6
+ private _codecs;
7
+ supportMp3(): boolean;
8
+ detect(): void;
9
+ private destroyAudioElement;
10
+ }
@@ -0,0 +1,13 @@
1
+ import { CurrentClientBrowser } from '../../../utils/ClientChecker/types/currentClientBrowser';
2
+ import { Checker } from '../../../utils/ClientChecker/types/checker';
3
+ export declare class BrowserChecker implements Checker {
4
+ private _current;
5
+ private _safariVersion;
6
+ get current(): CurrentClientBrowser;
7
+ get isYandex(): boolean;
8
+ get isSafari(): boolean;
9
+ get isSamsungBrowser(): boolean;
10
+ get safariVersion(): number | undefined;
11
+ detect(): void;
12
+ private detectSafariVersion;
13
+ }
@@ -0,0 +1,23 @@
1
+ import { CurrentClientDevice } from '../../../utils/ClientChecker/types/currentClientDevice';
2
+ import { DisplayChecker } from '../../../utils/ClientChecker/services/DisplayChecker';
3
+ import { Checker } from '../../../utils/ClientChecker/types/checker';
4
+ export declare class DeviceChecker implements Checker {
5
+ private _displayChecker;
6
+ private _isMobile;
7
+ private _current;
8
+ private _iosVersion;
9
+ private _highEntropyValues;
10
+ constructor(displayChecker: DisplayChecker);
11
+ get current(): CurrentClientDevice;
12
+ get isIOS(): boolean;
13
+ get isMac(): boolean;
14
+ get isApple(): boolean;
15
+ get isIphoneOrOldIpad(): boolean;
16
+ get isAndroid(): boolean;
17
+ get isMobile(): boolean;
18
+ get iOSVersion(): number | undefined;
19
+ detect(): void;
20
+ private detectHighEntropyValues;
21
+ private detectDevice;
22
+ private detectIOSVersion;
23
+ }
@@ -0,0 +1,22 @@
1
+ import { Checker } from '../../../utils/ClientChecker/types/checker';
2
+ export { isMobile } from '../utils/isMobile';
3
+ export declare class DisplayChecker implements Checker {
4
+ private _maxTouchPoints;
5
+ private _height;
6
+ private _width;
7
+ private _isHdr;
8
+ private _pixelRatio;
9
+ private _screenHeight;
10
+ private _screenWidth;
11
+ private _colorDepth;
12
+ get isTouch(): boolean;
13
+ get maxTouchPoints(): number;
14
+ get height(): number;
15
+ get width(): number;
16
+ get screenHeight(): number;
17
+ get screenWidth(): number;
18
+ get pixelRatio(): number;
19
+ get isHDR(): boolean;
20
+ get colorDepth(): number;
21
+ detect(): void;
22
+ }
@@ -0,0 +1,45 @@
1
+ import { VideoFormat } from '../../../player/types';
2
+ import { DeviceChecker } from './DeviceChecker';
3
+ import { BrowserChecker } from './BrowserChecker';
4
+ import { Checker } from '../../../utils/ClientChecker/types/checker';
5
+ type Protocols = {
6
+ mms: boolean;
7
+ mse: boolean;
8
+ hls: boolean;
9
+ webrtc: boolean;
10
+ ws: boolean;
11
+ };
12
+ type Containers = {
13
+ mp4: boolean;
14
+ webm: boolean;
15
+ cmaf: boolean;
16
+ };
17
+ type Codecs = {
18
+ h264: boolean;
19
+ h265: boolean;
20
+ vp9: boolean;
21
+ av1: boolean;
22
+ aac: boolean;
23
+ opus: boolean;
24
+ mpeg: boolean;
25
+ };
26
+ export type WebmFormat = VideoFormat.DASH_WEBM | VideoFormat.DASH_WEBM_AV1;
27
+ export declare class VideoChecker implements Checker {
28
+ private _video;
29
+ private _deviceChecker;
30
+ private _browserChecker;
31
+ private _protocols;
32
+ private _containers;
33
+ private _codecs;
34
+ private _nativeHlsSupported;
35
+ constructor(deviceChecker: DeviceChecker, browserChecker: BrowserChecker);
36
+ get protocols(): Protocols;
37
+ get containers(): Containers;
38
+ get codecs(): Codecs;
39
+ get webmDecodingInfo(): Record<WebmFormat, MediaCapabilitiesDecodingInfo> | undefined;
40
+ get supportedCodecs(): string[];
41
+ get nativeHlsSupported(): boolean;
42
+ detect(): void;
43
+ private destroyVideoElement;
44
+ }
45
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface Checker {
2
+ detect(): void;
3
+ }
@@ -0,0 +1,12 @@
1
+ export declare enum CurrentClientBrowser {
2
+ Unknown = "Unknown",
3
+ Yandex = "Yandex",
4
+ Chrome = "Chrome",
5
+ Chromium = "Chromium",//Хром и хромиум разделяем специально. Почти единственное отличие, поддержка H.264 как раз важна для нас
6
+ Firefox = "Firefox",
7
+ Safari = "Safari",
8
+ Opera = "Opera",
9
+ Edge = "Edge",
10
+ SamsungBrowser = "SamsungBrowser",
11
+ Rest = "Rest"
12
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum CurrentClientDevice {
2
+ Unknown = "Unknown",
3
+ Android = "Android",
4
+ iPhone = "iPhone",
5
+ iPad = "iPad",
6
+ iPod = "iPod",
7
+ RestMobile = "RestMobile",
8
+ Mac = "Mac",
9
+ Desktop = "Desktop"
10
+ }
@@ -0,0 +1,33 @@
1
+ export declare enum ClientArchitecture {
2
+ ARM = "arm",
3
+ X86 = "x86"
4
+ }
5
+ export declare enum ClientBitness {
6
+ SHORT = "32",
7
+ LONG = "64"
8
+ }
9
+ export interface UADataBrandItem {
10
+ brand: string;
11
+ version: string;
12
+ }
13
+ export declare enum UADataPlatform {
14
+ WINDOWS = "Windows",
15
+ MACOS = "macOS",
16
+ LINUX = "Linux",
17
+ ANDROID = "Android",
18
+ IOS = "iOS"
19
+ }
20
+ export interface HighEntropyValues {
21
+ mobile?: boolean;
22
+ model?: string;
23
+ platform?: UADataPlatform;
24
+ platformVersion?: string;
25
+ architecture?: ClientArchitecture;
26
+ bitness?: ClientBitness;
27
+ brands?: UADataBrandItem[];
28
+ }
29
+ export type NavigatorWithUserAgentData = Navigator & {
30
+ userAgentData: {
31
+ getHighEntropyValues: (values: Array<string>) => HighEntropyValues;
32
+ };
33
+ };
@@ -0,0 +1 @@
1
+ export declare const isMobile: () => boolean;
@@ -198,6 +198,8 @@ export type ITuningConfig = {
198
198
  * Отключает яндексовскую магию с пипом.
199
199
  */
200
200
  disableYandexPiP?: boolean;
201
+ asyncResolveClientChecker?: boolean;
202
+ useLazyInit?: boolean;
201
203
  };
202
204
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
203
205
  configName: ITuningConfig['configName'];