@vkontakte/videoplayer-core 2.0.164-dev.f2fd80887.0 → 2.0.164
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 +42 -42
- package/es2015.esm.js +42 -42
- package/esnext.cjs +34 -34
- package/esnext.esm.js +17 -17
- package/evergreen.esm.js +17 -17
- 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 +2 -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 +2 -2
- package/types/providers/DashProviderVirtual/baseDashProvider.d.ts +2 -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 +1 -0
- 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 +4 -4
- 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/insufficientBufferRule.d.ts +1 -1
- package/types/providers/utils/Abr/types.d.ts +2 -2
- 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 +1 -1
- 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/getPlayedTime.d.ts +3 -0
- package/types/utils/changePlaybackRate.d.ts +1 -1
- package/types/utils/tuningConfig.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/videoplayer-core",
|
|
3
|
-
"version": "2.0.164
|
|
3
|
+
"version": "2.0.164",
|
|
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.93
|
|
45
|
+
"@vkontakte/videoplayer-shared": "1.0.93"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/types/player/Player.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IOptionalTuningConfig } from "../utils/tuningConfig";
|
|
2
|
-
import type { ILogEntry,
|
|
3
|
-
import { type IAudioStream, type IConfig, type ICueSettings, type IExternalTextTrack, type IPlayer, type ITextTrack, type IVideoStream, type PlaybackRate,
|
|
2
|
+
import type { ILogEntry, ITracer, QualityLimits, Seconds, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import { type IAudioStream, type IConfig, type ICueSettings, type IExternalTextTrack, type IPlayer, type ITextTrack, type IVideoStream, type PlaybackRate, type PlayerEventsImpl, type PlayerExperimentalImpl, type PlayerInfoImpl, PredefinedQualityLimits } from "./types";
|
|
4
4
|
import type { IPlayerOptions } from "../utils/playerOptions";
|
|
5
5
|
export default class Player implements IPlayer {
|
|
6
6
|
private readonly subscription;
|
|
@@ -16,6 +16,7 @@ export default class Player implements IPlayer {
|
|
|
16
16
|
private throughputEstimator;
|
|
17
17
|
private internalsExposure;
|
|
18
18
|
private isPlaybackStarted;
|
|
19
|
+
private suppressWillStop;
|
|
19
20
|
private initedAt;
|
|
20
21
|
private hasLiveOffsetByPaused;
|
|
21
22
|
private hasLiveOffsetByPausedTimer;
|
|
@@ -40,8 +41,13 @@ export default class Player implements IPlayer {
|
|
|
40
41
|
* Позвонялет переиспользовать для другого видео
|
|
41
42
|
*/
|
|
42
43
|
private reset;
|
|
44
|
+
initAudio(config: Omit<IConfig, "container"> & {
|
|
45
|
+
audioElement?: HTMLAudioElement;
|
|
46
|
+
}): IPlayer;
|
|
43
47
|
initVideo(config: IConfig): IPlayer;
|
|
44
|
-
destroy(
|
|
48
|
+
destroy(options?: {
|
|
49
|
+
reportStop?: boolean;
|
|
50
|
+
}): void;
|
|
45
51
|
private waitInit;
|
|
46
52
|
prepare(): IPlayer;
|
|
47
53
|
play(): IPlayer;
|
package/types/player/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IError, ILogEntry, IObservable, IRectangle, IValueObservable, IValueSubject, Kbps, Milliseconds, QualityLimits, Seconds, Subject, ValueSubject, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import type { Pixel } from "../utils/3d/types";
|
|
3
3
|
import type { dump } from "../utils/playbackTelemetry";
|
|
4
4
|
export interface StartEnd<Unit extends number> {
|
|
@@ -16,7 +16,9 @@ export interface IPlayer {
|
|
|
16
16
|
/**
|
|
17
17
|
* Полная деинициализация плеера
|
|
18
18
|
*/
|
|
19
|
-
destroy(
|
|
19
|
+
destroy(options?: {
|
|
20
|
+
reportStop?: boolean;
|
|
21
|
+
}): void;
|
|
20
22
|
prepare(): IPlayer;
|
|
21
23
|
play(): IPlayer;
|
|
22
24
|
pause(): IPlayer;
|
|
@@ -251,6 +253,12 @@ export interface PlayerInfoValues {
|
|
|
251
253
|
* default value: `Infinity`
|
|
252
254
|
*/
|
|
253
255
|
duration$: Seconds;
|
|
256
|
+
/**
|
|
257
|
+
* Сумма времени воспроизведенных отрывков
|
|
258
|
+
*
|
|
259
|
+
* default value: `0`
|
|
260
|
+
*/
|
|
261
|
+
playedTime$: Seconds;
|
|
254
262
|
muted$: boolean;
|
|
255
263
|
volume$: number;
|
|
256
264
|
availableVideoStreams$: IVideoStream[];
|
|
@@ -457,8 +465,8 @@ export interface PlayerInfoValues {
|
|
|
457
465
|
*/
|
|
458
466
|
currentAudioSegmentLength$: number;
|
|
459
467
|
}
|
|
460
|
-
export type IPlayerInfo = { [K in keyof PlayerInfoValues]
|
|
461
|
-
export type PlayerInfoImpl = { [K in keyof PlayerInfoValues]
|
|
468
|
+
export type IPlayerInfo = { [K in keyof PlayerInfoValues]: IValueObservable<PlayerInfoValues[K]> };
|
|
469
|
+
export type PlayerInfoImpl = { [K in keyof PlayerInfoValues]: ValueSubject<PlayerInfoValues[K]> };
|
|
462
470
|
export interface PlayerEventsImpl {
|
|
463
471
|
inited$: Subject<void>;
|
|
464
472
|
ready$: Subject<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IMetadata, ISources, VideoFormat } from "../../player/types";
|
|
2
2
|
import type { IProviderParams } from "../types";
|
|
3
3
|
import type { IChromecastConnection } from "./ChromecastInitializer/types";
|
|
4
|
-
export interface IParams extends Omit<IProviderParams<ISources>, "skipVideoElVolumeSync$"> {
|
|
4
|
+
export interface IParams extends Omit<IProviderParams<ISources>, "skipVideoElVolumeSync$" | "allocation"> {
|
|
5
5
|
meta: IMetadata;
|
|
6
6
|
format: VideoFormat;
|
|
7
7
|
connection: IChromecastConnection;
|
|
@@ -11,7 +11,7 @@ type Params = IProviderParams<IDashURLSource> & {
|
|
|
11
11
|
export default class DashLiveProvider implements IProvider {
|
|
12
12
|
private subscription;
|
|
13
13
|
private volumeSubscription;
|
|
14
|
-
private
|
|
14
|
+
private readonly allocation;
|
|
15
15
|
private videoState;
|
|
16
16
|
private dash;
|
|
17
17
|
private representations$;
|
|
@@ -5,7 +5,7 @@ import { IRepresentation, State } from "../types";
|
|
|
5
5
|
import { Subject } from "@vkontakte/videoplayer-shared";
|
|
6
6
|
import { PlaybackState } from "../../../player/types";
|
|
7
7
|
interface IParams {
|
|
8
|
-
videoElement:
|
|
8
|
+
videoElement: HTMLMediaElement;
|
|
9
9
|
videoState: IStateMachine<State>;
|
|
10
10
|
playbackState: IStateMachine<PlaybackState>;
|
|
11
11
|
liveOffset: ILiveOffset;
|
|
@@ -2,7 +2,7 @@ import type { IAudioTrack, IDashURLSource, IHLSSource, IInternalTextTrack, IVide
|
|
|
2
2
|
import type { IProviderSubscriptionInfo } from "./lib/types";
|
|
3
3
|
import { ProviderState } from "./lib/types";
|
|
4
4
|
import type { CommonInit, Representation, Stream } from "../utils/parsers/types";
|
|
5
|
-
import type { IProvider, IProviderParams } from "../types";
|
|
5
|
+
import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
|
|
6
6
|
import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
|
|
7
7
|
import { TrackHistory } from "../../utils/autoSelectTrack";
|
|
8
8
|
import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
@@ -26,7 +26,7 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
26
26
|
protected subscription: ISubscription;
|
|
27
27
|
protected volumeSubscription: ISubscription;
|
|
28
28
|
protected videoState: IStateMachine<ProviderState>;
|
|
29
|
-
protected
|
|
29
|
+
protected readonly allocation: IProviderAllocationResolution;
|
|
30
30
|
protected observableVideo: IObservableVideo | null;
|
|
31
31
|
protected player: Player;
|
|
32
32
|
protected params: IParams;
|
|
@@ -3,6 +3,6 @@ import type { IParams } from "./lib/types";
|
|
|
3
3
|
import BaseDashProvider from "./baseDashProvider";
|
|
4
4
|
export default class DashCmafLiveProvider extends BaseDashProvider {
|
|
5
5
|
constructor(params: IParams);
|
|
6
|
-
protected subscribe(): void;
|
|
7
|
-
protected seek(position: Milliseconds): void;
|
|
6
|
+
protected override subscribe(): void;
|
|
7
|
+
protected override seek(position: Milliseconds): void;
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
2
2
|
import BaseDashProvider from "./baseDashProvider";
|
|
3
3
|
export default class DashProvider extends BaseDashProvider {
|
|
4
|
-
protected subscribe(): void;
|
|
5
|
-
protected seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
4
|
+
protected override subscribe(): void;
|
|
5
|
+
protected override seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
6
6
|
}
|
|
@@ -89,14 +89,14 @@ export declare class Player {
|
|
|
89
89
|
private dashMaxTvVideoQuality;
|
|
90
90
|
private destroyController;
|
|
91
91
|
constructor(params: Params);
|
|
92
|
-
initManifest: ReturnType<typeof abortable<[
|
|
92
|
+
initManifest: ReturnType<typeof abortable<[HTMLMediaElement, string, number]>>;
|
|
93
93
|
updateManifest: ReturnType<typeof abortable<[], Manifest | null>>;
|
|
94
94
|
setSmartRepresentationSwitch(state: boolean): void;
|
|
95
95
|
seekLive(nextOffset: Milliseconds): Promise<void>;
|
|
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>;
|
|
@@ -2,7 +2,7 @@ import type { IAudioTrack, IBaseTrack, IDashURLSource, IHLSSource, IInternalText
|
|
|
2
2
|
import type { IProviderSubscriptionInfo } from "./lib/types";
|
|
3
3
|
import { ProviderState } from "./lib/types";
|
|
4
4
|
import type { CommonInit, Representation, Stream } from "../utils/parsers/types";
|
|
5
|
-
import type { IProvider, IProviderParams } from "../types";
|
|
5
|
+
import type { IProvider, IProviderAllocationResolution, IProviderParams } from "../types";
|
|
6
6
|
import type { IObservableVideo } from "../utils/HTMLVideoElement/observable";
|
|
7
7
|
import { TrackHistory } from "../../utils/autoSelectTrack";
|
|
8
8
|
import type { IStateMachine } from "../../utils/StateMachine/types";
|
|
@@ -26,7 +26,7 @@ export default abstract class BaseDashProvider implements IProvider {
|
|
|
26
26
|
protected subscription: ISubscription;
|
|
27
27
|
protected volumeSubscription: ISubscription;
|
|
28
28
|
protected videoState: IStateMachine<ProviderState>;
|
|
29
|
-
protected
|
|
29
|
+
protected readonly allocation: IProviderAllocationResolution;
|
|
30
30
|
protected observableVideo: IObservableVideo | null;
|
|
31
31
|
protected player: BasePlayer;
|
|
32
32
|
protected params: IParams;
|
|
@@ -4,7 +4,7 @@ import BaseDashProvider from "./baseDashProvider";
|
|
|
4
4
|
import { LivePlayer } from "./lib/player/livePlayer";
|
|
5
5
|
export default class DashCmafLiveProvider extends BaseDashProvider {
|
|
6
6
|
constructor(params: IParams);
|
|
7
|
-
protected getPlayer(): LivePlayer;
|
|
8
|
-
protected subscribe(): void;
|
|
9
|
-
protected seek(position: Milliseconds): void;
|
|
7
|
+
protected override getPlayer(): LivePlayer;
|
|
8
|
+
protected override subscribe(): void;
|
|
9
|
+
protected override seek(position: Milliseconds): void;
|
|
10
10
|
}
|
|
@@ -2,7 +2,7 @@ import type { Milliseconds } from "@vkontakte/videoplayer-shared";
|
|
|
2
2
|
import BaseDashProvider from "./baseDashProvider";
|
|
3
3
|
import { Player } from "./lib/player/player";
|
|
4
4
|
export default class DashProvider extends BaseDashProvider {
|
|
5
|
-
protected subscribe(): void;
|
|
6
|
-
protected getPlayer(): Player;
|
|
7
|
-
protected seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
5
|
+
protected override subscribe(): void;
|
|
6
|
+
protected override getPlayer(): Player;
|
|
7
|
+
protected override seek(position: Milliseconds, forcePrecise: boolean): void;
|
|
8
8
|
}
|
package/types/providers/DashProviderVirtual/lib/buffer/virtualBuffer/baseVirtualBufferManager.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export declare abstract class BaseVirtualBufferManager<T extends Segment> implem
|
|
|
78
78
|
setTarget(time: Milliseconds): void;
|
|
79
79
|
setPreloadOnly(preloadOnly: boolean): void;
|
|
80
80
|
destroy(): void;
|
|
81
|
+
protected verifyBufferPlaybackQueue(position: Milliseconds): Promise<void>;
|
|
81
82
|
protected forceSwitchCondition(oldRepresentation: Representation, newRepresentation: Representation): boolean;
|
|
82
83
|
protected clearBuffer(): Promise<void>;
|
|
83
84
|
protected abortDownload(): void;
|
|
@@ -5,9 +5,9 @@ import type { NativeBufferManager } from "../nativeBufferManager";
|
|
|
5
5
|
import type { FetchParamsWithUrl, Priority } from "../../fetcher";
|
|
6
6
|
export declare class ByteRangeVirtualBufferManager extends BaseVirtualBufferManager<ByteRangeSegment> implements IVirtualBufferManager<ByteRangeSegment> {
|
|
7
7
|
constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
|
|
8
|
-
protected loadItems(itemsToLoad: IBufferPlaybackQueueItem<ByteRangeSegment>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
9
|
-
protected selectItemsToLoad(): IBufferPlaybackQueueItem<ByteRangeSegment>[];
|
|
10
|
-
protected prepareFetchParams(items: IBufferPlaybackQueueItem<ByteRangeSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
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
11
|
/**
|
|
12
12
|
* Закидываем в буфер сегменты атомарнее чем сегмент целиком. Например, по боксам в мпеге и по блокам в вебме.
|
|
13
13
|
* Таким образом не ждём его полной загрузки и готовы играть его намного быстрее
|
|
@@ -16,6 +16,6 @@ export declare class ByteRangeVirtualBufferManager extends BaseVirtualBufferMana
|
|
|
16
16
|
* @param loaded – Объём загруженных в dataView данных (всё что больше – пока нули)
|
|
17
17
|
* @private
|
|
18
18
|
*/
|
|
19
|
-
protected onSomeDataLoaded({ downloadingItems, dataView, representationId, globalFrom, loaded, signal }: ISomeDataLoadedCallbackParams<ByteRangeSegment>): Promise<void>;
|
|
20
|
-
protected updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
19
|
+
protected override onSomeDataLoaded({ downloadingItems, dataView, representationId, globalFrom, loaded, signal }: ISomeDataLoadedCallbackParams<ByteRangeSegment>): Promise<void>;
|
|
20
|
+
protected override updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
21
21
|
}
|
|
@@ -15,13 +15,13 @@ export declare class LiveVirtualBuffer extends TemplateVirtualBufferManager {
|
|
|
15
15
|
proceedLowLatencyLive(): void;
|
|
16
16
|
getLiveSegmentsToLoadState(manifest: Manifest | null): IRange<Milliseconds> | undefined;
|
|
17
17
|
getRepresentationInitialTime(): Milliseconds;
|
|
18
|
-
protected prepareFetchParams(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
19
|
-
protected onSomeDataLoaded({ downloadingItems, ...params }: ISomeDataLoadedCallbackParams<TemplateSegment>): Promise<void>;
|
|
20
|
-
protected onItemFullyDownloaded(downloadedItem: IBufferPlaybackQueueItem<TemplateSegment>): void;
|
|
18
|
+
protected override prepareFetchParams(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
19
|
+
protected override onSomeDataLoaded({ downloadingItems, ...params }: ISomeDataLoadedCallbackParams<TemplateSegment>): Promise<void>;
|
|
20
|
+
protected override onItemFullyDownloaded(downloadedItem: IBufferPlaybackQueueItem<TemplateSegment>): void;
|
|
21
21
|
protected updateLowLatencyItemTime(item: IBufferPlaybackQueueItem<TemplateSegment>): void;
|
|
22
22
|
protected updateLowLatencyLive(latestItem: IBufferPlaybackQueueItem<TemplateSegment>): void;
|
|
23
23
|
protected parseFeedableSegmentChunk(chunk: DataView): DataView | null;
|
|
24
24
|
protected getFetchUrl(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): URL;
|
|
25
|
-
protected loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
25
|
+
protected override loadInit(representation: Representation, requestedPriority?: Priority, critical?: boolean): Promise<void>;
|
|
26
26
|
protected getActualLiveStartingSegments(templateSegmentReference: TemplateSegmentReference): TemplateSegment[];
|
|
27
27
|
}
|
|
@@ -5,9 +5,9 @@ import type { NativeBufferManager } from "../nativeBufferManager";
|
|
|
5
5
|
import type { FetchParamsWithUrl, Priority } from "../../fetcher";
|
|
6
6
|
export declare class TemplateVirtualBufferManager extends BaseVirtualBufferManager<TemplateSegment> implements IVirtualBufferManager<TemplateSegment> {
|
|
7
7
|
constructor(kind: StreamKind, nativeBufferManager: NativeBufferManager, representations: Representation[], dependencies: Dependencies);
|
|
8
|
-
protected loadItems(itemsToLoad: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation, priority?: Priority): Promise<void>;
|
|
9
|
-
protected selectItemsToLoad(): IBufferPlaybackQueueItem<TemplateSegment>[];
|
|
10
|
-
protected prepareFetchParams(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): FetchParamsWithUrl;
|
|
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
11
|
protected getFetchUrl(items: IBufferPlaybackQueueItem<TemplateSegment>[], representation: Representation): URL;
|
|
12
12
|
/**
|
|
13
13
|
* Закидываем в буфер сегменты атомарнее чем сегмент целиком. Например, по боксам в мпеге и по блокам в вебме.
|
|
@@ -16,6 +16,6 @@ export declare class TemplateVirtualBufferManager extends BaseVirtualBufferManag
|
|
|
16
16
|
* @param loaded – Объём загруженных в dataView данных (всё что больше – пока нули)
|
|
17
17
|
* @private
|
|
18
18
|
*/
|
|
19
|
-
protected onSomeDataLoaded({ downloadingItems, dataView, representationId, loaded, signal }: ISomeDataLoadedCallbackParams<TemplateSegment>): Promise<void>;
|
|
20
|
-
protected updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
19
|
+
protected override onSomeDataLoaded({ downloadingItems, dataView, representationId, loaded, signal }: ISomeDataLoadedCallbackParams<TemplateSegment>): Promise<void>;
|
|
20
|
+
protected override updateRepresentationBaseUrl(representation: Representation, newBaseUrl: string): void;
|
|
21
21
|
}
|
|
@@ -14,7 +14,7 @@ import type { Params } from "./types";
|
|
|
14
14
|
import { State } from "./types";
|
|
15
15
|
import { NativeBufferManager } from "../buffer/nativeBufferManager";
|
|
16
16
|
export declare abstract class BasePlayer {
|
|
17
|
-
protected element:
|
|
17
|
+
protected element: HTMLMediaElement | null;
|
|
18
18
|
protected manifestUrlString: string;
|
|
19
19
|
protected source: MediaSource | null;
|
|
20
20
|
protected manifest: Manifest | null;
|
|
@@ -79,8 +79,8 @@ 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]>>;
|
|
83
|
-
initManifest(element:
|
|
82
|
+
initRepresentations: ReturnType<typeof abortable<[Representation["id"] | undefined, Representation["id"] | undefined, IHLSSource | undefined]>>;
|
|
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>;
|
|
86
86
|
seek(requestedPosition: Milliseconds, forcePrecise?: boolean): Promise<void>;
|
|
@@ -108,7 +108,7 @@ export declare abstract class BasePlayer {
|
|
|
108
108
|
protected parseManifest(manifestString: string): Nullable<Manifest>;
|
|
109
109
|
protected getResultManifest(manifest: Manifest): Manifest;
|
|
110
110
|
protected stopStallWatchdogSubscription(): void;
|
|
111
|
-
protected createBuffers(dependencies: Dependencies, initialVideo
|
|
111
|
+
protected createBuffers(dependencies: Dependencies, initialVideo?: Representation["id"], initialAudio?: Representation["id"], sourceHls?: IHLSSource): void;
|
|
112
112
|
protected waitStreamToOpen(): Promise<void>;
|
|
113
113
|
protected initRepresentationSubscriptions(): void;
|
|
114
114
|
protected initBufferLengthSubscription(): void;
|
|
@@ -14,18 +14,18 @@ export declare class LivePlayer extends BasePlayer {
|
|
|
14
14
|
protected livePauseWatchdogSubscription: ISubscription | undefined;
|
|
15
15
|
protected liveWasInterrupted: boolean;
|
|
16
16
|
constructor(params: Params);
|
|
17
|
-
seek(nextOffset: Milliseconds): Promise<void>;
|
|
18
|
-
initBuffer(): void;
|
|
17
|
+
override seek(nextOffset: Milliseconds): Promise<void>;
|
|
18
|
+
override initBuffer(): void;
|
|
19
19
|
protected forcePositionToRepresentationInitialTime(): Promise<void>;
|
|
20
20
|
protected tick(): Promise<void>;
|
|
21
|
-
protected setSourceInitDuration(): void;
|
|
22
|
-
protected isStallExceeded(timeInWaiting: Milliseconds): boolean;
|
|
23
|
-
protected restoreAfterDeepStall(): Promise<void>;
|
|
24
|
-
protected updateManifest(): Promise<Manifest | null>;
|
|
25
|
-
protected prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
|
|
21
|
+
protected override setSourceInitDuration(): void;
|
|
22
|
+
protected override isStallExceeded(timeInWaiting: Milliseconds): boolean;
|
|
23
|
+
protected override restoreAfterDeepStall(): Promise<void>;
|
|
24
|
+
protected override updateManifest(): Promise<Manifest | null>;
|
|
25
|
+
protected override prepareManifestUrlString(manifestBaseUrlString: string, offset: number): string;
|
|
26
26
|
protected updateManifestUrlWithTimeOffset(nextOffset: Milliseconds): void;
|
|
27
|
-
protected createBuffers(dependencies: Dependencies, initialVideo: Representation["id"], initialAudio?: Representation["id"], sourceHls?: IHLSSource): void;
|
|
28
|
-
protected initRepresentationSubscriptions(): void;
|
|
27
|
+
protected override createBuffers(dependencies: Dependencies, initialVideo: Representation["id"], initialAudio?: Representation["id"], sourceHls?: IHLSSource): void;
|
|
28
|
+
protected override initRepresentationSubscriptions(): void;
|
|
29
29
|
protected initStreamDurationOnPauseSubscription(): void;
|
|
30
30
|
protected initLiveDurationSubscriptions(videoBufferManager: LiveVirtualBuffer): void;
|
|
31
31
|
protected initLiveChangePlaybackRateSubscriptions(): void;
|
|
@@ -2,10 +2,10 @@ import { BasePlayer } from "./basePlayer";
|
|
|
2
2
|
import type { Params } from "./types";
|
|
3
3
|
export declare class Player extends BasePlayer {
|
|
4
4
|
constructor(params: Params);
|
|
5
|
-
protected prepareManifestUrlString(manifestBaseUrlString: string, _offset: number): string;
|
|
6
|
-
protected initRepresentationSubscriptions(): void;
|
|
7
|
-
protected setSourceInitDuration(): void;
|
|
8
|
-
protected restoreAfterDeepStall(): Promise<void>;
|
|
5
|
+
protected override prepareManifestUrlString(manifestBaseUrlString: string, _offset: number): string;
|
|
6
|
+
protected override initRepresentationSubscriptions(): void;
|
|
7
|
+
protected override setSourceInitDuration(): void;
|
|
8
|
+
protected override restoreAfterDeepStall(): Promise<void>;
|
|
9
9
|
protected initDisableStallWatchdogSubscription(): void;
|
|
10
10
|
protected initEndOfVideoSubscription(): void;
|
|
11
11
|
}
|
|
@@ -12,7 +12,7 @@ export default class HlsLiveProvider implements IProvider {
|
|
|
12
12
|
private subscription;
|
|
13
13
|
private volumeSubscription;
|
|
14
14
|
private videoState;
|
|
15
|
-
private
|
|
15
|
+
private readonly allocation;
|
|
16
16
|
private params;
|
|
17
17
|
private textTracksManager;
|
|
18
18
|
private liveTextManager;
|
|
@@ -1,5 +1,10 @@
|
|
|
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
|
+
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
4
|
+
export interface IInternalAudioStream extends IAudioStream {
|
|
5
|
+
type: "internal";
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
3
8
|
export type ManifestUrl = {
|
|
4
9
|
id: string;
|
|
5
10
|
quality: VideoQuality;
|
|
@@ -11,11 +16,8 @@ export type ManifestUrl = {
|
|
|
11
16
|
export type HLSManifestData = {
|
|
12
17
|
qualityManifests: ManifestUrl[];
|
|
13
18
|
textTracks: IInternalTextTrack[];
|
|
19
|
+
audioStreams: IInternalAudioStream[];
|
|
14
20
|
};
|
|
15
|
-
type ExtractHLSManifestDataConfig =
|
|
16
|
-
manifestRetryMaxCount: number;
|
|
17
|
-
manifestRetryInterval: number;
|
|
18
|
-
manifestRetryMaxInterval: number;
|
|
19
|
-
};
|
|
21
|
+
type ExtractHLSManifestDataConfig = Pick<ITuningConfig, "manifestRetryInterval" | "manifestRetryMaxCount" | "manifestRetryMaxInterval" | "audioOnly">;
|
|
20
22
|
declare const extractHLSManifestData: (masterManifestUrl: string, baseUrl: string | undefined, config: ExtractHLSManifestDataConfig, init?: RequestInit) => Promise<HLSManifestData>;
|
|
21
23
|
export default extractHLSManifestData;
|
|
@@ -10,7 +10,7 @@ export default class WebRTCLiveProvider implements IProvider {
|
|
|
10
10
|
private readonly volumeSubscription;
|
|
11
11
|
private readonly params;
|
|
12
12
|
private log;
|
|
13
|
-
private
|
|
13
|
+
private readonly allocation;
|
|
14
14
|
private videoState;
|
|
15
15
|
private liveStreamClient;
|
|
16
16
|
private maxSeekBackTime$;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ITuningConfig } from "../utils/tuningConfig";
|
|
2
|
-
import type {
|
|
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
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { IExternalTextTrack, IInternalTextTrack, ITextTrack, IVideoTrack, IVolumeState, PlaybackRate, PlaybackState } from "../player/types";
|
|
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";
|
|
@@ -62,10 +62,11 @@ export interface DesiredStateValues {
|
|
|
62
62
|
videoTrack: IVideoTrack | undefined;
|
|
63
63
|
volume: IVolumeState;
|
|
64
64
|
}
|
|
65
|
-
export type IDesiredState = { [K in keyof DesiredStateValues]
|
|
65
|
+
export type IDesiredState = { [K in keyof DesiredStateValues]: IStateMachine<DesiredStateValues[K]> };
|
|
66
66
|
export interface IProviderOutput {
|
|
67
67
|
position$: IValueSubject<Seconds>;
|
|
68
68
|
duration$: IValueSubject<Seconds>;
|
|
69
|
+
playedTime$: IValueSubject<Seconds>;
|
|
69
70
|
volume$: IValueSubject<IVolumeState>;
|
|
70
71
|
currentVideoSegmentLength$: IValueSubject<number>;
|
|
71
72
|
currentAudioSegmentLength$: IValueSubject<number>;
|
|
@@ -129,3 +130,7 @@ export interface IProviderOutput {
|
|
|
129
130
|
playbackState$: IValueSubject<PlaybackState | string>;
|
|
130
131
|
getCurrentTime$: IValueSubject<(() => number) | null>;
|
|
131
132
|
}
|
|
133
|
+
export interface IProviderAllocationResolution {
|
|
134
|
+
readonly target: HTMLMediaElement;
|
|
135
|
+
readonly video: HTMLVideoElement | null;
|
|
136
|
+
}
|
|
@@ -7,7 +7,7 @@ type LogsArgs = [forwardBufferDuration: Milliseconds | undefined, thresholdMs: M
|
|
|
7
7
|
export declare class InsufficientBufferRule extends LimitAboveRule<IVideoTrack, IVideoAbrContext, LogsArgs> implements IAbrRule<IVideoTrack, IVideoAbrContext> {
|
|
8
8
|
private lastPlaybackResetAtMs;
|
|
9
9
|
constructor(phaseConfig: RulePhaseConfig);
|
|
10
|
-
init(initContext: IRuleInitContext): void;
|
|
10
|
+
override init(initContext: IRuleInitContext): void;
|
|
11
11
|
execute(context: IVideoAbrContext): IAbrRuleResolution<IVideoTrack>;
|
|
12
12
|
private selectThroughputAwareFallback;
|
|
13
13
|
protected createLogMessage(selectedTrack: IVideoTrack, forwardBufferDuration: Milliseconds | undefined, thresholdMs: Milliseconds, triggered: boolean, suppressedByGrace: boolean): string;
|
|
@@ -58,7 +58,7 @@ export interface IInitAbrManagerContext {
|
|
|
58
58
|
throughput$: IValueSubject<Kbps>;
|
|
59
59
|
rtt$: IValueSubject<Milliseconds>;
|
|
60
60
|
throughputVariance$?: IValueSubject<number>;
|
|
61
|
-
element:
|
|
61
|
+
element: HTMLMediaElement;
|
|
62
62
|
failedVideoTrack: Nullable<IVideoTrack>;
|
|
63
63
|
abrLogger: IComponentLogger;
|
|
64
64
|
panelSize?: IRectangle;
|
|
@@ -66,7 +66,7 @@ export interface IInitAbrManagerContext {
|
|
|
66
66
|
export interface IVideoElementAbrManagerContext {
|
|
67
67
|
observableVideo: IObservableVideo;
|
|
68
68
|
elementVisible$: IValueSubject<boolean>;
|
|
69
|
-
elementSizeManager
|
|
69
|
+
elementSizeManager?: ElementSizeManager;
|
|
70
70
|
}
|
|
71
71
|
export interface IVideoTracksContext {
|
|
72
72
|
videoTracksAsc: IVideoTrack[];
|
|
@@ -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 {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ITuningConfig } from "../../utils/tuningConfig";
|
|
2
2
|
import type { Stream } from "./parsers/types";
|
|
3
|
-
export declare const filterStreams: (streams: Stream[], videoElement:
|
|
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;
|
|
@@ -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;
|