@vkontakte/videoplayer-core 2.0.105-dev.65651c8b.0 → 2.0.105-dev.7f999711.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.65651c8b.0",
3
+ "version": "2.0.105-dev.7f999711.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.36",
52
+ "@vkontakte/videoplayer-shared": "1.0.37-dev.9a1a0db8.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
  *
@@ -392,9 +398,11 @@ export interface IConfig {
392
398
  }
393
399
  export interface ISources {
394
400
  [VideoFormat.MPEG]?: IMpegSource;
401
+ [VideoFormat.DASH]?: IDashURLSource;
395
402
  [VideoFormat.DASH_SEP]?: IDashURLSource;
396
403
  [VideoFormat.DASH_WEBM]?: IDashURLSource;
397
404
  [VideoFormat.DASH_WEBM_AV1]?: IDashURLSource;
405
+ [VideoFormat.DASH_STREAMS]?: IDashURLSource;
398
406
  [VideoFormat.DASH_ONDEMAND]?: IDashURLSource;
399
407
  [VideoFormat.DASH_LIVE]?: IDashURLSource;
400
408
  [VideoFormat.DASH_LIVE_CMAF]?: IDashURLSource;
@@ -431,13 +439,14 @@ export type IHLSSource = URLSource;
431
439
  export type IHLSLiveSource = URLSourceWithSeek;
432
440
  export declare enum VideoFormat {
433
441
  MPEG = "MPEG",
434
- /** @deprecated Используйте DASH_SEP */
435
- DASH = "DASH_SEP",
442
+ /** @deprecated Больше не транскодируется */
443
+ DASH = "DASH",
436
444
  DASH_SEP = "DASH_SEP",
437
445
  /** @deprecated Используйте DASH_SEP */
438
446
  DASH_SEP_VK = "DASH_SEP",
439
447
  DASH_WEBM = "DASH_WEBM",
440
448
  DASH_WEBM_AV1 = "DASH_WEBM_AV1",
449
+ DASH_STREAMS = "DASH_STREAMS",
441
450
  /** @deprecated Используйте DASH_WEBM */
442
451
  DASH_WEBM_VK = "DASH_WEBM",
443
452
  DASH_ONDEMAND = "DASH_ONDEMAND",
@@ -455,6 +464,12 @@ export declare enum VideoFormat {
455
464
  HLS_LIVE_CMAF = "HLS_LIVE_CMAF",
456
465
  WEB_RTC_LIVE = "WEB_RTC_LIVE"
457
466
  }
467
+ export interface IVideoStream {
468
+ id: string;
469
+ language?: string;
470
+ hdr?: boolean;
471
+ label?: string;
472
+ }
458
473
  export interface IVideoTrack {
459
474
  id: string;
460
475
  quality: VideoQuality;
@@ -462,6 +477,12 @@ export interface IVideoTrack {
462
477
  size?: IRectangle;
463
478
  fps?: number;
464
479
  }
480
+ export interface IAudioStream {
481
+ id: string;
482
+ language?: string;
483
+ label?: string;
484
+ isDefault?: boolean;
485
+ }
465
486
  export interface IAudioTrack {
466
487
  id: string;
467
488
  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 +1,2 @@
1
1
  export declare const DASH_LIVE_UPDATE_INTERVAL_MS = 1000;
2
+ export declare const DASH_STALL_UPDATE_INTERVAL_MS = 1000;
@@ -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,9 +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
- private updateLowLatencyLive;
67
+ proceedLowLatencyLive(): void;
68
+ private updateLowLatencyLiveIfNeeded;
70
69
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
71
70
  setTarget(time: Milliseconds): void;
72
71
  setPreloadOnly(preloadOnly: boolean): void;
@@ -90,11 +89,15 @@ export declare class BufferManager {
90
89
  * @private
91
90
  */
92
91
  private onSomeByteRangesDataLoaded;
92
+ private onSomeByteRangesDataLoadedOld;
93
+ private onSomeByteRangesDataLoadedNew;
93
94
  private onSegmentFullyAppended;
94
95
  private abortSegment;
95
96
  private loadNextInit;
96
97
  private loadInit;
97
98
  private pruneBuffer;
99
+ private pruneBufferNew;
100
+ private pruneBufferOld;
98
101
  private abortBuffer;
99
102
  getDebugBufferState(): IRange<Milliseconds> | undefined;
100
103
  private detectGaps;
@@ -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>;
@@ -46,7 +47,7 @@ export declare class Player {
46
47
  livePositionFromPlayer$: IValueSubject<number>;
47
48
  liveEstimatedDelay: ISmoothedValue;
48
49
  timeInWaiting: number;
49
- isActiveLowLatency: boolean;
50
+ isActiveLowLatency$: IValueSubject<boolean>;
50
51
  private isUpdatingLive;
51
52
  private isJumpGapAfterSeekLive;
52
53
  private liveLastSeekOffset;
@@ -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,16 +2,16 @@ 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"
9
9
  }
10
10
  export declare enum LiveStatus {
11
- ActiveLowLatency = 0,
12
- LiveWithTargetOffset = 1,
13
- LiveForwardBuffering = 2,
14
- None = 3
11
+ ActiveLowLatency = "active_low_latency",
12
+ LiveWithTargetOffset = "live_with_target_offset",
13
+ LiveForwardBuffering = "live_forward_buffering",
14
+ None = "none"
15
15
  }
16
16
  export declare enum Profile {
17
17
  WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",
@@ -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,11 +1,9 @@
1
- import { Representation, Segment, SegmentReference, TemplateSegment, TemplateSegmentReference } from '../../../providers/DashProvider/lib/types';
1
+ import { Representation, Segment, SegmentReference, Stream, TemplateSegment, TemplateSegmentReference } from '../../../providers/DashProvider/lib/types';
2
2
  import { IAudioTrack, IInternalTextTrack, 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;
@@ -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>;
@@ -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>;
@@ -0,0 +1,2 @@
1
+ export declare const isHDRSupported: () => boolean;
2
+ export declare const isHDREncoded: (codec: string) => boolean;
@@ -19,6 +19,7 @@ export type ITuningConfig = {
19
19
  deviationFactor: number;
20
20
  lowLatency: {
21
21
  continuesByteSequenceInterval: Milliseconds;
22
+ maxLastEvaluationTimeout: Milliseconds;
22
23
  };
23
24
  };
24
25
  autoTrackSelection: {
@@ -113,6 +114,8 @@ export type ITuningConfig = {
113
114
  androidPreferredFormat: AndroidPreferredFormat;
114
115
  preferCMAF: boolean;
115
116
  preferWebRTC: boolean;
117
+ preferMultiStream: boolean;
118
+ preferHDR: boolean;
116
119
  bigRequestMinInitSize: Byte;
117
120
  bigRequestMinDataSize: Byte;
118
121
  stripRangeHeader: boolean;
@@ -128,6 +131,8 @@ export type ITuningConfig = {
128
131
  useDashAbortPartiallyFedSegment: boolean;
129
132
  useNativeHLSTextTracks: boolean;
130
133
  useManagedMediaSource: boolean;
134
+ useNewPruneBufferStrategy: boolean;
135
+ useNewPartialSegmentFeeding: boolean;
131
136
  isAudioDisabled: boolean;
132
137
  autoplayOnlyInActiveTab: boolean;
133
138
  dynamicImportTimeout: Milliseconds;