@vkontakte/videoplayer-core 2.0.163-dev.eb086bcd9.0 → 2.0.164-beta.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 +50 -41
- package/es2015.esm.js +48 -39
- package/esnext.cjs +42 -33
- package/esnext.esm.js +42 -33
- package/evergreen.esm.js +42 -33
- package/package.json +2 -2
- package/types/player/Player.d.ts +9 -3
- package/types/player/types.d.ts +12 -4
- package/types/providers/ChromecastProvider/types.d.ts +1 -1
- package/types/providers/DashLiveProvider/DashLiveProvider.d.ts +1 -1
- package/types/providers/DashLiveProvider/utils/LiveDashPlayer.d.ts +1 -1
- package/types/providers/DashProvider/baseDashProvider.d.ts +6 -2
- package/types/providers/DashProvider/dashCmafLiveProvider.d.ts +2 -2
- package/types/providers/DashProvider/dashProvider.d.ts +2 -2
- package/types/providers/DashProvider/lib/player.d.ts +4 -3
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +6 -2
- package/types/providers/DashProviderVirtual/dashCmafLiveProvider.d.ts +3 -3
- package/types/providers/DashProviderVirtual/dashProvider.d.ts +3 -3
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +3 -1
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/byteRangeVirtualBufferManager.d.ts +5 -5
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/liveVirtualBuffer.d.ts +4 -4
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/templateVirtualBufferManager.d.ts +5 -5
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +7 -6
- package/types/providers/DashProviderVirtual/lib/player/livePlayer.d.ts +9 -9
- package/types/providers/DashProviderVirtual/lib/player/player.d.ts +4 -4
- package/types/providers/HlsLiveProvider/index.d.ts +1 -1
- package/types/providers/HlsProvider/index.d.ts +1 -1
- package/types/providers/HlsProvider/manifestDataExtractor.d.ts +8 -6
- package/types/providers/MpegProvider/index.d.ts +1 -1
- package/types/providers/WebRTCLiveProvider/WebRTCLiveProvider.d.ts +1 -1
- package/types/providers/types.d.ts +9 -4
- package/types/providers/utils/Abr/rules/video/downloadTimeRule.d.ts +15 -0
- package/types/providers/utils/Abr/rules/video/insufficientBufferRule.d.ts +1 -1
- package/types/providers/utils/Abr/rules/video/tvDisabledVideoTrackRule.d.ts +9 -0
- package/types/providers/utils/Abr/types.d.ts +7 -3
- package/types/providers/utils/Abr/utils.d.ts +3 -1
- package/types/providers/utils/HTMLVideoElement/destroy.d.ts +1 -1
- package/types/providers/utils/HTMLVideoElement/forcePlay.d.ts +1 -1
- package/types/providers/utils/HTMLVideoElement/observable.d.ts +2 -1
- package/types/providers/utils/HTMLVideoElement/pool.d.ts +4 -3
- package/types/providers/utils/canPlay.d.ts +3 -0
- package/types/providers/utils/createAllocationResolution.d.ts +12 -0
- package/types/providers/utils/parsers/types.d.ts +1 -1
- package/types/providers/utils/syncDesiredState.d.ts +3 -3
- package/types/utils/buffer/dynamicBufferTarget.d.ts +10 -0
- package/types/utils/buffer/getPlayedTime.d.ts +3 -0
- package/types/utils/buffer/intersectBufferIntervals.d.ts +8 -0
- package/types/utils/changePlaybackRate.d.ts +1 -1
- package/types/utils/tuningConfig.d.ts +21 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
1
|
+
import type { Kbps, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../../../player/types";
|
|
3
|
+
import type { Segment } from "../parsers/types";
|
|
4
|
+
export declare const computeForwardBitrate: (segments: Nullable<Segment[]>) => Kbps;
|
|
3
5
|
export declare const bufferToPlaybackMs: (contentMs: Milliseconds | undefined, playbackRate: number) => Milliseconds;
|
|
4
6
|
export declare enum CompareTrack {
|
|
5
7
|
Descending = -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const destroy: (video:
|
|
1
|
+
export declare const destroy: (video: HTMLMediaElement, clearVideoElementInnerHTML: boolean) => void;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @param {Function} soundNotAllowedCallback - колбэк, который вызовется если нам не разрешили играть со звуком
|
|
5
5
|
* @return {Promise}<boolean> - получилось начать воспроизведение
|
|
6
6
|
*/
|
|
7
|
-
declare const _default: (video:
|
|
7
|
+
declare const _default: (video: HTMLMediaElement, soundNotAllowedCallback?: () => void) => Promise<boolean>;
|
|
8
8
|
export default _default;
|
|
@@ -12,6 +12,7 @@ export interface IObservableVideo {
|
|
|
12
12
|
progress$: IObservable<undefined>;
|
|
13
13
|
timeUpdate$: IObservable<Seconds>;
|
|
14
14
|
durationChange$: IObservable<Seconds>;
|
|
15
|
+
playedTime$: IObservable<Seconds>;
|
|
15
16
|
loadStart$: IObservable<void>;
|
|
16
17
|
loadedMetadata$: IObservable<undefined>;
|
|
17
18
|
loadedData$: IObservable<undefined>;
|
|
@@ -25,4 +26,4 @@ export interface IObservableVideo {
|
|
|
25
26
|
leavePip$: IObservable<PictureInPictureEvent>;
|
|
26
27
|
destroy: () => void;
|
|
27
28
|
}
|
|
28
|
-
export declare const observe: (video:
|
|
29
|
+
export declare const observe: (video: HTMLMediaElement) => IObservableVideo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
2
|
-
type AllocateConstraints = Pick<ITuningConfig, "audioVideoSyncRate" | "disableYandexPiP" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
|
|
2
|
+
export type AllocateConstraints = Pick<ITuningConfig, "audioVideoSyncRate" | "disableYandexPiP" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
|
|
3
3
|
type DisposeConstraints = Pick<ITuningConfig, "keepVideoElement" | "clearVideoElementInnerHTML" | "reuseOwnVideoElement">;
|
|
4
|
-
export declare const allocate: (container: HTMLElement, { audioVideoSyncRate, disableYandexPiP, clearVideoElementInnerHTML, reuseOwnVideoElement }:
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const allocate: (container: HTMLElement, { audioVideoSyncRate, disableYandexPiP, clearVideoElementInnerHTML, reuseOwnVideoElement }: ITuningConfig) => HTMLVideoElement;
|
|
5
|
+
export declare const initializeAudio: (element: HTMLAudioElement) => HTMLAudioElement;
|
|
6
|
+
export declare const dispose: (element: HTMLMediaElement, constraints: DisposeConstraints) => void;
|
|
6
7
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
2
|
+
import type { Stream } from "./parsers/types";
|
|
3
|
+
export declare const filterStreams: (streams: Stream[], videoElement: HTMLMediaElement, canPlayTypeRestriction: ITuningConfig["dash"]["checkRepresentationCanPlayType"]) => Stream[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
2
|
+
import type { IProviderAllocationResolution } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Разрешает аллокацию медиа-элемента для провайдера.
|
|
5
|
+
*
|
|
6
|
+
* Возвращает два поля:
|
|
7
|
+
* - `target: HTMLMediaElement` — элемент для управления воспроизведением (play, pause, load, currentTime и т.д.).
|
|
8
|
+
* Всегда присутствует, тип определяется входным контейнером: HTMLVideoElement для видео, HTMLAudioElement для аудио.
|
|
9
|
+
* - `video: HTMLVideoElement | null` — видеоэлемент для UI-специфичных операций (textTracks, getBoundingClientRect).
|
|
10
|
+
* Равен `target` если это HTMLVideoElement, иначе `null` для аудио-режима.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveAllocation(container: HTMLElement, tuningConfig: ITuningConfig): IProviderAllocationResolution;
|
|
@@ -121,7 +121,7 @@ export interface Stream {
|
|
|
121
121
|
}
|
|
122
122
|
export interface Manifest {
|
|
123
123
|
duration: Milliseconds | undefined;
|
|
124
|
-
streams: { [key in StreamKind]
|
|
124
|
+
streams: { [key in StreamKind]: Stream[] };
|
|
125
125
|
baseUrls: string[];
|
|
126
126
|
codecs?: {
|
|
127
127
|
video?: VideoCodec[];
|
|
@@ -6,9 +6,9 @@ declare const syncDesiredState: <Value>(desiredState: IStateMachine<Value | unde
|
|
|
6
6
|
changed$?: IObservable<Value | undefined>;
|
|
7
7
|
onError?: IListener<Error | unknown>;
|
|
8
8
|
}) => ISubscription;
|
|
9
|
-
export declare const syncVideoLooped: (video:
|
|
10
|
-
export declare const syncVideoVolumeState: (video:
|
|
9
|
+
export declare const syncVideoLooped: (video: HTMLMediaElement, desiredState: IStateMachine<boolean>, onError?: IListener<Error | unknown>) => ISubscription;
|
|
10
|
+
export declare const syncVideoVolumeState: (video: HTMLMediaElement, desiredState: IStateMachine<IVolumeState>, changed$: IObservable<IVolumeState>, onError?: IListener<Error | unknown>, params?: {
|
|
11
11
|
skipVideoElVolumeSync$: IValueSubject<boolean>;
|
|
12
12
|
}) => ISubscription;
|
|
13
|
-
export declare const syncVideoPlaybackRate: (video:
|
|
13
|
+
export declare const syncVideoPlaybackRate: (video: HTMLMediaElement, desiredState: IStateMachine<PlaybackRate>, changed$: IObservable<PlaybackRate>, onError?: IListener<Error | unknown>) => ISubscription;
|
|
14
14
|
export default syncDesiredState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Kbps, Milliseconds, Nullable } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { ITuningConfig } from "../tuningConfig";
|
|
3
|
+
type DynamicBufferTargetConfig = ITuningConfig["dash"]["dynamicBufferTarget"];
|
|
4
|
+
export interface IDynamicBufferTargetState {
|
|
5
|
+
throughputKbps: Kbps;
|
|
6
|
+
currentBitrateKbps: Nullable<Kbps>;
|
|
7
|
+
baseTargetMs: Milliseconds;
|
|
8
|
+
}
|
|
9
|
+
export declare const computeDynamicBufferTarget: (state: IDynamicBufferTargetState, config: DynamicBufferTargetConfig) => Milliseconds;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IRange, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Вычисляет пересечение двух наборов интервалов.
|
|
4
|
+
* Если один из наборов пуст, возвращается другой набор (т.к. пустой набор означает
|
|
5
|
+
* отсутствие ограничений — например, аудиодорожки может не быть).
|
|
6
|
+
* Оба набора должны быть отсортированы по полю from и не содержать пересекающихся интервалов внутри себя.
|
|
7
|
+
*/
|
|
8
|
+
export declare const intersectBufferIntervals: (range1: IRange<Milliseconds>[], range2: IRange<Milliseconds>[]) => IRange<Milliseconds>[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Nullable } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
export declare const changePlaybackRate: (element: Nullable<
|
|
2
|
+
export declare const changePlaybackRate: (element: Nullable<HTMLMediaElement>, targetPlaybackRate: number) => void;
|
|
@@ -132,6 +132,8 @@ export type ITuningConfig = {
|
|
|
132
132
|
forwardBufferTargetAuto: Milliseconds;
|
|
133
133
|
forwardBufferTargetManual: Milliseconds;
|
|
134
134
|
forwardBufferTargetPreload: Milliseconds;
|
|
135
|
+
audioBufferAheadOfVideoMs: Milliseconds;
|
|
136
|
+
useDynamicBufferTarget: boolean;
|
|
135
137
|
seekBiasInTheEnd: Milliseconds;
|
|
136
138
|
maxSegmentDurationLeftToSelectNextSegment: Milliseconds;
|
|
137
139
|
minSafeBufferThreshold: number;
|
|
@@ -146,6 +148,8 @@ export type ITuningConfig = {
|
|
|
146
148
|
enableSubSegmentBufferFeeding: boolean;
|
|
147
149
|
bufferEmptinessTolerance: Milliseconds;
|
|
148
150
|
virtualBufferEmptinessTolerance: Milliseconds;
|
|
151
|
+
useBufferQueueVerification: boolean;
|
|
152
|
+
useVirtualBufferImplicitSeek: boolean;
|
|
149
153
|
useNewRepresentationSwitch: boolean;
|
|
150
154
|
useDelayedRepresentationSwitch: boolean;
|
|
151
155
|
useSmartRepresentationSwitch: boolean;
|
|
@@ -209,9 +213,24 @@ export type ITuningConfig = {
|
|
|
209
213
|
budgetFactor: number;
|
|
210
214
|
fallbackSegmentDurationMs: Milliseconds;
|
|
211
215
|
};
|
|
216
|
+
dynamicBufferTarget: {
|
|
217
|
+
maxMs: Milliseconds;
|
|
218
|
+
optimisticHeadroomLow: number;
|
|
219
|
+
optimisticHeadroomHigh: number;
|
|
220
|
+
weakThroughputLowKbps: Kbps;
|
|
221
|
+
weakThroughputHighKbps: Kbps;
|
|
222
|
+
maxFactor: number;
|
|
223
|
+
};
|
|
212
224
|
videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodecName][];
|
|
213
225
|
filterOnDemandQualityList: boolean;
|
|
214
226
|
dashMaxTvVideoQuality: boolean;
|
|
227
|
+
checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
|
|
228
|
+
downloadTime: {
|
|
229
|
+
minLookaheadSegments: number;
|
|
230
|
+
safetyFactor: number;
|
|
231
|
+
bootstrapBufferMs: Milliseconds;
|
|
232
|
+
demandTolerance: number;
|
|
233
|
+
};
|
|
215
234
|
};
|
|
216
235
|
dashCmafLive: {
|
|
217
236
|
externalStopControl: boolean;
|
|
@@ -413,6 +432,8 @@ export type ITuningConfig = {
|
|
|
413
432
|
* Устанавливаем длительность видео на основе последнего сегмента.
|
|
414
433
|
*/
|
|
415
434
|
useDurationFromSegments: boolean;
|
|
435
|
+
/** включен режим проигрывания только аудио (без видео) */
|
|
436
|
+
audioOnly: boolean;
|
|
416
437
|
};
|
|
417
438
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
|
|
418
439
|
export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
|