@vkontakte/videoplayer 1.1.88 → 1.1.89-dev.fdf6110f.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 +38 -395
- package/es2015.esm.js +38 -395
- package/esnext.cjs +38 -395
- package/esnext.esm.js +38 -395
- package/evergreen.esm.js +17 -374
- package/package.json +5 -17
- package/types/VKVideoPlayer/defaultConfig.d.ts +5 -0
- package/types/VKVideoPlayer/index.svelte.d.ts +40 -5
- package/types/components/Ads/admanWrapper.d.ts +4 -3
- package/types/components/Ads/types.d.ts +0 -20
- package/types/components/Ads/utils.d.ts +6 -0
- package/types/components/Root/types.d.ts +9 -47
- package/types/config.d.ts +29 -25
- package/types/index.d.ts +3 -4
- package/types/store/index.d.ts +3 -401
- package/types/store/micro/base.d.ts +1 -1
- package/types/store/types.d.ts +407 -0
- package/types/store/utils.d.ts +1 -1
- package/types/types/ads.d.ts +20 -0
- package/types/types/index.d.ts +8 -3
- package/es2018.cjs +0 -428
- package/es2018.esm.js +0 -428
- package/es2024.cjs +0 -428
- package/es2024.esm.js +0 -428
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import type { ChromecastState, IAudioStream, IConfig as ICoreInitVideoConfig, IExternalTextTrack, IOptionalTuningConfig, IPlayer, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, VideoFormat } from "@vkontakte/videoplayer-core";
|
|
2
|
+
import type { InteractiveRange } from "@vkontakte/videoplayer-interactive";
|
|
3
|
+
import type { AppTracer, IError, ILogger, InterfaceLanguage, InternalsExposure, IRectangle, IValueObservable, QualityLimits, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
4
|
+
import type { SeekAction, ThinOneStat } from "@vkontakte/videoplayer-statistics";
|
|
5
|
+
import type { Readable, Writable } from "svelte/store";
|
|
6
|
+
import type { AdditionalButtonDeprecated, AdsPlaybackState, ControlBlocksRefs, ControlsKeys, HotKeyMapData, IAnnotationsApi, IControlInfo, IDisabledControls, IInteractiveData, IPictureInPictureApi, IPlayerControlsRef, IPlayerPhase, ITimelinePreviewThumbsData, IVideoEpisode, IVKVideoPlayerCallbacks, IVKVideoPlayerUICallbacks, PlaybackStateRealistic, Position, Size, VideoPlaybackRate, VideoPlayerView, VideoQualityForRender, VideoQualityUI, VideoSubtitle, VideoSubtitleParsed } from "../types";
|
|
7
|
+
import type { AdmanWrapper } from "../components/Ads/admanWrapper";
|
|
8
|
+
import type { Key, LanguageConfig } from "../translation/types";
|
|
9
|
+
import type { QualitySettingsAppliesTo } from "../utils/userSettings";
|
|
10
|
+
import type { GridTypes, PlayPrevChapterDisabledTooltipKey } from "../constans";
|
|
11
|
+
import type { AdditionalButton, AdditionalDesktopControlPanelButton } from "../components/Controls/types";
|
|
12
|
+
import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem, ContextMenuItem, SettingsMenuItem } from "../components/Menus/subMenuTabs/types";
|
|
13
|
+
import type { SlotsApi } from "../utils/webAPI/slotsApi";
|
|
14
|
+
import type { FocusManager } from "../utils/webAPI/focusManager";
|
|
15
|
+
import type { ISDKConfig, IUIConfig } from "../config";
|
|
16
|
+
import type { IUIStatistics } from "../services/statistics";
|
|
17
|
+
import type { DebugData } from "./utils";
|
|
18
|
+
export interface SetQualityInfo {
|
|
19
|
+
appliesTo?: QualitySettingsAppliesTo;
|
|
20
|
+
changeReason?: "default" | "limit-changed";
|
|
21
|
+
byUser?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface IAdsState {
|
|
24
|
+
position: Writable<number>;
|
|
25
|
+
duration: Writable<number>;
|
|
26
|
+
playbackState: Writable<AdsPlaybackState>;
|
|
27
|
+
canSkip: Writable<boolean>;
|
|
28
|
+
secondsToWatchBeforeSkip: Writable<number>;
|
|
29
|
+
postrollPassed: Writable<boolean>;
|
|
30
|
+
}
|
|
31
|
+
export interface IUIState {
|
|
32
|
+
t: (key: Key, params?: Record<string, string>) => string;
|
|
33
|
+
isMinimalView$: Writable<boolean>;
|
|
34
|
+
controlsVisible: Writable<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Точечно скрываем контролы.
|
|
37
|
+
*/
|
|
38
|
+
hiddenControls: Partial<Record<keyof IPlayerControlsRef, Writable<boolean>>>;
|
|
39
|
+
/**
|
|
40
|
+
* Определяет, могут ли вообще контролы быть показаны.
|
|
41
|
+
*/
|
|
42
|
+
isControlsAvailable: Writable<boolean>;
|
|
43
|
+
controlBlocks: { [key in keyof Required<ControlBlocksRefs>] : Writable<IControlInfo | undefined> };
|
|
44
|
+
touched: Writable<boolean>;
|
|
45
|
+
controls: {
|
|
46
|
+
prevButton: Writable<IControlInfo | undefined>;
|
|
47
|
+
playButton: Writable<IControlInfo | undefined>;
|
|
48
|
+
replayButton: Writable<IControlInfo | undefined>;
|
|
49
|
+
nextButton: Writable<IControlInfo | undefined>;
|
|
50
|
+
playPrevChapterButton: Writable<IControlInfo | undefined>;
|
|
51
|
+
seekToInteractiveButton: Writable<IControlInfo | undefined>;
|
|
52
|
+
interactiveGraphButton: Writable<IControlInfo | undefined>;
|
|
53
|
+
liveButton: Writable<IControlInfo | undefined>;
|
|
54
|
+
time: Writable<IControlInfo | undefined>;
|
|
55
|
+
episodes: Writable<IControlInfo | undefined>;
|
|
56
|
+
volume: Writable<IControlInfo | undefined>;
|
|
57
|
+
subtitles: Writable<IControlInfo | undefined>;
|
|
58
|
+
settings: Writable<IControlInfo | undefined>;
|
|
59
|
+
context: Writable<IControlInfo | undefined>;
|
|
60
|
+
fullscreen: Writable<IControlInfo | undefined>;
|
|
61
|
+
chromecast: Writable<IControlInfo | undefined>;
|
|
62
|
+
pip: Writable<IControlInfo | undefined>;
|
|
63
|
+
"theater-mode-button": Writable<IControlInfo | undefined>;
|
|
64
|
+
vkLogo: Writable<IControlInfo | undefined>;
|
|
65
|
+
interactiveTimeIndicator: Writable<IControlInfo | undefined>;
|
|
66
|
+
timeline: Writable<IControlInfo | undefined>;
|
|
67
|
+
autoplayNextToggle: Writable<IControlInfo | undefined>;
|
|
68
|
+
disabledControls$: IDisabledControls;
|
|
69
|
+
additionalButtons: Writable<IControlInfo | undefined>[];
|
|
70
|
+
};
|
|
71
|
+
modals: {
|
|
72
|
+
hotKeyMap: {
|
|
73
|
+
show: Writable<boolean>;
|
|
74
|
+
data: Writable<HotKeyMapData>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
isFullscreen: Writable<boolean>;
|
|
78
|
+
isFullscreenOpenedByKeyboard: Writable<boolean>;
|
|
79
|
+
rotateAlpha: Writable<number>;
|
|
80
|
+
isAutoplay: Writable<boolean>;
|
|
81
|
+
debugPanelVisible: Writable<boolean>;
|
|
82
|
+
episodes: {
|
|
83
|
+
panelOpened$: Writable<boolean>;
|
|
84
|
+
openedByKeyboard$: Writable<boolean>;
|
|
85
|
+
};
|
|
86
|
+
contextMenu: {
|
|
87
|
+
visible$: Writable<boolean>;
|
|
88
|
+
btnRef$: Writable<HTMLButtonElement | undefined>;
|
|
89
|
+
openedByBtnKeyboard$: Writable<boolean>;
|
|
90
|
+
openedByHotKey$: Writable<boolean>;
|
|
91
|
+
lastActiveElem$: Writable<HTMLButtonElement | undefined>;
|
|
92
|
+
showContextMenuBtn$: Writable<boolean>;
|
|
93
|
+
position$: Writable<Position>;
|
|
94
|
+
};
|
|
95
|
+
playerSize: Writable<Size>;
|
|
96
|
+
isMobile: Readable<boolean>;
|
|
97
|
+
mobileNotReportControlHidden$: Readable<boolean>;
|
|
98
|
+
icon3DVideoVisible: Writable<boolean>;
|
|
99
|
+
scrubbingInProgress: Writable<boolean>;
|
|
100
|
+
volumeChangingInProgress: Writable<boolean>;
|
|
101
|
+
is3DVideo: Writable<boolean>;
|
|
102
|
+
currentGridType$: Readable<GridTypes>;
|
|
103
|
+
interactiveHideMobileControls: Writable<boolean>;
|
|
104
|
+
additionalButtonsDeprecated$: Readable<AdditionalButtonDeprecated[]>;
|
|
105
|
+
additionalDesktopControlPanelRightButtons$: Readable<AdditionalDesktopControlPanelButton[]>;
|
|
106
|
+
additionalSettingsMenuItems$: Readable<SettingsMenuItem[]>;
|
|
107
|
+
additionalContextMenuItems$: Readable<ContextMenuItem[]>;
|
|
108
|
+
overlayContainer$: Writable<HTMLDivElement | undefined>;
|
|
109
|
+
startedByKeyboard$: Writable<boolean>;
|
|
110
|
+
autoplayNextEnabled$: Writable<boolean>;
|
|
111
|
+
timerNextVideoRunning$: Writable<boolean>;
|
|
112
|
+
settingsMenu: {
|
|
113
|
+
visible$: Writable<boolean>;
|
|
114
|
+
ref$: Writable<HTMLElement | undefined>;
|
|
115
|
+
openedByBtnKeyboard$: Writable<boolean>;
|
|
116
|
+
};
|
|
117
|
+
settingsSubMenu: {
|
|
118
|
+
visible$: Writable<boolean>;
|
|
119
|
+
ref$: Writable<HTMLElement | undefined>;
|
|
120
|
+
name$: Writable<string | undefined>;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Отключаем любое действие пользователя.
|
|
124
|
+
*/
|
|
125
|
+
userActionsDisabled: Writable<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Положение заголовка названия видео.
|
|
128
|
+
*/
|
|
129
|
+
videoTitleInfo: Writable<IControlInfo | undefined>;
|
|
130
|
+
/**
|
|
131
|
+
* Ускорение видео х2.
|
|
132
|
+
*/
|
|
133
|
+
doubleForwardOn$: Writable<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Определяет, что двойное ускорение видео доступно.
|
|
136
|
+
*/
|
|
137
|
+
doubleForwardAvailable$: Readable<boolean>;
|
|
138
|
+
previewTrackActive: Writable<boolean>;
|
|
139
|
+
previewTrackDragInProgress: Writable<boolean>;
|
|
140
|
+
previewTrackAvailable: Readable<boolean>;
|
|
141
|
+
isPreviewTrackHorizontallyAligned: Readable<boolean>;
|
|
142
|
+
}
|
|
143
|
+
export interface IWebApi {
|
|
144
|
+
pictureInPictureApi?: IPictureInPictureApi;
|
|
145
|
+
annotationsApi?: IAnnotationsApi;
|
|
146
|
+
slotsApi?: SlotsApi;
|
|
147
|
+
focusManager?: FocusManager;
|
|
148
|
+
}
|
|
149
|
+
export interface IPlayerState {
|
|
150
|
+
positionExact$: Readable<number>;
|
|
151
|
+
positionWithScrubbing$: Readable<number>;
|
|
152
|
+
duration$: Readable<number>;
|
|
153
|
+
playbackState$: Readable<PlaybackState | undefined>;
|
|
154
|
+
playbackStateRealistic$: Readable<PlaybackStateRealistic | undefined>;
|
|
155
|
+
isPlaying$: Readable<boolean>;
|
|
156
|
+
isLoaderVisible: Readable<boolean>;
|
|
157
|
+
bufferedProgress$: Readable<number>;
|
|
158
|
+
isLive$: Readable<boolean | undefined>;
|
|
159
|
+
canChangePlaybackSpeed$: Readable<boolean | undefined>;
|
|
160
|
+
isActiveLive$: Readable<boolean | undefined>;
|
|
161
|
+
isOldestAvailableLive$: Readable<boolean | undefined>;
|
|
162
|
+
isRewindableLive$: Readable<boolean>;
|
|
163
|
+
isEnded$: Readable<boolean>;
|
|
164
|
+
volume$: Readable<number>;
|
|
165
|
+
muted$: Readable<boolean>;
|
|
166
|
+
trafficSavingEnabled$: Readable<boolean>;
|
|
167
|
+
highQualityEnabled$: Readable<boolean>;
|
|
168
|
+
availableVideoStreams$: Readable<IVideoStream[]>;
|
|
169
|
+
availableAudioStreams$: Readable<IAudioStream[]>;
|
|
170
|
+
videoStream$: Readable<IVideoStream | undefined>;
|
|
171
|
+
audioStream$: Readable<IAudioStream | undefined>;
|
|
172
|
+
currentQuality$: Readable<VideoQuality | undefined>;
|
|
173
|
+
autoQualityLimitingAvailable$: Readable<boolean>;
|
|
174
|
+
isAutoQualityEnabled$: Readable<boolean | undefined>;
|
|
175
|
+
availableQualities$: Readable<VideoQualityForRender[]>;
|
|
176
|
+
currentPlaybackRate$: Readable<number>;
|
|
177
|
+
availablePlaybackRates$: Readable<VideoPlaybackRate[]>;
|
|
178
|
+
currentSubtitle$: Readable<Omit<VideoSubtitle, "selected">>;
|
|
179
|
+
availableTextTracks$: Readable<ITextTrack[]>;
|
|
180
|
+
availableSubtitlesList$: Readable<VideoSubtitle[]>;
|
|
181
|
+
currentSubtitleCaptions$: Readable<VideoSubtitleParsed["texts"]>;
|
|
182
|
+
previewThumbsData$: Writable<ITimelinePreviewThumbsData | undefined>;
|
|
183
|
+
isAutoSubtitleCaptionVisible$: Writable<boolean>;
|
|
184
|
+
chromecastState$: Readable<ChromecastState>;
|
|
185
|
+
chromecastDeviceName$: Readable<string | undefined>;
|
|
186
|
+
chromecastConnected$: Readable<boolean>;
|
|
187
|
+
currentFormat$: Readable<VideoFormat | undefined>;
|
|
188
|
+
throughputEstimation$: Readable<number | undefined>;
|
|
189
|
+
videoBitrate$: Readable<number | undefined>;
|
|
190
|
+
videoEpisodes$: Writable<IVideoEpisode[] | undefined>;
|
|
191
|
+
videoSize$: Readable<IRectangle | undefined>;
|
|
192
|
+
errorLog$: Readable<IError[]>;
|
|
193
|
+
crashed$: Readable<boolean>;
|
|
194
|
+
isAudioAvailable$: Readable<boolean>;
|
|
195
|
+
isAudioDisabled: boolean;
|
|
196
|
+
canDownload: boolean;
|
|
197
|
+
availableSources$: Readable<ISources | undefined>;
|
|
198
|
+
hasMpegSources$: Readable<boolean>;
|
|
199
|
+
isInteractive: boolean;
|
|
200
|
+
showInteractiveGraph: boolean;
|
|
201
|
+
showSeekToInteractive: boolean;
|
|
202
|
+
showPlayPrevChapter: boolean;
|
|
203
|
+
showInteractiveTimeIndicator: boolean;
|
|
204
|
+
isInteractiveTime$: Readable<boolean>;
|
|
205
|
+
interactiveEpisodes$: Readable<IVideoEpisode[]>;
|
|
206
|
+
isInteractiveExpectation$: Writable<boolean>;
|
|
207
|
+
hasInteractiveBranches?: boolean;
|
|
208
|
+
playPrevChapterDisabledTooltip: PlayPrevChapterDisabledTooltipKey;
|
|
209
|
+
looped$: Writable<boolean>;
|
|
210
|
+
loadedMetadata$: Writable<boolean>;
|
|
211
|
+
/**
|
|
212
|
+
* Определяет, можно ли в целом увидеть/выбрать Авто режим выбора качества.
|
|
213
|
+
*/
|
|
214
|
+
isAutoQualityAvailable$: Readable<boolean>;
|
|
215
|
+
}
|
|
216
|
+
export interface IStoreInternalActions {
|
|
217
|
+
preload: () => void;
|
|
218
|
+
firstStart: (showAds: boolean) => void;
|
|
219
|
+
play: () => void;
|
|
220
|
+
pause: () => void;
|
|
221
|
+
togglePlay: () => void;
|
|
222
|
+
toggleMuted: () => void;
|
|
223
|
+
openSettingsMenu: (wasOpenedByKey?: boolean, tick?: () => Promise<void>) => void;
|
|
224
|
+
closeSettingsMenu: (fromSubMenu?: boolean) => void;
|
|
225
|
+
openSettingsSubMenu: (name: string, ref: HTMLElement) => void;
|
|
226
|
+
closeSettingsSubMenu: (ref: HTMLElement, isClosing?: boolean) => void;
|
|
227
|
+
setTrafficSavingEnabled: (trafficSavingEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
|
|
228
|
+
setHighQualityEnabled: (highQualityEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
|
|
229
|
+
setVolume: (volume: number) => void;
|
|
230
|
+
setMuted: (muted: boolean) => void;
|
|
231
|
+
startVolumeChanging: () => void;
|
|
232
|
+
stopVolumeChanging: () => void;
|
|
233
|
+
setAudioStream: (stream: IAudioStream) => void;
|
|
234
|
+
setVideoStream: (stream: IVideoStream) => void;
|
|
235
|
+
setQuality: (quality: VideoQualityUI, info?: SetQualityInfo) => void;
|
|
236
|
+
setPlaybackRate: (playbackRate: PlaybackRate) => void;
|
|
237
|
+
incrementPlaybackRate: () => VideoPlaybackRate;
|
|
238
|
+
decrementPlaybackRate: () => VideoPlaybackRate;
|
|
239
|
+
setSubtitle: (subtitle?: VideoSubtitle) => void;
|
|
240
|
+
toggleSubtitle: () => void;
|
|
241
|
+
togglePictureInPicture: () => void;
|
|
242
|
+
startScrubbing: (progress: number) => void;
|
|
243
|
+
progressScrubbing: (progress: number) => void;
|
|
244
|
+
completeScrubbing: (progress: number, forcePrecise?: boolean, action?: ThinOneStat.ActionSeekType | SeekAction) => void;
|
|
245
|
+
toggleChromecast: () => void;
|
|
246
|
+
seekTime: (time: number, action: SeekAction, forcePrecise?: boolean) => void;
|
|
247
|
+
seekEpisodeStartTime: (time: number) => void;
|
|
248
|
+
getNextEpisode: () => IVideoEpisode | undefined;
|
|
249
|
+
seekToNextEpisode: (episode?: IVideoEpisode) => void;
|
|
250
|
+
getPrevEpisode: () => IVideoEpisode | undefined;
|
|
251
|
+
seekToPrevEpisode: (episode?: IVideoEpisode) => void;
|
|
252
|
+
seekToPercent: (percent: number, action: SeekAction) => void;
|
|
253
|
+
switchToActiveLive: () => void;
|
|
254
|
+
switchFromAdsToVideo: (callPlay?: boolean) => void;
|
|
255
|
+
switchFromVideoToAds: () => void;
|
|
256
|
+
skipAd: () => void;
|
|
257
|
+
setLiveWaitingStart: (state: boolean) => void;
|
|
258
|
+
setLiveWaitingRecover: (state: boolean) => void;
|
|
259
|
+
setLiveWaitingRecord: (state: boolean) => void;
|
|
260
|
+
clearDelayedBufferingCheckTimeout: () => void;
|
|
261
|
+
getDebugTextData: () => string;
|
|
262
|
+
getTraceTextData: () => string;
|
|
263
|
+
getDebugPanelData: () => DebugData;
|
|
264
|
+
getVideoElement: () => HTMLVideoElement | null;
|
|
265
|
+
startLogging: () => void;
|
|
266
|
+
stopLogging: () => void;
|
|
267
|
+
videoRotate: (alphaDiff?: number) => void;
|
|
268
|
+
startCameraManualRotation(mx: number, my: number): void;
|
|
269
|
+
stopCameraManualRotation(immediate?: boolean): void;
|
|
270
|
+
moveCameraFocusPX(xpx: number, ypx: number, dt: number): void;
|
|
271
|
+
holdCamera(): void;
|
|
272
|
+
releaseCamera(): void;
|
|
273
|
+
downloadVideo: () => void;
|
|
274
|
+
addLanguage: (config: LanguageConfig) => void;
|
|
275
|
+
setLanguage: (language: InterfaceLanguage | string) => void;
|
|
276
|
+
nextMovie: (movieId: number) => void;
|
|
277
|
+
correctSeekTimeToInteractive: (time: number) => number;
|
|
278
|
+
replayInteractive?: () => void;
|
|
279
|
+
stopPlayer?: () => void;
|
|
280
|
+
setLooped: (isLooped: boolean) => void;
|
|
281
|
+
reportProblem: () => void;
|
|
282
|
+
setAutoplayNextEnabled: (autoplayNext: boolean, byUser?: boolean) => void;
|
|
283
|
+
setTimerNextVideoRunning: (timerNextVideoRunning: boolean) => void;
|
|
284
|
+
prevVideoClick: (byUserAction?: boolean) => void;
|
|
285
|
+
nextVideoClick: (byUserAction?: boolean) => void;
|
|
286
|
+
nextVideoAnnouncementShow: () => void;
|
|
287
|
+
nextVideoAnnouncementClick: () => void;
|
|
288
|
+
nextVideoAnnouncementAuto: () => void;
|
|
289
|
+
nextVideoAnnouncementCancel: () => void;
|
|
290
|
+
checkFullscreenSupport: () => boolean;
|
|
291
|
+
changeDoubleForwardOn: (enabled: boolean) => void;
|
|
292
|
+
closePreviewTrack: () => void;
|
|
293
|
+
previewTrackOpened: () => void;
|
|
294
|
+
previewTrackDragStarted: () => void;
|
|
295
|
+
previewTrackDragFinished: () => void;
|
|
296
|
+
}
|
|
297
|
+
export interface IStoreExternalActions {
|
|
298
|
+
firstStart: (showAds: boolean) => void;
|
|
299
|
+
play: () => void;
|
|
300
|
+
pause: () => void;
|
|
301
|
+
stop: () => void;
|
|
302
|
+
seekTime: (time: number) => void;
|
|
303
|
+
seekEpisodeStartTime: (time: number) => void;
|
|
304
|
+
setPlaybackRate: (playbackRate: PlaybackRate) => void;
|
|
305
|
+
setAutoQualityLimits: (limits: QualityLimits) => void;
|
|
306
|
+
setMuted: (muted: boolean) => void;
|
|
307
|
+
toggleSubtitle: () => void;
|
|
308
|
+
changeSubtitle: (enabled: boolean, id?: string) => void;
|
|
309
|
+
setVolume: (volume: number) => void;
|
|
310
|
+
returnFocusToEpisodes: () => void;
|
|
311
|
+
updateAdditionalSettingsItem: (itemId: string, fields: Partial<Omit<AdditionalSettingsMenuItem, "id" | "type">>) => void;
|
|
312
|
+
addAdditionalSettingsItem: (newItem: AdditionalSettingsMenuItem) => void;
|
|
313
|
+
removeAdditionalSettingsItem: (itemId: string) => void;
|
|
314
|
+
updateAdditionalContextItem: (itemId: string, fields: Partial<Omit<AdditionalContextMenuItem, "id">>) => void;
|
|
315
|
+
addAdditionalContextItem: (newItem: AdditionalContextMenuItem) => void;
|
|
316
|
+
removeAdditionalContextItem: (itemId: string) => void;
|
|
317
|
+
updateAdditionalButton: (itemId: string, fields: Partial<Omit<AdditionalButton, "id" | "type">>) => void;
|
|
318
|
+
addAdditionalButton: (newButton: AdditionalButton) => void;
|
|
319
|
+
removeAdditionalButton: (itemId: string) => void;
|
|
320
|
+
setLiveLowLatency: (isLowLatency: boolean) => void;
|
|
321
|
+
hideControls: () => void;
|
|
322
|
+
showControls: () => void;
|
|
323
|
+
setQuality: (quality: VideoQualityUI) => void;
|
|
324
|
+
setTrafficSavingEnabled: (trafficSavingEnabled: boolean) => void;
|
|
325
|
+
setHighQualityEnabled: (highQualityEnabled: boolean) => void;
|
|
326
|
+
changeAudioStream: (id: string) => void;
|
|
327
|
+
setMinimalView: (enabled: boolean) => void;
|
|
328
|
+
}
|
|
329
|
+
export interface IStoreInitVideoConfig extends ICoreInitVideoConfig {
|
|
330
|
+
autoplay?: boolean;
|
|
331
|
+
canDownload?: boolean;
|
|
332
|
+
previewThumbsData?: ITimelinePreviewThumbsData;
|
|
333
|
+
subtitles?: Omit<IExternalTextTrack, "type">[];
|
|
334
|
+
subtitlesForcedLanguage?: string;
|
|
335
|
+
unitedVideoId?: number;
|
|
336
|
+
videoEpisodes?: IVideoEpisode[];
|
|
337
|
+
}
|
|
338
|
+
export interface IStore {
|
|
339
|
+
initVideo: (config: IStoreInitVideoConfig) => void;
|
|
340
|
+
videoId$: Writable<number | undefined>;
|
|
341
|
+
playerPhase: IPlayerPhase;
|
|
342
|
+
interfaceLanguage$: Readable<InterfaceLanguage | string>;
|
|
343
|
+
isCyrillicRelatedInterface$: Readable<boolean>;
|
|
344
|
+
interactiveData?: IInteractiveData;
|
|
345
|
+
vsid$: Readable<string | undefined>;
|
|
346
|
+
state: IPlayerState;
|
|
347
|
+
ui: IUIState;
|
|
348
|
+
ads: IAdsState;
|
|
349
|
+
webApi: IWebApi;
|
|
350
|
+
actions: {
|
|
351
|
+
internal: IStoreInternalActions;
|
|
352
|
+
external: IStoreExternalActions;
|
|
353
|
+
};
|
|
354
|
+
callbacks?: IVKVideoPlayerCallbacks;
|
|
355
|
+
setUiCallbacks: (uiCallbacks: IVKVideoPlayerUICallbacks) => void;
|
|
356
|
+
initAdmanWrapper: VoidFunction;
|
|
357
|
+
updateAdmanWrapperSubscriptions: VoidFunction;
|
|
358
|
+
updateStatisticsSubscriptions: VoidFunction;
|
|
359
|
+
updateAppTracerSubscriptions: VoidFunction;
|
|
360
|
+
getLogger: () => ILogger;
|
|
361
|
+
getPlayer: () => IPlayer;
|
|
362
|
+
destroy(): void;
|
|
363
|
+
}
|
|
364
|
+
export interface IStoreParams {
|
|
365
|
+
interfaceLanguage: InterfaceLanguage | string;
|
|
366
|
+
isCyrillicRelatedInterface: boolean;
|
|
367
|
+
isTouch: boolean;
|
|
368
|
+
isLiveCatchUpMode?: boolean;
|
|
369
|
+
isAudioDisabled?: boolean;
|
|
370
|
+
canDownload?: boolean;
|
|
371
|
+
statAuthToken?: string;
|
|
372
|
+
callbacks?: IVKVideoPlayerCallbacks;
|
|
373
|
+
webApi?: IWebApi;
|
|
374
|
+
videoEpisodes?: IVideoEpisode[];
|
|
375
|
+
previewThumbsData?: ITimelinePreviewThumbsData;
|
|
376
|
+
uiConfig: IUIConfig;
|
|
377
|
+
coreConfig: IOptionalTuningConfig;
|
|
378
|
+
metaConfig: ISDKConfig["meta"];
|
|
379
|
+
player?: IPlayer;
|
|
380
|
+
isInteractive: boolean;
|
|
381
|
+
interactiveRanges$?: IValueObservable<InteractiveRange[]>;
|
|
382
|
+
isInteractiveTime$?: IValueObservable<boolean>;
|
|
383
|
+
replayInteractive?: () => void;
|
|
384
|
+
stopPlayer?: () => void;
|
|
385
|
+
hasInteractiveBranches?: boolean;
|
|
386
|
+
disabledControls: ControlsKeys;
|
|
387
|
+
playPrevChapterDisabledTooltip: PlayPrevChapterDisabledTooltipKey;
|
|
388
|
+
additionalButtons: Array<AdditionalButtonDeprecated | AdditionalDesktopControlPanelButton>;
|
|
389
|
+
additionalSettingsMenuItems: AdditionalSettingsMenuItem[];
|
|
390
|
+
additionalContextMenuItems: AdditionalContextMenuItem[];
|
|
391
|
+
playPrevVideo: () => void;
|
|
392
|
+
playNextVideo: () => void;
|
|
393
|
+
/**
|
|
394
|
+
* playPrevVideo или playNextVideo могут не вызваться, если обработка следующего видео находится на стороне интегарции,
|
|
395
|
+
* поэтому используем данный колбэк.
|
|
396
|
+
*/
|
|
397
|
+
onVideoChanged: (prev: boolean) => void;
|
|
398
|
+
looped?: boolean;
|
|
399
|
+
getStatisticsService: () => IUIStatistics | undefined;
|
|
400
|
+
saveRate: boolean;
|
|
401
|
+
internalsExposure: InternalsExposure | null;
|
|
402
|
+
playerView?: VideoPlayerView;
|
|
403
|
+
playerId: string;
|
|
404
|
+
getAppTracer: () => AppTracer | undefined;
|
|
405
|
+
getAdmanWrapper: () => AdmanWrapper | undefined;
|
|
406
|
+
logger: ILogger;
|
|
407
|
+
}
|
package/types/store/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Readable } from "svelte/store";
|
|
2
2
|
import type { IValueObservable } from "@vkontakte/videoplayer-shared";
|
|
3
3
|
import type { IPlayer, IConfig, IObservable } from "@vkontakte/videoplayer-core";
|
|
4
|
-
import type { IStore } from "
|
|
4
|
+
import type { IStore } from "./types";
|
|
5
5
|
import type { AdditionalButtonDeprecated, IMicroStores } from "../types";
|
|
6
6
|
import type { AdditionalDesktopControlPanelButton } from "../components/Controls/types";
|
|
7
7
|
import type { ISDKConfig } from "../config";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AdsParams = Record<string, unknown>;
|
|
2
|
+
export interface IAdmanInitParamsExternalApi {
|
|
3
|
+
videoGetAds?: (p: AdsParams) => Promise<Record<string, unknown> | null>;
|
|
4
|
+
videoTrackAdEvent?: (sectionKey: string, bannerId: string) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export type AdmanInitParams = {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
isFullscreen: boolean;
|
|
10
|
+
isAutoplay: boolean;
|
|
11
|
+
slotId: number;
|
|
12
|
+
params?: AdsParams;
|
|
13
|
+
duration: number;
|
|
14
|
+
previewParam?: number;
|
|
15
|
+
adsContainer: HTMLElement;
|
|
16
|
+
adsVideoElement: HTMLVideoElement;
|
|
17
|
+
paramsOverride?: AdsParams;
|
|
18
|
+
externalApi?: IAdmanInitParamsExternalApi;
|
|
19
|
+
json?: Record<string, unknown>;
|
|
20
|
+
};
|
package/types/types/index.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ import type { Key } from "../translation/types";
|
|
|
12
12
|
import type { IUIStatistics } from "../services/statistics";
|
|
13
13
|
import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem } from "../components/Menus/subMenuTabs/types";
|
|
14
14
|
import type { AdditionalDesktopControlPanelButton } from "../components/Controls/types";
|
|
15
|
-
import type { AdmanInitParams } from "
|
|
15
|
+
import type { AdmanInitParams } from "./ads";
|
|
16
|
+
export type { AdmanInitParams, AdsParams, IAdmanInitParamsExternalApi } from "./ads";
|
|
16
17
|
export declare const enum UIType {
|
|
17
18
|
DESKTOP = "desktop",
|
|
18
19
|
MOBILE = "mobile"
|
|
@@ -87,6 +88,7 @@ export interface IVKVideoPlayerCallbacks {
|
|
|
87
88
|
onExternalFullscreenExit?: () => void;
|
|
88
89
|
onPrevVideoClick?: () => boolean;
|
|
89
90
|
onNextVideoClick?: () => boolean;
|
|
91
|
+
onNextVideoRequired?: () => boolean;
|
|
90
92
|
onNextVideoAnnouncementShow?: () => void;
|
|
91
93
|
onNextVideoAnnouncementClick?: () => void;
|
|
92
94
|
onNextVideoAnnouncementAuto?: () => void;
|
|
@@ -322,6 +324,10 @@ export interface IVKVideoPlayerConfig {
|
|
|
322
324
|
mediascopePixels?: MediascopePixelTypes.Pixel[];
|
|
323
325
|
getVideoDeeplink?: (timestamp: number) => string;
|
|
324
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Поля, которые можно обновить, сохранив итстанс плеера
|
|
329
|
+
*/
|
|
330
|
+
export type IUpdatableVKVideoPlayerConfig = Pick<Omit<IVKVideoPlayerConfig, "callbacks" | "interactiveData">, "adsSlotId" | "adsParams" | "albumId" | "canDownload" | "canRewindLive" | "failoverHosts" | "fromTime" | "isAudioDisabled" | "mediascopePixels" | "loop" | "muted" | "repeat" | "preload" | "showAutoplayNext" | "showNextPrevButtons" | "statTrackCode" | "videos" | "videoIndex" | "volumeMultiplier">;
|
|
325
331
|
export interface IControlInfo {
|
|
326
332
|
left: number;
|
|
327
333
|
right: number;
|
|
@@ -630,9 +636,9 @@ export interface IMicroStores {
|
|
|
630
636
|
export interface InitMicroStoreParams {
|
|
631
637
|
store: IStore;
|
|
632
638
|
microStores: IMicroStores;
|
|
633
|
-
config: IVKVideoPlayerConfig;
|
|
634
639
|
uiConfig: IUIConfig;
|
|
635
640
|
interactiveController?: Interactives;
|
|
641
|
+
interactiveData?: IInteractiveData;
|
|
636
642
|
}
|
|
637
643
|
export interface IMicroStore<StateName extends keyof IMicroStores = keyof IMicroStores> {
|
|
638
644
|
readonly stateName: StateName;
|
|
@@ -659,4 +665,3 @@ export declare enum PlaybackStateExtended {
|
|
|
659
665
|
BUFFERING = "buffering"
|
|
660
666
|
}
|
|
661
667
|
export type PlaybackStateRealistic = PlaybackState | PlaybackStateExtended;
|
|
662
|
-
export {};
|