@vkontakte/videoplayer-core 2.0.176-dev.20c0d4fde.0 → 2.0.176-dev.b09e84095.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 +4 -4
- package/es2015.esm.js +16 -16
- package/esnext.cjs +4 -4
- package/esnext.esm.js +8 -8
- package/evergreen.esm.js +15 -15
- package/package.json +2 -2
- package/types/index.d.ts +2 -2
- package/types/utils/ConnectionWarmUp.d.ts +21 -0
- package/types/utils/warmUpSources.d.ts +6 -8
- package/types/utils/warmUpTargets.d.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.176-dev.
|
|
3
|
+
"version": "2.0.176-dev.b09e84095.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.105-dev.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.105-dev.b09e84095.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { VideoCodec } from "./player/types";
|
|
|
4
4
|
import { VideoFormat, Surface, PredefinedQualityLimits, VideoCodecName } from "./player/types";
|
|
5
5
|
import Player from "./player/Player";
|
|
6
6
|
import warmUpSources from "./utils/warmUpSources";
|
|
7
|
-
import type { IWarmUp
|
|
7
|
+
import type { IWarmUp } from "./utils/warmUpSources";
|
|
8
8
|
import type { IPlayer, IPlayerInfo, IPlayerEvents, IConfig, ISources, ICueSettings, IExternalTextTrack, ITextTrack, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics } from "./player/types";
|
|
9
9
|
import { PlaybackState, ChromecastState, HttpConnectionType } from "./player/types";
|
|
10
10
|
import type { IOptionalTuningConfig } from "./utils/tuningConfig";
|
|
@@ -18,5 +18,5 @@ import { Subscription, Observable, Subject, ValueSubject, VideoQuality } from "@
|
|
|
18
18
|
*/
|
|
19
19
|
declare const SDK_VERSION: string;
|
|
20
20
|
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, ICueSettings, PlaybackRate, IVideoStream, IAudioStream, StartEnd, HttpConnectionMetrics, HttpDownloadMetrics };
|
|
21
|
-
export type { IWarmUp
|
|
21
|
+
export type { IWarmUp };
|
|
22
22
|
export { Player, warmUpSources, PlaybackState, ChromecastState, HttpConnectionType, Surface, Subscription, VideoFormat, VideoQuality, Observable, Subject, ValueSubject, VERSION, SDK_VERSION, PredefinedQualityLimits, VideoCodec, VideoCodecName };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IWarmUpTargets {
|
|
2
|
+
preconnect: string[];
|
|
3
|
+
dnsPrefetch: string[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Прогрев соединения к хостам раздачи. Первый запрос плеера иначе оплачивает полный
|
|
7
|
+
* холодный путь DNS → TCP → TLS, и только после него едут байты.
|
|
8
|
+
*
|
|
9
|
+
* `crossOrigin` на preconnect обязателен: медиазапросы уходят с CORS, а прогретое без него
|
|
10
|
+
* соединение лежит в другом пуле браузера — то есть впустую. Для dns-prefetch он не нужен:
|
|
11
|
+
* резолв имени от пула соединений не зависит.
|
|
12
|
+
*
|
|
13
|
+
* Линки снимаются при `destroy`: плеер переинициализируют, и без уборки `<head>` копил бы
|
|
14
|
+
* их до перезагрузки страницы.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ConnectionWarmUp {
|
|
17
|
+
private links;
|
|
18
|
+
warmUp(targets: IWarmUpTargets): IWarmUpTargets;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
private appendLinks;
|
|
21
|
+
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import type { ISources } from "../player/types";
|
|
2
|
-
|
|
3
|
-
preconnect: string[];
|
|
4
|
-
dnsPrefetch: string[];
|
|
5
|
-
}
|
|
2
|
+
import type { IWarmUpTargets } from "./ConnectionWarmUp";
|
|
6
3
|
export interface IWarmUp {
|
|
7
4
|
applied: IWarmUpTargets;
|
|
8
5
|
destroy: () => void;
|
|
9
6
|
}
|
|
10
7
|
interface IOptions {
|
|
11
8
|
failoverHosts?: string[];
|
|
9
|
+
limit?: number;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Прогрев соединения к хостам раздачи по готовым `sources` — до того, как создан плеер.
|
|
15
13
|
*
|
|
16
|
-
* Экономия равна запасу времени до первого
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Экономия равна запасу времени до первого запроса: плеер успевает пройти путь от `initVideo`
|
|
15
|
+
* до манифеста за считанные миллисекунды, поэтому звать эту функцию имеет смысл там, где
|
|
16
|
+
* `sources` появились сильно раньше плеера, — сразу после ответа API у потребителя.
|
|
19
17
|
*/
|
|
20
|
-
declare const _default: (sources: ISources, { failoverHosts }?: IOptions) => IWarmUp;
|
|
18
|
+
declare const _default: (sources: ISources, { failoverHosts, limit }?: IOptions) => IWarmUp;
|
|
21
19
|
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ISources } from "../player/types";
|
|
2
|
+
/**
|
|
3
|
+
* Хосты, к которым плеер пойдёт за данными. Считаются до того, как выбран формат:
|
|
4
|
+
* прогрев соединения имеет смысл ровно пока выбор ещё не сделан.
|
|
5
|
+
*
|
|
6
|
+
* Лимит намеренно жёсткий. Каждое лишнее соединение — это DNS, TCP и TLS, потраченные
|
|
7
|
+
* на хост, к которому в этой сессии, скорее всего, не пойдут.
|
|
8
|
+
*/
|
|
9
|
+
export declare const collectSourceOrigins: (sources: ISources, limit?: number) => string[];
|
|
10
|
+
/**
|
|
11
|
+
* Запасные хосты, которым достаточно резолва имени. Соединение к ним в большинстве сессий
|
|
12
|
+
* не понадобится — failover это аварийный путь, — но DNS стоит дешевле соединения,
|
|
13
|
+
* поэтому лимит прогрева на них не распространяется.
|
|
14
|
+
*
|
|
15
|
+
* `failoverHosts` — голые хосты: `ProviderContainer.applyFailoverHost` подставляет их
|
|
16
|
+
* в существующий URL, сохраняя протокол. Протокол здесь берётся у прогретого источника.
|
|
17
|
+
*/
|
|
18
|
+
export declare const collectDnsPrefetchHosts: (failoverHosts: string[], preconnectOrigins: string[]) => string[];
|