@vkontakte/videoplayer-core 2.0.66 → 2.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/es2015.cjs.js +4 -4
  2. package/es2015.esm.js +4 -4
  3. package/es2018.cjs.js +4 -4
  4. package/es2018.esm.js +4 -4
  5. package/esnext.cjs.js +4 -4
  6. package/esnext.esm.js +4 -4
  7. package/package.json +29 -4
  8. package/packages/{sdk → core}/src/providers/ChromecastProvider/ChromecastInitializer/types.d.ts +0 -0
  9. package/packages/{sdk → core}/src/providers/DashIFProvider/dashjsTypes.d.ts +0 -0
  10. package/packages/{sdk → core}/src/providers/DashLiveProvider/types.d.ts +0 -0
  11. package/packages/{sdk → core}/src/providers/DashLiveProvider/utils/FilesFetcher.d.ts +0 -0
  12. package/packages/{sdk → core}/src/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +0 -0
  13. package/packages/{sdk → core}/src/providers/DashLiveProvider/utils/ThroughputEstimator.d.ts +0 -0
  14. package/packages/{sdk → core}/src/providers/DashLiveProvider/utils/liveDashPlayerUtil.d.ts +0 -0
  15. package/packages/{sdk → core}/src/providers/DashProvider/types.d.ts +0 -0
  16. package/packages/{sdk → core}/src/providers/DashProvider/utils/DashLite.d.ts +0 -0
  17. package/packages/{sdk → core}/src/providers/DashProvider/utils/stream.d.ts +0 -0
  18. package/packages/{sdk → core}/src/providers/DashProvider/utils/xhr2.d.ts +0 -0
  19. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/buffer.d.ts +0 -0
  20. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/ebml.d.ts +0 -0
  21. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/fetcher.d.ts +0 -0
  22. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/isobmff.d.ts +0 -0
  23. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/mpd.d.ts +0 -0
  24. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/sourceBufferTaskQueue.d.ts +0 -0
  25. package/packages/{sdk → core}/src/providers/DashVKProvider/lib/webm.d.ts +0 -0
  26. package/packages/{sdk → core}/src/providers/ProviderContainer/types.d.ts +0 -0
  27. package/packages/{sdk → core}/src/providers/types.d.ts +0 -0
  28. package/packages/{sdk → core}/src/providers/utils/LiveOffset/types.d.ts +0 -0
  29. package/packages/{sdk → core}/src/utils/StateMachine/types.d.ts +0 -0
  30. package/packages/{sdk → core}/src/utils/StatefulIterator/StatefulIterator.spec.d.ts +0 -0
  31. package/packages/{sdk → core}/src/utils/buffer/getTotalBufferDuration.d.ts +0 -0
  32. package/packages/{sdk → core}/src/utils/buffer/isPositionBuffered.d.ts +0 -0
  33. package/packages/{sdk → core}/src/utils/buffer/types.d.ts +0 -0
  34. package/packages/{sdk → core}/src/utils/link.d.ts +0 -0
  35. package/packages/{sdk → core}/src/utils/quality/quality.spec.d.ts +0 -0
  36. package/player/Player.d.ts +1 -1
  37. package/player/types.d.ts +9 -8
  38. package/player/utils/optimisticPosition.d.ts +1 -1
  39. package/providers/ProviderContainer/utils/formatsSupport.d.ts +2 -1
  40. package/providers/utils/forcePlay.d.ts +1 -1
  41. package/providers/utils/syncDesiredState.d.ts +2 -2
  42. package/utils/buffer/isPositionBuffered.d.ts +3 -0
  43. package/utils/tuningConfig.d.ts +2 -0
  44. package/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +0 -135
  45. package/providers/DashProvider/utils/DashLite.d.ts +0 -60
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer-core",
3
- "version": "2.0.66",
3
+ "version": "2.0.68",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer core library based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -8,15 +8,40 @@
8
8
  "main": "esnext.cjs.js",
9
9
  "module": "esnext.esm.js",
10
10
  "types": "index.d.ts",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "import": "esnext.esm.js",
15
+ "require": "esnext.cjs.js"
16
+ },
17
+ "./esnext": {
18
+ "import": "esnext.esm.js",
19
+ "require": "esnext.cjs.js"
20
+ },
21
+ "./es2018": {
22
+ "import": "es2018.esm.js",
23
+ "require": "es2018.cjs.js"
24
+ },
25
+ "./es2015": {
26
+ "import": "es2015.esm.js",
27
+ "require": "es2015.cjs.js"
28
+ },
29
+ "./esnext.esm.js": "esnext.esm.js",
30
+ "./esnext.cjs.js": "esnext.cjs.js",
31
+ "./es2018.esm.js": "es2018.esm.js",
32
+ "./es2018.cjs.js": "es2018.cjs.js",
33
+ "./es2015.esm.js": "es2015.esm.js",
34
+ "./es2015.cjs.js": "es2015.cjs.js"
35
+ },
11
36
  "files": [
12
37
  "*.cjs.js",
13
38
  "*.esm.js",
14
39
  "**/*.d.ts"
15
40
  ],
16
41
  "dependencies": {
17
- "@vkontakte/videoplayer-shared": "^1.0.15",
18
- "dashjs": "4.4.0",
19
- "hls.js": "1.1.5",
42
+ "@vkontakte/videoplayer-shared": "^1.0.17",
43
+ "dashjs": "4.4.1",
44
+ "hls.js": "1.2.1",
20
45
  "lodash": "4.17.21"
21
46
  }
22
47
  }
File without changes
File without changes
@@ -28,7 +28,7 @@ export default class Player implements IPlayer {
28
28
  isAutoQualityEnabled$: ValueSubject<boolean>;
29
29
  autoQualityLimitingAvailable$: ValueSubject<boolean>;
30
30
  autoQualityLimits$: ValueSubject<QualityLimits>;
31
- currentBuffer$: ValueSubject<StartEnd<number> | undefined>;
31
+ currentBuffer$: ValueSubject<StartEnd<number>>;
32
32
  isBuffering$: ValueSubject<boolean>;
33
33
  isStalled$: ValueSubject<boolean>;
34
34
  isEnded$: ValueSubject<boolean>;
package/player/types.d.ts CHANGED
@@ -312,16 +312,12 @@ export interface ISources {
312
312
  [VideoFormat.MPEG]?: IMpegSource;
313
313
  [VideoFormat.DASH]?: IDashSource;
314
314
  [VideoFormat.DASH_SEP]?: IDashURLSource;
315
- [VideoFormat.DASH_SEP_VK]?: IDashURLSource;
316
- [VideoFormat.DASH_WEBM_VK]?: IDashURLSource;
317
315
  [VideoFormat.DASH_WEBM]?: IDashURLSource;
318
316
  [VideoFormat.DASH_ONDEMAND]?: IDashURLSource;
319
- [VideoFormat.DASH_ONDEMAND_VK]?: IDashURLSource;
320
317
  [VideoFormat.DASH_LIVE]?: IDashURLSource;
321
318
  [VideoFormat.DASH_LIVE_WEBM]?: IDashURLSource;
322
319
  [VideoFormat.HLS]?: IHLSSource;
323
320
  [VideoFormat.HLS_ONDEMAND]?: IHLSSource;
324
- [VideoFormat.HLS_JS]?: IHLSSource;
325
321
  [VideoFormat.HLS_LIVE]?: IHLSLiveSource;
326
322
  }
327
323
  export interface IMetadata {
@@ -350,16 +346,21 @@ export declare enum VideoFormat {
350
346
  MPEG = "MPEG",
351
347
  DASH = "DASH",
352
348
  DASH_SEP = "DASH_SEP",
353
- DASH_SEP_VK = "DASH_SEP_VK",
349
+ /** @deprecated Используйте DASH_SEP */
350
+ DASH_SEP_VK = "DASH_SEP",
354
351
  DASH_WEBM = "DASH_WEBM",
355
- DASH_WEBM_VK = "DASH_WEBM_VK",
352
+ /** @deprecated Используйте DASH_WEBM */
353
+ DASH_WEBM_VK = "DASH_WEBM",
356
354
  DASH_ONDEMAND = "DASH_ONDEMAND",
357
- DASH_ONDEMAND_VK = "DASH_ONDEMAND_VK",
355
+ /** @deprecated Используйте DASH_ONDEMAND */
356
+ DASH_ONDEMAND_VK = "DASH_ONDEMAND",
358
357
  DASH_LIVE = "DASH_LIVE",
358
+ /** @deprecated */
359
359
  DASH_LIVE_WEBM = "DASH_LIVE_WEBM",
360
360
  HLS = "HLS",
361
361
  HLS_ONDEMAND = "HLS_ONDEMAND",
362
- HLS_JS = "HLS_JS",
362
+ /** @deprecated Используйте HLS */
363
+ HLS_JS = "HLS",
363
364
  HLS_LIVE = "HLS_LIVE"
364
365
  }
365
366
  export interface IVideoTrack {
@@ -5,8 +5,8 @@ interface IParams {
5
5
  seekState: IStateMachine<SeekState>;
6
6
  position$: IValueObservable<Seconds>;
7
7
  }
8
- declare const _default: ({ seekState, position$ }: IParams) => IObservable<Seconds>;
9
8
  /**
10
9
  * Реализует оптимистичное изменение позиции при перемотке
11
10
  */
11
+ declare const _default: ({ seekState, position$ }: IParams) => IObservable<Seconds>;
12
12
  export default _default;
@@ -1,3 +1,4 @@
1
1
  import { VideoFormat } from "../../../player/types";
2
+ export declare const nativeHlsSupported: any;
2
3
  export declare const getSupportedCodecs: () => string[];
3
- export declare const filterAvailableFormats: (formats: VideoFormat[]) => VideoFormat[];
4
+ export declare const filterAvailableFormats: (formats: VideoFormat[], useHlsJs?: boolean) => VideoFormat[];
@@ -1,7 +1,7 @@
1
- declare const _default: (video: HTMLVideoElement) => Promise<boolean>;
2
1
  /**
3
2
  * Пытаемся запустить видео обходя ошибку `NotAllowedError` путём включения `mute`.
4
3
  * @param {HTMLVideoElement} video - видеообъект
5
4
  * @return {Promise}<boolean> - получилось начать воспроизведение
6
5
  */
6
+ declare const _default: (video: HTMLVideoElement) => Promise<boolean>;
7
7
  export default _default;
@@ -6,6 +6,6 @@ declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | unde
6
6
  changed$?: IObservable<Value | undefined> | undefined;
7
7
  onError?: IListener<unknown> | undefined;
8
8
  }) => ISubscription;
9
- export declare const syncVideoLooped: (video: HTMLVideoElement, desiredState: IStateMachine<boolean>, onError?: IListener<unknown> | undefined) => ISubscription;
10
- export declare const syncVideoVolumeState: (video: HTMLVideoElement, desiredState: IStateMachine<IVolumeState>, changed$: IObservable<IVolumeState>, onError?: IListener<unknown> | undefined) => ISubscription;
9
+ export declare const syncVideoLooped: (video: HTMLVideoElement, desiredState: IStateMachine<boolean>, onError?: IListener<Error | unknown>) => ISubscription;
10
+ export declare const syncVideoVolumeState: (video: HTMLVideoElement, desiredState: IStateMachine<IVolumeState>, changed$: IObservable<IVolumeState>, onError?: IListener<Error | unknown>) => ISubscription;
11
11
  export default syncDesiredState;
@@ -0,0 +1,3 @@
1
+ import { Milliseconds } from '@vkontakte/videoplayer-shared';
2
+ declare const _default: (timeRanges: TimeRanges, position: Milliseconds) => boolean;
3
+ export default _default;
@@ -63,6 +63,8 @@ export declare type ITuningConfig = {
63
63
  stallIgnoreThreshold: Milliseconds;
64
64
  gapWatchdogInterval: Milliseconds;
65
65
  requestQuick: boolean;
66
+ useDashJs: boolean;
67
+ useHlsJs: boolean;
66
68
  };
67
69
  export declare type IOptionalTuningConfig = {
68
70
  [key in keyof ITuningConfig]?: Partial<ITuningConfig[key]>;
@@ -1,135 +0,0 @@
1
- import { Milliseconds } from '@vkontakte/videoplayer-shared';
2
- import { IRepresentation } from '../types';
3
- interface IParams {
4
- videoElement: HTMLVideoElement;
5
- playerCallback: (...args: any) => void;
6
- config: {
7
- minBuffer: Milliseconds;
8
- lowLatencyMinBuffer: Milliseconds;
9
- minBufferSegments: number;
10
- lowLatencyMinBufferSegments: number;
11
- maxParallelRequests: number;
12
- };
13
- logger: (...args: any[]) => void;
14
- }
15
- export default class LiveDashPlayer {
16
- private paused;
17
- private autoQuality;
18
- private maxAutoQuality;
19
- private buffering;
20
- private destroyed;
21
- private videoPlayStarted;
22
- private lowLatency;
23
- private rep?;
24
- private bitrate;
25
- private manifest;
26
- private bitrateSwitcher?;
27
- private filesFetcher?;
28
- private sourceBuffer?;
29
- private mediaSource?;
30
- private currentManifestEntry?;
31
- private manifestRequest?;
32
- private manifestRefetchTimer?;
33
- private bufferStates;
34
- private downloadRate?;
35
- private sourceJitter;
36
- private chunkRateEstimator;
37
- private manifestUrl;
38
- private urlResolver;
39
- private params;
40
- constructor(params: IParams);
41
- attachSource(manifestUrl: string): void;
42
- /**
43
- * switch to auto quality
44
- */
45
- setAutoQualityEnabled(enabled: boolean): void;
46
- setMaxAutoQuality(height: number | undefined): void;
47
- /**
48
- * switch quality by name
49
- */
50
- switchByName(name: string): void;
51
- /**
52
- * seek to actual video position
53
- */
54
- catchUp(): void;
55
- stop(): void;
56
- pause(): void;
57
- play(onPlayNotAllowed?: () => void): void;
58
- startPlay(targetQ: IRepresentation, autoQuality: boolean): void;
59
- /**
60
- * destroy player
61
- */
62
- destroy(): void;
63
- reinit(newManifestUrl: string): void;
64
- /**
65
- * if all retries fail...
66
- */
67
- private _handleNetworkError;
68
- /**
69
- * Retry request
70
- */
71
- private _retryCallback;
72
- /**
73
- * how many seconds are there in the buffer
74
- */
75
- private _getBufferSizeSec;
76
- /**
77
- * send buffering notification to player
78
- */
79
- private _notifyBuffering;
80
- /**
81
- * initialize video tag, add necessary event listeners
82
- * @private
83
- */
84
- private _initVideo;
85
- /**
86
- * there may be small gaps of several milliseconds when switching quality
87
- * we jump over these gaps here
88
- */
89
- private _fixupStall;
90
- /**
91
- * return best quality for rate
92
- */
93
- private _selectQuality;
94
- private shouldPlay;
95
- /**
96
- * set video source
97
- */
98
- private _setVideoSrc;
99
- /**
100
- * initialize player with target quality
101
- */
102
- private _initPlayerWith;
103
- /**
104
- * represents specific quality stream
105
- */
106
- private _representation;
107
- /**
108
- * switch to quality
109
- * TODO: Если новое качество выше старого – переключиться сразу. Если хуже, доиграть буфер
110
- */
111
- private _switchToQuality;
112
- /**
113
- * check if quality is available
114
- */
115
- private _qualityAvailable;
116
- /**
117
- * analyze bitrate data and switch qualities accordingly
118
- */
119
- private _initBitrateSwitcher;
120
- /**
121
- * load and parse manifest file
122
- */
123
- private _fetchManifest;
124
- private _playVideoElement;
125
- /**
126
- * update internal state when manifest was received from remote
127
- */
128
- private _handleManifestUpdate;
129
- /**
130
- * schedule manifest update after delay
131
- */
132
- private _refetchManifest;
133
- private _initManifest;
134
- }
135
- export {};
@@ -1,60 +0,0 @@
1
- import { Milliseconds } from '@vkontakte/videoplayer-shared';
2
- import HttpVideoBuffer from "../../../utils/buffer/HttpVideoBuffer";
3
- import { IDashConfig, IRef, IRepresentation } from '../types';
4
- interface IParams {
5
- video: HTMLVideoElement;
6
- buffer: HttpVideoBuffer;
7
- selectRepresentation: (representations: IRepresentation[]) => IRepresentation;
8
- onManifestReady: (representations: IRepresentation[]) => void;
9
- onIdxRequestPing: (ping: Milliseconds) => void;
10
- onResponseHeaders: (headers: Headers) => void;
11
- onBandwidthChange: (payload: {
12
- size: number;
13
- duration: number;
14
- speed: number;
15
- }) => void;
16
- onRepresentationPlay: (representation: IRepresentation) => void;
17
- onError: (id: string, message: string, thrown?: Error | unknown) => void;
18
- config: IDashConfig;
19
- onDashCallback?: (eventName: string, param?: any) => any;
20
- }
21
- export default class DashLite {
22
- private _params;
23
- private _representations;
24
- private _appendVector;
25
- private _currentRepresentation?;
26
- private _stream;
27
- private _lastLoadOffset?;
28
- private _loopTimeout?;
29
- private _cachingPaused;
30
- private _duration;
31
- private STREAM_END_THRESHOLD;
32
- private _video;
33
- private _buffer;
34
- private _onDashCallback;
35
- private _config;
36
- constructor(params: IParams);
37
- /**
38
- * Parse duration from ISO8601 string.
39
- * @see https://en.wikipedia.org/wiki/ISO_8601#Durations
40
- * @see https://github.com/moment/moment/blob/develop/src/lib/duration/create.js#L13
41
- */
42
- _parseDurationFromISO8601(input: string): number;
43
- getRepresentations(): IRepresentation[];
44
- attachSource(manifestUrl: string, failoverHosts?: string[]): void;
45
- attachManifest(manifestString: string, failoverHosts?: string[], origin?: string): void;
46
- _loadInitAndSidx(representation: IRepresentation, cb?: () => void): void;
47
- startPlay(representation: IRepresentation): void;
48
- _loadRef(representation: IRepresentation, fromTime: number, needToSeek?: boolean, forcePrecise?: boolean): void;
49
- setQualityByRepresentation(newRepresentation: IRepresentation, force?: boolean): void;
50
- setQuality(index: number): void;
51
- pauseCaching(): void;
52
- resumeCaching(): void;
53
- seek(time: number, forcePrecise?: boolean): void;
54
- updateRefsForCurrentTime(): void;
55
- _findRef(time: number): IRef | undefined;
56
- _isLastRef(ref: IRef): boolean;
57
- _findBufferRangeEnd(time: number): number;
58
- destroy(): void;
59
- }
60
- export {};