@vkontakte/videoplayer-core 2.0.105-dev.9e273154.0 → 2.0.105-dev.d0bcde09.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.105-dev.9e273154.0",
3
+ "version": "2.0.105-dev.d0bcde09.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.37-dev.d644b4e8.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.37-dev.cf31253c.0",
53
53
  "hls.js": "~1.4.7"
54
54
  }
55
55
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { VERSION } from './env';
2
2
  import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek, Surface } from './player/types';
3
3
  import Player from './player/Player';
4
- import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, ChromecastState, HttpConnectionType, IExternalTextTrack, ITextTrack, PlaybackRate } from './player/types';
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
6
  import type { ISubscription, IUnsubscriber, IEmitter, IObservable, IValueObservable, IValue, IOperator, IListener, ILogEntry, IRange, ExactVideoQuality } from '@vkontakte/videoplayer-shared';
7
7
  import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@vkontakte/videoplayer-shared';
@@ -9,4 +9,4 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from '@
9
9
  * @deprecated
10
10
  */
11
11
  declare const SDK_VERSION: string;
12
- export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, Surface, Subscription, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, VideoFormat, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, VideoQuality, ExactVideoQuality, Observable, Subject, ValueSubject, IRange, ISeekRequest, ICueSettings, VERSION, SDK_VERSION, PlaybackRate, };
12
+ export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, Surface, Subscription, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, VideoFormat, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, VideoQuality, ExactVideoQuality, Observable, Subject, ValueSubject, IRange, ISeekRequest, ICueSettings, VERSION, SDK_VERSION, PlaybackRate, IVideoStream, IAudioStream, };
@@ -1,6 +1,6 @@
1
1
  import { IOptionalTuningConfig } from '../utils/tuningConfig';
2
2
  import { IError, ILogEntry, Seconds, Subject, ValueSubject, QualityLimits, VideoQuality } from '@vkontakte/videoplayer-shared';
3
- import { ChromecastState, HttpConnectionType, IAudioTrack, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, PlaybackRate, PlaybackState, StartEnd, Surface, VideoFormat } from './types';
3
+ import { ChromecastState, HttpConnectionType, IAudioStream, IAudioTrack, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, StartEnd, Surface, VideoFormat } from './types';
4
4
  export default class Player implements IPlayer {
5
5
  private subscription;
6
6
  private domContainer;
@@ -22,14 +22,18 @@ export default class Player implements IPlayer {
22
22
  duration$: ValueSubject<number>;
23
23
  muted$: ValueSubject<boolean>;
24
24
  volume$: ValueSubject<number>;
25
+ availableVideoStreams$: ValueSubject<IVideoStream[]>;
26
+ currentVideoStream$: ValueSubject<IVideoStream | undefined>;
25
27
  availableQualities$: ValueSubject<VideoQuality[]>;
26
28
  availableQualitiesFps$: ValueSubject<Partial<Record<VideoQuality, number>>>;
27
- availableAudioTracks$: ValueSubject<IAudioTrack[]>;
28
- isAudioAvailable$: ValueSubject<boolean>;
29
29
  currentQuality$: ValueSubject<VideoQuality | undefined>;
30
30
  isAutoQualityEnabled$: ValueSubject<boolean>;
31
31
  autoQualityLimitingAvailable$: ValueSubject<boolean>;
32
32
  autoQualityLimits$: ValueSubject<QualityLimits>;
33
+ availableAudioStreams$: ValueSubject<IAudioStream[]>;
34
+ currentAudioStream$: ValueSubject<IVideoStream | undefined>;
35
+ availableAudioTracks$: ValueSubject<IAudioTrack[]>;
36
+ isAudioAvailable$: ValueSubject<boolean>;
33
37
  currentPlaybackRate$: ValueSubject<number>;
34
38
  currentBuffer$: ValueSubject<StartEnd<number>>;
35
39
  isBuffering$: ValueSubject<boolean>;
@@ -109,6 +113,8 @@ export default class Player implements IPlayer {
109
113
  seekPercent(percent: number): IPlayer;
110
114
  setVolume(percent: number): IPlayer;
111
115
  setMuted(isMuted: boolean): IPlayer;
116
+ setVideoStream(stream: IVideoStream): IPlayer;
117
+ setAudioStream(stream: IAudioStream): IPlayer;
112
118
  setQuality(quality: VideoQuality): IPlayer;
113
119
  setAutoQuality(enable: boolean): IPlayer;
114
120
  setAutoQualityLimits(limits: QualityLimits): IPlayer;
@@ -33,6 +33,8 @@ export interface IPlayer {
33
33
  */
34
34
  setVolume(percent: number): IPlayer;
35
35
  setMuted(muted: boolean): IPlayer;
36
+ setAudioStream(stream: IVideoStream): IPlayer;
37
+ setVideoStream(stream: IVideoStream): IPlayer;
36
38
  setQuality(quality: VideoQuality): IPlayer;
37
39
  setAutoQuality(enable: boolean): IPlayer;
38
40
  setAutoQualityLimits(limit: QualityLimits): IPlayer;
@@ -203,6 +205,10 @@ export interface IPlayerInfo {
203
205
  * default value: `1`
204
206
  */
205
207
  volume$: IValueObservable<number>;
208
+ currentVideoStream$: IValueObservable<IVideoStream | undefined>;
209
+ availableVideoStreams$: IValueObservable<IVideoStream[]>;
210
+ currentAudioStream$: IValueObservable<IAudioStream | undefined>;
211
+ availableAudioStreams$: IValueObservable<IAudioStream[]>;
206
212
  /**
207
213
  * Список доступных качеств. Отсортированы по возрастанию.
208
214
  *
@@ -388,12 +394,15 @@ export interface IConfig {
388
394
  sources: ISources;
389
395
  meta?: IMetadata;
390
396
  failoverHosts?: string[];
397
+ volumeMultiplier?: number;
391
398
  }
392
399
  export interface ISources {
393
400
  [VideoFormat.MPEG]?: IMpegSource;
401
+ [VideoFormat.DASH]?: IDashURLSource;
394
402
  [VideoFormat.DASH_SEP]?: IDashURLSource;
395
403
  [VideoFormat.DASH_WEBM]?: IDashURLSource;
396
404
  [VideoFormat.DASH_WEBM_AV1]?: IDashURLSource;
405
+ [VideoFormat.DASH_STREAMS]?: IDashURLSource;
397
406
  [VideoFormat.DASH_ONDEMAND]?: IDashURLSource;
398
407
  [VideoFormat.DASH_LIVE]?: IDashURLSource;
399
408
  [VideoFormat.DASH_LIVE_CMAF]?: IDashURLSource;
@@ -430,13 +439,14 @@ export type IHLSSource = URLSource;
430
439
  export type IHLSLiveSource = URLSourceWithSeek;
431
440
  export declare enum VideoFormat {
432
441
  MPEG = "MPEG",
433
- /** @deprecated Используйте DASH_SEP */
434
- DASH = "DASH_SEP",
442
+ /** @deprecated Больше не транскодируется */
443
+ DASH = "DASH",
435
444
  DASH_SEP = "DASH_SEP",
436
445
  /** @deprecated Используйте DASH_SEP */
437
446
  DASH_SEP_VK = "DASH_SEP",
438
447
  DASH_WEBM = "DASH_WEBM",
439
448
  DASH_WEBM_AV1 = "DASH_WEBM_AV1",
449
+ DASH_STREAMS = "DASH_STREAMS",
440
450
  /** @deprecated Используйте DASH_WEBM */
441
451
  DASH_WEBM_VK = "DASH_WEBM",
442
452
  DASH_ONDEMAND = "DASH_ONDEMAND",
@@ -454,6 +464,13 @@ export declare enum VideoFormat {
454
464
  HLS_LIVE_CMAF = "HLS_LIVE_CMAF",
455
465
  WEB_RTC_LIVE = "WEB_RTC_LIVE"
456
466
  }
467
+ export interface IVideoStream {
468
+ id: string;
469
+ language?: string;
470
+ hdr?: boolean;
471
+ codec?: string;
472
+ label?: string;
473
+ }
457
474
  export interface IVideoTrack {
458
475
  id: string;
459
476
  quality: VideoQuality;
@@ -461,6 +478,13 @@ export interface IVideoTrack {
461
478
  size?: IRectangle;
462
479
  fps?: number;
463
480
  }
481
+ export interface IAudioStream {
482
+ id: string;
483
+ language?: string;
484
+ label?: string;
485
+ codec?: string;
486
+ isDefault?: boolean;
487
+ }
464
488
  export interface IAudioTrack {
465
489
  id: string;
466
490
  bitrate?: Kbps;
@@ -1,10 +1,10 @@
1
1
  import { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack } from '../../player/types';
2
- import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation } from '../../providers/DashProvider/lib/types';
2
+ import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, Stream } from './lib/types';
3
3
  import { IProvider, IProviderParams } from '../../providers/types';
4
4
  import TextTrackManager from '../../providers/utils/HTMLVideoElement/TextTrackManager';
5
5
  import { TrackHistory } from '../../utils/autoSelectVideoTrack';
6
6
  import { IStateMachine } from '../../utils/StateMachine/types';
7
- import { IRectangle, ISubscription, IValueSubject, Milliseconds, ValueSubject } from '@vkontakte/videoplayer-shared';
7
+ import { IRectangle, ISubscription, Milliseconds, ValueSubject } from '@vkontakte/videoplayer-shared';
8
8
  import { Player } from './lib/player';
9
9
  import { ILiveOffset } from '../utils/LiveOffset/types';
10
10
  import { Scene3D } from '../../utils/3d/Scene3D';
@@ -22,15 +22,20 @@ export default abstract class BaseDashProvider implements IProvider {
22
22
  protected elementSize$: ValueSubject<IRectangle<number> | undefined>;
23
23
  protected textTracksManager: TextTrackManager;
24
24
  protected droppedFramesManager: DroppedFramesManager;
25
- protected videoTracks$: IValueSubject<{
26
- track: IVideoTrack;
25
+ protected videoTracksMap: Map<IVideoTrack, {
26
+ stream: Stream;
27
27
  representation: Representation;
28
- }[]>;
29
- protected audioTracks: {
30
- track: IAudioTrack;
28
+ }>;
29
+ protected audioTracksMap: Map<IAudioTrack, {
30
+ stream: Stream;
31
31
  representation: Representation;
32
- }[];
33
- protected audioRepresentations: Map<string, Representation>;
32
+ }>;
33
+ protected textTracksMap: Map<IInternalTextTrack, {
34
+ stream: Stream;
35
+ representation: Representation;
36
+ }>;
37
+ protected videoStreamsMap: Map<Stream, IVideoTrack[]>;
38
+ protected audioStreamsMap: Map<Stream, IAudioTrack[]>;
34
39
  protected videoTrackSwitchHistory: TrackHistory;
35
40
  protected textTracks: {
36
41
  track: IInternalTextTrack;
@@ -41,7 +46,7 @@ export default abstract class BaseDashProvider implements IProvider {
41
46
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
42
47
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
43
48
  protected subscribe(): void;
44
- protected selectVideoRepresentation(): Representation | undefined;
49
+ protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
45
50
  protected prepare(manifestOffset?: number): void;
46
51
  protected syncPlayback: () => undefined;
47
52
  protected init3DScene: (init: CommonInit) => void;
@@ -1,2 +1,3 @@
1
1
  export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
- export declare const DASH_STALL_UPDATE_INTERVAL_MS: number;
2
+ export declare const DASH_STALL_UPDATE_INTERVAL_MS = 1000;
3
+ export declare const DASH_LIVE_STALL_REINIT_INTERVAL_MS = 5000;
@@ -1,7 +1,7 @@
1
1
  import { ITuningConfig } from '../../../utils/tuningConfig';
2
2
  import { IError, IRange, ISubject, IValueSubject, Milliseconds } from '@vkontakte/videoplayer-shared';
3
3
  import type { Fetcher } from './fetcher';
4
- import { CommonInit, Container, Manifest, Representation, RepresentationKind } from './types';
4
+ import { CommonInit, Manifest, Representation, StreamKind, Stream } from './types';
5
5
  export interface Dependencies {
6
6
  fetcher: Fetcher;
7
7
  tuning: ITuningConfig;
@@ -23,8 +23,6 @@ export declare class BufferManager {
23
23
  gaps: Gap[];
24
24
  private subscription;
25
25
  private kind;
26
- private container;
27
- private containerParser;
28
26
  private initData;
29
27
  private parsedInitData;
30
28
  private representations;
@@ -56,7 +54,7 @@ export declare class BufferManager {
56
54
  private isSeekingLive;
57
55
  private index;
58
56
  private loadByteRangeSegmentsTimeoutId;
59
- constructor(kind: RepresentationKind, mediaSource: MediaSource, container: Container, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
57
+ constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
60
58
  startWith: (param_0: string) => Promise<void | undefined>;
61
59
  switchTo: (param_0: string) => Promise<void | undefined>;
62
60
  abort(): void;
@@ -64,10 +62,10 @@ export declare class BufferManager {
64
62
  private searchGaps;
65
63
  private getActualLiveStartingSegments;
66
64
  getLiveSegmentsToLoadState(manifest: Manifest | null): IRange<Milliseconds> | undefined;
67
- seekLive: (param_0: Representation[] | undefined) => Promise<void | undefined>;
65
+ seekLive: (param_0: Stream[] | undefined) => Promise<void | undefined>;
68
66
  updateLive(manifest: Manifest | null): void;
69
67
  proceedLowLatencyLive(): void;
70
- private updateLowLatencyLive;
68
+ private updateLowLatencyLiveIfNeeded;
71
69
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
72
70
  setTarget(time: Milliseconds): void;
73
71
  setPreloadOnly(preloadOnly: boolean): void;
@@ -0,0 +1,2 @@
1
+ import { ContainerParser } from '../../../../providers/DashProvider/lib/types';
2
+ export declare const getContainerParser: (mime: string) => ContainerParser;
@@ -1,5 +1,5 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
- import { CommonInit, Manifest, Representation, RepresentationKind } from './types';
2
+ import { CommonInit, Manifest, Representation, StreamKind } 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';
@@ -32,6 +32,7 @@ export declare class Player {
32
32
  state$: StateMachine<State>;
33
33
  currentVideoRepresentation$: IValueSubject<Representation['id'] | undefined>;
34
34
  currentVideoRepresentationInit$: IValueSubject<CommonInit | undefined>;
35
+ currentAudioRepresentation$: IValueSubject<Representation['id'] | undefined>;
35
36
  currentVideoSegmentLength$: IValueSubject<number>;
36
37
  currentAudioSegmentLength$: IValueSubject<number>;
37
38
  error$: ISubject<IError>;
@@ -61,11 +62,11 @@ export declare class Player {
61
62
  seekLive(nextOffset: Milliseconds): Promise<void>;
62
63
  initRepresentations: (param_0: string, param_1: string | undefined, param_2: import("../../../player/types").URLSource | undefined) => Promise<void | undefined>;
63
64
  initBuffer(): void;
64
- switchRepresentation(kind: RepresentationKind, id: Representation['id']): Promise<void>;
65
+ switchRepresentation(kind: StreamKind, id: Representation['id']): Promise<void>;
65
66
  seek(requestedPosition: Milliseconds, forcePrecise: boolean): void;
66
67
  stop(): void;
67
68
  setBufferTarget(time: Milliseconds): void;
68
- getRepresentations(): Manifest['representations'] | undefined;
69
+ getStreams(): Manifest['streams'] | undefined;
69
70
  setPreloadOnly(preloadOnly: boolean): void;
70
71
  destroy(): void;
71
72
  private normolizeLiveOffset;
@@ -2,7 +2,7 @@ import { Byte, Kbps, Milliseconds, IRange, IObservable, ISubject, IValueSubject
2
2
  import { IDesiredState, IProviderOutput, IProviderParams } from '../../../providers/types';
3
3
  import { IObservableVideo } from '../../../providers/utils/HTMLVideoElement/observable';
4
4
  import { IDashURLSource } from '../../../player/types';
5
- export declare enum RepresentationKind {
5
+ export declare enum StreamKind {
6
6
  VIDEO = "video",
7
7
  AUDIO = "audio",
8
8
  TEXT = "text"
@@ -19,7 +19,7 @@ export declare enum Profile {
19
19
  }
20
20
  export interface Representation {
21
21
  id: string;
22
- kind: RepresentationKind;
22
+ kind: StreamKind;
23
23
  segmentReference: SegmentReference;
24
24
  profiles: Array<Profile | string>;
25
25
  duration?: Milliseconds;
@@ -78,19 +78,24 @@ export declare enum SegmentStatus {
78
78
  PARTIALLY_EJECTED = "partially_ejected",
79
79
  FED = "fed"
80
80
  }
81
+ export interface Stream {
82
+ id: string;
83
+ hdr?: boolean;
84
+ language?: string;
85
+ isDefault?: boolean;
86
+ label?: string;
87
+ codecs: string;
88
+ mime: string;
89
+ representations: Representation[];
90
+ }
81
91
  export interface Manifest {
82
92
  dynamic: boolean;
83
93
  liveAvailabilityStartTime: Milliseconds | undefined;
84
94
  duration: Milliseconds | undefined;
85
- container: Container;
86
- representations: {
87
- [key in RepresentationKind]: Representation[];
95
+ streams: {
96
+ [key in StreamKind]: Stream[];
88
97
  };
89
98
  }
90
- export declare enum Container {
91
- MP4 = "mp4",
92
- WEBM = "webm"
93
- }
94
99
  export declare enum ProjectionType {
95
100
  RECTANGULAR = 0,
96
101
  EQUIRECTANGULAR = 1,
@@ -1,14 +1,14 @@
1
- import { Representation, Segment, SegmentReference, TemplateSegment, TemplateSegmentReference } from '../../../providers/DashProvider/lib/types';
2
- import { IAudioTrack, IInternalTextTrack, IVideoTrack } from '../../../player/types';
1
+ import { Representation, Segment, SegmentReference, Stream, TemplateSegment, TemplateSegmentReference } from '../../../providers/DashProvider/lib/types';
2
+ import { IAudioStream, IAudioTrack, IInternalTextTrack, IVideoStream, IVideoTrack } from '../../../player/types';
3
3
  export declare const representationToVideoTrack: ({ id, width, height, bitrate, fps, quality: qualityString }: Representation) => IVideoTrack | undefined;
4
- export declare const representationToAudioTrack: ({ id, bitrate }: Representation) => IAudioTrack | undefined;
5
- export declare const selectAudioRepresentation: (audioRepresentations: Representation[], videoRepresentations: Representation[], selectedVideo: Representation) => Representation | undefined;
6
- export declare const representationToTextTrack: ({ id, lang, label, url, isAuto }: Representation & {
7
- lang: string;
8
- label: string;
4
+ export declare const representationToAudioTrack: ({ id, bitrate }: Representation) => IAudioTrack;
5
+ export declare const selectAudioForVideo: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[]) => IAudioTrack | undefined;
6
+ export declare const representationToTextTrack: ({ language, label }: Stream, { id, url, isAuto }: Representation & {
9
7
  url: string;
10
8
  isAuto: boolean;
11
9
  }) => IInternalTextTrack;
10
+ export declare const streamToIAudioStream: ({ id, language, label, codecs }: Stream) => IAudioStream;
11
+ export declare const streamToIVideoStream: ({ id, language, label, hdr, codecs }: Stream) => IVideoStream;
12
12
  export declare const isTemplateSegment: (segment: Segment) => segment is TemplateSegment;
13
13
  export declare const isTemplateSegmentReference: (segmentReference: SegmentReference) => segmentReference is TemplateSegmentReference;
14
14
  export declare const isAbortError: (e: Error | unknown) => boolean;
@@ -10,11 +10,13 @@ interface IParams extends IProviderDependencies {
10
10
  failoverHosts: string[];
11
11
  desiredState: IDesiredState;
12
12
  tuning: ITuningConfig;
13
+ volumeMultiplier?: number;
13
14
  }
14
15
  export default class ProviderContainer implements IProviderContainer {
15
16
  current$: IValueSubject<IProviderEntry>;
16
17
  providerError$: ISubject<IError>;
17
18
  noAvailableProvidersError$: ISubject<VideoFormat | undefined>;
19
+ volumeMultiplierError$: ISubject<IError>;
18
20
  providerOutput: IProviderOutput;
19
21
  private subscription;
20
22
  private screenFormatsIterator;
@@ -22,6 +24,7 @@ export default class ProviderContainer implements IProviderContainer {
22
24
  private log;
23
25
  private params;
24
26
  private failoverIndex;
27
+ private volumeMultiplierManager;
25
28
  constructor(params: IParams);
26
29
  init(): void;
27
30
  destroy(): void;
@@ -5,6 +5,7 @@ export interface IProviderContainer {
5
5
  current$: IValueObservable<IProviderEntry>;
6
6
  providerError$: ISubject<IError>;
7
7
  noAvailableProvidersError$: ISubject<VideoFormat | undefined>;
8
+ volumeMultiplierError$: ISubject<IError>;
8
9
  providerOutput: IProviderOutput;
9
10
  init(): void;
10
11
  destroy(): void;
@@ -3,8 +3,8 @@ import { ITuningConfig } from '../../../utils/tuningConfig';
3
3
  export declare const nativeHlsSupported: boolean;
4
4
  export declare const getSupportedCodecs: () => string[];
5
5
  export declare const filterAvailableFormats: (formats: VideoFormat[], useHlsJs?: boolean, useManagedMediaSource?: boolean) => VideoFormat[];
6
- type VodFormat = VideoFormat.MPEG | VideoFormat.DASH_SEP | VideoFormat.DASH_WEBM | VideoFormat.DASH_WEBM_AV1 | VideoFormat.DASH_ONDEMAND | VideoFormat.HLS | VideoFormat.HLS_ONDEMAND;
7
- type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' | 'preferCMAF' | 'preferWebRTC'>;
6
+ 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;
7
+ type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' | 'preferCMAF' | 'preferWebRTC' | 'preferMultiStream'>;
8
8
  /**
9
9
  * Все ONDEMAND форматы ниже готовых эквивалентов потому что ONDEMAND требует серверных ресурсов для нарезки.
10
10
  * Из дашей VP9 (WEBM) самый оптимальный
@@ -12,9 +12,10 @@ type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' |
12
12
  * HLS нативно поддерживается в Сафари и на мобильных девайсах, при этом на андроиде он играет плохо
13
13
  * MPEG – более-менее пуленепробиваемый формат который играет везде и есть у всех видео (за редкими исключениями), но он не адаптивный
14
14
  */
15
- export declare const getFormatsPriority: ({ webmCodec, androidPreferredFormat }: Constraints) => VodFormat[];
15
+ export declare const getFormatsPriority: ({ webmCodec, androidPreferredFormat, preferMultiStream }: Constraints) => VodFormat[];
16
16
  type LiveFormat = VideoFormat.WEB_RTC_LIVE | VideoFormat.HLS_LIVE | VideoFormat.DASH_LIVE | VideoFormat.DASH_LIVE_CMAF | VideoFormat.HLS_LIVE_CMAF;
17
17
  type AllLiveFormats = [LiveFormat, LiveFormat, LiveFormat, LiveFormat, LiveFormat];
18
18
  export declare const getLiveFormatsPriority: ({ androidPreferredFormat, preferCMAF, preferWebRTC }: Constraints) => AllLiveFormats;
19
19
  export declare const getChromeCastFormatsPriority: (live: boolean) => VideoFormat[];
20
+ export declare const selectCodec: (codecs: Set<string>) => string | undefined;
20
21
  export {};
@@ -1,7 +1,7 @@
1
1
  import { ITuningConfig } from '../utils/tuningConfig';
2
2
  import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IRange, IError, QualityLimits, IWarning, IComponentLogger } from '@vkontakte/videoplayer-shared';
3
3
  import { IChromecastInitializer } from '../providers/ChromecastProvider/ChromecastInitializer/types';
4
- import { HttpConnectionType, IAudioTrack, ICueSettings, ISources, SeekState } from '../player/types';
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';
6
6
  import { IStateMachine } from '../utils/StateMachine/types';
7
7
  import ThroughputEstimator from '../utils/ThroughputEstimator';
@@ -31,10 +31,12 @@ export interface IDesiredState {
31
31
  seekState: IStateMachine<SeekState>;
32
32
  volume: IStateMachine<IVolumeState>;
33
33
  playbackRate: IStateMachine<PlaybackRate>;
34
+ isLooped: IStateMachine<boolean>;
35
+ videoStream: IStateMachine<IVideoStream | undefined>;
34
36
  videoTrack: IStateMachine<IVideoTrack | undefined>;
37
+ audioStream: IStateMachine<IAudioStream | undefined>;
35
38
  autoVideoTrackSwitching: IStateMachine<boolean>;
36
39
  autoVideoTrackLimits: IStateMachine<QualityLimits>;
37
- isLooped: IStateMachine<boolean>;
38
40
  externalTextTracks: IStateMachine<IExternalTextTrack[]>;
39
41
  internalTextTracks: IStateMachine<IInternalTextTrack[]>;
40
42
  currentTextTrack: IStateMachine<ITextTrack['id'] | undefined>;
@@ -45,13 +47,19 @@ export interface IProviderOutput {
45
47
  position$: IValueSubject<Seconds>;
46
48
  duration$: IValueSubject<Seconds>;
47
49
  volume$: IValueSubject<IVolumeState>;
48
- autoVideoTrackLimits$: IValueSubject<QualityLimits | undefined>;
49
- currentVideoTrack$: IValueSubject<IVideoTrack | undefined>;
50
50
  currentVideoSegmentLength$: IValueSubject<number>;
51
51
  currentAudioSegmentLength$: IValueSubject<number>;
52
+ availableVideoStreams$: IValueSubject<IVideoStream[]>;
53
+ currentVideoStream$: IValueSubject<IVideoStream | undefined>;
52
54
  availableVideoTracks$: IValueSubject<IVideoTrack[]>;
55
+ currentVideoTrack$: IValueSubject<IVideoTrack | undefined>;
56
+ availableAudioStreams$: IValueSubject<IAudioStream[]>;
57
+ currentAudioStream$: IValueSubject<IAudioStream | undefined>;
53
58
  availableAudioTracks$: IValueSubject<IAudioTrack[]>;
59
+ availableTextTracks$: IValueSubject<ITextTrack[]>;
60
+ currentTextTrack$: IValueSubject<ITextTrack['id'] | undefined>;
54
61
  isAudioAvailable$: IValueSubject<boolean>;
62
+ autoVideoTrackLimits$: IValueSubject<QualityLimits | undefined>;
55
63
  autoVideoTrackLimitingAvailable$: IValueSubject<boolean>;
56
64
  canChangePlaybackSpeed$: IValueSubject<boolean | undefined>;
57
65
  currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
@@ -60,8 +68,6 @@ export interface IProviderOutput {
60
68
  isLowLatency$: IValueSubject<boolean | undefined>;
61
69
  liveTime$: IValueSubject<Milliseconds | undefined>;
62
70
  liveBufferTime$: IValueSubject<Milliseconds | undefined>;
63
- availableTextTracks$: IValueSubject<ITextTrack[]>;
64
- currentTextTrack$: IValueSubject<ITextTrack['id'] | undefined>;
65
71
  hostname$: IValueSubject<string | undefined>;
66
72
  httpConnectionType$: IValueSubject<HttpConnectionType | undefined>;
67
73
  httpConnectionReused$: IValueSubject<boolean | undefined>;
@@ -80,4 +86,5 @@ export interface IProviderOutput {
80
86
  is3DVideo$: ISubject<boolean>;
81
87
  inPiP$: IValueSubject<boolean>;
82
88
  inFullscreen$: IValueSubject<boolean>;
89
+ playbackState$: IValueSubject<PlaybackState | string>;
83
90
  }
@@ -5,11 +5,11 @@ import { IStateMachine } from '../../../utils/StateMachine/types';
5
5
  interface IConnectData {
6
6
  logger: ILogger;
7
7
  video: HTMLVideoElement;
8
+ tracks: IVideoTrack[];
8
9
  droppedFramesChecker: ITuningConfig['droppedFramesChecker'];
9
10
  isAuto: IStateMachine<boolean>;
10
11
  playing$: IObservable<undefined>;
11
12
  pause$: IObservable<undefined>;
12
- tracks$: IObservable<IVideoTrack[]>;
13
13
  }
14
14
  declare class DroppedFramesManager {
15
15
  onDroopedVideoFramesLimit$: Subject<void>;
@@ -1,2 +1,5 @@
1
- export declare const allocate: (container: HTMLElement) => HTMLVideoElement;
1
+ import { ITuningConfig } from '../../../utils/tuningConfig';
2
+ type Constraints = Pick<ITuningConfig, 'audioVideoSyncRate'>;
3
+ export declare const allocate: (container: HTMLElement, { audioVideoSyncRate }: Constraints) => HTMLVideoElement;
2
4
  export declare const dispose: (element: HTMLVideoElement) => void;
5
+ export {};
@@ -0,0 +1,17 @@
1
+ import { IError, ISubject, IValueSubject } from '@vkontakte/videoplayer-shared';
2
+ import { IProviderOutput } from '../../providers/types';
3
+ import { IProviderEntry } from '../../providers/ProviderContainer/types';
4
+ export declare class VolumeMultiplierManager {
5
+ private providerOutput;
6
+ private provider$;
7
+ private volumeMultiplierError$;
8
+ private volumeMultiplier;
9
+ private static errorId;
10
+ private subscriptions;
11
+ private lastAudioContextResumeId;
12
+ constructor(providerOutput: IProviderOutput, provider$: IValueSubject<IProviderEntry>, volumeMultiplierError$: ISubject<IError>, volumeMultiplier: number, enabled: boolean);
13
+ private subscribe;
14
+ private isSupported;
15
+ private initAudioContextOnce;
16
+ destroy(): void;
17
+ }
@@ -0,0 +1,9 @@
1
+ interface IAudioContext {
2
+ audioCtx: AudioContext;
3
+ gainNode: GainNode;
4
+ }
5
+ /**
6
+ * Возвращает AudioContext
7
+ */
8
+ export declare function getAudioContext(): IAudioContext;
9
+ export {};
@@ -0,0 +1 @@
1
+ export { VolumeMultiplierManager } from './VolumeMultiplierManager';
@@ -0,0 +1,2 @@
1
+ export declare const isHDRSupported: () => boolean;
2
+ export declare const isHDREncoded: (codec: string) => boolean;
@@ -114,6 +114,8 @@ export type ITuningConfig = {
114
114
  androidPreferredFormat: AndroidPreferredFormat;
115
115
  preferCMAF: boolean;
116
116
  preferWebRTC: boolean;
117
+ preferMultiStream: boolean;
118
+ preferHDR: boolean;
117
119
  bigRequestMinInitSize: Byte;
118
120
  bigRequestMinDataSize: Byte;
119
121
  stripRangeHeader: boolean;
@@ -139,6 +141,7 @@ export type ITuningConfig = {
139
141
  manifestRetryInterval: number;
140
142
  manifestRetryMaxInterval: number;
141
143
  manifestRetryMaxCount: number;
144
+ audioVideoSyncRate: number;
142
145
  webrtc: {
143
146
  connectionRetryMaxNumber: number;
144
147
  };
@@ -160,6 +163,7 @@ export type ITuningConfig = {
160
163
  speedFadeTime: Milliseconds;
161
164
  speedFadeThreshold: Milliseconds;
162
165
  };
166
+ useVolumeMultiplier: boolean;
163
167
  };
164
168
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
165
169
  configName: ITuningConfig['configName'];