@vkontakte/videoplayer 1.1.37-dev.aaebf6d2.0 → 1.1.38-beta.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 +17 -17
- package/es2015.esm.js +17 -17
- package/es2018.cjs.js +17 -17
- package/es2018.esm.js +17 -17
- package/esnext.cjs.js +17 -17
- package/esnext.esm.js +17 -17
- package/evergreen.esm.js +17 -17
- package/package.json +11 -11
- package/types/VKVideoPlayer/index.d.ts +86 -0
- package/types/components/Ads/admanWrapper.d.ts +82 -0
- package/types/components/Ads/utils.d.ts +1 -0
- package/types/config.d.ts +118 -0
- package/types/constans/controls.d.ts +27 -0
- package/types/constans/debounce-timers.d.ts +1 -0
- package/types/constans/grid.d.ts +14 -0
- package/types/constans/index.d.ts +8 -0
- package/types/constans/interactives.d.ts +7 -0
- package/types/constans/keyboard.d.ts +51 -0
- package/types/constans/lang.d.ts +2 -0
- package/types/constans/storage-keys.d.ts +1 -0
- package/types/constans/throttle-timers.d.ts +1 -0
- package/types/env.d.ts +2 -0
- package/types/index.d.ts +12 -0
- package/types/services/sentry.d.ts +28 -0
- package/types/services/statistics.d.ts +13 -0
- package/types/store/index.d.ts +277 -0
- package/types/store/micro/base.d.ts +8 -0
- package/types/store/micro/fakeIsPlaying.d.ts +13 -0
- package/types/store/micro/index.d.ts +2 -0
- package/types/store/micro/interactiveControlsOpacity.d.ts +13 -0
- package/types/store/micro/seekToInteractiveDisabledTooltip.d.ts +9 -0
- package/types/store/micro/showInteractiveTimeIndicatorTooltip.d.ts +15 -0
- package/types/store/utils.d.ts +30 -0
- package/types/translation/index.d.ts +6 -0
- package/types/translation/packs/en.d.ts +3 -0
- package/types/translation/packs/ru.d.ts +3 -0
- package/types/translation/types.d.ts +8 -0
- package/types/types/index.d.ts +467 -0
- package/types/utils/WebVttParser.d.ts +19 -0
- package/types/utils/changeVolume.d.ts +6 -0
- package/types/utils/clipboard.d.ts +1 -0
- package/types/utils/dom.d.ts +2 -0
- package/types/utils/fetchFile.d.ts +1 -0
- package/types/utils/findCurrentSubtltlePhrase.d.ts +2 -0
- package/types/utils/formatSeconds.d.ts +1 -0
- package/types/utils/fullscreen.d.ts +24 -0
- package/types/utils/getActualEpisode.d.ts +10 -0
- package/types/utils/getHotKeyMapData.d.ts +2 -0
- package/types/utils/getQualityLabel.d.ts +2 -0
- package/types/utils/grid.d.ts +6 -0
- package/types/utils/isIphoneOrOldIpad.d.ts +2 -0
- package/types/utils/keyboardHandleCases.d.ts +2 -0
- package/types/utils/menuNavigation.d.ts +13 -0
- package/types/utils/roundFps.d.ts +1 -0
- package/types/utils/sanitizeHtml.d.ts +5 -0
- package/types/utils/stack/index.d.ts +9 -0
- package/types/utils/stack/node.d.ts +5 -0
- package/types/utils/subtitleLanguages.d.ts +1 -0
- package/types/utils/updatePlayerControlsInfo.d.ts +3 -0
- package/types/utils/userSettings.d.ts +13 -0
- package/types/utils/videoConfig.d.ts +2 -0
- package/types/utils/volumeChange.d.ts +5 -0
- package/types/utils/webAPI/annotationsApi/annotationsApi.d.ts +29 -0
- package/types/utils/webAPI/annotationsApi/errors.d.ts +7 -0
- package/types/utils/webAPI/language.d.ts +2 -0
- package/types/utils/webAPI/mediaSessionApi.d.ts +8 -0
- package/types/utils/webAPI/pictureInPictureApi/documentPictureInPictureApi.d.ts +23 -0
- package/types/utils/webAPI/pictureInPictureApi/pictureInPictureApi.d.ts +38 -0
- package/types/utils/webAPI/pictureInPictureApi/pictureInPictureApiFactory.d.ts +4 -0
- package/index.d.ts +0 -477
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import type { VideoQuality, VideoFormat, ISources, IExternalTextTrack } from '@vkontakte/videoplayer-core';
|
|
2
|
+
import type { IValueObservable, InterfaceLanguage, Subscription } from '@vkontakte/videoplayer-shared';
|
|
3
|
+
import type { Manifest, VideoInfo } from '@vkontakte/videoplayer-interactive';
|
|
4
|
+
import { PlaybackState } from '@vkontakte/videoplayer-core';
|
|
5
|
+
import type { Writable, Readable } from 'svelte/store';
|
|
6
|
+
import type { ISDKConfig } from '../config';
|
|
7
|
+
import type { IStore } from '../store';
|
|
8
|
+
import { Controls, GridTypes, type SeekToInteractiveDisabledTooltipKey } from '../constans';
|
|
9
|
+
import type { Key } from '../translation/types';
|
|
10
|
+
import type { IUIStatistics } from '../services/statistics';
|
|
11
|
+
import { UISentry } from '../services/sentry';
|
|
12
|
+
export declare const enum AdditionalVideoQuality {
|
|
13
|
+
AUTO = "auto"
|
|
14
|
+
}
|
|
15
|
+
export type VideoQualityUI = VideoQuality | AdditionalVideoQuality;
|
|
16
|
+
export interface IVKVideoPlayerCallbacks {
|
|
17
|
+
onInited?: () => void;
|
|
18
|
+
onStarted?: () => void;
|
|
19
|
+
onEnded?: () => void;
|
|
20
|
+
onPlay?: () => void;
|
|
21
|
+
onPause?: () => void;
|
|
22
|
+
onVolumeChange?: (volume: number) => void;
|
|
23
|
+
onFullscreenEnter?: () => void;
|
|
24
|
+
onFullscreenExit?: () => void;
|
|
25
|
+
onMute?: () => void;
|
|
26
|
+
onUnmute?: () => void;
|
|
27
|
+
onAudioDisabledHint?: () => void;
|
|
28
|
+
onAudioDoesNotExistHint?: () => void;
|
|
29
|
+
onEpisodeClicked?: (byKeyboard: boolean) => void;
|
|
30
|
+
onEpisodeChanged?: (episode: IVideoEpisode) => void;
|
|
31
|
+
onTimeupdate?: (duration: number, position: number) => void;
|
|
32
|
+
onSeek?: (from: number, to: number) => void;
|
|
33
|
+
onCrashed?: () => void;
|
|
34
|
+
onCurrentFormatChanged?: (currentFormat: VideoFormat | undefined) => void;
|
|
35
|
+
onThroughputEstimationChanged?: (throughputEstimation: number | undefined) => void;
|
|
36
|
+
onVideoBitrateChanged?: (videoBitrate: number | undefined) => void;
|
|
37
|
+
onPlayerPhaseChanged?: (value?: PlayerPhase) => void;
|
|
38
|
+
onPlaybackStateChanged?: (value?: PlaybackState) => void;
|
|
39
|
+
onIsLiveChanged?: (value?: boolean) => void;
|
|
40
|
+
onIsActiveLiveChanged?: (value?: boolean) => void;
|
|
41
|
+
onIsAudioAvailableChanged?: (value?: boolean) => void;
|
|
42
|
+
onCopyVideoLink?: (withTimestamp: boolean, currentTimestamp: number) => string;
|
|
43
|
+
onOpenHotKeyMap?: (mapData: HotKeyMapData) => void;
|
|
44
|
+
onCurrentQualityChanged?: (currentQuality: VideoQuality | undefined) => void;
|
|
45
|
+
onAvailableQualitiesChanged?: (availableQualities: VideoQuality[]) => void;
|
|
46
|
+
onPiPEnter?: () => void;
|
|
47
|
+
onPiPExit?: () => void;
|
|
48
|
+
onLiveTime?: (liveTime: number | undefined) => void;
|
|
49
|
+
onReplayInteractiveVideo?: () => void;
|
|
50
|
+
onInteractiveHistoryChanged?: (chapterIds: string[]) => void;
|
|
51
|
+
onDisabledInteractiveClick?: () => void;
|
|
52
|
+
onDisabledPlayPrevChapterClick?: (message: string | undefined) => void;
|
|
53
|
+
onDisabledSeekToInteractiveClick?: (message: string | undefined) => void;
|
|
54
|
+
onInteractiveTimeIndicatorClick?: () => void;
|
|
55
|
+
onInteractiveTimeIndicatorHintDeactivated?: () => void;
|
|
56
|
+
onPrevVideoClick?: () => boolean;
|
|
57
|
+
onNextVideoClick?: () => boolean;
|
|
58
|
+
onTrafficSavingEnabledChanged?: (isEnabled: boolean) => void;
|
|
59
|
+
onCurrentPlaybackRateChanged?: (rate: number) => void;
|
|
60
|
+
onStalledChanged?: (isStalled: boolean) => void;
|
|
61
|
+
onLogoClicked?: () => void;
|
|
62
|
+
uiInfo?: {
|
|
63
|
+
onControlsVisibleChanged?: (value?: boolean) => void;
|
|
64
|
+
onIsMobileChanged?: (value?: boolean) => void;
|
|
65
|
+
onPrevButtonChanged?: (value?: IControlInfo) => void;
|
|
66
|
+
onPlayButtonChanged?: (value?: IControlInfo) => void;
|
|
67
|
+
onReplayButtonChanged?: (value?: IControlInfo) => void;
|
|
68
|
+
onNextButtonChanged?: (value?: IControlInfo) => void;
|
|
69
|
+
onPlayPrevChapterChanged?: (value?: IControlInfo) => void;
|
|
70
|
+
onSeekToInteractiveButtonChanged?: (value?: IControlInfo) => void;
|
|
71
|
+
onGraphButtonChanged?: (value?: IControlInfo) => void;
|
|
72
|
+
onLiveButtonChanged?: (value?: IControlInfo) => void;
|
|
73
|
+
onTimeUpdateChanged?: (value?: IControlInfo) => void;
|
|
74
|
+
onEpisodesChanged?: (value?: IControlInfo) => void;
|
|
75
|
+
onVolumeChanged?: (value?: IControlInfo) => void;
|
|
76
|
+
onSubtitlesChanged?: (value?: IControlInfo) => void;
|
|
77
|
+
onSettingsChanged?: (value?: IControlInfo) => void;
|
|
78
|
+
onFullscreenChanged?: (value?: IControlInfo) => void;
|
|
79
|
+
onChromecastChanged?: (value?: IControlInfo) => void;
|
|
80
|
+
onPipChanged?: (value?: IControlInfo) => void;
|
|
81
|
+
onVkLogoChanged?: (value?: IControlInfo) => void;
|
|
82
|
+
onInteractiveTimeIndicatorChanged?: (value?: IControlInfo) => void;
|
|
83
|
+
onPlayerSizeChanged?: (value?: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
}) => void;
|
|
87
|
+
};
|
|
88
|
+
adsInfo?: {
|
|
89
|
+
onStarted?: () => void;
|
|
90
|
+
onCompleted?: () => void;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface IVKVideoPlayerUICallbacks {
|
|
94
|
+
onStarted?: (isMuted: boolean) => void;
|
|
95
|
+
}
|
|
96
|
+
export interface IVKVideoPlayerStatistics extends Partial<IUIStatistics> {
|
|
97
|
+
config: ISDKConfig['statistics'];
|
|
98
|
+
}
|
|
99
|
+
export interface IVKVideoPlayerSentry extends Partial<UISentry> {
|
|
100
|
+
config: ISDKConfig['ui']['sentry'];
|
|
101
|
+
}
|
|
102
|
+
export type AdsParams = Record<string, unknown>;
|
|
103
|
+
export interface IVideoEpisodesNormalizedTimeline {
|
|
104
|
+
from: number;
|
|
105
|
+
width: number;
|
|
106
|
+
loadedWidth: number;
|
|
107
|
+
filledWidth: number;
|
|
108
|
+
interactive?: boolean;
|
|
109
|
+
completed?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface IVideoEpisode {
|
|
112
|
+
time: number;
|
|
113
|
+
text: string;
|
|
114
|
+
interactive?: boolean;
|
|
115
|
+
completed?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface ITimelinePreviewThumbsData {
|
|
118
|
+
countPerImage: number;
|
|
119
|
+
countPerRow: number;
|
|
120
|
+
countTotal: number;
|
|
121
|
+
frameHeight: number;
|
|
122
|
+
frameWidth: number;
|
|
123
|
+
frequency: number;
|
|
124
|
+
isUV: boolean;
|
|
125
|
+
links: string[];
|
|
126
|
+
}
|
|
127
|
+
export interface IVideoLive {
|
|
128
|
+
status: 'started' | 'upcoming' | 'waiting' | 'finished' | 'postlive' | 'failed';
|
|
129
|
+
startTime?: number;
|
|
130
|
+
}
|
|
131
|
+
export interface IVideoDataBase {
|
|
132
|
+
title: string;
|
|
133
|
+
thumbUrl?: string;
|
|
134
|
+
unitedVideoId?: number;
|
|
135
|
+
duration: number;
|
|
136
|
+
adsParams?: AdsParams;
|
|
137
|
+
videoEpisodes?: IVideoEpisode[];
|
|
138
|
+
previewThumbsData?: ITimelinePreviewThumbsData;
|
|
139
|
+
isClip?: boolean;
|
|
140
|
+
subtitles?: Array<Omit<IExternalTextTrack, 'type'>>;
|
|
141
|
+
}
|
|
142
|
+
export interface IVideoDataWithSources extends IVideoDataBase {
|
|
143
|
+
sources: ISources;
|
|
144
|
+
live?: never;
|
|
145
|
+
}
|
|
146
|
+
export interface IVideoDataWithLive extends IVideoDataBase {
|
|
147
|
+
live: IVideoLive;
|
|
148
|
+
sources?: never;
|
|
149
|
+
}
|
|
150
|
+
export type IVideoData = IVideoDataWithSources | IVideoDataWithLive;
|
|
151
|
+
export interface IInteractiveData {
|
|
152
|
+
manifest: string | Manifest;
|
|
153
|
+
initChapterId?: string;
|
|
154
|
+
visitedChapters?: string[];
|
|
155
|
+
videosInfo?: VideoInfo[];
|
|
156
|
+
videoLoader?: (owner_id: string, video_id: string) => Promise<IVKVideoPlayerConfig>;
|
|
157
|
+
historyApi: {
|
|
158
|
+
get: (videoId: string) => Promise<number[]>;
|
|
159
|
+
save: (videoId: string, videoIds: number[]) => Promise<void>;
|
|
160
|
+
};
|
|
161
|
+
projectInfo?: {
|
|
162
|
+
pid: string;
|
|
163
|
+
title: string;
|
|
164
|
+
videoId: string;
|
|
165
|
+
variantPayloadType: string;
|
|
166
|
+
};
|
|
167
|
+
tooltipHelpHintActive?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface AdditionalButton {
|
|
170
|
+
iconUrl: string;
|
|
171
|
+
onClick?: (event?: MouseEvent) => void;
|
|
172
|
+
tooltip?: string;
|
|
173
|
+
ariaLabel?: string;
|
|
174
|
+
testId?: string;
|
|
175
|
+
hideOnDesktopGridTypes?: GridTypes[];
|
|
176
|
+
hideOnMobile?: boolean;
|
|
177
|
+
}
|
|
178
|
+
export interface IVKVideoPlayerConfig {
|
|
179
|
+
videos: IVideoData[];
|
|
180
|
+
interactiveData?: IInteractiveData;
|
|
181
|
+
albumId?: string;
|
|
182
|
+
statPlace?: 'embed' | 'direct' | string;
|
|
183
|
+
statAuthToken?: string;
|
|
184
|
+
statUserSalt?: string;
|
|
185
|
+
statTrackCode?: string;
|
|
186
|
+
refreshStatAuthToken?: () => Promise<string | undefined>;
|
|
187
|
+
preload?: boolean;
|
|
188
|
+
autoplay?: boolean;
|
|
189
|
+
repeat?: boolean;
|
|
190
|
+
volume?: number;
|
|
191
|
+
muted?: boolean;
|
|
192
|
+
fromTime?: number;
|
|
193
|
+
canRewindLive?: boolean;
|
|
194
|
+
supportLink?: string;
|
|
195
|
+
showAds?: boolean;
|
|
196
|
+
adsSlotId?: number;
|
|
197
|
+
adsParams?: AdsParams;
|
|
198
|
+
adsPreviewParam?: number;
|
|
199
|
+
interfaceLanguage?: InterfaceLanguage | string;
|
|
200
|
+
logoClickable?: boolean;
|
|
201
|
+
logoHidden?: boolean;
|
|
202
|
+
isMobile?: boolean;
|
|
203
|
+
/** @deprecated */
|
|
204
|
+
isMediaSessionEnabled?: boolean;
|
|
205
|
+
/** @deprecated */
|
|
206
|
+
isPictureInPictureEnabled?: boolean;
|
|
207
|
+
isAudioDisabled?: boolean;
|
|
208
|
+
isLiveCatchUpMode?: boolean;
|
|
209
|
+
canDownload?: boolean;
|
|
210
|
+
fullScreenTarget?: HTMLElement;
|
|
211
|
+
failoverHosts?: string[];
|
|
212
|
+
showThumbTimer?: boolean;
|
|
213
|
+
is3DVideo?: boolean;
|
|
214
|
+
callbacks?: IVKVideoPlayerCallbacks;
|
|
215
|
+
additionalButtons?: AdditionalButton[];
|
|
216
|
+
refDomain?: string;
|
|
217
|
+
volumeMultiplier?: number;
|
|
218
|
+
saveRate?: boolean;
|
|
219
|
+
}
|
|
220
|
+
export interface IControlInfo {
|
|
221
|
+
/** @deprecated Используйте новое поле left */
|
|
222
|
+
positionStartX: number;
|
|
223
|
+
/** @deprecated Используйте новое поле right */
|
|
224
|
+
positionEndX: number;
|
|
225
|
+
left: number;
|
|
226
|
+
right: number;
|
|
227
|
+
top: number;
|
|
228
|
+
bottom: number;
|
|
229
|
+
isDisplayed: boolean;
|
|
230
|
+
}
|
|
231
|
+
export interface IPlayerControlsRef {
|
|
232
|
+
prevButton?: HTMLElement;
|
|
233
|
+
playButton?: HTMLElement;
|
|
234
|
+
replayButton?: HTMLElement;
|
|
235
|
+
nextButton?: HTMLElement;
|
|
236
|
+
playPrevChapterButton?: HTMLElement;
|
|
237
|
+
seekToInteractiveButton?: HTMLElement;
|
|
238
|
+
interactiveGraphButton?: HTMLElement;
|
|
239
|
+
liveButton?: HTMLElement;
|
|
240
|
+
time?: HTMLElement;
|
|
241
|
+
episodes?: HTMLElement;
|
|
242
|
+
volume?: HTMLElement;
|
|
243
|
+
subtitles?: HTMLElement;
|
|
244
|
+
settings?: HTMLElement;
|
|
245
|
+
context?: HTMLElement;
|
|
246
|
+
fullscreen?: HTMLElement;
|
|
247
|
+
chromecast?: HTMLElement;
|
|
248
|
+
pip?: HTMLElement;
|
|
249
|
+
vkLogo?: HTMLElement;
|
|
250
|
+
interactiveTimeIndicator?: HTMLElement;
|
|
251
|
+
}
|
|
252
|
+
export interface IPlayerDesktopControlsWidth {
|
|
253
|
+
prevButton: number;
|
|
254
|
+
playButton: number;
|
|
255
|
+
replayButton: number;
|
|
256
|
+
nextButton: number;
|
|
257
|
+
playPrevChapterButton: number;
|
|
258
|
+
seekToInteractiveButton: number;
|
|
259
|
+
interactiveGraphButton: number;
|
|
260
|
+
liveButton: number;
|
|
261
|
+
time: number;
|
|
262
|
+
episodes: number;
|
|
263
|
+
volume: number;
|
|
264
|
+
subtitles: number;
|
|
265
|
+
settings: number;
|
|
266
|
+
context: number;
|
|
267
|
+
fullscreen: number;
|
|
268
|
+
chromecast: number;
|
|
269
|
+
vkLogo: number;
|
|
270
|
+
additionalButtons: number[];
|
|
271
|
+
}
|
|
272
|
+
export declare const enum PlayerPhase {
|
|
273
|
+
Thumb = "thumb",
|
|
274
|
+
Video = "video",
|
|
275
|
+
Ads = "ads",
|
|
276
|
+
Crashed = "crashed",
|
|
277
|
+
WaitingLive = "waitingLive",
|
|
278
|
+
WaitingRecord = "waitingRecord"
|
|
279
|
+
}
|
|
280
|
+
export declare const enum AdsSection {
|
|
281
|
+
Preroll = "preroll",
|
|
282
|
+
Midroll = "midroll",
|
|
283
|
+
Postroll = "postroll"
|
|
284
|
+
}
|
|
285
|
+
export declare const enum AdsPlaybackState {
|
|
286
|
+
INACTIVE = "inactive",
|
|
287
|
+
PLAYING = "playing",
|
|
288
|
+
PAUSED = "paused"
|
|
289
|
+
}
|
|
290
|
+
export type VideoQualityForRender = {
|
|
291
|
+
value: VideoQualityUI;
|
|
292
|
+
displayValue: string;
|
|
293
|
+
selected: boolean;
|
|
294
|
+
};
|
|
295
|
+
export type VideoPlaybackRate = {
|
|
296
|
+
value: number;
|
|
297
|
+
displayValue: string;
|
|
298
|
+
selected: boolean;
|
|
299
|
+
};
|
|
300
|
+
export type MediaSessionApiMetadata = {
|
|
301
|
+
title: string;
|
|
302
|
+
artist?: string;
|
|
303
|
+
thumbUrl?: string;
|
|
304
|
+
};
|
|
305
|
+
export type MediaSessionApiActionHandler = [MediaSessionAction, MediaSessionActionHandler];
|
|
306
|
+
export interface PictureInPictureResizeEvent extends Event {
|
|
307
|
+
target: PictureInPictureWindow;
|
|
308
|
+
}
|
|
309
|
+
export interface DocumentPictureInPictureRequestWindow {
|
|
310
|
+
width?: number;
|
|
311
|
+
height?: number;
|
|
312
|
+
initialAspectRatio?: number;
|
|
313
|
+
copyStyleSheets: boolean;
|
|
314
|
+
}
|
|
315
|
+
export interface DocumentPictureInPicture {
|
|
316
|
+
onenter?: (event: Event) => void;
|
|
317
|
+
window: Window;
|
|
318
|
+
requestWindow: (params: DocumentPictureInPictureRequestWindow) => Promise<Window>;
|
|
319
|
+
}
|
|
320
|
+
export declare enum PictureInPictureType {
|
|
321
|
+
PictureInPicture = 0,
|
|
322
|
+
DocumentPictureInPicture = 1
|
|
323
|
+
}
|
|
324
|
+
export interface IPictureInPictureApiInfo {
|
|
325
|
+
isActive$: IValueObservable<boolean>;
|
|
326
|
+
type: PictureInPictureType;
|
|
327
|
+
}
|
|
328
|
+
export interface IPictureInPictureApi {
|
|
329
|
+
isSupported: () => boolean;
|
|
330
|
+
isActive: () => boolean;
|
|
331
|
+
setContext: (svelteContext: Map<unknown, unknown>) => void;
|
|
332
|
+
request: () => Promise<void>;
|
|
333
|
+
remove: () => Promise<void>;
|
|
334
|
+
info: IPictureInPictureApiInfo;
|
|
335
|
+
dispose: () => Promise<void>;
|
|
336
|
+
}
|
|
337
|
+
export interface IAnnotationsApi {
|
|
338
|
+
/** @deprecated Больше не используется. Контейнер теперь определяется самостоятельно */
|
|
339
|
+
registryRootContainer: (container: HTMLElement) => void;
|
|
340
|
+
/** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
|
|
341
|
+
addLayer: (layerName: string) => HTMLElement | never;
|
|
342
|
+
/** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
|
|
343
|
+
getLayer: (layerName: string) => HTMLElement | undefined;
|
|
344
|
+
/** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
|
|
345
|
+
removeLayer: (layerName: string) => void;
|
|
346
|
+
/** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
|
|
347
|
+
clearLayer: (layerName: string) => void;
|
|
348
|
+
/** @deprecated Метод больше не является публичным */
|
|
349
|
+
detach: () => void;
|
|
350
|
+
/** @deprecated Больше нет необходимости переназначать контейнер для аннотаций в ходе работы плеера */
|
|
351
|
+
reattach: () => void;
|
|
352
|
+
add: (annotationName: string, annotation: HTMLElement) => void | never;
|
|
353
|
+
get: (annotationName: string) => HTMLElement | never;
|
|
354
|
+
remove: (annotationName: string) => void | never;
|
|
355
|
+
clear: () => void;
|
|
356
|
+
destroy: () => void;
|
|
357
|
+
}
|
|
358
|
+
export type VideoSubtitle = {
|
|
359
|
+
value: string;
|
|
360
|
+
displayValue: string;
|
|
361
|
+
selected: boolean;
|
|
362
|
+
isAuto?: boolean;
|
|
363
|
+
};
|
|
364
|
+
export type VideoSubtitleParsed = {
|
|
365
|
+
startTime: number;
|
|
366
|
+
endTime: number;
|
|
367
|
+
lang: string;
|
|
368
|
+
texts: ({
|
|
369
|
+
type: 'text';
|
|
370
|
+
value: string;
|
|
371
|
+
} | {
|
|
372
|
+
type: 'timestamp';
|
|
373
|
+
value: number;
|
|
374
|
+
})[];
|
|
375
|
+
};
|
|
376
|
+
export type VideoSubtitlesParsed = {
|
|
377
|
+
lang: string;
|
|
378
|
+
isAuto: boolean;
|
|
379
|
+
subtitles: VideoSubtitleParsed[];
|
|
380
|
+
}[];
|
|
381
|
+
export type ControlsEnumType = keyof typeof Controls;
|
|
382
|
+
export type ControlsKeys = ControlsEnumType[];
|
|
383
|
+
export interface IPlayerPhase extends Readable<PlayerPhase> {
|
|
384
|
+
is: (playerPhase: PlayerPhase) => boolean;
|
|
385
|
+
}
|
|
386
|
+
export interface IDisabledControls extends Writable<Set<ControlsEnumType>> {
|
|
387
|
+
add: (addData: ControlsEnumType | ControlsKeys) => void;
|
|
388
|
+
remove: (removeData: ControlsEnumType | ControlsKeys) => void;
|
|
389
|
+
includes: (includeData: ControlsEnumType | ControlsKeys) => boolean;
|
|
390
|
+
}
|
|
391
|
+
export interface HotKeyMapItem {
|
|
392
|
+
description: string;
|
|
393
|
+
value: string;
|
|
394
|
+
}
|
|
395
|
+
export interface HotKeyMapGroup {
|
|
396
|
+
title: string;
|
|
397
|
+
items: HotKeyMapItem[];
|
|
398
|
+
}
|
|
399
|
+
export interface HotKeyMapData {
|
|
400
|
+
title: string;
|
|
401
|
+
groups: HotKeyMapGroup[];
|
|
402
|
+
closeBtnText: string;
|
|
403
|
+
}
|
|
404
|
+
export declare enum HotKeyHelperType {
|
|
405
|
+
PLAY = "PLAY",
|
|
406
|
+
PAUSE = "PAUSE",
|
|
407
|
+
REPLAY = "REPLAY",
|
|
408
|
+
BACKWARD_SEEK = "BACKWARD_SEEK",
|
|
409
|
+
FORWARD_SEEK = "FORWARD_SEEK",
|
|
410
|
+
SUBTITLES_ON = "SUBTITLES_ON",
|
|
411
|
+
SUBTITLES_OFF = "SUBTITLES_OFF",
|
|
412
|
+
RATE_UP = "RATE_UP",
|
|
413
|
+
RATE_DOWN = "RATE_DOWN",
|
|
414
|
+
EPISODE_PREV = "EPISODE_PREV",
|
|
415
|
+
EPISODE_NEXT = "EPISODE_NEXT",
|
|
416
|
+
MUTE = "MUTE",
|
|
417
|
+
VOLUME = "VOLUME"
|
|
418
|
+
}
|
|
419
|
+
export interface HotKeyHelperData {
|
|
420
|
+
type: HotKeyHelperType;
|
|
421
|
+
text?: string;
|
|
422
|
+
t?: {
|
|
423
|
+
key: Key;
|
|
424
|
+
value?: string;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
export declare enum EpisodesModes {
|
|
428
|
+
FULL = "FULL",
|
|
429
|
+
COUNT = "COUNT",
|
|
430
|
+
SHORT = "SHORT"
|
|
431
|
+
}
|
|
432
|
+
export type IToggleable<T> = T & {
|
|
433
|
+
toggle: () => void;
|
|
434
|
+
};
|
|
435
|
+
type MicroStoreWritableBase<T = unknown> = Writable<T>;
|
|
436
|
+
type ToggleableMicroStore = IToggleable<MicroStoreWritableBase<boolean | null>>;
|
|
437
|
+
export interface IMicroStores {
|
|
438
|
+
fakeIsPlaying$: ToggleableMicroStore;
|
|
439
|
+
interactiveControlsOpacity$: ToggleableMicroStore;
|
|
440
|
+
seekToInteractiveDisabledTooltip$: MicroStoreWritableBase<SeekToInteractiveDisabledTooltipKey>;
|
|
441
|
+
showInteractiveTimeIndicatorTooltip$: MicroStoreWritableBase<boolean> & {
|
|
442
|
+
set: (newValue: boolean, useTimeout: boolean) => void;
|
|
443
|
+
clearTimeout: () => void;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
export interface InitMicroStoreParams {
|
|
447
|
+
store: IStore;
|
|
448
|
+
microStores: IMicroStores;
|
|
449
|
+
config: IVKVideoPlayerConfig;
|
|
450
|
+
}
|
|
451
|
+
export interface IMicroStore<StateName extends keyof IMicroStores = keyof IMicroStores> {
|
|
452
|
+
readonly stateName: StateName;
|
|
453
|
+
state$: IMicroStores[StateName];
|
|
454
|
+
subscription: Subscription;
|
|
455
|
+
init: (initStoreParams: InitMicroStoreParams) => Subscription;
|
|
456
|
+
}
|
|
457
|
+
export type IMicroStoresRoot = {
|
|
458
|
+
subscribers: IMicroStore[];
|
|
459
|
+
stores: IMicroStores;
|
|
460
|
+
};
|
|
461
|
+
export type Position = {
|
|
462
|
+
top?: number;
|
|
463
|
+
left?: number;
|
|
464
|
+
bottom?: number;
|
|
465
|
+
right?: number;
|
|
466
|
+
};
|
|
467
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type ITextCueWebVttParser = ({
|
|
2
|
+
type: 'text';
|
|
3
|
+
value: string;
|
|
4
|
+
} | {
|
|
5
|
+
type: 'timestamp';
|
|
6
|
+
value: number;
|
|
7
|
+
})[];
|
|
8
|
+
interface ICueWebVttParser {
|
|
9
|
+
startTime: number;
|
|
10
|
+
endTime: number;
|
|
11
|
+
lang: string;
|
|
12
|
+
texts: ITextCueWebVttParser;
|
|
13
|
+
}
|
|
14
|
+
declare class WebVttParser {
|
|
15
|
+
private readonly oneLineRegExp;
|
|
16
|
+
private readonly twoLinesRegExp;
|
|
17
|
+
parse(vtt: string): ICueWebVttParser[];
|
|
18
|
+
}
|
|
19
|
+
export default WebVttParser;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isAvailableVolumeChange: ({ isAudioDisabled, audioDisabledHintCallback, isAudioAvailable, audioIsNotExistHintCallback, }: {
|
|
2
|
+
isAudioDisabled: boolean;
|
|
3
|
+
audioDisabledHintCallback?: (() => void) | undefined;
|
|
4
|
+
isAudioAvailable: boolean;
|
|
5
|
+
audioIsNotExistHintCallback?: (() => void) | undefined;
|
|
6
|
+
}) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const copyToClipboard: (text: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchFile: (url: string, filename: string, fileExtension: string) => void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { VideoSubtitle, VideoSubtitleParsed, VideoSubtitlesParsed } from '../types';
|
|
2
|
+
export declare const findCurrentSubtitlePhrase: (position: number, currentSubtitle: Omit<VideoSubtitle, 'selected'>, availableSubtitlesParsed: VideoSubtitlesParsed) => VideoSubtitleParsed | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatSeconds: (inputSeconds: number) => string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface DocumentWithFullscreen extends HTMLDocument {
|
|
2
|
+
mozFullScreenElement?: Element;
|
|
3
|
+
msFullscreenElement?: Element;
|
|
4
|
+
webkitFullscreenElement?: Element;
|
|
5
|
+
msExitFullscreen?: () => Promise<void>;
|
|
6
|
+
mozCancelFullScreen?: () => Promise<void>;
|
|
7
|
+
webkitExitFullscreen?: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
interface DocumentElementWithFullscreen extends HTMLElement {
|
|
10
|
+
msRequestFullscreen?: () => Promise<void>;
|
|
11
|
+
mozRequestFullScreen?: () => Promise<void>;
|
|
12
|
+
webkitRequestFullscreen?: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare const requestFullscreen: (element: DocumentElementWithFullscreen) => Promise<void>;
|
|
15
|
+
export declare const exitFullscreen: (doc: DocumentWithFullscreen) => Promise<void>;
|
|
16
|
+
export declare const exitIosSafariVideoElementFullscreen: (videoElement: HTMLVideoElement) => Promise<void>;
|
|
17
|
+
export declare const checkIsFullscreen: () => boolean;
|
|
18
|
+
export declare const registerFullscreenChangeEvent: (callback: () => void) => void;
|
|
19
|
+
export declare const removeFullscreenChangeEvent: (callback: () => void) => void;
|
|
20
|
+
export declare const requestLockScreenOrientation: (videoSize?: {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}) => Promise<void>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IVideoEpisode } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Функция для получения актуального (текущего) воспроизводимого эпизода
|
|
4
|
+
|
|
5
|
+
* @param progress - вещественное число от 0 до 1. Отображает процент прогрессии видео
|
|
6
|
+
* @param duration - общая продолжительность видеоролика
|
|
7
|
+
* @param videoEpisodes - массив размеченных эпизодов с временными метками
|
|
8
|
+
* @return {IVideoEpisode|undefined} - актуальный эпизод, если он есть, или undefined
|
|
9
|
+
*/
|
|
10
|
+
export declare const getActualEpisode: (progress: number, duration: number, videoEpisodes: IVideoEpisode[]) => IVideoEpisode | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GridTypes } from '../constans';
|
|
2
|
+
export declare const isHigher: (a: GridTypes, b: GridTypes) => boolean;
|
|
3
|
+
export declare const isHigherOrEqual: (a: GridTypes, b: GridTypes) => boolean;
|
|
4
|
+
export declare const isLower: (a: GridTypes, b: GridTypes) => boolean;
|
|
5
|
+
export declare const isLowerOrEqual: (a: GridTypes, b: GridTypes) => boolean;
|
|
6
|
+
export declare const getGridTypeByWidth: (width: number) => GridTypes;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Writable } from 'svelte/store';
|
|
2
|
+
import type { Position } from '../types';
|
|
3
|
+
export declare const isKeyboardHandleCase: (event?: MouseEvent) => boolean;
|
|
4
|
+
export declare const handleFocusReturnToBtn: (ref: HTMLButtonElement, menuVisible: boolean, openedByKeyboard$: Writable<boolean>) => Promise<void>;
|
|
5
|
+
export declare const handleFocusReturnToElem: (ref: HTMLButtonElement, menuVisible: boolean, openedByKeyboard$: Writable<boolean>) => Promise<void>;
|
|
6
|
+
export declare const handleFocusOnMenu: (ref: HTMLUListElement, menuVisible: boolean, isOpenedByKeyboard: boolean) => Promise<void>;
|
|
7
|
+
export declare const returnFocusToMenuItem: (ref: HTMLLIElement, returnCase: Writable<boolean>, isReturnCase: boolean) => Promise<void>;
|
|
8
|
+
export declare const handleKeyDownMainMenu: (event: KeyboardEvent, closeCallback: () => void) => void;
|
|
9
|
+
export declare const handleKeyDownOpenSubMenuItem: (event: KeyboardEvent, openSubmenuFn: () => void, getSubItemFn: () => HTMLLIElement) => Promise<void>;
|
|
10
|
+
export declare const handleKeyDownSubMenu: (event: KeyboardEvent, backToMainSettingsFn: () => void, mainMenuReturnCase: Writable<boolean>, closeSettingsMenuFn: () => void) => Promise<void>;
|
|
11
|
+
export declare const handleChoseMenuItem: (event: KeyboardEvent, selectFn: () => void) => void;
|
|
12
|
+
export declare const getContextMenuPositionByButton: (btnRef: HTMLButtonElement) => Position;
|
|
13
|
+
export declare const getContextMenuPositionByHotKey: (overlayRef: HTMLDivElement | undefined) => Position;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const roundFps: (fps: number) => "" | 50 | 60 | 120 | 240;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const subtitleLanguages: Record<string, string>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IPlayerControlsRef } from '../types';
|
|
2
|
+
import { type IUIState } from '../store';
|
|
3
|
+
export declare const updatePlayerControlsInfo: (videoElement: HTMLVideoElement | null, controls: IUIState['controls'], controlsRef: IPlayerControlsRef, showControls: boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VideoQuality } from '@vkontakte/videoplayer-shared';
|
|
2
|
+
import { type PlaybackRate } from '@vkontakte/videoplayer-core';
|
|
3
|
+
export declare const savePreferredVolume: (volume: number) => void;
|
|
4
|
+
export declare const getPreferredVolume: () => number | undefined;
|
|
5
|
+
export declare const savePreferredQuality: (videoId: number | undefined, value: VideoQuality) => void;
|
|
6
|
+
export declare const deletePreferredQuality: () => void;
|
|
7
|
+
export declare const getPreferredQuality: (currentVideoId: number | undefined) => VideoQuality | undefined;
|
|
8
|
+
export declare const savePreferMute: (preferMute: boolean) => void;
|
|
9
|
+
export declare const getPreferMute: () => boolean;
|
|
10
|
+
export declare const savePreferTrafficSavingEnabled: (trafficSavingEnabled: boolean) => void;
|
|
11
|
+
export declare const getPreferTrafficSavingEnabled: () => boolean;
|
|
12
|
+
export declare const savePreferredRate: (rate: PlaybackRate) => void;
|
|
13
|
+
export declare const getPreferredRate: () => PlaybackRate | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { IVKVideoPlayerConfig } from '../types';
|
|
2
|
+
export declare function overrideVideoConfig<Base extends Partial<IVKVideoPlayerConfig>, Override extends Partial<IVKVideoPlayerConfig>, Key extends keyof Partial<IVKVideoPlayerConfig>>(base: Base, override: Override): Base & Override;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IStore } from '../store';
|
|
2
|
+
export declare const getNextVolumeUp: (currentVolume: number, step: number) => number;
|
|
3
|
+
export declare const getNextVolumeDown: (currentVolume: number, step: number) => number;
|
|
4
|
+
export declare const volumeDiscreteChangeUp: (store: IStore, currentVolume: number, step: number) => void;
|
|
5
|
+
export declare const volumeDiscreteChangeDown: (store: IStore, currentVolume: number, step: number) => void;
|