@vkontakte/videoplayer-core 2.0.163-dev.2ed41cd75.0 → 2.0.163-dev.50a3fed19.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 +35 -26
- package/es2015.esm.js +35 -26
- package/esnext.cjs +35 -26
- package/esnext.esm.js +35 -26
- package/evergreen.esm.js +35 -26
- package/package.json +2 -2
- package/types/player/Player.d.ts +3 -0
- package/types/player/types.d.ts +1 -23
- package/types/player/utils/selectContainer.d.ts +3 -0
- package/types/providers/DashProvider/baseDashProvider.d.ts +4 -0
- package/types/providers/DashProvider/lib/player.d.ts +3 -2
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +4 -0
- package/types/providers/DashProviderVirtual/lib/player/basePlayer.d.ts +5 -4
- package/types/providers/HlsProvider/manifestDataExtractor.d.ts +6 -1
- package/types/providers/ProviderContainer/index.d.ts +2 -2
- package/types/providers/types.d.ts +2 -3
- package/types/providers/utils/Abr/rules/video/downloadTimeRule.d.ts +15 -0
- package/types/providers/utils/Abr/rules/video/tvDisabledVideoTrackRule.d.ts +9 -0
- package/types/providers/utils/Abr/types.d.ts +5 -1
- package/types/providers/utils/Abr/utils.d.ts +3 -1
- package/types/providers/utils/HTMLVideoElement/pool.d.ts +1 -1
- package/types/providers/utils/canPlay.d.ts +3 -0
- package/types/providers/utils/createAllocationResolution.d.ts +12 -3
- package/types/utils/buffer/dynamicBufferTarget.d.ts +10 -0
- package/types/utils/tuningConfig.d.ts +19 -0
- package/types/player/utils/extractEmbeddableAllocation.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.163-dev.
|
|
3
|
+
"version": "2.0.163-dev.50a3fed19.0",
|
|
4
4
|
"author": "vk.com",
|
|
5
5
|
"description": "Videoplayer core library based on the vk.com platform",
|
|
6
6
|
"homepage": "https://vk.com",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"**/*.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vkontakte/videoplayer-shared": "1.0.92-dev.
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.92-dev.50a3fed19.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ export default class Player implements IPlayer {
|
|
|
40
40
|
* Позвонялет переиспользовать для другого видео
|
|
41
41
|
*/
|
|
42
42
|
private reset;
|
|
43
|
+
initAudio(config: Omit<IConfig, "container"> & {
|
|
44
|
+
audioElement?: HTMLAudioElement;
|
|
45
|
+
}): IPlayer;
|
|
43
46
|
initVideo(config: IConfig): IPlayer;
|
|
44
47
|
destroy(): void;
|
|
45
48
|
private waitInit;
|
package/types/player/types.d.ts
CHANGED
|
@@ -533,9 +533,7 @@ export interface IVolumeState {
|
|
|
533
533
|
muted: boolean;
|
|
534
534
|
}
|
|
535
535
|
export interface IConfig {
|
|
536
|
-
|
|
537
|
-
container?: string | HTMLElement;
|
|
538
|
-
readonly allocation?: TAnyAllocation;
|
|
536
|
+
container: string | HTMLElement;
|
|
539
537
|
sources: ISources;
|
|
540
538
|
meta?: IMetadata;
|
|
541
539
|
failoverHosts?: string[];
|
|
@@ -547,26 +545,6 @@ export interface IConfig {
|
|
|
547
545
|
*/
|
|
548
546
|
handleNetworkRecoverableErrorAsProviderError?: boolean;
|
|
549
547
|
}
|
|
550
|
-
export type TAllocationParent = string | HTMLElement;
|
|
551
|
-
export type TAllocationSelf = HTMLAudioElement;
|
|
552
|
-
export interface IAllocation<Parent extends TAllocationParent = TAllocationParent> {
|
|
553
|
-
readonly strategy: string;
|
|
554
|
-
readonly parent?: Parent;
|
|
555
|
-
readonly self?: TAllocationSelf;
|
|
556
|
-
}
|
|
557
|
-
export interface IEmbeddableAllocation<Parent extends TAllocationParent = TAllocationParent> extends IAllocation<Parent> {
|
|
558
|
-
readonly strategy: "embeddable";
|
|
559
|
-
readonly parent: Parent;
|
|
560
|
-
readonly self?: never;
|
|
561
|
-
}
|
|
562
|
-
export type IStringifiedEmbeddableAllocation = IEmbeddableAllocation<string>;
|
|
563
|
-
export type IDirectEmbeddableAllocation = IEmbeddableAllocation<HTMLElement>;
|
|
564
|
-
export interface IPersonalAllocation extends IAllocation {
|
|
565
|
-
readonly strategy: "personal";
|
|
566
|
-
readonly self: TAllocationSelf;
|
|
567
|
-
readonly parent?: never;
|
|
568
|
-
}
|
|
569
|
-
export type TAnyAllocation = IStringifiedEmbeddableAllocation | IDirectEmbeddableAllocation | IPersonalAllocation;
|
|
570
548
|
export interface ISources {
|
|
571
549
|
[VideoFormat.MPEG]?: IMpegSource;
|
|
572
550
|
[VideoFormat.DASH]?: IDashURLSource;
|
|
@@ -57,6 +57,10 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
57
57
|
protected abstract seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
58
58
|
protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
|
|
59
59
|
protected subscribe(): void;
|
|
60
|
+
private syncBufferTarget;
|
|
61
|
+
private resolveAudioBufferTargetMs;
|
|
62
|
+
private resolveBufferTargetMs;
|
|
63
|
+
private getCurrentVideoBitrateKbps;
|
|
60
64
|
protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
|
|
61
65
|
protected prepare(manifestOffset?: number): void;
|
|
62
66
|
protected syncPlayback: () => void;
|
|
@@ -96,7 +96,7 @@ export declare class Player {
|
|
|
96
96
|
private updateManifestUrlWithTimeOffset;
|
|
97
97
|
private updateLiveBuffersFromManifest;
|
|
98
98
|
private stopStallWatchdogSubscription;
|
|
99
|
-
initRepresentations: ReturnType<typeof abortable<[Representation["id"], Representation["id"] | undefined, IHLSSource | undefined]>>;
|
|
99
|
+
initRepresentations: ReturnType<typeof abortable<[Representation["id"] | undefined, Representation["id"] | undefined, IHLSSource | undefined]>>;
|
|
100
100
|
initBuffer(): void;
|
|
101
101
|
switchRepresentation(kind: StreamKind, id: Representation["id"], dropBuffer?: boolean): Promise<void>;
|
|
102
102
|
seek(requestedPosition: Milliseconds, forcePrecise: boolean): Promise<void>;
|
|
@@ -106,7 +106,8 @@ export declare class Player {
|
|
|
106
106
|
getForwardBufferRepresentations(kind: Exclude<StreamKind, StreamKind.TEXT>): Map<Representation["id"], Segment[]> | undefined;
|
|
107
107
|
getActiveVideoSegmentProgress(): VideoSegmentLoadProgress | undefined;
|
|
108
108
|
getMpdVideoSegmentDuration(): Milliseconds | undefined;
|
|
109
|
-
setBufferTarget(
|
|
109
|
+
setBufferTarget(videoTarget: Milliseconds, audioTarget: Milliseconds): void;
|
|
110
|
+
getVideoForwardBufferDuration(): Milliseconds;
|
|
110
111
|
getStreams(): Manifest["streams"] | undefined;
|
|
111
112
|
getCodecs(): Manifest["codecs"] | undefined;
|
|
112
113
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
@@ -57,6 +57,10 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
57
57
|
protected abstract getPlayer(): BasePlayer;
|
|
58
58
|
protected getProviderSubscriptionInfo(): IProviderSubscriptionInfo;
|
|
59
59
|
protected subscribe(): void;
|
|
60
|
+
private syncBufferTarget;
|
|
61
|
+
private resolveAudioBufferTargetMs;
|
|
62
|
+
private resolveBufferTargetMs;
|
|
63
|
+
private getCurrentVideoBitrateKbps;
|
|
60
64
|
protected selectVideoAudioRepresentations(): [Representation, Representation | undefined] | undefined;
|
|
61
65
|
protected prepare(manifestOffset?: number): void;
|
|
62
66
|
protected syncPlayback: () => void;
|
|
@@ -20,7 +20,7 @@ export declare abstract class BasePlayer {
|
|
|
20
20
|
protected manifest: Manifest | null;
|
|
21
21
|
protected tuning: ITuningConfig;
|
|
22
22
|
protected tracer: ITracer;
|
|
23
|
-
protected stallTracer
|
|
23
|
+
protected stallTracer?: ITracer;
|
|
24
24
|
protected forceVideoCodec?: VideoCodec;
|
|
25
25
|
protected stallTimeInWaitingExitAttemptMade: Milliseconds;
|
|
26
26
|
protected videoBufferManager: IVirtualBufferManager | null;
|
|
@@ -79,7 +79,7 @@ export declare abstract class BasePlayer {
|
|
|
79
79
|
protected abstract prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
|
|
80
80
|
protected abstract setSourceInitDuration(): void;
|
|
81
81
|
protected abstract restoreAfterDeepStall(): Promise<void>;
|
|
82
|
-
initRepresentations: ReturnType<typeof abortable<[Representation["id"], Representation["id"] | undefined, IHLSSource | undefined]>>;
|
|
82
|
+
initRepresentations: ReturnType<typeof abortable<[Representation["id"] | undefined, Representation["id"] | undefined, IHLSSource | undefined]>>;
|
|
83
83
|
initManifest(element: HTMLMediaElement, manifestBaseUrlString: string, offset: number): Promise<void>;
|
|
84
84
|
initBuffer(): void;
|
|
85
85
|
switchRepresentation(kind: StreamKind, id: Representation["id"], mode: SwithRepresentationMode): Promise<void>;
|
|
@@ -91,7 +91,8 @@ export declare abstract class BasePlayer {
|
|
|
91
91
|
get isStreamEnded(): boolean;
|
|
92
92
|
getStreams(): Manifest["streams"] | undefined;
|
|
93
93
|
getCodecs(): Manifest["codecs"] | undefined;
|
|
94
|
-
setBufferTarget(
|
|
94
|
+
setBufferTarget(videoTarget: Milliseconds, audioTarget: Milliseconds): void;
|
|
95
|
+
getVideoForwardBufferDuration(): Milliseconds;
|
|
95
96
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
96
97
|
stop(): void;
|
|
97
98
|
destroy(): void;
|
|
@@ -107,7 +108,7 @@ export declare abstract class BasePlayer {
|
|
|
107
108
|
protected parseManifest(manifestString: string): Nullable<Manifest>;
|
|
108
109
|
protected getResultManifest(manifest: Manifest): Manifest;
|
|
109
110
|
protected stopStallWatchdogSubscription(): void;
|
|
110
|
-
protected createBuffers(dependencies: Dependencies, initialVideo
|
|
111
|
+
protected createBuffers(dependencies: Dependencies, initialVideo?: Representation["id"], initialAudio?: Representation["id"], sourceHls?: IHLSSource): void;
|
|
111
112
|
protected waitStreamToOpen(): Promise<void>;
|
|
112
113
|
protected initRepresentationSubscriptions(): void;
|
|
113
114
|
protected initBufferLengthSubscription(): void;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Kbps, IRectangle, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
import type { IInternalTextTrack } from "../../player/types";
|
|
2
|
+
import type { IInternalTextTrack, IAudioStream } from "../../player/types";
|
|
3
|
+
export interface IInternalAudioStream extends IAudioStream {
|
|
4
|
+
type: "internal";
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
3
7
|
export type ManifestUrl = {
|
|
4
8
|
id: string;
|
|
5
9
|
quality: VideoQuality;
|
|
@@ -11,6 +15,7 @@ export type ManifestUrl = {
|
|
|
11
15
|
export type HLSManifestData = {
|
|
12
16
|
qualityManifests: ManifestUrl[];
|
|
13
17
|
textTracks: IInternalTextTrack[];
|
|
18
|
+
audioStreams: IInternalAudioStream[];
|
|
14
19
|
};
|
|
15
20
|
type ExtractHLSManifestDataConfig = {
|
|
16
21
|
manifestRetryMaxCount: number;
|
|
@@ -3,10 +3,10 @@ import { VideoFormat } from "../../player/types";
|
|
|
3
3
|
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
4
4
|
import type { IError, ISubject, IValueSubject, IRectangle } from "@vkontakte/videoplayer-shared";
|
|
5
5
|
import { ValueSubject } from "@vkontakte/videoplayer-shared";
|
|
6
|
-
import type { IDesiredState, IProviderDependencies, IProviderOutput
|
|
6
|
+
import type { IDesiredState, IProviderDependencies, IProviderOutput } from "../types";
|
|
7
7
|
import type { IProviderContainer, IProviderEntry } from "./types";
|
|
8
8
|
interface IParams extends IProviderDependencies {
|
|
9
|
-
|
|
9
|
+
container: HTMLElement;
|
|
10
10
|
sources: ISources;
|
|
11
11
|
meta: IMetadata;
|
|
12
12
|
failoverHosts: string[];
|
|
@@ -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, ICueSettings,
|
|
5
|
+
import type { AudioCodec, HttpConnectionMetrics, HttpConnectionType, HttpDownloadMetrics, IAudioStream, IAudioTrack, ICueSettings, 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
|
import type { Scene3D } from "../utils/3d/Scene3D";
|
|
@@ -21,7 +21,7 @@ export interface IProviderDependencies {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export interface IProviderParams<TSourceType> extends IProviderDependencies {
|
|
24
|
-
|
|
24
|
+
container: HTMLElement;
|
|
25
25
|
source: TSourceType;
|
|
26
26
|
desiredState: IDesiredState;
|
|
27
27
|
output: IProviderOutput;
|
|
@@ -130,7 +130,6 @@ export interface IProviderOutput {
|
|
|
130
130
|
playbackState$: IValueSubject<PlaybackState | string>;
|
|
131
131
|
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
132
132
|
}
|
|
133
|
-
export type TProviderAllocation = Extract<TAnyAllocation, IDirectEmbeddableAllocation | IPersonalAllocation>;
|
|
134
133
|
export interface IProviderAllocationResolution {
|
|
135
134
|
readonly target: HTMLMediaElement;
|
|
136
135
|
readonly video: HTMLVideoElement | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "../../types";
|
|
2
|
+
import type { IVideoTrack } from "../../../../../player/types";
|
|
3
|
+
import type { Kbps, Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
4
|
+
import { LimitAboveRule } from "../limitAboveRule";
|
|
5
|
+
import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
|
|
6
|
+
type DownloadTimeLogsArgs = [estimatedThroughput: Kbps, forwardBufferDuration: Milliseconds, simulatedFinalBufferMs: Milliseconds | null];
|
|
7
|
+
export declare class DownloadTimeRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, DownloadTimeLogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
8
|
+
constructor(phaseConfig: RulePhaseConfig);
|
|
9
|
+
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
10
|
+
private buildReferenceTimeline;
|
|
11
|
+
private resolveLookaheadCount;
|
|
12
|
+
private simulate;
|
|
13
|
+
protected createLogMessage(selectedTrack: IVideoTrack, estimatedThroughput: Kbps, forwardBufferDuration: Milliseconds, simulatedFinalBufferMs: Milliseconds | null): string;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IAbrRule, IAbrRuleResolution, IVideoAbrContext } from "../../types";
|
|
2
|
+
import type { IVideoTrack } from "../../../../../player/types";
|
|
3
|
+
import { LimitAboveRule } from "../limitAboveRule";
|
|
4
|
+
import type { RulePhaseConfig } from "../../controllers/abrPhaseController";
|
|
5
|
+
export declare class TvDisabledVideoTrackRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
6
|
+
constructor(phaseConfig: RulePhaseConfig);
|
|
7
|
+
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
8
|
+
protected createLogMessage(selectedTrack: IVideoTrack): string;
|
|
9
|
+
}
|
|
@@ -16,12 +16,14 @@ export declare enum VideoRuleName {
|
|
|
16
16
|
Bola = "bola_rule",
|
|
17
17
|
FitsContainer = "fits_container_rule",
|
|
18
18
|
FailedVideoTrack = "failed_video_track_rule",
|
|
19
|
+
TvDisabledVideoTrack = "tv_disabled_video_track_rule",
|
|
19
20
|
Stalls = "stalls_rule",
|
|
20
21
|
LowerLimit = "lower_limit_rule",
|
|
21
22
|
UpperLimit = "upper_limit_rule",
|
|
22
23
|
Throughput = "throughput_rule",
|
|
23
24
|
AbandonRequest = "abandon_request_rule",
|
|
24
|
-
InsufficientBuffer = "insufficient_buffer_rule"
|
|
25
|
+
InsufficientBuffer = "insufficient_buffer_rule",
|
|
26
|
+
DownloadTime = "download_time_rule"
|
|
25
27
|
}
|
|
26
28
|
export declare enum AudioRuleName {
|
|
27
29
|
MinAudioForVideo = "min_audio_for_video_rule",
|
|
@@ -39,6 +41,7 @@ export interface IUpdatableAbrManagerContext {
|
|
|
39
41
|
desiredVideoTrack: Nullable<IVideoTrack>;
|
|
40
42
|
limits: QualityLimits;
|
|
41
43
|
forwardBufferHealth?: number;
|
|
44
|
+
forwardBufferTarget: Milliseconds;
|
|
42
45
|
forwardVideoBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
|
|
43
46
|
forwardAudioBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
|
|
44
47
|
forwardBufferDuration?: Milliseconds;
|
|
@@ -119,6 +122,7 @@ export interface IVideoAbrContext extends IBaseAbrControllerContext {
|
|
|
119
122
|
container: Nullable<IRectangle>;
|
|
120
123
|
panelSize: Nullable<IRectangle>;
|
|
121
124
|
forwardBufferRepresentations: Nullable<Map<Representation["id"], Segment[]>>;
|
|
125
|
+
forwardBufferTarget: Milliseconds;
|
|
122
126
|
limits: QualityLimits;
|
|
123
127
|
visible: boolean;
|
|
124
128
|
severeStallOccurred: boolean;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import type { ITuningConfig } from "../../../utils/tuningConfig";
|
|
2
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 }:
|
|
4
|
+
export declare const allocate: (container: HTMLElement, { audioVideoSyncRate, disableYandexPiP, clearVideoElementInnerHTML, reuseOwnVideoElement }: ITuningConfig) => HTMLVideoElement;
|
|
5
5
|
export declare const initializeAudio: (element: HTMLAudioElement) => HTMLAudioElement;
|
|
6
6
|
export declare const dispose: (element: HTMLMediaElement, constraints: DisposeConstraints) => void;
|
|
7
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[];
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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;
|
|
@@ -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 {};
|
|
@@ -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;
|
|
@@ -209,9 +211,24 @@ export type ITuningConfig = {
|
|
|
209
211
|
budgetFactor: number;
|
|
210
212
|
fallbackSegmentDurationMs: Milliseconds;
|
|
211
213
|
};
|
|
214
|
+
dynamicBufferTarget: {
|
|
215
|
+
maxMs: Milliseconds;
|
|
216
|
+
optimisticHeadroomLow: number;
|
|
217
|
+
optimisticHeadroomHigh: number;
|
|
218
|
+
weakThroughputLowKbps: Kbps;
|
|
219
|
+
weakThroughputHighKbps: Kbps;
|
|
220
|
+
maxFactor: number;
|
|
221
|
+
};
|
|
212
222
|
videoStreamRepresentaionsFilter: [VideoQuality, number, VideoCodecName][];
|
|
213
223
|
filterOnDemandQualityList: boolean;
|
|
214
224
|
dashMaxTvVideoQuality: boolean;
|
|
225
|
+
checkRepresentationCanPlayType: Extract<CanPlayTypeResult, "maybe" | "probably"> | false;
|
|
226
|
+
downloadTime: {
|
|
227
|
+
minLookaheadSegments: number;
|
|
228
|
+
safetyFactor: number;
|
|
229
|
+
bootstrapBufferMs: Milliseconds;
|
|
230
|
+
demandTolerance: number;
|
|
231
|
+
};
|
|
215
232
|
};
|
|
216
233
|
dashCmafLive: {
|
|
217
234
|
externalStopControl: boolean;
|
|
@@ -413,6 +430,8 @@ export type ITuningConfig = {
|
|
|
413
430
|
* Устанавливаем длительность видео на основе последнего сегмента.
|
|
414
431
|
*/
|
|
415
432
|
useDurationFromSegments: boolean;
|
|
433
|
+
/** включен режим проигрывания только аудио (без видео) */
|
|
434
|
+
audioOnly: boolean;
|
|
416
435
|
};
|
|
417
436
|
export type IOptionalTuningConfig = RecursivePartial<ITuningConfig>;
|
|
418
437
|
export declare const fillDefault: (partial: IOptionalTuningConfig) => ITuningConfig;
|