@vkontakte/videoplayer-core 2.0.75-beta.0 → 2.0.76

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, StartStatus, ISeekRequest, URLSource, RawSource, URLSourceWithSeek } from "./player/types";
1
+ import { VideoFormat, IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSource, ISeekRequest, URLSource, RawSource, URLSourceWithSeek } from "./player/types";
2
2
  import Player from "./player/Player";
3
3
  import { IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, ChromecastState, HttpConnectionType, IExternalTextTrack, ITextTrack, PlaybackRate } from "./player/types";
4
4
  import { VideoQuality, ExactVideoQuality } from "./utils/quality/types";
@@ -8,4 +8,4 @@ import { Subscription, Observable, Subject, ValueSubject } from '@vkontakte/vide
8
8
  * Версия sdk
9
9
  */
10
10
  declare const SDK_VERSION: string;
11
- export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, Subscription, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, VideoFormat, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, VideoQuality, ExactVideoQuality, Observable, Subject, ValueSubject, IRange, StartStatus, ISeekRequest, ICueSettings, SDK_VERSION, PlaybackRate, };
11
+ export { Player, IPlayer, PlaybackState, IPlayerInfo, IPlayerEvents, IConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ChromecastState, HttpConnectionType, 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, SDK_VERSION, PlaybackRate, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.75-beta.0",
3
+ "version": "2.0.76",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer core library based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -39,7 +39,7 @@
39
39
  "**/*.d.ts"
40
40
  ],
41
41
  "dependencies": {
42
- "@vkontakte/videoplayer-shared": "^1.0.17",
42
+ "@vkontakte/videoplayer-shared": "^1.0.18",
43
43
  "dashjs": "4.4.1",
44
44
  "hls.js": "1.2.1",
45
45
  "lodash": "4.17.21"
@@ -0,0 +1,92 @@
1
+ import { Byte, Kbps, Milliseconds, IRange } from '@vkontakte/videoplayer-shared';
2
+ export declare enum RepresentationKind {
3
+ VIDEO = "video",
4
+ AUDIO = "audio",
5
+ TEXT = "text"
6
+ }
7
+ export declare enum Profile {
8
+ WEBM_AS_IN_SPEC = "urn:mpeg:dash:profile:webm-on-demand:2012",
9
+ WEBM_AS_IN_FFMPEG = "urn:webm:dash:profile:webm-on-demand:2012"
10
+ }
11
+ export interface Representation {
12
+ id: string;
13
+ kind: RepresentationKind;
14
+ segmentReference: SegmentReference;
15
+ profiles: Array<Profile | string>;
16
+ duration?: Milliseconds;
17
+ bitrate: Kbps;
18
+ mime: string;
19
+ codecs: string;
20
+ width: number;
21
+ height: number;
22
+ fps?: number;
23
+ quality?: string;
24
+ }
25
+ export declare enum SegmentReferencingType {
26
+ BYTE_RANGE = "byteRange",
27
+ TEMPLATE = "template"
28
+ }
29
+ export declare type ByteRangeSegmentReference = {
30
+ type: SegmentReferencingType.BYTE_RANGE;
31
+ url: string;
32
+ initRange: IRange<Byte>;
33
+ indexRange?: IRange<Byte>;
34
+ };
35
+ export declare type TemplateSegmentReference = {
36
+ type: SegmentReferencingType.TEMPLATE;
37
+ baseUrl: string;
38
+ initUrl: string;
39
+ segments: {
40
+ url: string;
41
+ time: IRange<Milliseconds>;
42
+ }[];
43
+ };
44
+ export declare type SegmentReference = ByteRangeSegmentReference | TemplateSegmentReference;
45
+ export interface ByteRangeSegment {
46
+ status: SegmentStatus;
47
+ time: IRange<Milliseconds>;
48
+ byte: IRange<Byte>;
49
+ }
50
+ export interface TemplateSegment {
51
+ status: SegmentStatus;
52
+ time: IRange<Milliseconds>;
53
+ size: Byte | undefined;
54
+ url: string;
55
+ }
56
+ export declare type Segment = ByteRangeSegment | TemplateSegment;
57
+ export declare enum SegmentStatus {
58
+ NONE = "none",
59
+ DOWNLOADING = "downloading",
60
+ DOWNLOADED = "downloaded",
61
+ PARTIALLY_FED = "partially_fed",
62
+ PARTIALLY_EJECTED = "partially_ejected",
63
+ FED = "fed"
64
+ }
65
+ export interface Manifest {
66
+ duration: Milliseconds | undefined;
67
+ container: Container;
68
+ representations: {
69
+ [key in RepresentationKind]: Representation[];
70
+ };
71
+ }
72
+ export declare enum Container {
73
+ MP4 = "mp4",
74
+ WEBM = "webm"
75
+ }
76
+ export interface GenericContainerParser<InitData> {
77
+ validateData(data: DataView): boolean;
78
+ getIndexRange(init: InitData): IRange<Byte> | undefined;
79
+ parseInit(data: DataView): InitData;
80
+ parseSegments(data: DataView, init: InitData): Segment[];
81
+ parseFeedableSegmentChunk(data: DataView): DataView | null;
82
+ }
83
+ export interface WebmInit {
84
+ segmentStart: Byte;
85
+ segmentEnd: Byte;
86
+ timeScale: number;
87
+ segmentDuration: number;
88
+ cuesSeekPosition?: Byte;
89
+ }
90
+ export declare type WebmParser = GenericContainerParser<WebmInit>;
91
+ export declare type MpegParser = GenericContainerParser<null>;
92
+ export declare type ContainerParser = WebmParser | MpegParser;
@@ -2,7 +2,7 @@ import { HttpConnectionType, ICueSettings, StartEnd, PlaybackRate } from "./type
2
2
  import { QualityLimits, VideoQuality } from "../utils/quality/types";
3
3
  import { IOptionalTuningConfig } from "../utils/tuningConfig";
4
4
  import { IError, ILogEntry, Seconds, Subject, ValueSubject } from '@vkontakte/videoplayer-shared';
5
- import { ChromecastState, IConfig, IExternalTextTrack, IPlayer, ISeekRequest, ITextTrack, PlaybackState, StartStatus, VideoFormat } from './types';
5
+ import { ChromecastState, IConfig, IExternalTextTrack, IPlayer, ISeekRequest, ITextTrack, PlaybackState, VideoFormat } from './types';
6
6
  export default class Player implements IPlayer {
7
7
  private subscription;
8
8
  private domContainer;
@@ -54,8 +54,7 @@ export default class Player implements IPlayer {
54
54
  };
55
55
  events: {
56
56
  inited$: Subject<void>;
57
- started$: Subject<boolean>;
58
- startAttempt$: Subject<StartStatus>;
57
+ started$: Subject<void>;
59
58
  willPause$: Subject<void>;
60
59
  willResume$: Subject<void>;
61
60
  willDestruct$: Subject<void>;
package/player/types.d.ts CHANGED
@@ -76,13 +76,8 @@ export interface IPlayerEvents {
76
76
  /**
77
77
  * Видео начало воспроизведение в первый раз
78
78
  * Соответствует первому для видео внешнему запуску воспроизведения
79
- * Параметр содержит значение isMuted (true если видео заиграло без звука, false если со звуком)
80
79
  */
81
- started$: IObservable<boolean>;
82
- /**
83
- * Попытка начать играть видео
84
- */
85
- startAttempt$: IObservable<StartStatus>;
80
+ started$: IObservable<void>;
86
81
  /**
87
82
  * Запрошена пауза
88
83
  */
@@ -310,6 +305,7 @@ export interface IConfig {
310
305
  container: string | HTMLElement;
311
306
  sources: ISources;
312
307
  meta?: IMetadata;
308
+ failoverHosts?: string[];
313
309
  }
314
310
  export interface ISources {
315
311
  [VideoFormat.MPEG]?: IMpegSource;
@@ -329,7 +325,7 @@ export interface IMetadata {
329
325
  subtitle?: string;
330
326
  videoId?: string;
331
327
  }
332
- declare type QualitySetSource = Partial<Record<VideoQuality, string>>;
328
+ export declare type QualitySetSource = Partial<Record<VideoQuality, string>>;
333
329
  export declare type URLSource = {
334
330
  type: 'url';
335
331
  url: string;
@@ -410,11 +406,6 @@ export interface ISeekRequest {
410
406
  from: Seconds;
411
407
  to: Seconds;
412
408
  }
413
- export declare enum StartStatus {
414
- SuccessWithSound = "success_with_sound",
415
- SuccessWithoutSound = "success_without_sound",
416
- Failed = "failed"
417
- }
418
409
  export declare enum HttpConnectionType {
419
410
  HTTP1 = "http1",
420
411
  HTTP2 = "http2",
@@ -7,6 +7,7 @@ interface IParams extends IProviderDependencies {
7
7
  container: HTMLElement;
8
8
  sources: ISources;
9
9
  meta: IMetadata;
10
+ failoverHosts: string[];
10
11
  screenFormatsPriority: VideoFormat[];
11
12
  chromecastFormatsPriority: VideoFormat[];
12
13
  desiredState: IDesiredState;
@@ -47,6 +48,7 @@ export default class ProviderContainer implements IProviderContainer {
47
48
  private chromecastFormatsIterator;
48
49
  private log;
49
50
  private params;
51
+ private failoverIndex;
50
52
  constructor(params: IParams);
51
53
  init(): void;
52
54
  destroy(): void;
@@ -61,6 +63,7 @@ export default class ProviderContainer implements IProviderContainer {
61
63
  private chooseFormat;
62
64
  private skipFormat;
63
65
  private handleNoFormatsError;
66
+ private applyFailoverHost;
64
67
  private initProviderErrorHandling;
65
68
  }
66
69
  export {};