@vkontakte/videoplayer-core 2.0.105-dev.17a808f4.0 → 2.0.105-dev.35548197.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.17a808f4.0",
3
+ "version": "2.0.105-dev.35548197.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.0bef53b3.0",
52
+ "@vkontakte/videoplayer-shared": "1.0.37-dev.7467b46e.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, IVideoStream, IAudioStream } from './player/types';
4
+ import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, ChromecastState, HttpConnectionType, IExternalTextTrack, ITextTrack, PlaybackRate } 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, IVideoStream, IAudioStream, };
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, };
@@ -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, IAudioStream, IAudioTrack, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, StartEnd, Surface, VideoFormat } from './types';
3
+ import { ChromecastState, HttpConnectionType, IAudioTrack, IConfig, ICueSettings, IExternalTextTrack, IPlayer, ISeekRequest, ISources, ITextTrack, PlaybackRate, PlaybackState, StartEnd, Surface, VideoFormat } from './types';
4
4
  export default class Player implements IPlayer {
5
5
  private subscription;
6
6
  private domContainer;
@@ -22,18 +22,14 @@ 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>;
27
25
  availableQualities$: ValueSubject<VideoQuality[]>;
28
26
  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>;
37
33
  currentPlaybackRate$: ValueSubject<number>;
38
34
  currentBuffer$: ValueSubject<StartEnd<number>>;
39
35
  isBuffering$: ValueSubject<boolean>;
@@ -113,8 +109,6 @@ export default class Player implements IPlayer {
113
109
  seekPercent(percent: number): IPlayer;
114
110
  setVolume(percent: number): IPlayer;
115
111
  setMuted(isMuted: boolean): IPlayer;
116
- setVideoStream(stream: IVideoStream): IPlayer;
117
- setAudioStream(stream: IAudioStream): IPlayer;
118
112
  setQuality(quality: VideoQuality): IPlayer;
119
113
  setAutoQuality(enable: boolean): IPlayer;
120
114
  setAutoQualityLimits(limits: QualityLimits): IPlayer;
@@ -33,8 +33,6 @@ 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;
38
36
  setQuality(quality: VideoQuality): IPlayer;
39
37
  setAutoQuality(enable: boolean): IPlayer;
40
38
  setAutoQualityLimits(limit: QualityLimits): IPlayer;
@@ -205,10 +203,6 @@ export interface IPlayerInfo {
205
203
  * default value: `1`
206
204
  */
207
205
  volume$: IValueObservable<number>;
208
- currentVideoStream$: IValueObservable<IVideoStream | undefined>;
209
- availableVideoStreams$: IValueObservable<IVideoStream[]>;
210
- currentAudioStream$: IValueObservable<IAudioStream | undefined>;
211
- availableAudioStreams$: IValueObservable<IAudioStream[]>;
212
206
  /**
213
207
  * Список доступных качеств. Отсортированы по возрастанию.
214
208
  *
@@ -394,14 +388,13 @@ export interface IConfig {
394
388
  sources: ISources;
395
389
  meta?: IMetadata;
396
390
  failoverHosts?: string[];
391
+ volumeMultiplier?: number;
397
392
  }
398
393
  export interface ISources {
399
394
  [VideoFormat.MPEG]?: IMpegSource;
400
- [VideoFormat.DASH]?: IDashURLSource;
401
395
  [VideoFormat.DASH_SEP]?: IDashURLSource;
402
396
  [VideoFormat.DASH_WEBM]?: IDashURLSource;
403
397
  [VideoFormat.DASH_WEBM_AV1]?: IDashURLSource;
404
- [VideoFormat.DASH_STREAMS]?: IDashURLSource;
405
398
  [VideoFormat.DASH_ONDEMAND]?: IDashURLSource;
406
399
  [VideoFormat.DASH_LIVE]?: IDashURLSource;
407
400
  [VideoFormat.DASH_LIVE_CMAF]?: IDashURLSource;
@@ -438,14 +431,13 @@ export type IHLSSource = URLSource;
438
431
  export type IHLSLiveSource = URLSourceWithSeek;
439
432
  export declare enum VideoFormat {
440
433
  MPEG = "MPEG",
441
- /** @deprecated Больше не транскодируется */
442
- DASH = "DASH",
434
+ /** @deprecated Используйте DASH_SEP */
435
+ DASH = "DASH_SEP",
443
436
  DASH_SEP = "DASH_SEP",
444
437
  /** @deprecated Используйте DASH_SEP */
445
438
  DASH_SEP_VK = "DASH_SEP",
446
439
  DASH_WEBM = "DASH_WEBM",
447
440
  DASH_WEBM_AV1 = "DASH_WEBM_AV1",
448
- DASH_STREAMS = "DASH_STREAMS",
449
441
  /** @deprecated Используйте DASH_WEBM */
450
442
  DASH_WEBM_VK = "DASH_WEBM",
451
443
  DASH_ONDEMAND = "DASH_ONDEMAND",
@@ -463,12 +455,6 @@ export declare enum VideoFormat {
463
455
  HLS_LIVE_CMAF = "HLS_LIVE_CMAF",
464
456
  WEB_RTC_LIVE = "WEB_RTC_LIVE"
465
457
  }
466
- export interface IVideoStream {
467
- id: string;
468
- language?: string;
469
- hdr?: boolean;
470
- label?: string;
471
- }
472
458
  export interface IVideoTrack {
473
459
  id: string;
474
460
  quality: VideoQuality;
@@ -476,12 +462,6 @@ export interface IVideoTrack {
476
462
  size?: IRectangle;
477
463
  fps?: number;
478
464
  }
479
- export interface IAudioStream {
480
- id: string;
481
- language?: string;
482
- label?: string;
483
- isDefault?: boolean;
484
- }
485
465
  export interface IAudioTrack {
486
466
  id: string;
487
467
  bitrate?: Kbps;
@@ -1,10 +1,10 @@
1
1
  import { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVideoTrack } from '../../player/types';
2
- import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation, Stream } from './lib/types';
2
+ import { CommonInit, IProviderSubscriptionInfo, ProviderState, Representation } from '../../providers/DashProvider/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, Milliseconds, ValueSubject } from '@vkontakte/videoplayer-shared';
7
+ import { IRectangle, ISubscription, IValueSubject, 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,20 +22,15 @@ 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 videoTracksMap: Map<IVideoTrack, {
26
- stream: Stream;
25
+ protected videoTracks$: IValueSubject<{
26
+ track: IVideoTrack;
27
27
  representation: Representation;
28
- }>;
29
- protected audioTracksMap: Map<IAudioTrack, {
30
- stream: Stream;
28
+ }[]>;
29
+ protected audioTracks: {
30
+ track: IAudioTrack;
31
31
  representation: 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[]>;
32
+ }[];
33
+ protected audioRepresentations: Map<string, Representation>;
39
34
  protected videoTrackSwitchHistory: TrackHistory;
40
35
  protected textTracks: {
41
36
  track: IInternalTextTrack;
@@ -46,7 +41,7 @@ export default abstract class BaseDashProvider implements IProvider {
46
41
  protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
47
42
  protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
48
43
  protected subscribe(): void;
49
- protected selectVideoAudioRepresentations(): [Representation, Representation] | undefined;
44
+ protected selectVideoRepresentation(): Representation | undefined;
50
45
  protected prepare(manifestOffset?: number): void;
51
46
  protected syncPlayback: () => undefined;
52
47
  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: number;
@@ -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, Manifest, Representation, StreamKind, Stream } from './types';
4
+ import { CommonInit, Container, Manifest, Representation, RepresentationKind } from './types';
5
5
  export interface Dependencies {
6
6
  fetcher: Fetcher;
7
7
  tuning: ITuningConfig;
@@ -23,6 +23,8 @@ export declare class BufferManager {
23
23
  gaps: Gap[];
24
24
  private subscription;
25
25
  private kind;
26
+ private container;
27
+ private containerParser;
26
28
  private initData;
27
29
  private parsedInitData;
28
30
  private representations;
@@ -54,7 +56,7 @@ export declare class BufferManager {
54
56
  private isSeekingLive;
55
57
  private index;
56
58
  private loadByteRangeSegmentsTimeoutId;
57
- constructor(kind: StreamKind, mediaSource: MediaSource, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
59
+ constructor(kind: RepresentationKind, mediaSource: MediaSource, container: Container, representations: Representation[], { fetcher, tuning, getCurrentPosition, isActiveLowLatency, compatibilityMode, manifest }: Dependencies);
58
60
  startWith: (param_0: string) => Promise<void | undefined>;
59
61
  switchTo: (param_0: string) => Promise<void | undefined>;
60
62
  abort(): void;
@@ -62,8 +64,9 @@ export declare class BufferManager {
62
64
  private searchGaps;
63
65
  private getActualLiveStartingSegments;
64
66
  getLiveSegmentsToLoadState(manifest: Manifest | null): IRange<Milliseconds> | undefined;
65
- seekLive: (param_0: Stream[] | undefined) => Promise<void | undefined>;
67
+ seekLive: (param_0: Representation[] | undefined) => Promise<void | undefined>;
66
68
  updateLive(manifest: Manifest | null): void;
69
+ proceedLowLatencyLive(): void;
67
70
  private updateLowLatencyLive;
68
71
  findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
69
72
  setTarget(time: Milliseconds): void;
@@ -93,6 +96,8 @@ export declare class BufferManager {
93
96
  private loadNextInit;
94
97
  private loadInit;
95
98
  private pruneBuffer;
99
+ private pruneBufferNew;
100
+ private pruneBufferOld;
96
101
  private abortBuffer;
97
102
  getDebugBufferState(): IRange<Milliseconds> | undefined;
98
103
  private detectGaps;
@@ -1,5 +1,5 @@
1
1
  import { HttpConnectionType } from '../../../player/types';
2
- import { CommonInit, Manifest, Representation, StreamKind } from './types';
2
+ import { CommonInit, Manifest, Representation, RepresentationKind } 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,7 +32,6 @@ 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>;
36
35
  currentVideoSegmentLength$: IValueSubject<number>;
37
36
  currentAudioSegmentLength$: IValueSubject<number>;
38
37
  error$: ISubject<IError>;
@@ -47,7 +46,7 @@ export declare class Player {
47
46
  livePositionFromPlayer$: IValueSubject<number>;
48
47
  liveEstimatedDelay: ISmoothedValue;
49
48
  timeInWaiting: number;
50
- isActiveLowLatency: boolean;
49
+ isActiveLowLatency$: IValueSubject<boolean>;
51
50
  private isUpdatingLive;
52
51
  private isJumpGapAfterSeekLive;
53
52
  private liveLastSeekOffset;
@@ -62,11 +61,11 @@ export declare class Player {
62
61
  seekLive(nextOffset: Milliseconds): Promise<void>;
63
62
  initRepresentations: (param_0: string, param_1: string | undefined, param_2: import("../../../player/types").URLSource | undefined) => Promise<void | undefined>;
64
63
  initBuffer(): void;
65
- switchRepresentation(kind: StreamKind, id: Representation['id']): Promise<void>;
64
+ switchRepresentation(kind: RepresentationKind, id: Representation['id']): Promise<void>;
66
65
  seek(requestedPosition: Milliseconds, forcePrecise: boolean): void;
67
66
  stop(): void;
68
67
  setBufferTarget(time: Milliseconds): void;
69
- getStreams(): Manifest['streams'] | undefined;
68
+ getRepresentations(): Manifest['representations'] | undefined;
70
69
  setPreloadOnly(preloadOnly: boolean): void;
71
70
  destroy(): void;
72
71
  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 StreamKind {
5
+ export declare enum RepresentationKind {
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: StreamKind;
22
+ kind: RepresentationKind;
23
23
  segmentReference: SegmentReference;
24
24
  profiles: Array<Profile | string>;
25
25
  duration?: Milliseconds;
@@ -78,24 +78,19 @@ 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
- }
91
81
  export interface Manifest {
92
82
  dynamic: boolean;
93
83
  liveAvailabilityStartTime: Milliseconds | undefined;
94
84
  duration: Milliseconds | undefined;
95
- streams: {
96
- [key in StreamKind]: Stream[];
85
+ container: Container;
86
+ representations: {
87
+ [key in RepresentationKind]: Representation[];
97
88
  };
98
89
  }
90
+ export declare enum Container {
91
+ MP4 = "mp4",
92
+ WEBM = "webm"
93
+ }
99
94
  export declare enum ProjectionType {
100
95
  RECTANGULAR = 0,
101
96
  EQUIRECTANGULAR = 1,
@@ -1,9 +1,11 @@
1
- import { Representation, Segment, SegmentReference, Stream, TemplateSegment, TemplateSegmentReference } from '../../../providers/DashProvider/lib/types';
1
+ import { Representation, Segment, SegmentReference, 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;
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 & {
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;
7
9
  url: string;
8
10
  isAuto: boolean;
9
11
  }) => IInternalTextTrack;
@@ -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_STREAMS | VideoFormat.DASH_ONDEMAND | VideoFormat.HLS | VideoFormat.HLS_ONDEMAND;
7
- type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' | 'preferCMAF' | 'preferWebRTC' | 'preferMultiStream'>;
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'>;
8
8
  /**
9
9
  * Все ONDEMAND форматы ниже готовых эквивалентов потому что ONDEMAND требует серверных ресурсов для нарезки.
10
10
  * Из дашей VP9 (WEBM) самый оптимальный
@@ -12,10 +12,9 @@ type Constraints = Pick<ITuningConfig, 'webmCodec' | 'androidPreferredFormat' |
12
12
  * HLS нативно поддерживается в Сафари и на мобильных девайсах, при этом на андроиде он играет плохо
13
13
  * MPEG – более-менее пуленепробиваемый формат который играет везде и есть у всех видео (за редкими исключениями), но он не адаптивный
14
14
  */
15
- export declare const getFormatsPriority: ({ webmCodec, androidPreferredFormat, preferMultiStream }: Constraints) => VodFormat[];
15
+ export declare const getFormatsPriority: ({ webmCodec, androidPreferredFormat }: 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;
21
20
  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, IAudioStream, IAudioTrack, ICueSettings, ISources, IVideoStream, SeekState } from '../player/types';
4
+ import { HttpConnectionType, IAudioTrack, ICueSettings, ISources, 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,12 +31,10 @@ 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>;
36
34
  videoTrack: IStateMachine<IVideoTrack | undefined>;
37
- audioStream: IStateMachine<IAudioStream | undefined>;
38
35
  autoVideoTrackSwitching: IStateMachine<boolean>;
39
36
  autoVideoTrackLimits: IStateMachine<QualityLimits>;
37
+ isLooped: IStateMachine<boolean>;
40
38
  externalTextTracks: IStateMachine<IExternalTextTrack[]>;
41
39
  internalTextTracks: IStateMachine<IInternalTextTrack[]>;
42
40
  currentTextTrack: IStateMachine<ITextTrack['id'] | undefined>;
@@ -47,19 +45,13 @@ export interface IProviderOutput {
47
45
  position$: IValueSubject<Seconds>;
48
46
  duration$: IValueSubject<Seconds>;
49
47
  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>;
54
52
  availableVideoTracks$: IValueSubject<IVideoTrack[]>;
55
- currentVideoTrack$: IValueSubject<IVideoTrack | undefined>;
56
- availableAudioStreams$: IValueSubject<IAudioStream[]>;
57
- currentAudioStream$: IValueSubject<IAudioStream | undefined>;
58
53
  availableAudioTracks$: IValueSubject<IAudioTrack[]>;
59
- availableTextTracks$: IValueSubject<ITextTrack[]>;
60
- currentTextTrack$: IValueSubject<ITextTrack['id'] | undefined>;
61
54
  isAudioAvailable$: IValueSubject<boolean>;
62
- autoVideoTrackLimits$: IValueSubject<QualityLimits | undefined>;
63
55
  autoVideoTrackLimitingAvailable$: IValueSubject<boolean>;
64
56
  canChangePlaybackSpeed$: IValueSubject<boolean | undefined>;
65
57
  currentBuffer$: IValueSubject<IRange<Seconds> | undefined>;
@@ -68,6 +60,8 @@ export interface IProviderOutput {
68
60
  isLowLatency$: IValueSubject<boolean | undefined>;
69
61
  liveTime$: IValueSubject<Milliseconds | undefined>;
70
62
  liveBufferTime$: IValueSubject<Milliseconds | undefined>;
63
+ availableTextTracks$: IValueSubject<ITextTrack[]>;
64
+ currentTextTrack$: IValueSubject<ITextTrack['id'] | undefined>;
71
65
  hostname$: IValueSubject<string | undefined>;
72
66
  httpConnectionType$: IValueSubject<HttpConnectionType | undefined>;
73
67
  httpConnectionReused$: IValueSubject<boolean | undefined>;
@@ -86,4 +80,5 @@ export interface IProviderOutput {
86
80
  is3DVideo$: ISubject<boolean>;
87
81
  inPiP$: IValueSubject<boolean>;
88
82
  inFullscreen$: IValueSubject<boolean>;
83
+ playbackState$: IValueSubject<PlaybackState | string>;
89
84
  }
@@ -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[];
9
8
  droppedFramesChecker: ITuningConfig['droppedFramesChecker'];
10
9
  isAuto: IStateMachine<boolean>;
11
10
  playing$: IObservable<undefined>;
12
11
  pause$: IObservable<undefined>;
12
+ tracks$: IObservable<IVideoTrack[]>;
13
13
  }
14
14
  declare class DroppedFramesManager {
15
15
  onDroopedVideoFramesLimit$: Subject<void>;
@@ -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';
@@ -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,8 +114,6 @@ export type ITuningConfig = {
113
114
  androidPreferredFormat: AndroidPreferredFormat;
114
115
  preferCMAF: boolean;
115
116
  preferWebRTC: boolean;
116
- preferMultiStream: boolean;
117
- preferHDR: boolean;
118
117
  bigRequestMinInitSize: Byte;
119
118
  bigRequestMinDataSize: Byte;
120
119
  stripRangeHeader: boolean;
@@ -130,6 +129,7 @@ export type ITuningConfig = {
130
129
  useDashAbortPartiallyFedSegment: boolean;
131
130
  useNativeHLSTextTracks: boolean;
132
131
  useManagedMediaSource: boolean;
132
+ useNewPruneBufferStrategy: boolean;
133
133
  isAudioDisabled: boolean;
134
134
  autoplayOnlyInActiveTab: boolean;
135
135
  dynamicImportTimeout: Milliseconds;
@@ -159,6 +159,7 @@ export type ITuningConfig = {
159
159
  speedFadeTime: Milliseconds;
160
160
  speedFadeThreshold: Milliseconds;
161
161
  };
162
+ useVolumeMultiplier: boolean;
162
163
  };
163
164
  export type IOptionalTuningConfig = RecursivePartial<ITuningConfig> & {
164
165
  configName: ITuningConfig['configName'];
@@ -1,2 +0,0 @@
1
- import { ContainerParser } from '../../../../providers/DashProvider/lib/types';
2
- export declare const getContainerParser: (mime: string) => ContainerParser;