@vkontakte/videoplayer-core 2.0.42 → 2.0.45
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/es2015.cjs.js +6 -0
- package/es2015.esm.js +6 -0
- package/es2018.cjs.js +4 -4
- package/es2018.esm.js +4 -4
- package/esnext.cjs.js +4 -4
- package/esnext.esm.js +4 -4
- package/package.json +2 -2
- package/player/Player.d.ts +4 -1
- package/player/types.d.ts +6 -1
- package/player/utils/watchCoverage.d.ts +5 -4
- package/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +2 -0
- package/providers/DashVKProvider/lib/types.d.ts +1 -0
- package/providers/ProviderContainer/index.d.ts +1 -0
- package/providers/types.d.ts +3 -0
- package/providers/utils/observableVideo.d.ts +1 -0
- package/utils/autoSelectVideoTrack.d.ts +3 -1
- package/utils/quality/types.d.ts +8 -0
- package/utils/quality/utils.d.ts +3 -1
- package/es5.cjs.js +0 -6
- package/es5.esm.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.45",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"**/*.d.ts"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vkontakte/videoplayer-shared": "1.0.
|
|
17
|
+
"@vkontakte/videoplayer-shared": "1.0.9",
|
|
18
18
|
"dashjs": "4.3.0",
|
|
19
19
|
"hls.js": "1.1.5",
|
|
20
20
|
"lodash": "4.17.21"
|
package/player/Player.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Subject, ValueSubject, ILogEntry, IError } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { IOptionalTuningConfig } from "../utils/tuningConfig";
|
|
3
3
|
import { HttpConnectionType, ICueSettings } from "./types";
|
|
4
|
-
import { VideoQuality } from "../utils/quality/types";
|
|
4
|
+
import { QualityLimits, VideoQuality } from "../utils/quality/types";
|
|
5
5
|
import { IRange } from "../utils/range";
|
|
6
6
|
import { IConfig, ChromecastState, IExternalTextTrack, IPlayer, ISeekRequest, ITextTrack, PlaybackState, StartStatus, VideoFormat } from './types';
|
|
7
7
|
export default class Player implements IPlayer {
|
|
@@ -26,6 +26,7 @@ export default class Player implements IPlayer {
|
|
|
26
26
|
availableQualitiesFps$: ValueSubject<Partial<Record<VideoQuality, number>>>;
|
|
27
27
|
currentQuality$: ValueSubject<VideoQuality | undefined>;
|
|
28
28
|
isAutoQualityEnabled$: ValueSubject<boolean>;
|
|
29
|
+
autoQualityLimits$: ValueSubject<QualityLimits>;
|
|
29
30
|
currentBuffer$: ValueSubject<IRange<number> | undefined>;
|
|
30
31
|
isBuffering$: ValueSubject<boolean>;
|
|
31
32
|
isStalled$: ValueSubject<boolean>;
|
|
@@ -60,6 +61,7 @@ export default class Player implements IPlayer {
|
|
|
60
61
|
managedError$: Subject<IError>;
|
|
61
62
|
fatalError$: Subject<IError>;
|
|
62
63
|
ended$: Subject<void>;
|
|
64
|
+
looped$: Subject<number>;
|
|
63
65
|
seeked$: Subject<void>;
|
|
64
66
|
willSeek$: Subject<ISeekRequest>;
|
|
65
67
|
firstBytes$: Subject<number>;
|
|
@@ -87,6 +89,7 @@ export default class Player implements IPlayer {
|
|
|
87
89
|
setMuted(muted: boolean): IPlayer;
|
|
88
90
|
setQuality(quality: VideoQuality): IPlayer;
|
|
89
91
|
setAutoQuality(enable: boolean): IPlayer;
|
|
92
|
+
setAutoQualityLimits(limits: QualityLimits): IPlayer;
|
|
90
93
|
setExternalTextTracks(tracks: Omit<IExternalTextTrack, 'type'>[]): IPlayer;
|
|
91
94
|
selectTextTrack(id: ITextTrack['id'] | undefined): IPlayer;
|
|
92
95
|
setTextTrackCueSettings(settings: ICueSettings): IPlayer;
|
package/player/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IObservable, IValueObservable, IValueSubject, ILogEntry, Kbps, Milliseconds, Seconds, IError } from '@vkontakte/videoplayer-shared';
|
|
2
|
-
import { VideoQuality } from "../utils/quality/types";
|
|
2
|
+
import { QualityLimits, VideoQuality } from "../utils/quality/types";
|
|
3
3
|
import { IRange } from "../utils/range";
|
|
4
4
|
import { IRectangle } from "../utils/rectangle";
|
|
5
5
|
export interface IPlayer {
|
|
@@ -28,6 +28,7 @@ export interface IPlayer {
|
|
|
28
28
|
setMuted(muted: boolean): IPlayer;
|
|
29
29
|
setQuality(quality: VideoQuality): IPlayer;
|
|
30
30
|
setAutoQuality(enable: boolean): IPlayer;
|
|
31
|
+
setAutoQualityLimits(limit: QualityLimits): IPlayer;
|
|
31
32
|
setLooped(isLooped: boolean): IPlayer;
|
|
32
33
|
setExternalTextTracks(tracks: Omit<IExternalTextTrack, 'type'>[]): IPlayer;
|
|
33
34
|
selectTextTrack(id: ITextTrack['id'] | undefined): IPlayer;
|
|
@@ -105,6 +106,10 @@ export interface IPlayerEvents {
|
|
|
105
106
|
* Проигрывание видео завершено
|
|
106
107
|
*/
|
|
107
108
|
ended$: IObservable<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Видео доиграло до конца, перемоталось в начало и заиграло снова, в параметре время в которое произошло переключение
|
|
111
|
+
*/
|
|
112
|
+
looped$: IObservable<Seconds>;
|
|
108
113
|
/**
|
|
109
114
|
* Совершена перемотка
|
|
110
115
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IObservable, IValueObservable } from '@vkontakte/videoplayer-shared';
|
|
1
|
+
import { IObservable, IValueObservable, Seconds } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import { IRange } from "../../utils/range";
|
|
3
3
|
import { IStateMachine } from "../../utils/StateMachine/types";
|
|
4
4
|
import { PlaybackState } from "../types";
|
|
@@ -6,8 +6,9 @@ interface IParams {
|
|
|
6
6
|
playbackState: IStateMachine<PlaybackState>;
|
|
7
7
|
seekPosition: IStateMachine<number | undefined>;
|
|
8
8
|
playbackAbort$: IObservable<void>;
|
|
9
|
-
|
|
9
|
+
looped$: IObservable<Seconds>;
|
|
10
|
+
position$: IValueObservable<Seconds>;
|
|
10
11
|
}
|
|
11
|
-
export declare const watchCoverageRecord: ({ playbackState, seekPosition, playbackAbort$, position$, }: IParams) => IObservable<IRange<number>>;
|
|
12
|
-
export declare const watchCoverageLive: ({ playbackState, seekPosition, playbackAbort$, position$, }: IParams) => IObservable<IRange<number>>;
|
|
12
|
+
export declare const watchCoverageRecord: ({ playbackState, seekPosition, playbackAbort$, looped$, position$, }: IParams) => IObservable<IRange<number>>;
|
|
13
|
+
export declare const watchCoverageLive: ({ playbackState, seekPosition, playbackAbort$, looped$, position$, }: IParams) => IObservable<IRange<number>>;
|
|
13
14
|
export {};
|
|
@@ -8,6 +8,7 @@ interface IParams {
|
|
|
8
8
|
export default class LiveDashPlayer {
|
|
9
9
|
private paused;
|
|
10
10
|
private autoQuality;
|
|
11
|
+
private maxAutoQuality;
|
|
11
12
|
private buffering;
|
|
12
13
|
private destroyed;
|
|
13
14
|
private videoPlayStarted;
|
|
@@ -35,6 +36,7 @@ export default class LiveDashPlayer {
|
|
|
35
36
|
* switch to auto quality
|
|
36
37
|
*/
|
|
37
38
|
setAutoQualityEnabled(enabled: boolean): void;
|
|
39
|
+
setMaxAutoQuality(height: number | undefined): void;
|
|
38
40
|
/**
|
|
39
41
|
* switch quality by name
|
|
40
42
|
*/
|
|
@@ -28,6 +28,7 @@ export default class ProviderContainer implements IProviderContainer {
|
|
|
28
28
|
error$: Subject<IError>;
|
|
29
29
|
willSeekEvent$: Subject<void>;
|
|
30
30
|
seekedEvent$: Subject<void>;
|
|
31
|
+
loopedEvent$: Subject<number>;
|
|
31
32
|
endedEvent$: Subject<void>;
|
|
32
33
|
firstBytesEvent$: Subject<number>;
|
|
33
34
|
firstFrameEvent$: Subject<number>;
|
package/providers/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QualityLimits } from "../utils/quality/types";
|
|
1
2
|
import { ITuningConfig } from "../utils/tuningConfig";
|
|
2
3
|
import { ILogger, ISubject, IValueSubject, Milliseconds, Seconds, IError } from '@vkontakte/videoplayer-shared';
|
|
3
4
|
import { IChromecastInitializer } from "./ChromecastProvider/ChromecastInitializer/types";
|
|
@@ -29,6 +30,7 @@ export interface IDesiredState {
|
|
|
29
30
|
volume: IStateMachine<IVolumeState>;
|
|
30
31
|
videoTrack: IStateMachine<IVideoTrack['id'] | undefined>;
|
|
31
32
|
autoVideoTrackSwitching: IStateMachine<boolean>;
|
|
33
|
+
autoVideoTrackLimits: IStateMachine<QualityLimits>;
|
|
32
34
|
isLooped: IStateMachine<boolean>;
|
|
33
35
|
externalTextTracks: IStateMachine<IExternalTextTrack[]>;
|
|
34
36
|
currentTextTrack: IStateMachine<ITextTrack['id'] | undefined>;
|
|
@@ -54,6 +56,7 @@ export interface IProviderOutput {
|
|
|
54
56
|
seekedEvent$: ISubject<void>;
|
|
55
57
|
error$: ISubject<IError>;
|
|
56
58
|
endedEvent$: ISubject<void>;
|
|
59
|
+
loopedEvent$: ISubject<Seconds>;
|
|
57
60
|
firstBytesEvent$: ISubject<number>;
|
|
58
61
|
firstFrameEvent$: ISubject<number>;
|
|
59
62
|
}
|
|
@@ -6,6 +6,7 @@ interface IObservableVideo {
|
|
|
6
6
|
pause$: IObservable<undefined>;
|
|
7
7
|
canplay$: IObservable<undefined>;
|
|
8
8
|
ended$: IObservable<undefined>;
|
|
9
|
+
looped$: IObservable<Seconds>;
|
|
9
10
|
error$: IObservable<IError>;
|
|
10
11
|
seeked$: IObservable<undefined>;
|
|
11
12
|
seeking$: IObservable<undefined>;
|
|
@@ -2,13 +2,15 @@ import { IRepresentation } from "../providers/DashProvider/types";
|
|
|
2
2
|
import { ITuningConfig } from "./tuningConfig";
|
|
3
3
|
import { Kbps } from '@vkontakte/videoplayer-shared';
|
|
4
4
|
import { IVideoTrack } from "../player/types";
|
|
5
|
+
import { QualityLimits } from "./quality/types";
|
|
5
6
|
import { IRectangle } from "./rectangle";
|
|
6
7
|
export interface Constraints {
|
|
7
8
|
container?: IRectangle;
|
|
8
9
|
throughput?: Kbps;
|
|
9
10
|
tuning: ITuningConfig['autoTrackSelection'];
|
|
11
|
+
limits?: QualityLimits;
|
|
10
12
|
forwardBufferHealth?: number;
|
|
11
13
|
currentRepresentation?: IRepresentation;
|
|
12
14
|
}
|
|
13
|
-
declare const autoSelectVideoTrack: (tracks: IVideoTrack[], { container, throughput, tuning, forwardBufferHealth, currentRepresentation, }: Constraints) => IVideoTrack;
|
|
15
|
+
declare const autoSelectVideoTrack: (tracks: IVideoTrack[], { container, throughput, tuning, limits, forwardBufferHealth, currentRepresentation, }: Constraints) => IVideoTrack;
|
|
14
16
|
export default autoSelectVideoTrack;
|
package/utils/quality/types.d.ts
CHANGED
|
@@ -11,3 +11,11 @@ export declare enum VideoQuality {
|
|
|
11
11
|
Q_4320P = "4320p"
|
|
12
12
|
}
|
|
13
13
|
export declare type ExactVideoQuality = Exclude<VideoQuality, VideoQuality.INVARIANT>;
|
|
14
|
+
/**
|
|
15
|
+
* Лимиты трактуются включительно
|
|
16
|
+
* Значение undefined снимает лимит
|
|
17
|
+
*/
|
|
18
|
+
export declare type QualityLimits = {
|
|
19
|
+
max?: ExactVideoQuality;
|
|
20
|
+
min?: ExactVideoQuality;
|
|
21
|
+
};
|
package/utils/quality/utils.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { IRectangle } from '../rectangle';
|
|
2
2
|
import { ExactVideoQuality, VideoQuality } from './types';
|
|
3
3
|
export declare const isHigher: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
4
|
+
export declare const isHigherOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
4
5
|
export declare const isLower: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
6
|
+
export declare const isLowerOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
5
7
|
export declare const getHighestQuality: (qualities: VideoQuality[]) => VideoQuality | undefined;
|
|
6
8
|
/**
|
|
7
9
|
* Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
|
|
@@ -11,7 +13,7 @@ export declare const videoHeightToQuality: (height: number, tolerance?: number)
|
|
|
11
13
|
/**
|
|
12
14
|
* Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
|
|
13
15
|
*/
|
|
14
|
-
export declare const videoSizeToQuality: ({ width, height }: IRectangle
|
|
16
|
+
export declare const videoSizeToQuality: ({ width, height }: IRectangle) => ExactVideoQuality | undefined;
|
|
15
17
|
export declare const videoQualityToHeight: (quality: ExactVideoQuality) => number;
|
|
16
18
|
export declare const isInvariantQuality: (quality: VideoQuality) => quality is VideoQuality.INVARIANT;
|
|
17
19
|
export declare const areQualitiesExact: (qualities: VideoQuality[]) => qualities is ExactVideoQuality[];
|