@vkontakte/videoplayer-core 2.0.170-dev.f84bb177a.0 → 2.0.171-dev.4982aad68.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 +54 -58
- package/es2015.esm.js +58 -62
- package/esnext.cjs +56 -60
- package/esnext.esm.js +56 -60
- package/evergreen.esm.js +56 -60
- package/package.json +2 -2
- package/types/providers/DashProvider/baseDashProvider.d.ts +0 -2
- package/types/providers/DashProvider/lib/buffer.d.ts +2 -0
- package/types/providers/DashProvider/lib/fetcher.d.ts +6 -4
- package/types/providers/DashProvider/lib/player.d.ts +1 -0
- package/types/providers/DashProvider/lib/sourceBufferTaskQueue.d.ts +1 -2
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +0 -1
- package/types/providers/DashProviderVirtual/lib/buffer/nativeBufferManager.d.ts +1 -1
- package/types/providers/DashProviderVirtual/lib/buffer/sourceBufferTaskQueue.d.ts +1 -2
- package/types/providers/DashProviderVirtual/lib/buffer/types.d.ts +2 -1
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.versionA.d.ts +3 -2
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/byteRangeVirtualBufferManager.versionA.d.ts +1 -0
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/liveVirtualBuffer.d.ts +1 -1
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/virtualBufferFactory.d.ts +1 -2
- package/types/providers/DashProviderVirtual/lib/fetcher.d.ts +9 -6
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +2 -1
- package/types/providers/ProviderContainer/Mayday/heuristics/TvFetcherErrorHeuristic.d.ts +10 -0
- package/types/providers/ProviderContainer/Mayday/index.d.ts +1 -0
- package/types/providers/ProviderContainer/index.d.ts +3 -1
- package/types/providers/utils/Abr/types.d.ts +0 -2
- package/types/providers/utils/HTMLVideoElement/destroy.d.ts +1 -1
- package/types/providers/utils/HTMLVideoElement/pool.d.ts +2 -3
- package/types/providers/utils/segmentCache/IndexedDbSegmentCacheStorage.d.ts +52 -0
- package/types/providers/utils/segmentCache/SegmentCache.d.ts +40 -0
- package/types/providers/utils/segmentCache/constants.d.ts +20 -0
- package/types/providers/utils/segmentCache/index.d.ts +8 -0
- package/types/providers/utils/segmentCache/segmentCacheDb.d.ts +25 -0
- package/types/providers/utils/segmentCache/segmentCacheUtils.d.ts +25 -0
- package/types/providers/utils/segmentCache/types.d.ts +74 -0
- package/types/utils/autoSelectTrack.d.ts +3 -4
- package/types/utils/tuningConfig.d.ts +11 -30
- package/types/providers/DashProvider/lib/urlsCache.d.ts +0 -23
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts +0 -110
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/byteRangeVirtualBufferManager.d.ts +0 -21
- package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/templateVirtualBufferManager.d.ts +0 -21
- package/types/providers/DashProviderVirtual/lib/urlsCache.d.ts +0 -22
- package/types/providers/utils/Abr/rules/video/failedVideoTrackRule.d.ts +0 -14
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Byte, IRange } from "@vkontakte/videoplayer-shared";
|
|
2
|
+
import type { CacheEntryType } from "./constants";
|
|
3
|
+
export type InitSegmentRangeType = "init" | "index";
|
|
4
|
+
export interface SegmentCacheEntry {
|
|
5
|
+
data: ArrayBuffer;
|
|
6
|
+
segmentIndex: number;
|
|
7
|
+
}
|
|
8
|
+
export interface InitSegmentParams {
|
|
9
|
+
normalizedUrl: string;
|
|
10
|
+
rangeType: InitSegmentRangeType;
|
|
11
|
+
range: IRange<Byte>;
|
|
12
|
+
}
|
|
13
|
+
export interface SetMediaSegmentParams {
|
|
14
|
+
type: "media";
|
|
15
|
+
normalizedUrl: string;
|
|
16
|
+
segmentIndex: number;
|
|
17
|
+
data: ArrayBuffer;
|
|
18
|
+
}
|
|
19
|
+
export interface SetInitSegmentParams {
|
|
20
|
+
type: "init";
|
|
21
|
+
normalizedUrl: string;
|
|
22
|
+
rangeType: InitSegmentRangeType;
|
|
23
|
+
range: IRange<Byte>;
|
|
24
|
+
data: ArrayBuffer;
|
|
25
|
+
}
|
|
26
|
+
export type SetSegmentParams = SetMediaSegmentParams | SetInitSegmentParams;
|
|
27
|
+
export interface ISegmentCacheStorage {
|
|
28
|
+
getSegments(normalizedUrl: string, indices: number[]): Promise<Map<number, ArrayBuffer>>;
|
|
29
|
+
setSegment(params: SetSegmentParams): Promise<void>;
|
|
30
|
+
getInitSegment(params: InitSegmentParams): Promise<ArrayBuffer | null>;
|
|
31
|
+
/** Полная очистка кэша (все записи, без привязки к url) с рассылкой события другим инстансам */
|
|
32
|
+
clear(): Promise<void>;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
35
|
+
export interface CacheMetadataEntry {
|
|
36
|
+
index: number;
|
|
37
|
+
byteRange: IRange<Byte>;
|
|
38
|
+
}
|
|
39
|
+
export interface CacheMetadata {
|
|
40
|
+
segments: CacheMetadataEntry[];
|
|
41
|
+
}
|
|
42
|
+
export interface SegmentCacheConfig {
|
|
43
|
+
/** Включает кэширование media-сегментов в IndexedDB */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Лимит суммарного размера кэша (media + init/index сегменты) в байтах. При QuotaExceededError автоматически опускается до текущего размера */
|
|
46
|
+
maxTotalSizeBytes: number;
|
|
47
|
+
/** Доля от эффективного лимита, при превышении которой запускается LRU-эвикт (0.9 = 90%) */
|
|
48
|
+
evictionThreshold: number;
|
|
49
|
+
/** Доля от максимального хранимого кэша, до которой LRU-эвикт очищает кэш (0.7 = 70%).
|
|
50
|
+
* Должна быть ниже evictionThreshold: запас между ними не даёт эвикту срабатывать на каждую запись у границы лимита
|
|
51
|
+
* */
|
|
52
|
+
evictionTargetPercent: number;
|
|
53
|
+
/** Максимальный объём данных в байтах, который LRU-эвикт удаляет за один проход (ограничивает длительность одной транзакции) */
|
|
54
|
+
evictionBatchMaxBytes: number;
|
|
55
|
+
/** Доля от maxTotalStoredBytes, которую нужно освободить при QuotaExceededError (0.5 = 50%) */
|
|
56
|
+
quotaExceededEvictPercent: number;
|
|
57
|
+
/** TTL для media-сегментов в миллисекундах. Протухшие записи удаляются при чтении и при rehydrate */
|
|
58
|
+
ttlMs: number;
|
|
59
|
+
/** TTL для init/index-сегментов в миллисекундах (обычно длиннее, т.к. они стабильнее) */
|
|
60
|
+
initTtlMs: number;
|
|
61
|
+
/** Стратегия очистки кэша при ошибках декодера/фетчера: 'once' — один раз за жизнь контейнера, 'always' — на каждую ошибку */
|
|
62
|
+
clearOnErrorStrategy: "once" | "always";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Единая запись кэша. Ключ передаётся явно (out-of-line) через createMediaKey / createInitKey.
|
|
66
|
+
*/
|
|
67
|
+
export interface CacheRecord {
|
|
68
|
+
normalizedUrl: string;
|
|
69
|
+
data: ArrayBuffer;
|
|
70
|
+
byteLength: number;
|
|
71
|
+
createdAt: number;
|
|
72
|
+
lastAccessAt: number;
|
|
73
|
+
}
|
|
74
|
+
export type CachePrimaryKey = [string, CacheEntryType, number, number];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ITuningConfig } from "./tuningConfig";
|
|
2
|
-
import type { Kbps, Milliseconds, IRectangle, QualityLimits, IComponentLogger
|
|
2
|
+
import type { Kbps, Milliseconds, IRectangle, QualityLimits, IComponentLogger } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import { type ExactVideoQuality } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
import type { IAudioTrack, IBaseTrack, IVideoTrack } from "../player/types";
|
|
5
5
|
interface IConstraints<T extends IBaseTrack> {
|
|
@@ -11,7 +11,6 @@ interface IConstraints<T extends IBaseTrack> {
|
|
|
11
11
|
playbackRate?: number;
|
|
12
12
|
forwardBufferHealth?: number;
|
|
13
13
|
current?: T;
|
|
14
|
-
failedVideoTrack?: Nullable<T>;
|
|
15
14
|
visible?: boolean;
|
|
16
15
|
history?: TrackHistory<T>;
|
|
17
16
|
droppedVideoMaxQualityLimit?: ExactVideoQuality;
|
|
@@ -30,8 +29,8 @@ export declare class TrackHistory<T extends IBaseTrack> {
|
|
|
30
29
|
export declare const defaultEmptyArrayErrorMessage = "Assertion \"ABR Tracks is empty array\" failed";
|
|
31
30
|
export declare const getMinPossibleAudioForVideoOld: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
|
|
32
31
|
export declare const getMinPossibleAudioForVideoNew: (videoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], minVideoAudioRatio: number) => IAudioTrack | undefined;
|
|
33
|
-
export declare const autoSelectVideoTrackNew: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current,
|
|
34
|
-
export declare const autoSelectVideoTrackOld: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current,
|
|
32
|
+
export declare const autoSelectVideoTrackNew: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, abrLogger, panelSize }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
33
|
+
export declare const autoSelectVideoTrackOld: (videoTracks: IVideoTrack[], { container, estimatedThroughput, tuning, limits, reserve, forwardBufferHealth, playbackRate, current, history, visible, droppedVideoMaxQualityLimit, stallsVideoMaxQualityLimit, stallsPredictedThroughput, abrLogger, panelSize }: IConstraints<IVideoTrack>) => IVideoTrack;
|
|
35
34
|
export declare const autoSelectAudioTrackForVideoOld: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, stallsPredictedThroughput }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
36
35
|
export declare const autoSelectAudioTrackForVideoNew: (selectedVideoTrack: IVideoTrack, videoTracks: IVideoTrack[], audioTracks: IAudioTrack[], { estimatedThroughput, tuning, playbackRate, forwardBufferHealth, history, abrLogger, stallsPredictedThroughput }: IConstraints<IAudioTrack>) => IAudioTrack | undefined;
|
|
37
36
|
export {};
|
|
@@ -5,6 +5,7 @@ import { IOSPreferredFormat } from "../enums/IOSPreferredFormat";
|
|
|
5
5
|
import type { Byte, Kbps, Milliseconds, RecursivePartial, Seconds } from "@vkontakte/videoplayer-shared";
|
|
6
6
|
import { type ExactVideoQuality, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
7
7
|
import { AudioRuleName, VideoRuleName } from "../providers/utils/Abr/types";
|
|
8
|
+
import type { SegmentCacheConfig } from "../providers/utils/segmentCache/types";
|
|
8
9
|
export type ITuningConfig = {
|
|
9
10
|
/** @deprecated */
|
|
10
11
|
configName?: string[];
|
|
@@ -15,19 +16,6 @@ export type ITuningConfig = {
|
|
|
15
16
|
heuristics: string[];
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
* Если true, внутренний video элемент не будет уничтожаться при реините провайдера
|
|
19
|
-
* и при создании нового экземляра Player.
|
|
20
|
-
* Будет веcти себя аналогично элементу переданному снаружи
|
|
21
|
-
* Для кейса прямого использовани ядра
|
|
22
|
-
*/
|
|
23
|
-
keepVideoElement: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Временный флаг для тестирования очистки video элемента
|
|
26
|
-
* Если true, при очистке будет вызван innerHTML = '' для очистки дочерних элементов трэков
|
|
27
|
-
* В противном случае они размножаются
|
|
28
|
-
*/
|
|
29
|
-
clearVideoElementInnerHTML: boolean;
|
|
30
|
-
/**
|
|
31
19
|
* Включает очистку состояния плеера при вызове метода stop()
|
|
32
20
|
*/
|
|
33
21
|
allowPlayerReuse: boolean;
|
|
@@ -180,11 +168,8 @@ export type ITuningConfig = {
|
|
|
180
168
|
useNewRepresentationSwitch: boolean;
|
|
181
169
|
useDelayedRepresentationSwitch: boolean;
|
|
182
170
|
useSmartRepresentationSwitch: boolean;
|
|
183
|
-
|
|
184
|
-
mutexStallExitPolicy: boolean;
|
|
171
|
+
stallForceSeekOncePerStall: boolean;
|
|
185
172
|
useFetchPriorityHints: boolean;
|
|
186
|
-
useAbortMSEFix: boolean;
|
|
187
|
-
useByteRangeNullFetchRecovery: boolean;
|
|
188
173
|
enableBaseUrlSupport: boolean;
|
|
189
174
|
maxSegmentRetryCount: number;
|
|
190
175
|
sourceOpenTimeout: number;
|
|
@@ -210,9 +195,7 @@ export type ITuningConfig = {
|
|
|
210
195
|
abrVideoRules: VideoRuleName[];
|
|
211
196
|
abrAudioRules: AudioRuleName[];
|
|
212
197
|
useDynamicBirtateRule: boolean;
|
|
213
|
-
useNewFailoverLogic: boolean;
|
|
214
198
|
useFailoverHostsOnAllProviderCrash: boolean;
|
|
215
|
-
videoTrackBanAfterProviderFail: Milliseconds;
|
|
216
199
|
saveData3gQualityLimit: ExactVideoQuality;
|
|
217
200
|
saveData2gQualityLimit: ExactVideoQuality;
|
|
218
201
|
useConnectionDataUpperLimit: boolean;
|
|
@@ -253,7 +236,6 @@ export type ITuningConfig = {
|
|
|
253
236
|
dashMaxTvVideoQuality: boolean;
|
|
254
237
|
checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
|
|
255
238
|
preloadFirstSegment: boolean;
|
|
256
|
-
jumpGapToNearestBuffer: boolean;
|
|
257
239
|
maxQualityForFirstSegmentPreload: ExactVideoQuality;
|
|
258
240
|
downloadTime: {
|
|
259
241
|
minLookaheadSegments: number;
|
|
@@ -357,7 +339,6 @@ export type ITuningConfig = {
|
|
|
357
339
|
useNewSwitchTo: boolean;
|
|
358
340
|
alwaysAbortPreviousSwitch: boolean;
|
|
359
341
|
useDashProviderVirtual: boolean;
|
|
360
|
-
useDashProviderVirtualVersionA: boolean;
|
|
361
342
|
useDashProviderVirtualMobile: boolean;
|
|
362
343
|
useNewAutoSelectVideoTrack: boolean;
|
|
363
344
|
useSafariEndlessRequestBugfix: boolean;
|
|
@@ -435,15 +416,6 @@ export type ITuningConfig = {
|
|
|
435
416
|
*/
|
|
436
417
|
handleExtendedNetworkErrorsSet?: boolean;
|
|
437
418
|
/**
|
|
438
|
-
* Кэшируем ответы от сервера руками, так как из за динамичесокй природы некоторых параметров в урле
|
|
439
|
-
* браузер это не может сделать.
|
|
440
|
-
*/
|
|
441
|
-
useUrlCacheMechanism?: boolean;
|
|
442
|
-
/**
|
|
443
|
-
* Очищаем кэш урлов при падение провайдера.
|
|
444
|
-
*/
|
|
445
|
-
dropUrlCacheWhenProviderCrashed?: boolean;
|
|
446
|
-
/**
|
|
447
419
|
* При смене/реините провайдера игнорируем результат того, смогло видео заиграть или нет.
|
|
448
420
|
*/
|
|
449
421
|
ignoreForcePlayResultWhenProviderChanged?: boolean;
|
|
@@ -458,6 +430,15 @@ export type ITuningConfig = {
|
|
|
458
430
|
useDurationFromSegments: boolean;
|
|
459
431
|
/** включен режим проигрывания только аудио (без видео) */
|
|
460
432
|
audioOnly: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Переводить провайдер в READY по loadedmetadata вместо canplay.
|
|
435
|
+
* canplay означает, что видео уже может играться, что избыточно для READY —
|
|
436
|
+
* достаточно получить манифест (loadedmetadata).
|
|
437
|
+
* Применяется только когда желаемое состояние — READY (preload): при автоплее
|
|
438
|
+
* провайдер по-прежнему ждёт canplay, чтобы play() не вызывался до появления данных.
|
|
439
|
+
*/
|
|
440
|
+
readyOnLoadedMetadata: boolean;
|
|
441
|
+
segmentCache: SegmentCacheConfig;
|
|
461
442
|
};
|
|
462
443
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
|
|
463
444
|
export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type CacheManager = {
|
|
2
|
-
get: () => Promise<Response | null>;
|
|
3
|
-
set: (response: Response) => void;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Пытаемся добиться кэширования вызовов.
|
|
7
|
-
* Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
|
|
8
|
-
* Из за этого обрабатываем кэш вручную.
|
|
9
|
-
*/
|
|
10
|
-
export declare const createCacheManager: (url: string) => Promise<CacheManager>;
|
|
11
|
-
export declare function canUseCacheApi(): boolean;
|
|
12
|
-
export declare function normalizeUrl(url: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Проверяет, не просрочен ли кэшированный ответ
|
|
15
|
-
*/
|
|
16
|
-
export declare function isResponseExpired(response: Response): boolean;
|
|
17
|
-
export declare function cloneResponse(response: Response, url: string): Response;
|
|
18
|
-
/**
|
|
19
|
-
* Извлекает expires из оригинального URL (параметр expires1)
|
|
20
|
-
* Предполагается, что expires1 — timestamp в секундах
|
|
21
|
-
*/
|
|
22
|
-
export declare function getExpiresFromUrl(url: string): number;
|
|
23
|
-
export declare const dropUrlsCache: () => Promise<void>;
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { Fetcher, FetchParamsWithUrl, Priority, RepresentationFetchResult } from "../../fetcher";
|
|
2
|
-
import type { CommonInit, ContainerParser, Representation, Segment } from "../../../../utils/parsers/types";
|
|
3
|
-
import { StreamKind } from "../../../../utils/parsers/types";
|
|
4
|
-
import type { ITuningConfig } from "../../../../../utils/tuningConfig";
|
|
5
|
-
import type { Byte, IError, IRange, ISubject, ITracer, IValueSubject, Milliseconds, Seconds } from "@vkontakte/videoplayer-shared";
|
|
6
|
-
import { abortable, Subscription } from "@vkontakte/videoplayer-shared";
|
|
7
|
-
import type { NativeBufferManager } from "../nativeBufferManager";
|
|
8
|
-
import { SwithRepresentationMode, type Dependencies, type IBufferPlaybackQueueItem, type ISomeDataLoadedCallbackParams, type IVirtualBufferManager } from "../types";
|
|
9
|
-
import type { VideoSegmentLoadProgress } from "../../../../utils/Abr/types";
|
|
10
|
-
export declare abstract class BaseVirtualBufferManager<T extends Segment> implements IVirtualBufferManager<T> {
|
|
11
|
-
error$: ISubject<IError>;
|
|
12
|
-
playingRepresentation$: IValueSubject<Representation["id"] | undefined>;
|
|
13
|
-
playingRepresentationInit$: IValueSubject<CommonInit | undefined>;
|
|
14
|
-
currentSegmentLength$: IValueSubject<number>;
|
|
15
|
-
onLastSegment$: IValueSubject<boolean>;
|
|
16
|
-
fullyBuffered$: IValueSubject<boolean>;
|
|
17
|
-
protected readonly kind: StreamKind;
|
|
18
|
-
protected readonly nativeBufferManager: NativeBufferManager;
|
|
19
|
-
protected readonly fetcher: Fetcher;
|
|
20
|
-
protected readonly tracer: ITracer;
|
|
21
|
-
protected readonly tuning: ITuningConfig;
|
|
22
|
-
protected representations: Map<Representation["id"], Representation>;
|
|
23
|
-
protected playingRepresentationId: Representation["id"] | undefined;
|
|
24
|
-
protected downloadingRepresentationId: Representation["id"] | undefined;
|
|
25
|
-
protected switchingRepresentationId: Representation["id"] | null;
|
|
26
|
-
protected initData: Map<Representation["id"], ArrayBuffer>;
|
|
27
|
-
protected initDataPromises: Map<Representation["id"], Promise<RepresentationFetchResult<T> | null | undefined>>;
|
|
28
|
-
protected idleCallbacks: Map<Representation["id"], number>;
|
|
29
|
-
protected parsedInitData: Map<Representation["id"], CommonInit>;
|
|
30
|
-
protected forwardBufferRepresentations: Map<Representation["id"], T[]>;
|
|
31
|
-
protected segments: Map<Representation["id"], T[]>;
|
|
32
|
-
protected containerParser: ContainerParser;
|
|
33
|
-
protected bufferPlaybackQueue: IBufferPlaybackQueueItem<T>[];
|
|
34
|
-
protected downloadingBufferItems: IBufferPlaybackQueueItem<T>[];
|
|
35
|
-
protected preloadOnly: boolean;
|
|
36
|
-
protected forwardBufferTarget: Milliseconds;
|
|
37
|
-
protected failedDownloads: number;
|
|
38
|
-
protected lastDataObtainedTimestampMs: Milliseconds;
|
|
39
|
-
protected loadByteRangeSegmentsTimeoutId: number;
|
|
40
|
-
protected currentVirtualBufferSize: Byte;
|
|
41
|
-
private baseUrls;
|
|
42
|
-
private baseUrlsIndex;
|
|
43
|
-
protected maintainPlaybackBufferMutex: boolean;
|
|
44
|
-
protected maintainNativeBufferMutex: boolean;
|
|
45
|
-
protected bufferClearingMutex: boolean;
|
|
46
|
-
protected abortNativeBufferMutex: boolean;
|
|
47
|
-
protected switchMutex: boolean;
|
|
48
|
-
protected seekMutex: boolean;
|
|
49
|
-
protected destroyAbortController: AbortController;
|
|
50
|
-
protected switchAbortController: AbortController;
|
|
51
|
-
protected downloadAbortController: AbortController;
|
|
52
|
-
protected subscription: Subscription;
|
|
53
|
-
protected readonly getCurrentPosition: () => Milliseconds | undefined;
|
|
54
|
-
protected readonly getCurrentStallDuration: () => Milliseconds | undefined;
|
|
55
|
-
protected constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], { fetcher, tracer, tuning, getCurrentPosition, getCurrentStallDuration, manifest }: Dependencies);
|
|
56
|
-
protected abstract loadItems(itemsToLoad: IBufferPlaybackQueueItem<T>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
57
|
-
protected abstract selectItemsToLoad(): IBufferPlaybackQueueItem<T>[];
|
|
58
|
-
protected abstract prepareFetchParams(items: IBufferPlaybackQueueItem<T>[], representation: Representation): FetchParamsWithUrl;
|
|
59
|
-
protected abstract onSomeDataLoaded(data: ISomeDataLoadedCallbackParams<T>): Promise<void>;
|
|
60
|
-
protected abstract updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
61
|
-
startWith: ReturnType<typeof abortable<[Representation["id"]]>>;
|
|
62
|
-
switchTo(newRepresentationId: Representation["id"], mode?: SwithRepresentationMode): Promise<void>;
|
|
63
|
-
protected getSwitchWithAbort(switchToTracer: ITracer): ReturnType<typeof abortable<[Representation["id"], SwithRepresentationMode], void>>;
|
|
64
|
-
prepareSeek(): Promise<void>;
|
|
65
|
-
seek(position: Milliseconds | undefined): Promise<void>;
|
|
66
|
-
maintain(currentPosition?: Milliseconds | undefined): Promise<void>;
|
|
67
|
-
getForwardBufferRepresentations(currentPosition?: Milliseconds | undefined): Map<Representation["id"], T[]>;
|
|
68
|
-
getForwardPlaybackBufferDuration(currentPosition?: Milliseconds | undefined): Milliseconds;
|
|
69
|
-
getPlaybackBufferState(): IRange<Milliseconds> | null;
|
|
70
|
-
abort(): Promise<void>;
|
|
71
|
-
findSegmentStartTime(position: Milliseconds): Milliseconds | undefined;
|
|
72
|
-
getRepresentationInitialTime(): Seconds;
|
|
73
|
-
getMutexInfo(): string;
|
|
74
|
-
calculateDurationFromSegments(): Milliseconds;
|
|
75
|
-
getActiveSegmentProgress(): VideoSegmentLoadProgress | undefined;
|
|
76
|
-
getMpdSegmentDuration(): Milliseconds | undefined;
|
|
77
|
-
get lastDataObtainedTimestamp(): Milliseconds;
|
|
78
|
-
setTarget(time: Milliseconds): void;
|
|
79
|
-
setPreloadOnly(preloadOnly: boolean): void;
|
|
80
|
-
destroy(): void;
|
|
81
|
-
protected verifyBufferPlaybackQueue(position: Milliseconds): Promise<void>;
|
|
82
|
-
protected forceSwitchCondition(oldRepresentation: Representation, newRepresentation: Representation): boolean;
|
|
83
|
-
protected clearBuffer(): Promise<void>;
|
|
84
|
-
protected abortDownload(): void;
|
|
85
|
-
protected abortDownloadingItems(): void;
|
|
86
|
-
protected abortNativeBuffer(): Promise<boolean>;
|
|
87
|
-
protected loadInits(): Promise<void>;
|
|
88
|
-
protected loadInitIfNeeded(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
89
|
-
protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
90
|
-
private isMaintainNativeBufferMutexActive;
|
|
91
|
-
protected maintainNativeBuffer(): Promise<void>;
|
|
92
|
-
protected maintainPlaybackBuffer(position: Milliseconds): Promise<void>;
|
|
93
|
-
protected actualizeLastSegmentInfo(currentPosition: Milliseconds): void;
|
|
94
|
-
protected selectDownloadingItems(position: Milliseconds, segments: T[]): IBufferPlaybackQueueItem<T>[];
|
|
95
|
-
protected processCachedItems(): Promise<void>;
|
|
96
|
-
protected withinInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>, leftTolerance?: Milliseconds, rightTolerance?: Milliseconds): boolean;
|
|
97
|
-
protected withinAppendInterval(currentPosition: Milliseconds | undefined, { from, to }: IRange<Milliseconds>): boolean;
|
|
98
|
-
protected withinRemoveInterval(currentPosition: Milliseconds | undefined, { to }: IRange<Milliseconds>): boolean;
|
|
99
|
-
protected getExponentialDownloadDelay(): ReturnType<typeof abortable>;
|
|
100
|
-
protected waitExponentialDownloadDelay(): Promise<void>;
|
|
101
|
-
protected appendSegmentFully(nextPlayingItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
|
|
102
|
-
protected appendSegmentPartially(nextPlayingItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
|
|
103
|
-
protected parseFeedableSegmentChunk(chunk: DataView): DataView | null;
|
|
104
|
-
protected onItemFullyDownloaded(downloadedItem: IBufferPlaybackQueueItem<T>): void;
|
|
105
|
-
protected onItemFullyAppended(appendedItem: IBufferPlaybackQueueItem<T>): void;
|
|
106
|
-
protected removeSegment(nextRemoveItem: IBufferPlaybackQueueItem<T>, signal: AbortSignal): Promise<void>;
|
|
107
|
-
protected onDownloadItem(downloadedItem: IBufferPlaybackQueueItem<T>): Promise<void>;
|
|
108
|
-
protected pruneVirtualBuffer(currentPosition: Milliseconds): void;
|
|
109
|
-
protected updateRepresentationsBaseUrlIfNeeded(): void;
|
|
110
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseVirtualBufferManager } from "./baseVirtualBufferManager";
|
|
2
|
-
import type { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackParams, IVirtualBufferManager } from "../types";
|
|
3
|
-
import type { ByteRangeSegment, Representation, StreamKind } from "../../../../utils/parsers/types";
|
|
4
|
-
import type { NativeBufferManager } from "../nativeBufferManager";
|
|
5
|
-
import type { FetchParamsWithUrl, Priority } from "../../fetcher";
|
|
6
|
-
export declare class ByteRangeVirtualBufferManager extends BaseVirtualBufferManager<ByteRangeSegment> implements IVirtualBufferManager<ByteRangeSegment> {
|
|
7
|
-
constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
|
|
8
|
-
protected override loadItems(itemsToLoad: IBufferPlaybackQueueItem<ByteRangeSegment>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
9
|
-
protected override selectItemsToLoad(): IBufferPlaybackQueueItem<ByteRangeSegment>[];
|
|
10
|
-
protected override prepareFetchParams(items: IBufferPlaybackQueueItem<ByteRangeSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
11
|
-
/**
|
|
12
|
-
* Закидываем в буфер сегменты атомарнее чем сегмент целиком. Например, по боксам в мпеге и по блокам в вебме.
|
|
13
|
-
* Таким образом не ждём его полной загрузки и готовы играть его намного быстрее
|
|
14
|
-
* @param dataView – данные, размер буфера – весь запрос
|
|
15
|
-
* @param globalFrom – Отступ dataView от начала файла, совпадает с отсупами сегментов
|
|
16
|
-
* @param loaded – Объём загруженных в dataView данных (всё что больше – пока нули)
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
protected override onSomeDataLoaded({ downloadingItems, dataView, representationId, globalFrom, loaded, signal }: ISomeDataLoadedCallbackParams<ByteRangeSegment>): Promise<void>;
|
|
20
|
-
protected override updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseVirtualBufferManager } from "./baseVirtualBufferManager";
|
|
2
|
-
import type { Dependencies, IBufferPlaybackQueueItem, ISomeDataLoadedCallbackParams, IVirtualBufferManager } from "../types";
|
|
3
|
-
import type { TemplateSegment, Representation, StreamKind } from "../../../../utils/parsers/types";
|
|
4
|
-
import type { NativeBufferManager } from "../nativeBufferManager";
|
|
5
|
-
import type { FetchParamsWithUrl, Priority } from "../../fetcher";
|
|
6
|
-
export declare class TemplateVirtualBufferManager extends BaseVirtualBufferManager<TemplateSegment> implements IVirtualBufferManager<TemplateSegment> {
|
|
7
|
-
constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
|
|
8
|
-
protected override loadItems(itemsToLoad: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
9
|
-
protected override selectItemsToLoad(): IBufferPlaybackQueueItem<TemplateSegment>[];
|
|
10
|
-
protected override prepareFetchParams(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
11
|
-
protected getFetchUrl(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): URL;
|
|
12
|
-
/**
|
|
13
|
-
* Закидываем в буфер сегменты атомарнее чем сегмент целиком. Например, по боксам в мпеге и по блокам в вебме.
|
|
14
|
-
* Таким образом не ждём его полной загрузки и готовы играть его намного быстрее
|
|
15
|
-
* @param dataView – данные, размер буфера – весь запрос
|
|
16
|
-
* @param loaded – Объём загруженных в dataView данных (всё что больше – пока нули)
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
protected override onSomeDataLoaded({ downloadingItems, dataView, representationId, loaded, signal }: ISomeDataLoadedCallbackParams<TemplateSegment>): Promise<void>;
|
|
20
|
-
protected override updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
21
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type CacheManager = {
|
|
2
|
-
get: () => Promise<Response | null>;
|
|
3
|
-
set: (response: Response) => Promise<void>;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Пытаемся добиться кэширования вызовов.
|
|
7
|
-
* Сейчас есть проблема, что expires и sig меняются, хотя контент не меняется, поэтому ходим мимо кэша.
|
|
8
|
-
* Из за этого обрабатываем кэш вручную.
|
|
9
|
-
*/
|
|
10
|
-
export declare const createCacheManager: (url: string) => Promise<CacheManager>;
|
|
11
|
-
export declare function canUseCacheApi(): boolean;
|
|
12
|
-
export declare function normalizeUrl(url: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Проверяет, не просрочен ли кэшированный ответ
|
|
15
|
-
*/
|
|
16
|
-
export declare function isResponseExpired(response: Response): boolean;
|
|
17
|
-
export declare function cloneResponse(response: Response, url: string): Response;
|
|
18
|
-
/**
|
|
19
|
-
* Извлекает expires из оригинального URL (параметр expires1)
|
|
20
|
-
* Предполагается, что expires1 — timestamp в секундах
|
|
21
|
-
*/
|
|
22
|
-
export declare function getExpiresFromUrl(url: string): number;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IAbrRule, IAbrRuleResolution, IRuleInitContext, IVideoAbrContext } from "../../types";
|
|
2
|
-
import type { IVideoTrack } from "../../../../../player/types";
|
|
3
|
-
import type { Nullable } from "@vkontakte/videoplayer-shared";
|
|
4
|
-
import { LimitAboveRule } from "../limitAboveRule";
|
|
5
|
-
import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
|
|
6
|
-
type FailedVideoTracLogsArgs = [banTrack: Nullable<IVideoTrack>];
|
|
7
|
-
export declare class FailedVideoTrackRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, FailedVideoTracLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
8
|
-
protected banTrack: Nullable<IVideoTrack>;
|
|
9
|
-
constructor(phaseConfig: RulePhaseConfig);
|
|
10
|
-
init(initContext: IRuleInitContext): void;
|
|
11
|
-
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
12
|
-
protected createLogMessage(selectedTrack: IVideoTrack, banTrack: Nullable<IVideoTrack>): string;
|
|
13
|
-
}
|
|
14
|
-
export {};
|