@vkontakte/videoplayer-core 2.0.128-dev.6c63bff4.0 → 2.0.128-dev.d52ca770.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 +24 -24
  2. package/es2015.esm.js +21 -21
  3. package/es2018.cjs.js +22 -22
  4. package/es2018.esm.js +20 -20
  5. package/esnext.cjs.js +25 -25
  6. package/esnext.esm.js +22 -22
  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 +2 -1
  11. package/types/player/types.d.ts +0 -4
  12. package/types/providers/DashProvider/baseDashProvider.d.ts +2 -0
  13. package/types/providers/DashProvider/consts.d.ts +1 -1
  14. package/types/providers/DashProvider/lib/player.d.ts +4 -7
  15. package/types/providers/DashProvider/lib/types.d.ts +2 -13
  16. package/types/providers/ProviderContainer/utils/formatsSupport.d.ts +0 -2
  17. package/types/providers/types.d.ts +0 -1
  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 +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.128-dev.6c63bff4.0",
3
+ "version": "2.0.128-dev.d52ca770.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.55",
52
+ "@vkontakte/videoplayer-shared": "1.0.56-dev.ca9f83cf.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,6 +17,7 @@ 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;
@@ -46,7 +47,6 @@ export default class Player implements IPlayer {
46
47
  isEnded$: ValueSubject<boolean>;
47
48
  isLooped$: ValueSubject<boolean>;
48
49
  isLive$: ValueSubject<boolean | undefined>;
49
- isLiveEnded$: ValueSubject<boolean | null>;
50
50
  canChangePlaybackSpeed$: ValueSubject<boolean | undefined>;
51
51
  atLiveEdge$: ValueSubject<boolean | undefined>;
52
52
  atLiveDurationEdge$: ValueSubject<boolean | undefined>;
@@ -192,4 +192,5 @@ export default class Player implements IPlayer {
192
192
  private initWakeLock;
193
193
  private setVideoTrackIdByQuality;
194
194
  private getActiveLiveDelay;
195
+ private isNotActiveTabCase;
195
196
  }
@@ -310,10 +310,6 @@ export interface IPlayerInfo {
310
310
  * Бесконечный ли стрим
311
311
  */
312
312
  isLive$: IValueObservable<boolean | undefined>;
313
- /**
314
- * Был ли завершен бесконечный стрим
315
- */
316
- isLiveEnded$: IValueObservable<boolean | null>;
317
313
  /**
318
314
  * Доступно ли ускоренное воспроизведении в лайв трансляции
319
315
  */
@@ -5,6 +5,7 @@ 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';
8
9
  import { Scene3D } from '../../utils/3d/Scene3D';
9
10
  import DroppedFramesManager from '../../providers/utils/HTMLVideoElement/DroppedFramesManager';
10
11
  import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
@@ -41,6 +42,7 @@ export default abstract class BaseDashProvider implements IProvider {
41
42
  protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
42
43
  protected videoTrackSwitchHistory: TrackHistory<IVideoTrack>;
43
44
  protected audioTrackSwitchHistory: TrackHistory<import("../../player/types").IBaseTrack>;
45
+ protected liveOffset?: ILiveOffset;
44
46
  constructor(params: IParams);
45
47
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
46
48
  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 = 2000;
3
+ export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 5000;
@@ -1,9 +1,9 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
- import { CommonInit, LiveStreamStatus, Manifest, Representation, StreamKind, TextRepresentation } from './types';
2
+ import { CommonInit, 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, Subject } from '@vkontakte/videoplayer-shared';
6
+ import { IError, ISubject, ITracer, IValueSubject, Milliseconds, Seconds, Subject } from '@vkontakte/videoplayer-shared';
7
7
  export declare enum State {
8
8
  NONE = "none",
9
9
  MANIFEST_READY = "manifest_ready",
@@ -46,9 +46,7 @@ export declare class Player {
46
46
  isActiveLive$: IValueSubject<boolean>;
47
47
  isLowLatency$: IValueSubject<boolean>;
48
48
  liveDuration$: IValueSubject<Milliseconds>;
49
- liveSeekableDuration$: IValueSubject<Milliseconds>;
50
- liveAvailabilityStartTime$: IValueSubject<Milliseconds>;
51
- liveStreamStatus$: IValueSubject<LiveStreamStatus | undefined>;
49
+ liveAvailabilityStartTime$: IValueSubject<Seconds | undefined>;
52
50
  bufferLength$: IValueSubject<Milliseconds>;
53
51
  liveLatency$: IValueSubject<Milliseconds | undefined>;
54
52
  liveLoadBufferLength$: IValueSubject<Milliseconds>;
@@ -57,15 +55,14 @@ export declare class Player {
57
55
  videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
58
56
  fetcherRecoverableError$: Subject<IError>;
59
57
  fetcherError$: Subject<IError>;
60
- private liveStreamEndTimestamp;
61
58
  private liveBuffer;
62
59
  private isUpdatingLive;
63
60
  private isJumpGapAfterSeekLive;
61
+ private liveLastSeekOffset;
64
62
  private forceEnded$;
65
63
  private gapWatchdogActive;
66
64
  private gapWatchdogSubscription;
67
65
  private stallWatchdogSubscription;
68
- private livePauseWatchdogSubscription;
69
66
  private destroyController;
70
67
  constructor(params: Params);
71
68
  initManifest: (param_0: HTMLVideoElement, param_1: string, param_2: number) => Promise<void | undefined>;
@@ -13,11 +13,6 @@ 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
- }
21
16
  export declare enum Profile {
22
17
  WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",// Такой указан в спеке
23
18
  WEBM_AS_IN_FFMPEG = "urn:webm:dash:profile:webm-on-demand:2012"
@@ -104,20 +99,14 @@ export interface Stream {
104
99
  mime: string;
105
100
  representations: Representation[];
106
101
  }
107
- export interface LiveMetadata {
108
- availabilityStartTime: Milliseconds;
109
- publishTime: Milliseconds;
110
- latestSegmentPublishTime: Milliseconds;
111
- streamIsAlive: boolean;
112
- streamIsUnpublished: boolean;
113
- }
114
102
  export interface Manifest {
103
+ dynamic: boolean;
104
+ liveAvailabilityStartTime: Milliseconds | undefined;
115
105
  duration: Milliseconds | undefined;
116
106
  streams: {
117
107
  [key in StreamKind]: Stream[];
118
108
  };
119
109
  baseUrls: string[];
120
- live?: LiveMetadata;
121
110
  }
122
111
  export declare enum ProjectionType {
123
112
  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,7 +67,6 @@ 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>;
71
70
  isLowLatency$: IValueSubject<boolean | undefined>;
72
71
  liveTime$: IValueSubject<Milliseconds | undefined>;
73
72
  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,7 @@ export type ITuningConfig = {
198
198
  * Отключает яндексовскую магию с пипом.
199
199
  */
200
200
  disableYandexPiP?: boolean;
201
+ asyncResolveClientChecker?: boolean;
201
202
  };
202
203
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
203
204
  configName: ITuningConfig['configName'];