@vkontakte/videoplayer-core 2.0.180 → 2.0.181-dev.2c5180761.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/es2015.cjs +17 -17
- package/es2015.esm.js +17 -17
- package/esnext.cjs +16 -16
- package/esnext.esm.js +16 -16
- package/evergreen.esm.js +16 -16
- package/package.json +2 -2
- package/types/index.d.ts +2 -2
- package/types/player/Player.d.ts +1 -2
- package/types/player/types.d.ts +4 -8
- package/types/providers/DashProvider/baseDashProvider.d.ts +1 -1
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +1 -1
- package/types/providers/types.d.ts +1 -3
- package/types/providers/utils/Abr/rules/video/stallsRule.d.ts +9 -11
- package/types/providers/utils/StallsManager.d.ts +1 -8
- package/types/providers/utils/TextTrackManager.d.ts +16 -0
- package/types/utils/buffer/isPositionBuffered.d.ts +1 -0
- package/types/utils/tuningConfig.d.ts +1 -2
- package/types/providers/utils/HTMLVideoElement/TextTrackManager.d.ts +0 -32
- package/types/utils/setStateWithSubscribe.d.ts +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.181-dev.2c5180761.0",
|
|
4
4
|
"author": "vk.ru",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.ru platform",
|
|
6
6
|
"homepage": "https://vk.ru",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"**/*.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vkontakte/videoplayer-shared": "1.0.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.110-dev.2c5180761.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { IMpegSource, IDashSource, IHLSSource, IDashURLSource, IHLSLiveSour
|
|
|
3
3
|
import type { VideoCodec } from "./player/types";
|
|
4
4
|
import { VideoFormat, Surface, PredefinedQualityLimits, VideoCodecName } from "./player/types";
|
|
5
5
|
import Player from "./player/Player";
|
|
6
|
-
import type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, ISources,
|
|
6
|
+
import type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, ISources, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics } from "./player/types";
|
|
7
7
|
import { PlaybackState, ChromecastState, HttpConnectionType } from "./player/types";
|
|
8
8
|
import type { IOptionalTuningConfig } from "./utils/tuningConfig";
|
|
9
9
|
export { clientChecker, isMobile } from "./utils/ClientChecker";
|
|
@@ -15,5 +15,5 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from "@
|
|
|
15
15
|
* @deprecated
|
|
16
16
|
*/
|
|
17
17
|
declare const SDK_VERSION: string;
|
|
18
|
-
export type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, ExactVideoQuality, IRange, ISeekRequest,
|
|
18
|
+
export type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, IOptionalTuningConfig, ILogEntry, ISources, IExternalTextTrack, ITextTrack, ISubscription, IUnsubscriber, IObservable, IEmitter, IValueObservable, IValue, IOperator, IListener, IMpegSource, IDashSource, IDashURLSource, IHLSSource, IHLSLiveSource, URLSource, RawSource, URLSourceWithSeek, ExactVideoQuality, IRange, ISeekRequest, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics };
|
|
19
19
|
export { Player, PlaybackState, ChromecastState, HttpConnectionType, Surface, Subscription, VideoFormat, VideoQuality, Observable, Subject, ValueSubject, VERSION, SDK_VERSION, PredefinedQualityLimits, VideoCodec, VideoCodecName };
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IOptionalTuningConfig } from "../utils/tuningConfig";
|
|
2
2
|
import type { ILogEntry, ITracer, QualityLimits, Seconds, VideoQuality, DebugData } from "@vkontakte/videoplayer-shared";
|
|
3
|
-
import { type IAudioStream, type IConfig, type
|
|
3
|
+
import { type IAudioStream, type IConfig, type IExternalTextTrack, type IPlayer, type ITextTrack, type IVideoStream, type PlaybackRate, type PlayerEventsImpl, type PlayerExperimentalImpl, type PlayerInfoImpl, PredefinedQualityLimits } from "./types";
|
|
4
4
|
import type { IPlayerOptions } from "../utils/playerOptions";
|
|
5
5
|
export default class Player implements IPlayer {
|
|
6
6
|
private readonly subscription;
|
|
@@ -71,7 +71,6 @@ export default class Player implements IPlayer {
|
|
|
71
71
|
setPlaybackRate(playbackRate: PlaybackRate): IPlayer;
|
|
72
72
|
setExternalTextTracks(tracks: Omit<IExternalTextTrack, "type">[]): IPlayer;
|
|
73
73
|
selectTextTrack(id: ITextTrack["id"] | undefined): IPlayer;
|
|
74
|
-
setTextTrackCueSettings(settings: ICueSettings): IPlayer;
|
|
75
74
|
setLiveLowLatency(isLowLatency: boolean): IPlayer;
|
|
76
75
|
setLooped(isLooped: boolean): IPlayer;
|
|
77
76
|
toggleChromecast(): void;
|
package/types/player/types.d.ts
CHANGED
|
@@ -56,8 +56,10 @@ export interface IPlayer {
|
|
|
56
56
|
setPlaybackRate(playbackRate: PlaybackRate): IPlayer;
|
|
57
57
|
setLooped(isLooped: boolean): IPlayer;
|
|
58
58
|
setExternalTextTracks(tracks: Omit<IExternalTextTrack, "type">[]): IPlayer;
|
|
59
|
+
/**
|
|
60
|
+
* Запоминает выбранную дорожку субтитров. Отрисовка субтитров на стороне UI
|
|
61
|
+
*/
|
|
59
62
|
selectTextTrack(id: ITextTrack["id"] | undefined): IPlayer;
|
|
60
|
-
setTextTrackCueSettings(settings: ICueSettings): IPlayer;
|
|
61
63
|
setLiveLowLatency(isLowLatency: boolean): IPlayer;
|
|
62
64
|
/**
|
|
63
65
|
* Включает или отключает Chromecast
|
|
@@ -407,7 +409,7 @@ export interface PlayerInfoValues {
|
|
|
407
409
|
*/
|
|
408
410
|
availableTextTracks$: ITextTrack[];
|
|
409
411
|
/**
|
|
410
|
-
* Выбранная
|
|
412
|
+
* Выбранная дорожка субтитров
|
|
411
413
|
*/
|
|
412
414
|
currentTextTrack$: ITextTrack["id"] | undefined;
|
|
413
415
|
/**
|
|
@@ -685,12 +687,6 @@ export interface IInternalTextTrack extends ITextTrackBase {
|
|
|
685
687
|
url: string;
|
|
686
688
|
}
|
|
687
689
|
export type ITextTrack = IExternalTextTrack | IInternalTextTrack;
|
|
688
|
-
export interface ICueSettings {
|
|
689
|
-
align?: "left" | "center" | "right";
|
|
690
|
-
position?: number | "auto";
|
|
691
|
-
size?: number;
|
|
692
|
-
line?: number | "auto";
|
|
693
|
-
}
|
|
694
690
|
export declare enum VideoDestination {
|
|
695
691
|
SCREEN = "SCREEN",
|
|
696
692
|
CHROMECAST = "CHROMECAST"
|
|
@@ -8,7 +8,7 @@ import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
|
8
8
|
import type { ExactVideoQuality, ISubscription, ITracer, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
9
9
|
import { Player } from "./lib/player";
|
|
10
10
|
import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
|
|
11
|
-
import TextTrackManager from "../utils/
|
|
11
|
+
import TextTrackManager from "../utils/TextTrackManager";
|
|
12
12
|
import StallsManager from "../utils/StallsManager";
|
|
13
13
|
import { AbrManager } from "../utils/Abr/abrManager";
|
|
14
14
|
import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
|
|
@@ -7,7 +7,7 @@ import type { IObservableMediaElement } from "../utils/HTMLVideoElement/observab
|
|
|
7
7
|
import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
8
8
|
import type { ExactVideoQuality, ISubscription, ITracer, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
9
9
|
import DroppedFramesManager from "../utils/HTMLVideoElement/DroppedFramesManager";
|
|
10
|
-
import TextTrackManager from "../utils/
|
|
10
|
+
import TextTrackManager from "../utils/TextTrackManager";
|
|
11
11
|
import StallsManager from "../utils/StallsManager";
|
|
12
12
|
import { ElementSizeManager } from "../utils/HTMLVideoElement/ElementSizeManager";
|
|
13
13
|
import type { BasePlayer } from "./lib/player/basePlayer";
|
|
@@ -2,7 +2,7 @@ import type { ITuningConfig } from "../utils/tuningConfig";
|
|
|
2
2
|
import type { IComponentLogger, IError, ILogger, IRange, IRectangle, ISubject, ITracer, IValueSubject, IWarning, Milliseconds, QualityLimits, Seconds } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IChromecastInitializer } from "./ChromecastProvider/ChromecastInitializer/types";
|
|
4
4
|
import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackRate, PlaybackState } from "../player/types";
|
|
5
|
-
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack,
|
|
5
|
+
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ISources, IVideoStream, SeekState, VideoCodec } from "../player/types";
|
|
6
6
|
import type { IStateMachine } from "../utils/StateMachine/types";
|
|
7
7
|
import type ThroughputEstimator from "../utils/ThroughputEstimator";
|
|
8
8
|
export interface IProvider {
|
|
@@ -44,7 +44,6 @@ export interface DesiredStateValues {
|
|
|
44
44
|
playbackRate: PlaybackRate;
|
|
45
45
|
playbackState: PlaybackState;
|
|
46
46
|
seekState: SeekState;
|
|
47
|
-
textTrackCuesSettings: ICueSettings;
|
|
48
47
|
videoStream: IVideoStream | undefined;
|
|
49
48
|
/**
|
|
50
49
|
* Порядок смены видео дорожек:
|
|
@@ -76,7 +75,6 @@ export interface IProviderOutput {
|
|
|
76
75
|
availableAudioTracks$: IValueSubject<IAudioTrack[]>;
|
|
77
76
|
availableAudioCodecs$: IValueSubject<AudioCodec[]>;
|
|
78
77
|
availableTextTracks$: IValueSubject<ITextTrack[]>;
|
|
79
|
-
currentTextTrack$: IValueSubject<ITextTrack["id"] | undefined>;
|
|
80
78
|
isAudioAvailable$: IValueSubject<boolean>;
|
|
81
79
|
autoVideoTrackLimits$: IValueSubject<QualityLimits | undefined>;
|
|
82
80
|
autoVideoTrackLimitingAvailable$: IValueSubject<boolean>;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext, RuleLogData } from "../../types";
|
|
2
2
|
import type { IVideoTrack } from "../../../../../player/types";
|
|
3
|
-
import type { Kbps, Nullable } from "@vkontakte/videoplayer-shared";
|
|
4
3
|
import { LimitAboveRule } from "../limitAboveRule";
|
|
5
|
-
import type { ITuningConfig } from "../../../../../utils/tuningConfig";
|
|
6
4
|
import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
5
|
+
export declare class StallsRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, []> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
6
|
+
private wasSevereStall;
|
|
7
|
+
private restrictedInCurrentStall;
|
|
8
|
+
private stalledQuality;
|
|
9
|
+
private stallsByQuality;
|
|
10
|
+
private recoveryStartedAt;
|
|
12
11
|
private maxQualityLimitOnStall;
|
|
13
|
-
private predictedThroughputWithoutData;
|
|
14
12
|
private restrictionTracer;
|
|
15
13
|
private restrictionStartedAt;
|
|
16
14
|
constructor(phaseConfig: RulePhaseConfig);
|
|
17
15
|
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
18
|
-
protected createLogData(selectedTrack: IVideoTrack
|
|
16
|
+
protected createLogData(selectedTrack: IVideoTrack): RuleLogData;
|
|
17
|
+
private trackStallEpisode;
|
|
18
|
+
private resolveQualityLimit;
|
|
19
19
|
private traceRestrictionSet;
|
|
20
20
|
private traceRestrictionReset;
|
|
21
|
-
private updateStallQualityLimits;
|
|
22
21
|
}
|
|
23
|
-
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IObservable, IValueSubject, Milliseconds, Seconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import type { IVideoTrack } from "../../player/types";
|
|
3
3
|
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
4
4
|
interface IConnectData {
|
|
5
5
|
videoLastDataObtainedTimestamp$: IValueSubject<Milliseconds>;
|
|
6
|
-
throughput$: IValueSubject<number>;
|
|
7
6
|
rtt$: IValueSubject<Milliseconds>;
|
|
8
7
|
isBuffering$: IObservable<boolean>;
|
|
9
8
|
isSeeked$: IObservable<boolean>;
|
|
@@ -18,7 +17,6 @@ interface IConnectData {
|
|
|
18
17
|
declare class StallsManager {
|
|
19
18
|
private currentStallDuration$;
|
|
20
19
|
private videoLastDataObtainedTimestamp$;
|
|
21
|
-
private throughput$;
|
|
22
20
|
private rtt$;
|
|
23
21
|
private tuning;
|
|
24
22
|
private abrParams;
|
|
@@ -26,20 +24,15 @@ declare class StallsManager {
|
|
|
26
24
|
private isSeeked$;
|
|
27
25
|
private isBuffering$;
|
|
28
26
|
private isPaused;
|
|
29
|
-
private maxQualityLimit;
|
|
30
27
|
private lastUniqueVideoTrackSelected;
|
|
31
28
|
private currentStallsCount;
|
|
32
29
|
private sumStallsDuration;
|
|
33
30
|
private lastStallDuration;
|
|
34
31
|
private providerStartWatchingTimestamp;
|
|
35
32
|
private lastUniqueVideoTrackSelectedTimestamp;
|
|
36
|
-
private predictedThroughputWithoutData;
|
|
37
|
-
private qualityRestrictionTimer;
|
|
38
33
|
private subscription;
|
|
39
34
|
severeStallOccurred$: IValueSubject<boolean>;
|
|
40
35
|
init(data: IConnectData): void;
|
|
41
|
-
get videoMaxQualityLimit(): ExactVideoQuality | undefined;
|
|
42
|
-
get predictedThroughput(): Kbps;
|
|
43
36
|
get abrTuningParams(): ITuningConfig["autoTrackSelection"];
|
|
44
37
|
set lastVideoTrackSelected(lastUniqueVideoTrackSelected: IVideoTrack);
|
|
45
38
|
destroy(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IExternalTextTrack, IInternalTextTrack } from "../../player/types";
|
|
2
|
+
import type { IDesiredState, IProviderOutput } from "../types";
|
|
3
|
+
declare class TextTrackManager {
|
|
4
|
+
private available$;
|
|
5
|
+
private error$;
|
|
6
|
+
private subscription;
|
|
7
|
+
private externalTracks;
|
|
8
|
+
private internalTracks;
|
|
9
|
+
private emittedIds;
|
|
10
|
+
connect(desiredState: Pick<IDesiredState, "externalTextTracks" | "internalTextTracks">, providerOutput: Pick<IProviderOutput, "availableTextTracks$" | "error$">): void;
|
|
11
|
+
setExternal(tracks: IExternalTextTrack[]): void;
|
|
12
|
+
setInternal(tracks: IInternalTextTrack[]): void;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
private emitAvailable;
|
|
15
|
+
}
|
|
16
|
+
export default TextTrackManager;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
declare const _default: (timeRanges: TimeRanges, position: Milliseconds, tolerance?: number) => boolean;
|
|
3
3
|
export default _default;
|
|
4
|
+
export declare const isTimeRangeBuffered: (timeRanges: TimeRanges, from: Milliseconds, to: Milliseconds) => boolean;
|
|
@@ -143,7 +143,6 @@ export type ITuningConfig = {
|
|
|
143
143
|
enabled: boolean;
|
|
144
144
|
ignoreDynamicAbrForShortVideo: boolean;
|
|
145
145
|
stallDurationNoDataBeforeQualityDecrease: Milliseconds;
|
|
146
|
-
stallDurationToBeCount: Milliseconds;
|
|
147
146
|
stallCountBeforeQualityDecrease: Milliseconds;
|
|
148
147
|
resetQualityRestrictionTimeout: Milliseconds;
|
|
149
148
|
ignoreStallsOnSeek: boolean;
|
|
@@ -283,6 +282,7 @@ export type ITuningConfig = {
|
|
|
283
282
|
* дешевле замершего воспроизведения.
|
|
284
283
|
*/
|
|
285
284
|
recoverStuckSegmentLoading: boolean;
|
|
285
|
+
skipReloadOfFullyBufferedPartiallyEjectedSegments: boolean;
|
|
286
286
|
};
|
|
287
287
|
dashCmafLive: {
|
|
288
288
|
externalStopControl: boolean;
|
|
@@ -385,7 +385,6 @@ export type ITuningConfig = {
|
|
|
385
385
|
/** @deprecated HLS.js удалён, флаг ничего не делает */
|
|
386
386
|
useHlsJs: boolean;
|
|
387
387
|
disableHlsOnDesktop: boolean;
|
|
388
|
-
useNativeHLSTextTracks: boolean;
|
|
389
388
|
useNewSwitchTo: boolean;
|
|
390
389
|
alwaysAbortPreviousSwitch: boolean;
|
|
391
390
|
useDashProviderVirtual: boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { IExternalTextTrack, IInternalTextTrack, ITextTrack } from "../../../player/types";
|
|
2
|
-
import type { IDesiredState, IProviderOutput } from "../../types";
|
|
3
|
-
/**
|
|
4
|
-
* TODO: сейчас externalTextTracks и internalTextTracks записываются в availableTextTracks отсюда
|
|
5
|
-
* нужно будет выпилить этот класс за исключением этой логики,
|
|
6
|
-
* когда перестанет быть необходима поддержка браузерных субтитров
|
|
7
|
-
*/
|
|
8
|
-
declare class TextTrackManager {
|
|
9
|
-
private available$;
|
|
10
|
-
private current$;
|
|
11
|
-
private error$;
|
|
12
|
-
private video;
|
|
13
|
-
private cueSettings;
|
|
14
|
-
private subscription;
|
|
15
|
-
private externalTracks;
|
|
16
|
-
private internalTracks;
|
|
17
|
-
private baseURL?;
|
|
18
|
-
constructor(baseURL?: string);
|
|
19
|
-
connect(video: HTMLVideoElement, desiredState: Pick<IDesiredState, "externalTextTracks" | "internalTextTracks" | "currentTextTrack" | "textTrackCuesSettings">, providerOutput: Pick<IProviderOutput, "availableTextTracks$" | "currentTextTrack$" | "error$">): void;
|
|
20
|
-
private subscribe;
|
|
21
|
-
private applyCueSettings;
|
|
22
|
-
private htmlTextTracksAsArray;
|
|
23
|
-
private htmlTextTrackToITextTrack;
|
|
24
|
-
private static isHealthyTrack;
|
|
25
|
-
setExternal(tracks: IExternalTextTrack[]): void;
|
|
26
|
-
setInternal(tracks: IInternalTextTrack[]): void;
|
|
27
|
-
select(selectedId: ITextTrack["id"] | undefined): void;
|
|
28
|
-
destroy(): void;
|
|
29
|
-
private attach;
|
|
30
|
-
private detach;
|
|
31
|
-
}
|
|
32
|
-
export default TextTrackManager;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IValueSubject } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
import type { IStateMachine } from "./StateMachine/types";
|
|
3
|
-
export declare const setStateWithSubscribe: <
|
|
4
|
-
State,
|
|
5
|
-
Value
|
|
6
|
-
>(nextState: State | undefined, currentState: IStateMachine<State | undefined>, availableValues: IValueSubject<Array<Value>> | undefined, predicate: (value: Value) => boolean) => void;
|