@vkontakte/videoplayer-shared 1.0.83 → 1.0.85-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 +5 -4
- package/es2015.esm.js +5 -4
- package/es2018.cjs +5 -4
- package/es2018.esm.js +5 -4
- package/es2024.cjs +5 -4
- package/es2024.esm.js +5 -4
- package/esnext.cjs +5 -4
- package/esnext.esm.js +5 -4
- package/evergreen.esm.js +5 -4
- package/package.json +1 -1
- package/types/AppTracer/AppTracer.d.ts +23 -23
- package/types/AppTracer/index.d.ts +2 -2
- package/types/AppTracer/types.d.ts +14 -14
- package/types/AppTracer/utils.d.ts +3 -2
- package/types/InternalsExposure/index.d.ts +18 -18
- package/types/Logger/Logger.d.ts +8 -8
- package/types/Logger/index.d.ts +2 -2
- package/types/Logger/types.d.ts +21 -22
- package/types/Tracer/FakeTracer.d.ts +11 -11
- package/types/Tracer/RootTracer.d.ts +8 -8
- package/types/Tracer/Tracer.d.ts +23 -22
- package/types/Tracer/TracerFactory.d.ts +2 -2
- package/types/Tracer/index.d.ts +3 -3
- package/types/Tracer/types.d.ts +24 -24
- package/types/Tracer/utils.d.ts +2 -2
- package/types/devNull.d.ts +4 -4
- package/types/index.d.ts +11 -11
- package/types/reactive/Observable.d.ts +12 -12
- package/types/reactive/ReplaySubject.d.ts +10 -9
- package/types/reactive/Subject.d.ts +8 -8
- package/types/reactive/Subscription.d.ts +4 -4
- package/types/reactive/SubscriptionRemovable.d.ts +3 -3
- package/types/reactive/ValueSubject.d.ts +8 -8
- package/types/reactive/combine.d.ts +5 -8
- package/types/reactive/fromEvent.d.ts +3 -3
- package/types/reactive/index.d.ts +25 -25
- package/types/reactive/interval.d.ts +2 -2
- package/types/reactive/merge.d.ts +81 -11
- package/types/reactive/observableFrom.d.ts +1 -1
- package/types/reactive/operators/buffer.d.ts +1 -1
- package/types/reactive/operators/debounce.d.ts +7 -6
- package/types/reactive/operators/filter.d.ts +5 -2
- package/types/reactive/operators/filterChanged.d.ts +3 -3
- package/types/reactive/operators/map.d.ts +5 -2
- package/types/reactive/operators/mapTo.d.ts +5 -2
- package/types/reactive/operators/once.d.ts +3 -3
- package/types/reactive/operators/pairwise.d.ts +1 -2
- package/types/reactive/operators/shareReplay.d.ts +1 -1
- package/types/reactive/operators/skip.d.ts +4 -4
- package/types/reactive/operators/tap.d.ts +1 -1
- package/types/reactive/operators/throttle.d.ts +6 -5
- package/types/reactive/timeout.d.ts +2 -2
- package/types/reactive/types.d.ts +36 -18
- package/types/translation/index.d.ts +2 -2
- package/types/translation/loadVKLangPack.d.ts +12 -12
- package/types/translation/types.d.ts +2 -2
- package/types/types/index.d.ts +57 -58
- package/types/utils/abortable.d.ts +4 -1
- package/types/utils/config.d.ts +1 -1
- package/types/utils/debounceFn.d.ts +7 -7
- package/types/utils/detectEmbed.d.ts +4 -4
- package/types/utils/exponentialBackoff.d.ts +6 -6
- package/types/utils/flattenObject.d.ts +7 -7
- package/types/utils/getRangeAroundIndex.d.ts +5 -5
- package/types/utils/index.d.ts +34 -29
- package/types/utils/interpolate.d.ts +9 -9
- package/types/utils/isIntersecting.d.ts +3 -3
- package/types/utils/now.d.ts +1 -1
- package/types/utils/observeElementSize.d.ts +3 -3
- package/types/utils/quality/index.d.ts +7 -7
- package/types/utils/quality/types.d.ts +16 -16
- package/types/utils/throttleFn.d.ts +4 -3
package/types/types/index.d.ts
CHANGED
|
@@ -1,72 +1,71 @@
|
|
|
1
1
|
export type SafeAny = any;
|
|
2
2
|
export interface IError {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Код или другой идентификатор для статистики
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
category: ErrorCategory;
|
|
8
|
+
/**
|
|
9
|
+
* Сообщение по которому можно разобрать что случилось
|
|
10
|
+
*/
|
|
11
|
+
message: string;
|
|
12
|
+
/**
|
|
13
|
+
* Данные, полезные для отладки
|
|
14
|
+
*/
|
|
15
|
+
data?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Возникшее исключение
|
|
18
|
+
*/
|
|
19
|
+
thrown?: Error | unknown;
|
|
20
|
+
/**
|
|
21
|
+
* Отправлять в трейс не как error а как log
|
|
22
|
+
*/
|
|
23
|
+
traceAsLog?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* HTTP-code ошибки
|
|
26
|
+
*/
|
|
27
|
+
httpCode?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Код ошибки, который вернул backend Единого Видео
|
|
30
|
+
*/
|
|
31
|
+
UVBackendErrorCode?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface IWarning {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Код или другой идентификатор для статистики
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Сообщение по которому можно разобрать что случилось
|
|
40
|
+
*/
|
|
41
|
+
message: string;
|
|
42
|
+
/**
|
|
43
|
+
* Данные, полезные для отладки
|
|
44
|
+
*/
|
|
45
|
+
data?: any;
|
|
46
46
|
}
|
|
47
47
|
export declare enum ErrorCategory {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
NETWORK = "network",
|
|
49
|
+
VIDEO_PIPELINE = "video_pipeline",
|
|
50
|
+
EXTERNAL_API = "external_api",
|
|
51
|
+
PARSER = "parser",
|
|
52
|
+
DOM = "dom",
|
|
53
|
+
WTF = "wtf",
|
|
54
|
+
FATAL = "fatal"
|
|
55
55
|
}
|
|
56
56
|
export interface IRange<Unit extends number = number> {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
from: Unit;
|
|
58
|
+
to: Unit;
|
|
59
59
|
}
|
|
60
60
|
export interface IRectangle<Unit extends number = number> {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
width: Unit;
|
|
62
|
+
height: Unit;
|
|
63
63
|
}
|
|
64
|
-
export type RecursivePartial<T> = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
64
|
+
export type RecursivePartial<T> = { [P in keyof T]? : T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P] };
|
|
65
|
+
export type WithRequired<
|
|
66
|
+
T,
|
|
67
|
+
K extends keyof T
|
|
68
|
+
> = T & { [P in K]-? : T[P] };
|
|
70
69
|
export type Constructor<T> = new () => T;
|
|
71
70
|
export type AbstractConstructor<T> = abstract new () => T;
|
|
72
71
|
export type AnyConstructor<T> = Constructor<T> | AbstractConstructor<T>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
type AbortableDecorator = <
|
|
1
|
+
type AbortableDecorator = <
|
|
2
|
+
Params extends unknown[] = void[],
|
|
3
|
+
Return = void
|
|
4
|
+
>(signal: AbortSignal, createGenerator: (...param: Params) => AsyncGenerator<unknown, Return, unknown>) => (...param: Params) => Promise<Return | undefined>;
|
|
2
5
|
export declare const abortable: AbortableDecorator;
|
|
3
6
|
export {};
|
package/types/utils/config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RecursivePartial } from
|
|
1
|
+
import type { RecursivePartial } from "../types";
|
|
2
2
|
export declare const fillWithDefault: <Config extends object>(partial: RecursivePartial<Config>, defaultConfig: Config) => Config;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
interface DebounceSettings {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
leading?: boolean;
|
|
3
|
+
maxWait?: number;
|
|
4
|
+
trailing?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export interface DebouncedFn<T extends (...args: any[]) => any> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
8
|
+
cancel(): void;
|
|
9
|
+
flush(): ReturnType<T> | undefined;
|
|
10
|
+
pending(): boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function debounceFn<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFn<T>;
|
|
13
13
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
interface Result {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
isEmbed: boolean;
|
|
3
|
+
origins: string[];
|
|
4
|
+
topOrigin?: string;
|
|
5
|
+
immediateOrigin?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const detectEmbed: () => Result;
|
|
8
8
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Milliseconds } from
|
|
1
|
+
import type { Milliseconds } from "./semanticTypes";
|
|
2
2
|
export type ExponentialBackoffConfig = Partial<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
start: Milliseconds;
|
|
4
|
+
factor: number;
|
|
5
|
+
min: Milliseconds;
|
|
6
|
+
max: Milliseconds;
|
|
7
|
+
random: number;
|
|
8
8
|
}>;
|
|
9
9
|
export declare const getExponentialDelay: (errorsCount: number, { start, factor, max, min, random }?: ExponentialBackoffConfig) => Milliseconds;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
* Функция, которая "сплющивает" вложенный объект. Делает так, чтобы все проперти в объекте были примитивами и
|
|
3
|
+
* не содержали вложенных объектов
|
|
4
|
+
* @param obj - исходный объект
|
|
5
|
+
* @param maxDeep - максимальная глубина рекурсивного обхода
|
|
6
|
+
* @param separator - символ разделитель. По умолчанию точка '.'
|
|
7
|
+
* @return - новый сплющенный объект, который не содержит больше вложенных объектов
|
|
8
|
+
*/
|
|
9
9
|
export declare const flattenObject: (obj: Record<string, any> | undefined, maxDeep?: number, separator?: string) => Record<string, any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
* Возвращает диапозон индексов вокруг определнного индекса.
|
|
3
|
+
* @param totalItems Размер массива.
|
|
4
|
+
* @param currentIndex Индекс вокруг которого нужно собрать массив.
|
|
5
|
+
* @param max Максимальный размер индекса.
|
|
6
|
+
*/
|
|
7
7
|
export declare function getRangeAroundIndex(totalItems: number, currentIndex: number, max: number): number[];
|
package/types/utils/index.d.ts
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
export { noop } from
|
|
2
|
-
export { assertNever, checkNever } from
|
|
3
|
-
export { isNonNullable, isNullable, assertNonNullable, assertNullable,
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export {
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export * from
|
|
29
|
-
export {
|
|
1
|
+
export { noop } from "./noop";
|
|
2
|
+
export { assertNever, checkNever } from "./never";
|
|
3
|
+
export { isNonNullable, isNullable, assertNonNullable, assertNullable, withoutNullable } from "./nullable";
|
|
4
|
+
export type { Nullable } from "./nullable";
|
|
5
|
+
export { assertNotEmptyArray, assertEmptyArray } from "./empty";
|
|
6
|
+
export { addScript } from "./addScript";
|
|
7
|
+
export type { Milliseconds, bps, Byte, Seconds, Kbps, Mbps, Percentage } from "./semanticTypes";
|
|
8
|
+
export { now } from "./now";
|
|
9
|
+
export { abortable } from "./abortable";
|
|
10
|
+
export { getExponentialDelay } from "./exponentialBackoff";
|
|
11
|
+
export type { ExponentialBackoffConfig } from "./exponentialBackoff";
|
|
12
|
+
export * as safeStorage from "./iframeSafeStorage";
|
|
13
|
+
export { detectEmbed } from "./detectEmbed";
|
|
14
|
+
export { VideoQuality } from "./quality/types";
|
|
15
|
+
export type { ExactVideoQuality, QualityLimits } from "./quality/types";
|
|
16
|
+
export { isHigher, isHigherOrEqual, isLower, isLowerOrEqual, getHighestQuality, videoHeightToQuality, videoSizeToQuality, videoQualityToHeight, isInvariantQuality, areQualitiesExact, assertQualityIsExact, getVideoQualityLabel } from "./quality";
|
|
17
|
+
export * from "./config";
|
|
18
|
+
export * from "./timecode";
|
|
19
|
+
export { debounceFn } from "./debounceFn";
|
|
20
|
+
export type { DebouncedFn } from "./debounceFn";
|
|
21
|
+
export { throttleFn } from "./throttleFn";
|
|
22
|
+
export type { ThrottleOptions } from "./throttleFn";
|
|
23
|
+
export { cloneDeep } from "./cloneDeep";
|
|
24
|
+
export { observeElementSize } from "./observeElementSize";
|
|
25
|
+
export { cloneDeepWith } from "./cloneDeepWith";
|
|
26
|
+
export { flattenObject } from "./flattenObject";
|
|
27
|
+
export { clearVideoElement } from "./clearVideoElement";
|
|
28
|
+
export * from "./isValidURL";
|
|
29
|
+
export { isIntersecting } from "./isIntersecting";
|
|
30
|
+
export { getPlayerId } from "./getPlayerId";
|
|
31
|
+
export { interpolate } from "./interpolate";
|
|
32
|
+
export { getRangeAroundIndex } from "./getRangeAroundIndex";
|
|
33
|
+
export * from "./browser";
|
|
34
|
+
export { suppressAbort, isAbortError } from "./suppressAbort";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type Extrapolate =
|
|
2
|
+
* clamp - значение не выходит за outputRange, прибиваем его к краям диапозона.
|
|
3
|
+
*/
|
|
4
|
+
export type Extrapolate = "clamp";
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
* Линейно интерполирует значение из inputRange в outputRange.
|
|
7
|
+
* @param value - Входное значение (например, прогресс анимации)
|
|
8
|
+
* @param inputRange - Диапазон входных значений (должен быть отсортирован)
|
|
9
|
+
* @param outputRange - Диапазон выходных значений
|
|
10
|
+
* @returns - Интерполированное значение
|
|
11
|
+
*/
|
|
12
12
|
export declare function interpolate(value: number, inputRange: [number, number], outputRange: [number, number]): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
type Rect = Pick<DOMRect,
|
|
1
|
+
type Rect = Pick<DOMRect, "top" | "bottom" | "left" | "right">;
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
* Проверяет пересекаются ли прямоугольники.
|
|
4
|
+
*/
|
|
5
5
|
export declare const isIntersecting: (rect1: Rect, rect2: Rect) => boolean;
|
|
6
6
|
export {};
|
package/types/utils/now.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Milliseconds } from
|
|
1
|
+
import type { Milliseconds } from "./semanticTypes";
|
|
2
2
|
export declare const now: () => Milliseconds;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IObservable } from
|
|
2
|
-
import type { IRectangle } from
|
|
3
|
-
import type { Milliseconds } from
|
|
1
|
+
import type { IObservable } from "../reactive";
|
|
2
|
+
import type { IRectangle } from "../types";
|
|
3
|
+
import type { Milliseconds } from "./semanticTypes";
|
|
4
4
|
export declare const observeElementSize: (element: Element, throttleTime?: Milliseconds) => IObservable<IRectangle>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { IRectangle } from
|
|
2
|
-
import { type ExactVideoQuality, VideoQuality } from
|
|
1
|
+
import type { IRectangle } from "../../types";
|
|
2
|
+
import { type ExactVideoQuality, VideoQuality } from "./types";
|
|
3
3
|
export declare const isHigher: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
4
4
|
export declare const isHigherOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
5
5
|
export declare const isLower: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
6
6
|
export declare const isLowerOrEqual: (a: ExactVideoQuality, b: ExactVideoQuality) => boolean;
|
|
7
7
|
export declare const getHighestQuality: (qualities: VideoQuality[]) => VideoQuality | undefined;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* Выбирает качество, наиболее близкое к указанной высоте кадра, но не менее её.
|
|
10
|
+
* @param tolerance позволяет выбрать качество менее заданной высоты на величину погрешности (в процентах)
|
|
11
|
+
*/
|
|
12
12
|
export declare const videoHeightToQuality: (height: number, tolerance?: number) => ExactVideoQuality | undefined;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* Выбирает качество описывающее заданные размеры видео потока, т.е. не меньше его.
|
|
15
|
+
*/
|
|
16
16
|
export declare const videoSizeToQuality: ({ width, height }: IRectangle) => ExactVideoQuality | undefined;
|
|
17
17
|
export declare const videoQualityToHeight: (quality: ExactVideoQuality) => number;
|
|
18
18
|
export declare const isInvariantQuality: (quality: VideoQuality) => quality is VideoQuality.INVARIANT;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export declare enum VideoQuality {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
INVARIANT = "Invariant quality",
|
|
3
|
+
Q_144P = "144p",
|
|
4
|
+
Q_240P = "240p",
|
|
5
|
+
Q_360P = "360p",
|
|
6
|
+
Q_480P = "480p",
|
|
7
|
+
Q_576P = "576p",
|
|
8
|
+
Q_720P = "720p",
|
|
9
|
+
Q_1080P = "1080p",
|
|
10
|
+
Q_1440P = "1440p",
|
|
11
|
+
Q_2160P = "2160p",
|
|
12
|
+
Q_4320P = "4320p"
|
|
13
13
|
}
|
|
14
14
|
export type ExactVideoQuality = Exclude<VideoQuality, VideoQuality.INVARIANT>;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
* Лимиты трактуются включительно
|
|
17
|
+
* Значение undefined снимает лимит
|
|
18
|
+
*/
|
|
19
19
|
export type QualityLimits = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
max?: ExactVideoQuality;
|
|
21
|
+
min?: ExactVideoQuality;
|
|
22
22
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type DebouncedFn } from "./debounceFn";
|
|
1
2
|
export interface ThrottleOptions {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
leading?: boolean;
|
|
4
|
+
trailing?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare const throttleFn: <T extends (...args: any) => any>(func: T, wait?: number, options?: ThrottleOptions) =>
|
|
6
|
+
export declare const throttleFn: <T extends (...args: any) => any>(func: T, wait?: number, options?: ThrottleOptions) => DebouncedFn<T>;
|