@vkontakte/videoplayer-interactive 1.0.19-dev.c3a364e7.0 → 1.0.19-dev.d432d6cd.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.js +6 -6
- package/es2015.esm.js +6 -6
- package/es2018.cjs.js +6 -6
- package/es2018.esm.js +6 -6
- package/esnext.cjs.js +6 -6
- package/esnext.esm.js +6 -6
- package/evergreen.esm.js +6 -6
- package/package.json +5 -5
- package/types/index.d.ts +3 -4
- package/types/manifest/index.d.ts +3 -0
- package/types/manifest/utils.d.ts +11 -0
- package/types/modules/Graph/Graph.d.ts +16 -12
- package/types/modules/Interactives/Interactives.d.ts +99 -83
- package/types/modules/Interactives/Layout.d.ts +11 -7
- package/types/modules/Interactives/controls/AreaControl.d.ts +2 -11
- package/types/modules/Interactives/controls/ButtonControl.d.ts +2 -11
- package/types/modules/Interactives/controls/Control.d.ts +20 -12
- package/types/modules/Interactives/controls/TextControl.d.ts +2 -11
- package/types/modules/Interactives/controls/index.d.ts +4 -3
- package/types/modules/Interactives/controls/types.d.ts +24 -0
- package/types/modules/Interactives/index.d.ts +4 -4
- package/types/modules/Interactives/types.d.ts +38 -7
- package/types/modules/Interactives/utils/GameController.d.ts +35 -16
- package/types/modules/Interactives/utils/GroupsStack.d.ts +31 -21
- package/types/modules/Interactives/utils/HistoryController.d.ts +8 -8
- package/types/modules/Interactives/utils/InteractiveEvents.d.ts +16 -10
- package/types/modules/Interactives/utils/ResizeManager.d.ts +8 -1
- package/types/modules/Interactives/utils/SelectBranches.d.ts +15 -51
- package/types/modules/Interactives/utils/SelectBranches.types.d.ts +73 -0
- package/types/modules/Interactives/utils/events.d.ts +8 -0
- package/types/modules/Interactives/utils/fallbackStrategies.d.ts +23 -6
- package/types/modules/Interactives/utils/gameUtils.d.ts +28 -26
- package/types/modules/Interactives/utils/getInteractiveRanges.d.ts +4 -4
- package/types/modules/Interactives/utils/renderingUtils.d.ts +64 -59
- package/types/modules/Loaders/vkVideoLoader/types.d.ts +2 -2
- package/types/modules/Loaders/vkVideoLoader/utils.d.ts +1 -1
- package/types/modules/ManifestController/Loadable.d.ts +4 -7
- package/types/modules/ManifestController/ManifestController.d.ts +11 -12
- package/types/modules/ManifestController/utils.d.ts +6 -6
- package/types/modules/SeamlessController/SeamlessController.d.ts +10 -12
- package/types/modules/SeamlessController/utils.d.ts +2 -2
- package/types/modules/SeekToInteractiveController/SeekToInteractiveController.d.ts +2 -2
- package/types/utils/EventManager.d.ts +3 -3
- package/types/utils/LastFrame.d.ts +1 -1
- package/types/utils/Raf.d.ts +1 -1
- package/types/utils/chapterHelpers.d.ts +1 -1
- package/types/utils/extractVkMovieId.d.ts +2 -2
- package/types/modules/Interactives/controls/constants.d.ts +0 -5
- package/types/movika.core/manifest/index.d.ts +0 -19
- package/types/movika.core/manifest/manifest_3_2/chapter.d.ts +0 -62
- package/types/movika.core/manifest/manifest_3_2/control.d.ts +0 -67
- package/types/movika.core/manifest/manifest_3_2/manifest.d.ts +0 -50
- package/types/movika.core/manifest/manifest_3_2/template.d.ts +0 -34
- package/types/movika.core/manifest/manifest_3_3/chapter.d.ts +0 -70
- package/types/movika.core/manifest/manifest_3_3/control.d.ts +0 -66
- package/types/movika.core/manifest/manifest_3_3/graph.d.ts +0 -73
- package/types/movika.core/manifest/manifest_3_3/manifest.d.ts +0 -52
- package/types/movika.core/manifest/manifest_3_3/template.d.ts +0 -34
- package/types/movika.core/manifest/migrations/index.d.ts +0 -1
- package/types/movika.core/manifest/migrations/migrateManifestToLatestVersion.d.ts +0 -1
- package/types/movika.core/manifest/migrations/migrate_from_3_0_to_3_1.d.ts +0 -21
- package/types/movika.core/manifest/migrations/migrate_from_3_1_to_3_2.d.ts +0 -2
- package/types/movika.core/manifest/migrations/migrate_from_3_2_to_3_3.d.ts +0 -8
- package/types/movika.core/manifest/types.d.ts +0 -29
- package/types/movika.core/manifest/utils.d.ts +0 -5
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Observable, Subject, ValueSubject } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import type { Chapter, Manifest, VideoInfo, AnyManifest } from '../../manifest';
|
|
3
|
+
import { type InteractiveRange } from './utils/getInteractiveRanges';
|
|
4
|
+
import type { IInteractiveOptions, IOptionalInteractiveOptions } from "./types";
|
|
5
|
+
import type { IPlayer } from "@vkontakte/videoplayer-core";
|
|
6
|
+
import { InstanceStatistics } from '../../modules/SeamlessController/InstanceManager';
|
|
7
|
+
declare enum INTERACTIVE_APP_STATES {
|
|
8
|
+
created = 0,
|
|
9
|
+
initiated = 1,
|
|
10
|
+
ready = 2,
|
|
11
|
+
destroyed = 3
|
|
12
|
+
}
|
|
13
|
+
export declare class Interactives {
|
|
14
|
+
private subscription;
|
|
15
|
+
private globalEventEmitter;
|
|
16
|
+
private animation;
|
|
17
|
+
private eventManager;
|
|
18
|
+
private seekToInteractiveController;
|
|
19
|
+
private endedRanges;
|
|
20
|
+
private gameControllers;
|
|
21
|
+
private rootElement;
|
|
22
|
+
private factories;
|
|
23
|
+
private isFirstChapterFetched;
|
|
24
|
+
private _options;
|
|
25
|
+
private manifestController;
|
|
26
|
+
private resizeManager;
|
|
27
|
+
private historyController;
|
|
28
|
+
private player;
|
|
29
|
+
private interactiveEvents;
|
|
30
|
+
private selectBranches;
|
|
31
|
+
private seamlessController;
|
|
32
|
+
private seamlessControllerSubs;
|
|
33
|
+
private graph;
|
|
34
|
+
private lastFrame;
|
|
35
|
+
private noInteractionTimeout;
|
|
36
|
+
appState: INTERACTIVE_APP_STATES;
|
|
3
37
|
state: {
|
|
4
|
-
prevChapter$: ValueSubject<
|
|
38
|
+
prevChapter$: ValueSubject<Nullable<Chapter>>;
|
|
5
39
|
isInitialChapter$: ValueSubject<boolean>;
|
|
6
40
|
isFirstChapter$: ValueSubject<boolean>;
|
|
7
41
|
isEndChapter$: ValueSubject<boolean>;
|
|
@@ -9,98 +43,80 @@ export class Interactives {
|
|
|
9
43
|
calledByInteractive$: ValueSubject<boolean>;
|
|
10
44
|
lastChapterChangeWasInitiatedByInteractive$: ValueSubject<boolean>;
|
|
11
45
|
disabledControls$: ValueSubject<boolean>;
|
|
12
|
-
interactiveRanges$: ValueSubject<
|
|
46
|
+
interactiveRanges$: ValueSubject<InteractiveRange[]>;
|
|
13
47
|
isInteractiveTime$: ValueSubject<boolean>;
|
|
14
|
-
statistics$: ValueSubject<
|
|
48
|
+
statistics$: ValueSubject<Nullable<InstanceStatistics>>;
|
|
49
|
+
isSeekable$: ValueSubject<boolean>;
|
|
15
50
|
};
|
|
16
51
|
events: {
|
|
17
|
-
noInteraction$: Subject<
|
|
52
|
+
noInteraction$: Subject<void>;
|
|
53
|
+
graphVisibilityChanged$: Subject<unknown>;
|
|
54
|
+
watchAgainIsClicked$: Subject<unknown>;
|
|
18
55
|
};
|
|
19
|
-
options:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setManifest(manifest:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
setVisitedChapters(chapterIds: string[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {Object} VideosInfo
|
|
45
|
-
* @property {string} id
|
|
46
|
-
* @property {string} cover
|
|
47
|
-
* @property {string=} title
|
|
48
|
-
*/
|
|
49
|
-
/**
|
|
50
|
-
* @param {Array<VideosInfo>} videosInfo
|
|
51
|
-
*/
|
|
52
|
-
updateGraphVideosInfo(videosInfo: Array<{
|
|
53
|
-
id: string;
|
|
54
|
-
cover: string;
|
|
55
|
-
title?: string | undefined;
|
|
56
|
-
}>): void;
|
|
57
|
-
/**
|
|
58
|
-
* Set new chapter
|
|
59
|
-
*
|
|
60
|
-
* @async
|
|
61
|
-
* @param {{ chapterId?: string; pushToHistory?: boolean }}
|
|
62
|
-
* @returns {Promise<any>}
|
|
63
|
-
*/
|
|
64
|
-
setChapter({ chapterId, pushToHistory }?: {
|
|
56
|
+
constructor(options: IOptionalInteractiveOptions);
|
|
57
|
+
private clearHistoryIfEnded;
|
|
58
|
+
private initSubscriptions;
|
|
59
|
+
private initSeamless;
|
|
60
|
+
private handleSeamlessPlayerChanged;
|
|
61
|
+
private onPlaybackStarted;
|
|
62
|
+
private handlePositionChange;
|
|
63
|
+
private registerVideoEvents;
|
|
64
|
+
private removeControllers;
|
|
65
|
+
private setGameControllers;
|
|
66
|
+
private filterGameControllers;
|
|
67
|
+
private checkIfSeekable;
|
|
68
|
+
private updateLastEventInfo;
|
|
69
|
+
private pushChapterToHistory;
|
|
70
|
+
private completeInteractiveRange;
|
|
71
|
+
private clearNoInteractionTimeout;
|
|
72
|
+
private reset;
|
|
73
|
+
get options(): IInteractiveOptions;
|
|
74
|
+
init(): void;
|
|
75
|
+
setManifest(manifest: AnyManifest | string): Promise<Manifest | undefined>;
|
|
76
|
+
setPlayer(player: IPlayer): void;
|
|
77
|
+
setChapter({ chapterId, pushToHistory, playPrev }?: {
|
|
65
78
|
chapterId?: string;
|
|
66
79
|
pushToHistory?: boolean;
|
|
67
|
-
|
|
80
|
+
playPrev?: boolean;
|
|
81
|
+
}): Promise<void>;
|
|
82
|
+
getStatEvents(): {
|
|
83
|
+
click$: Observable<unknown>;
|
|
84
|
+
nextMovie$: Observable<unknown>;
|
|
85
|
+
};
|
|
68
86
|
toggleGraphView(show?: boolean): void;
|
|
69
|
-
|
|
87
|
+
setVisitedChapters(chapterIds: string[]): void;
|
|
88
|
+
updateGraphVideosInfo(videosInfo: VideoInfo[]): void;
|
|
70
89
|
deadEndCheck(): boolean;
|
|
71
90
|
allControlsAreRemoved(): boolean;
|
|
72
|
-
isEndedExpectation():
|
|
91
|
+
isEndedExpectation(): boolean;
|
|
73
92
|
playPrevChapter(): void;
|
|
74
|
-
setDisabledControls(value:
|
|
75
|
-
isSupport(manifest?:
|
|
93
|
+
setDisabledControls(value: boolean): void;
|
|
94
|
+
isSupport(manifest?: Nullable<Manifest>): boolean;
|
|
76
95
|
getInitialVideoInfo(): {
|
|
77
|
-
videoId:
|
|
78
|
-
chapterId:
|
|
96
|
+
videoId: string | null;
|
|
97
|
+
chapterId: string;
|
|
79
98
|
};
|
|
80
|
-
getHistoryState():
|
|
81
|
-
getIsSeekable(): ValueSubject<boolean>;
|
|
82
|
-
getInteractiveRanges(): import("./utils/getInteractiveRanges").ReduceAcc;
|
|
83
|
-
/**
|
|
84
|
-
* Description
|
|
85
|
-
* @param {number|undefined} [offsetMs="3000"]
|
|
86
|
-
* @returns {number | null}
|
|
87
|
-
*/
|
|
88
|
-
getNextInteractiveStartTime(offsetMs?: number | undefined): number | null;
|
|
99
|
+
getHistoryState(): import("./utils/HistoryController").HistoryControllerState;
|
|
89
100
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* @deprecated Используйте this.state.isSeekable$
|
|
102
|
+
*/
|
|
103
|
+
getIsSeekable(): ValueSubject<boolean>;
|
|
104
|
+
getInteractiveRanges(): import("./utils/getInteractiveRanges").InteractiveRanges;
|
|
105
|
+
getNextInteractiveStartTime(offsetMs?: number): number | null;
|
|
106
|
+
getChapterBranches(chapterId?: string): {
|
|
107
|
+
chapter: Chapter;
|
|
108
|
+
graph: import("@interactiveplatform/movika-graph-editor").GraphEditChapter | import("@interactiveplatform/movika-graph-editor").GraphViewChapter | undefined;
|
|
109
|
+
media: import("@interactiveplatform/movika-graph-editor").ManifestVideo;
|
|
110
|
+
}[];
|
|
111
|
+
getCurrentChapter(): {
|
|
112
|
+
chapter: Nullable<Chapter>;
|
|
113
|
+
media: Nullable<import("@interactiveplatform/movika-graph-editor").ManifestVideo>;
|
|
114
|
+
graph: Nullable<import("@interactiveplatform/movika-graph-editor").GraphDesign>;
|
|
115
|
+
};
|
|
116
|
+
getCurrentManifest(): Nullable<Manifest>;
|
|
117
|
+
on(eventName: string, fn: Function): this;
|
|
118
|
+
off(eventName: string, fn: Function): this;
|
|
119
|
+
once(eventName: string, fn: Function): this;
|
|
102
120
|
destroy(): void;
|
|
103
|
-
#private;
|
|
104
121
|
}
|
|
105
|
-
|
|
106
|
-
import { Subject } from '@vkontakte/videoplayer-shared';
|
|
122
|
+
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
layout:
|
|
1
|
+
import { ChapterContainer, ControlLayoutParams } from '../../manifest';
|
|
2
|
+
declare abstract class Layout {
|
|
3
|
+
layout: ChapterContainer['layout'];
|
|
4
|
+
protected constructor(layout: ChapterContainer['layout']);
|
|
5
|
+
abstract setContainerLayout(target: HTMLElement): void;
|
|
6
|
+
abstract setControlLayout(target: HTMLElement, layoutParams: ControlLayoutParams): void;
|
|
4
7
|
}
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
setContainerLayout(target:
|
|
8
|
-
setControlLayout(target:
|
|
8
|
+
export declare class RelativeLayout extends Layout {
|
|
9
|
+
constructor(layout: ChapterContainer['layout']);
|
|
10
|
+
setContainerLayout(target: HTMLElement): void;
|
|
11
|
+
setControlLayout(target: HTMLElement, layoutParams: ControlLayoutParams): void;
|
|
9
12
|
}
|
|
13
|
+
export {};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
createView({ parent, layoutFn }: {
|
|
4
|
-
parent: any;
|
|
5
|
-
layoutFn: any;
|
|
6
|
-
}): HTMLDivElement;
|
|
7
|
-
controlEl: HTMLButtonElement | undefined;
|
|
8
|
-
disable(): void;
|
|
9
|
-
enable(): void;
|
|
10
|
-
}
|
|
11
|
-
import { Control } from './Control';
|
|
1
|
+
import { type ControlCreator } from './types';
|
|
2
|
+
export declare const createAreaControl: ControlCreator;
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
createView({ parent, layoutFn }: {
|
|
4
|
-
parent: any;
|
|
5
|
-
layoutFn: any;
|
|
6
|
-
}): HTMLDivElement;
|
|
7
|
-
controlEl: HTMLButtonElement | undefined;
|
|
8
|
-
disable(): void;
|
|
9
|
-
enable(): void;
|
|
10
|
-
}
|
|
11
|
-
import { Control } from './Control';
|
|
1
|
+
import { type ControlCreator } from './types';
|
|
2
|
+
export declare const createButtonControl: ControlCreator;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { ControlEventCallback, CreateViewParams, Dimensions, LayoutCallback, TControl } from './types';
|
|
2
|
+
type ControlContainer = {
|
|
3
|
+
element: HTMLElement;
|
|
4
|
+
dimensions: Dimensions;
|
|
5
|
+
};
|
|
6
|
+
export default abstract class Control {
|
|
7
|
+
control: TControl;
|
|
8
|
+
protected container: Nullable<ControlContainer>;
|
|
9
|
+
protected controlElement: Nullable<HTMLElement>;
|
|
10
|
+
private clickListener;
|
|
11
|
+
protected constructor(control: TControl);
|
|
12
|
+
abstract createView(params: CreateViewParams): void;
|
|
13
|
+
abstract getElement(): Nullable<HTMLElement>;
|
|
14
|
+
abstract disable(): void;
|
|
15
|
+
abstract enable(): void;
|
|
16
|
+
protected createContainerElement(layoutCallback: LayoutCallback): void;
|
|
17
|
+
private createClickListener;
|
|
18
|
+
setEvents(callback: ControlEventCallback): void;
|
|
19
|
+
removeListeners(): void;
|
|
13
20
|
}
|
|
21
|
+
export {};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
createView({ parent, layoutFn }: {
|
|
4
|
-
parent: any;
|
|
5
|
-
layoutFn: any;
|
|
6
|
-
}): HTMLDivElement;
|
|
7
|
-
controlEl: HTMLDivElement | undefined;
|
|
8
|
-
disable(): void;
|
|
9
|
-
enable(): void;
|
|
10
|
-
}
|
|
11
|
-
import { Control } from './Control';
|
|
1
|
+
import { type ControlCreator } from './types';
|
|
2
|
+
export declare const createTextControl: ControlCreator;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './AreaControl.js';
|
|
2
|
+
export * from './ButtonControl.js';
|
|
3
|
+
export * from './Control';
|
|
4
|
+
export * from './types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Control as TControl, ControlEvent, ControlLayoutParams } from '../../../manifest';
|
|
2
|
+
import Control from '../../../modules/Interactives/controls/Control';
|
|
3
|
+
export { TControl };
|
|
4
|
+
export declare enum CONTROLLER_IDS {
|
|
5
|
+
AREA = "int_area",
|
|
6
|
+
TEXT = "int_text",
|
|
7
|
+
BUTTON = "int_bttn"
|
|
8
|
+
}
|
|
9
|
+
export type Dimensions = {
|
|
10
|
+
width: string;
|
|
11
|
+
height: string;
|
|
12
|
+
};
|
|
13
|
+
export type LayoutCallback = (element: HTMLElement, controlLayoutParams: ControlLayoutParams) => void;
|
|
14
|
+
export type CreateViewParams = {
|
|
15
|
+
parentElement: HTMLElement;
|
|
16
|
+
layoutCallback: LayoutCallback;
|
|
17
|
+
};
|
|
18
|
+
type ControlEventCallbackParams = {
|
|
19
|
+
action: ControlEvent['action'];
|
|
20
|
+
controlId: string;
|
|
21
|
+
controlType: TControl['type'];
|
|
22
|
+
};
|
|
23
|
+
export type ControlEventCallback = (params: ControlEventCallbackParams) => void;
|
|
24
|
+
export type ControlCreator = (control: TControl) => Control | undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Container } from './containers/index';
|
|
2
2
|
export { Interactives } from './Interactives';
|
|
3
3
|
export { EVENT_NAMES, graphEventTypes, interactivesEventTypes } from './utils/events';
|
|
4
|
-
export type {
|
|
4
|
+
export type { InteractiveProjectInfo } from './types';
|
|
5
5
|
export { isLastChapter, hasEndTemplate } from './utils/gameUtils';
|
|
6
|
+
export type { InteractiveRange } from './utils/getInteractiveRanges';
|
|
6
7
|
export declare const utils: {
|
|
7
8
|
Container: typeof Container;
|
|
8
9
|
createChoiceContainer: (container: any, rootElement: any) => import("./containers/ChoiceContainer").ChoiceContainer | undefined;
|
|
9
|
-
createAreaControl:
|
|
10
|
-
createButtonControl:
|
|
11
|
-
createRelativeLayout: (layout: any) => import("./Layout").RelativeLayout | undefined;
|
|
10
|
+
createAreaControl: import("./controls").ControlCreator;
|
|
11
|
+
createButtonControl: import("./controls").ControlCreator;
|
|
12
12
|
getRootEl: () => Element | null;
|
|
13
13
|
classnamesPrefix: string;
|
|
14
14
|
};
|
|
@@ -1,9 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { InterfaceLanguage } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import type { IOptionalTuningConfig } from '@vkontakte/videoplayer-core';
|
|
3
|
+
import type { IOneStat } from '@vkontakte/videoplayer-statistics';
|
|
4
|
+
import type { Loaders } from '../../modules/ManifestController/Loadable';
|
|
5
|
+
import type { HistoryApi, HistorySettings } from '../../modules/Interactives/utils/HistoryController';
|
|
6
|
+
export type InteractiveProjectInfo = {
|
|
7
|
+
videoId: string;
|
|
8
|
+
pid?: string;
|
|
8
9
|
title?: string;
|
|
10
|
+
variantPayloadType?: string;
|
|
11
|
+
};
|
|
12
|
+
export type RequiredOptions = 'parentElement' | 'fullscreenTargetElement';
|
|
13
|
+
export type IOptionalInteractiveOptions = Partial<Omit<IInteractiveOptions, RequiredOptions | 'config'>> & Required<Pick<IInteractiveOptions, RequiredOptions>> & {
|
|
14
|
+
config?: Partial<IInteractiveOptions['config']>;
|
|
9
15
|
};
|
|
16
|
+
export interface IInteractiveOptions {
|
|
17
|
+
parentElement: HTMLElement;
|
|
18
|
+
fullscreenTargetElement: HTMLElement;
|
|
19
|
+
lang: InterfaceLanguage | string;
|
|
20
|
+
config: {
|
|
21
|
+
historyMaxLength: number;
|
|
22
|
+
noInteractionEventTimeout: number;
|
|
23
|
+
};
|
|
24
|
+
graph: boolean;
|
|
25
|
+
lastFrame: boolean;
|
|
26
|
+
initSeamless: boolean;
|
|
27
|
+
permanentTextControls: boolean;
|
|
28
|
+
loaders: Partial<Loaders>;
|
|
29
|
+
initChapterId?: string;
|
|
30
|
+
projectInfo?: InteractiveProjectInfo;
|
|
31
|
+
historyApi?: HistoryApi;
|
|
32
|
+
historySettings?: HistorySettings;
|
|
33
|
+
coreConfig?: IOptionalTuningConfig;
|
|
34
|
+
vkVideoLoader?: (owner_id: string, video_id: string) => unknown;
|
|
35
|
+
createOneStat?: (video: any, configOverwrite?: any) => IOneStat | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
* */
|
|
39
|
+
disableControlsOnPause?: boolean;
|
|
40
|
+
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ISubscription, type IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { type IPlayer } from '@vkontakte/videoplayer-core';
|
|
3
|
+
import type { InteractiveEventsType } from './InteractiveEvents';
|
|
4
|
+
import type { ChapterBranch, ChapterContainer } from '../../../manifest';
|
|
5
|
+
import type { EventEmitter } from '../../../utils/EventEmitter';
|
|
6
|
+
import { SelectBranches } from './SelectBranches';
|
|
7
|
+
import { GameStates } from './gameUtils';
|
|
8
|
+
type Container = {
|
|
9
|
+
container: ChapterContainer;
|
|
10
|
+
getElement: () => HTMLElement;
|
|
11
|
+
disable: () => void;
|
|
12
|
+
enable: () => void;
|
|
13
|
+
hide: () => void;
|
|
14
|
+
show: () => void;
|
|
15
|
+
createView: AnyFn;
|
|
16
|
+
removeView: () => void;
|
|
17
|
+
isDisabled: boolean;
|
|
18
|
+
isRemoved: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare class GameController {
|
|
21
|
+
container: Container;
|
|
22
|
+
branches: ChapterBranch[];
|
|
23
|
+
selectBranches: ReturnType<typeof SelectBranches>;
|
|
24
|
+
subscription: ISubscription;
|
|
25
|
+
player: IPlayer;
|
|
26
|
+
interactiveEvents: InteractiveEventsType;
|
|
27
|
+
ignoreContainerEvent: () => boolean;
|
|
28
|
+
isPermanentText: boolean;
|
|
29
|
+
disabledControls$: IValueSubject<boolean>;
|
|
30
|
+
onRemove: () => void;
|
|
31
|
+
globalEventEmitter: EventEmitter;
|
|
32
|
+
gameState: GameStates;
|
|
33
|
+
isSelectedControlEvent: boolean;
|
|
34
|
+
isSelectedContainerEvent: boolean;
|
|
2
35
|
constructor({ player, container, branches, selectBranches, interactiveEvents, globalEventEmitter, ignoreContainerEvent, permanentTextControls, disabledControls$, onRemove, }: {
|
|
3
36
|
player: any;
|
|
4
37
|
container: any;
|
|
@@ -11,20 +44,6 @@ export class GameController {
|
|
|
11
44
|
disabledControls$: any;
|
|
12
45
|
onRemove: any;
|
|
13
46
|
});
|
|
14
|
-
container: any;
|
|
15
|
-
branches: any;
|
|
16
|
-
selectBranches: any;
|
|
17
|
-
subscription: Subscription;
|
|
18
|
-
player: any;
|
|
19
|
-
interactiveEvents: any;
|
|
20
|
-
ignoreContainerEvent: any;
|
|
21
|
-
isPermanentText: any;
|
|
22
|
-
disabledControls$: any;
|
|
23
|
-
onRemove: any;
|
|
24
|
-
globalEventEmitter: any;
|
|
25
|
-
gameState: 0;
|
|
26
|
-
isSelectedControlEvent: boolean;
|
|
27
|
-
isSelectedContainerEvent: boolean;
|
|
28
47
|
registerEvents(): void;
|
|
29
48
|
hide: () => void;
|
|
30
49
|
show: () => void;
|
|
@@ -38,4 +57,4 @@ export class GameController {
|
|
|
38
57
|
removeView(): void;
|
|
39
58
|
destroy(): void;
|
|
40
59
|
}
|
|
41
|
-
|
|
60
|
+
export {};
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
initiator: any;
|
|
7
|
-
}) => boolean | undefined;
|
|
8
|
-
add: ({ timestamp, priority, initiator, ...rest }: {
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
timestamp: any;
|
|
11
|
-
priority: any;
|
|
12
|
-
initiator: any;
|
|
13
|
-
}) => void;
|
|
14
|
-
removeAll: () => boolean;
|
|
15
|
-
get: ({ timestamp, priority, initiator }: {
|
|
16
|
-
timestamp: any;
|
|
17
|
-
priority: any;
|
|
18
|
-
initiator: any;
|
|
19
|
-
}) => any;
|
|
20
|
-
getLte: (timestamp: any) => {};
|
|
21
|
-
getGte: (timestamp: any) => {};
|
|
1
|
+
import type { EventActionKeys } from '../../../manifest';
|
|
2
|
+
export type TPriority = 'chapter' | 'container' | 'control';
|
|
3
|
+
export type TPayload = {
|
|
4
|
+
actionType: EventActionKeys;
|
|
5
|
+
action: AnyFn;
|
|
22
6
|
};
|
|
7
|
+
export type TMapInitiator = {
|
|
8
|
+
[initiator: string]: TPayload[];
|
|
9
|
+
};
|
|
10
|
+
type TMapPriority = {
|
|
11
|
+
[priority in TPriority]?: TMapInitiator;
|
|
12
|
+
};
|
|
13
|
+
type TMap = {
|
|
14
|
+
[timestamp: number]: TMapPriority;
|
|
15
|
+
};
|
|
16
|
+
export type TMapFlattened = {
|
|
17
|
+
timestamp: number;
|
|
18
|
+
priority: TPriority;
|
|
19
|
+
initiator: string;
|
|
20
|
+
} & TPayload;
|
|
21
|
+
type GetAndRemoveArgType = Partial<Omit<TMapFlattened, keyof TPayload>> & Pick<TMapFlattened, 'timestamp'>;
|
|
22
|
+
export type TGroupsStack = ReturnType<typeof GroupsStack>;
|
|
23
|
+
export declare function GroupsStack(): {
|
|
24
|
+
map: TMap;
|
|
25
|
+
remove: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => boolean;
|
|
26
|
+
add: ({ timestamp, priority, initiator, ...rest }: TMapFlattened) => void;
|
|
27
|
+
removeAll: () => void;
|
|
28
|
+
get: ({ timestamp, priority, initiator }: GetAndRemoveArgType) => TMapInitiator | TPayload[] | TMapPriority | null;
|
|
29
|
+
getLte: (timestamp: number) => TMap;
|
|
30
|
+
getGte: (timestamp: number) => TMap;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { Nullable } from '@vkontakte/videoplayer-shared';
|
|
2
2
|
import type { IValueSubject } from '@vkontakte/videoplayer-shared';
|
|
3
3
|
import { EventEmitter } from '../../../utils/EventEmitter';
|
|
4
|
-
import type { VideoId } from '../../../
|
|
4
|
+
import type { VideoId } from '../../../manifest';
|
|
5
5
|
import type { Interactives } from '../../../modules/Interactives';
|
|
6
|
-
interface HistoryApi {
|
|
7
|
-
get: (
|
|
8
|
-
save: (
|
|
6
|
+
export interface HistoryApi {
|
|
7
|
+
get: (rawId: string) => Promise<number[]>;
|
|
8
|
+
save: (rawId: string, videoIds: number[]) => Promise<void>;
|
|
9
9
|
}
|
|
10
|
-
interface HistorySettings {
|
|
10
|
+
export interface HistorySettings {
|
|
11
11
|
maxLength: number;
|
|
12
12
|
initChapterId?: string;
|
|
13
13
|
}
|
|
14
14
|
interface HistoryControllerParams {
|
|
15
|
-
videoId: string;
|
|
16
15
|
globalEventEmitter: EventEmitter;
|
|
17
16
|
interactiveController: Interactives;
|
|
18
17
|
settings: HistorySettings;
|
|
18
|
+
videoId?: string;
|
|
19
19
|
historyApi?: Nullable<HistoryApi>;
|
|
20
20
|
}
|
|
21
|
-
interface HistoryControllerState {
|
|
21
|
+
export interface HistoryControllerState {
|
|
22
22
|
history$: IValueSubject<string[]>;
|
|
23
23
|
hasPrevChapter$: IValueSubject<boolean>;
|
|
24
24
|
prevChapter$: IValueSubject<Nullable<string>>;
|
|
@@ -27,7 +27,7 @@ interface HistoryControllerState {
|
|
|
27
27
|
}
|
|
28
28
|
export default class HistoryController {
|
|
29
29
|
#private;
|
|
30
|
-
state:
|
|
30
|
+
state: HistoryControllerState;
|
|
31
31
|
constructor({ globalEventEmitter, videoId, interactiveController, historyApi, settings }: HistoryControllerParams);
|
|
32
32
|
setManifest(manifest: any): Promise<void>;
|
|
33
33
|
get inited(): boolean;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { type Container } from '../../../manifest';
|
|
2
|
+
import { type TPayload, type TGroupsStack } from './GroupsStack';
|
|
3
|
+
import type { IPlayer } from '@vkontakte/videoplayer-core';
|
|
4
|
+
export type InteractiveEventsType = ReturnType<typeof InteractiveEvents>;
|
|
5
|
+
type AddMethodParamType = Parameters<TGroupsStack['add']>[0];
|
|
6
|
+
type RemoveMethodParamType = Parameters<TGroupsStack['remove']>[0];
|
|
1
7
|
/**
|
|
2
8
|
* Executes an events at different times of the current chapter
|
|
3
|
-
* @param {object} player
|
|
4
9
|
*/
|
|
5
|
-
export function InteractiveEvents(player:
|
|
6
|
-
setPlayer: (player:
|
|
7
|
-
add: (args:
|
|
8
|
-
remove: (args:
|
|
9
|
-
exec: (timestamp:
|
|
10
|
+
export declare function InteractiveEvents(player: IPlayer): {
|
|
11
|
+
setPlayer: (player: IPlayer) => void;
|
|
12
|
+
add: (args: AddMethodParamType) => void;
|
|
13
|
+
remove: (args: RemoveMethodParamType) => void;
|
|
14
|
+
exec: (timestamp: number) => void;
|
|
10
15
|
execEndOfVideo: () => void;
|
|
11
16
|
listen: () => void;
|
|
12
17
|
unlisten: () => void;
|
|
@@ -16,10 +21,11 @@ export function InteractiveEvents(player: object): {
|
|
|
16
21
|
timestamp: any;
|
|
17
22
|
id: any;
|
|
18
23
|
}) => void;
|
|
19
|
-
setData: (containers?:
|
|
20
|
-
resetCalled: (timestamp:
|
|
21
|
-
isReady: (timestamp:
|
|
24
|
+
setData: (containers?: Container[]) => void;
|
|
25
|
+
resetCalled: (timestamp: number) => void;
|
|
26
|
+
isReady: (timestamp: number) => boolean;
|
|
22
27
|
release: () => void;
|
|
23
28
|
};
|
|
24
|
-
getPreparedToExecActions: (timestamp?: number) =>
|
|
29
|
+
getPreparedToExecActions: (timestamp?: number) => TPayload[];
|
|
25
30
|
};
|
|
31
|
+
export {};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IPlayer } from '@vkontakte/videoplayer-core';
|
|
2
|
+
type ResizeManagerArg = () => {
|
|
3
|
+
parentElement: HTMLElement;
|
|
4
|
+
player?: Nullable<IPlayer>;
|
|
5
|
+
fns?: AnyFn[];
|
|
6
|
+
};
|
|
7
|
+
export declare function ResizeManager(getOptions: ResizeManagerArg): {
|
|
2
8
|
resizeObserver: ResizeObserver;
|
|
3
9
|
calc: () => void;
|
|
4
10
|
release: () => void;
|
|
5
11
|
};
|
|
12
|
+
export {};
|