@vkontakte/videoplayer 1.0.9 → 1.0.95-dev.e4134bc49.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.
Files changed (180) hide show
  1. package/es2015.cjs +20 -0
  2. package/es2015.esm.js +18 -4
  3. package/esnext.cjs +20 -0
  4. package/esnext.esm.js +18 -4
  5. package/evergreen.esm.js +20 -0
  6. package/package.json +38 -9
  7. package/types/VKVideoPlayer/HTMLElement.d.ts +2 -0
  8. package/types/VKVideoPlayer/defaultConfig.d.ts +5 -0
  9. package/types/VKVideoPlayer/index.svelte.d.ts +211 -0
  10. package/types/components/Ads/admanWrapper.d.ts +84 -0
  11. package/types/components/Ads/types.d.ts +20 -0
  12. package/types/components/Ads/utils.d.ts +6 -0
  13. package/types/components/Controls/contants/desktopButtonsLeftIds.d.ts +10 -0
  14. package/types/components/Controls/contants/desktopButtonsLeftWeights.d.ts +2 -0
  15. package/types/components/Controls/contants/desktopButtonsRightIds.d.ts +11 -0
  16. package/types/components/Controls/contants/desktopButtonsRightWeights.d.ts +2 -0
  17. package/types/components/Controls/types.d.ts +41 -0
  18. package/types/components/Controls/utils/isInnerButtonGuard.d.ts +2 -0
  19. package/types/components/Icons/constants.d.ts +8 -0
  20. package/types/components/Icons/utils.d.ts +2 -0
  21. package/types/components/Menus/constants/contextMenuItemIds.d.ts +11 -0
  22. package/types/components/Menus/constants/contextMenuItemWeights.d.ts +2 -0
  23. package/types/components/Menus/constants/defaultSubMenuMinWidth.d.ts +1 -0
  24. package/types/components/Menus/constants/index.d.ts +4 -0
  25. package/types/components/Menus/constants/openSubMenuItemsIds.d.ts +3 -0
  26. package/types/components/Menus/constants/settingsMenuItemIds.d.ts +11 -0
  27. package/types/components/Menus/constants/settingsMenuItemWeights.d.ts +2 -0
  28. package/types/components/Menus/constants/subMenuIds.d.ts +8 -0
  29. package/types/components/Menus/constants/topOffset.d.ts +1 -0
  30. package/types/components/Menus/subMenuTabs/rootMenuItems.d.ts +33 -0
  31. package/types/components/Menus/subMenuTabs/sharedMenuItems.d.ts +17 -0
  32. package/types/components/Menus/subMenuTabs/subMenuItems.d.ts +7 -0
  33. package/types/components/Menus/subMenuTabs/types.d.ts +151 -0
  34. package/types/components/Menus/subMenuTabs/utils.d.ts +3 -0
  35. package/types/components/Menus/types.d.ts +96 -0
  36. package/types/components/Menus/utils/constants.d.ts +1 -0
  37. package/types/components/Menus/utils/getCurrentQualityDisplayValue.d.ts +21 -0
  38. package/types/components/Menus/utils/getQualityIcon.d.ts +3 -0
  39. package/types/components/Menus/utils/getSubMenusStack.svelte.d.ts +10 -0
  40. package/types/components/Menus/utils/menuNavigation.d.ts +20 -0
  41. package/types/components/Qoe/constants.d.ts +9 -0
  42. package/types/components/Qoe/utils.d.ts +1 -0
  43. package/types/components/Root/types.d.ts +47 -0
  44. package/types/components/Root/utils.d.ts +2 -0
  45. package/types/components/Timeline/PreviewTrack/useTransitionToPreviewTrack.svelte.d.ts +21 -0
  46. package/types/components/Timeline/consts.d.ts +4 -0
  47. package/types/components/Tooltips/TimelinePreview.utils.d.ts +1 -0
  48. package/types/components/shared/interpolateUtils.d.ts +7 -0
  49. package/types/config.d.ts +315 -0
  50. package/types/constans/controls.d.ts +28 -0
  51. package/types/constans/debounce-timers.d.ts +1 -0
  52. package/types/constans/grid.d.ts +14 -0
  53. package/types/constans/index.d.ts +8 -0
  54. package/types/constans/interactives.d.ts +7 -0
  55. package/types/constans/keyboard.d.ts +50 -0
  56. package/types/constans/lang.d.ts +2 -0
  57. package/types/constans/storage-keys.d.ts +1 -0
  58. package/types/constans/subtitles.d.ts +1 -0
  59. package/types/constans/throttle-timers.d.ts +1 -0
  60. package/types/env.d.ts +2 -0
  61. package/types/index.d.ts +16 -68
  62. package/types/services/statistics.d.ts +17 -0
  63. package/types/store/composition.d.ts +32 -0
  64. package/types/store/index.d.ts +7 -0
  65. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.module.d.ts +3 -0
  66. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.store.d.ts +26 -0
  67. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.token.d.ts +3 -0
  68. package/types/store/modules/fakeIsPlayingStore/index.d.ts +3 -0
  69. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.module.d.ts +3 -0
  70. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.store.d.ts +50 -0
  71. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.token.d.ts +3 -0
  72. package/types/store/modules/graphIsOpenedStore/index.d.ts +3 -0
  73. package/types/store/modules/index.d.ts +20 -0
  74. package/types/store/modules/infrastructure/index.d.ts +3 -0
  75. package/types/store/modules/infrastructure/infrastructure.module.d.ts +21 -0
  76. package/types/store/modules/infrastructure/infrastructure.token.d.ts +26 -0
  77. package/types/store/modules/interactiveControlsOpacityStore/index.d.ts +3 -0
  78. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.module.d.ts +3 -0
  79. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.store.d.ts +34 -0
  80. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.token.d.ts +3 -0
  81. package/types/store/modules/notificationsStore/index.d.ts +3 -0
  82. package/types/store/modules/notificationsStore/notificationsStore.module.d.ts +3 -0
  83. package/types/store/modules/notificationsStore/notificationsStore.store.d.ts +34 -0
  84. package/types/store/modules/notificationsStore/notificationsStore.token.d.ts +3 -0
  85. package/types/store/modules/pictureInPictureStore/index.d.ts +3 -0
  86. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.module.d.ts +3 -0
  87. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.store.d.ts +42 -0
  88. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.token.d.ts +3 -0
  89. package/types/store/modules/qoeStore/index.d.ts +3 -0
  90. package/types/store/modules/qoeStore/qoeStore.module.d.ts +3 -0
  91. package/types/store/modules/qoeStore/qoeStore.store.d.ts +4 -0
  92. package/types/store/modules/qoeStore/qoeStore.token.d.ts +3 -0
  93. package/types/store/modules/qoeStore/types.d.ts +24 -0
  94. package/types/store/modules/seekToInteractiveDisabledTooltipStore/index.d.ts +3 -0
  95. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.module.d.ts +3 -0
  96. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.store.d.ts +26 -0
  97. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.token.d.ts +3 -0
  98. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/index.d.ts +3 -0
  99. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.module.d.ts +3 -0
  100. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.store.d.ts +44 -0
  101. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.token.d.ts +3 -0
  102. package/types/store/modules/utils.d.ts +6 -0
  103. package/types/store/types.d.ts +419 -0
  104. package/types/store/utils.d.ts +53 -0
  105. package/types/translation/index.d.ts +6 -0
  106. package/types/translation/labels.d.ts +3 -0
  107. package/types/translation/packs/en.d.ts +3 -0
  108. package/types/translation/packs/ru.d.ts +3 -0
  109. package/types/translation/types.d.ts +8 -0
  110. package/types/types/ads.d.ts +20 -0
  111. package/types/types/index.d.ts +634 -0
  112. package/types/types/qoe.d.ts +59 -0
  113. package/types/types/svg.d.d.ts +5 -0
  114. package/types/types/tmp.d.ts +1 -0
  115. package/types/utils/CaptionsPrepared.d.ts +17 -0
  116. package/types/utils/WebVttParser.d.ts +19 -0
  117. package/types/utils/attachments/defferedDisableByCondition.d.ts +4 -0
  118. package/types/utils/changeVolume.d.ts +9 -0
  119. package/{utils → types/utils}/clipboard.d.ts +1 -1
  120. package/{utils → types/utils}/dom.d.ts +3 -2
  121. package/types/utils/elementHelpers.d.ts +4 -0
  122. package/types/utils/fetchFile.d.ts +1 -0
  123. package/types/utils/findCurrentSubtltlePhrase.d.ts +2 -0
  124. package/{utils → types/utils}/formatSeconds.d.ts +1 -1
  125. package/types/utils/fullscreen.d.ts +29 -0
  126. package/types/utils/getActualEpisode.d.ts +10 -0
  127. package/types/utils/getControlInfo.d.ts +5 -0
  128. package/types/utils/getHotKeyMapData.d.ts +2 -0
  129. package/types/utils/grid.d.ts +6 -0
  130. package/types/utils/hooks/useIosSafariFullscreen.d.ts +6 -0
  131. package/types/utils/hooks/useIosSafariFullscreenSubtitles.d.ts +7 -0
  132. package/types/utils/keyboardHandleCases.d.ts +2 -0
  133. package/types/utils/landscapeUtils.d.ts +1 -0
  134. package/types/utils/notificationShowManager.d.ts +10 -0
  135. package/types/utils/roundFps.d.ts +1 -0
  136. package/types/utils/sanitizeHtml.d.ts +5 -0
  137. package/types/utils/sorts.d.ts +5 -0
  138. package/types/utils/stack/index.d.ts +9 -0
  139. package/types/utils/stack/node.d.ts +5 -0
  140. package/types/utils/subtitleLanguages.d.ts +3 -0
  141. package/types/utils/subtitles.d.ts +10 -0
  142. package/types/utils/timeout.d.ts +4 -0
  143. package/types/utils/updatePlayerControlBlocks.d.ts +3 -0
  144. package/types/utils/updatePlayerControlsInfo.d.ts +3 -0
  145. package/types/utils/userSettings.d.ts +58 -0
  146. package/types/utils/videoConfig.d.ts +6 -0
  147. package/types/utils/volumeChange.d.ts +5 -0
  148. package/types/utils/webAPI/annotationsApi/annotationsApi.d.ts +34 -0
  149. package/types/utils/webAPI/annotationsApi/errors.d.ts +7 -0
  150. package/types/utils/webAPI/focusLock.d.ts +34 -0
  151. package/types/utils/webAPI/focusManager.d.ts +17 -0
  152. package/types/utils/webAPI/language.d.ts +2 -0
  153. package/types/utils/webAPI/mediaSessionApi.d.ts +16 -0
  154. package/types/utils/webAPI/pictureInPictureApi/documentPictureInPictureApi.svelte.d.ts +47 -0
  155. package/types/utils/webAPI/pictureInPictureApi/factory.d.ts +3 -0
  156. package/types/utils/webAPI/pictureInPictureApi/index.d.ts +4 -0
  157. package/types/utils/webAPI/pictureInPictureApi/pictureInPictureApi.d.ts +49 -0
  158. package/types/utils/webAPI/pictureInPictureApi/types.d.ts +6 -0
  159. package/types/utils/webAPI/pictureInPictureApi/utils.d.ts +10 -0
  160. package/types/utils/webAPI/slotsApi.d.ts +53 -0
  161. package/VKVideoPlayer/index.d.ts +0 -38
  162. package/components/Ads/admanWrapper.d.ts +0 -71
  163. package/components/Ads/utils.d.ts +0 -1
  164. package/constans.d.ts +0 -31
  165. package/env.d.ts +0 -3
  166. package/es2015.cjs.js +0 -6
  167. package/es2018.cjs.js +0 -6
  168. package/es2018.esm.js +0 -6
  169. package/esnext.cjs.js +0 -6
  170. package/index.d.ts +0 -6
  171. package/store/index.d.ts +0 -110
  172. package/store/initStatistics.d.ts +0 -5
  173. package/store/utils.d.ts +0 -27
  174. package/utils/fullscreen.d.ts +0 -20
  175. package/utils/isios.d.ts +0 -1
  176. package/utils/roundFps.d.ts +0 -1
  177. package/utils/stack/index.d.ts +0 -9
  178. package/utils/stack/node.d.ts +0 -5
  179. package/utils/storage.d.ts +0 -5
  180. package/utils/volume.d.ts +0 -4
@@ -0,0 +1,17 @@
1
+ import { type IValueSubject } from "@vkontakte/videoplayer-shared";
2
+ import type { Caption, VideoSubtitleParsed } from "../types";
3
+ export declare class CaptionsPrepared {
4
+ private readonly flickeringTimeout;
5
+ private readonly subscriptions;
6
+ private isAuto;
7
+ private isLive;
8
+ private readonly captions$;
9
+ readonly captionsPrepared$: IValueSubject<Caption[][]>;
10
+ subscribe(): this;
11
+ setIsAuto(value: boolean): void;
12
+ setIsLive(value: boolean): void;
13
+ setCaptions(value: VideoSubtitleParsed["texts"]): void;
14
+ destroy(): void;
15
+ private isEnabled;
16
+ private processCaptions;
17
+ }
@@ -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, lang: string): ICueWebVttParser[];
18
+ }
19
+ export default WebVttParser;
@@ -0,0 +1,4 @@
1
+ import type { Attachment } from "svelte/attachments";
2
+ import type { Writable } from "svelte/store";
3
+ import type { Milliseconds } from "@vkontakte/videoplayer-shared";
4
+ export declare const deferredDisableByCondition: (condition: boolean, disable: Writable<boolean>, disableTimeout: Milliseconds) => Attachment;
@@ -0,0 +1,9 @@
1
+ type Params = {
2
+ isAudioDisabled: boolean;
3
+ isAudioAvailable: boolean;
4
+ isAds: boolean;
5
+ audioDisabledHintCallback?: () => void;
6
+ audioIsNotExistHintCallback?: () => void;
7
+ };
8
+ export declare const isAvailableVolumeChange: ({ isAudioDisabled, isAudioAvailable, isAds, audioDisabledHintCallback, audioIsNotExistHintCallback }: Params) => boolean;
9
+ export {};
@@ -1 +1 @@
1
- export declare const copyToClipboard: (text: string) => void;
1
+ export declare const copyToClipboard: (text: string) => void;
@@ -1,2 +1,3 @@
1
- export declare function matchesSelector(el: HTMLElement, selector: string): boolean;
2
- export declare function isHover(el: HTMLElement): boolean;
1
+ export declare function matchesSelector(el: HTMLElement, selector: string): boolean;
2
+ export declare function isHover(el: HTMLElement): boolean;
3
+ export declare function getShadowActiveElement(): Element | null;
@@ -0,0 +1,4 @@
1
+ import type { IRectangle } from "@vkontakte/videoplayer-shared";
2
+ import type { Position } from "../types";
3
+ export declare const calcPosition: (childElement?: HTMLElement, parentElement?: HTMLElement) => Required<Position>;
4
+ export declare const getSize: (element?: HTMLElement) => IRectangle;
@@ -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, isLive?: boolean) => VideoSubtitleParsed | undefined;
@@ -1 +1 @@
1
- export declare const formatSeconds: (inputSeconds: number) => string;
1
+ export declare const formatSeconds: (inputSeconds: number) => string;
@@ -0,0 +1,29 @@
1
+ interface DocumentWithFullscreen extends HTMLDocument {
2
+ msFullscreenElement?: Element;
3
+ msFullscreenEnabled?: boolean;
4
+ msExitFullscreen?: () => Promise<void>;
5
+ mozFullScreenElement?: Element;
6
+ mozFullscreenEnabled?: boolean;
7
+ mozCancelFullScreen?: () => Promise<void>;
8
+ webkitFullscreenElement?: Element;
9
+ webkitFullscreenEnabled?: boolean;
10
+ webkitExitFullscreen?: () => Promise<void>;
11
+ }
12
+ interface DocumentElementWithFullscreen extends HTMLElement {
13
+ msRequestFullscreen?: () => Promise<void>;
14
+ mozRequestFullScreen?: () => Promise<void>;
15
+ webkitRequestFullscreen?: () => Promise<void>;
16
+ }
17
+ export declare const requestFullscreen: (element: DocumentElementWithFullscreen) => Promise<void>;
18
+ export declare const exitFullscreen: (doc: DocumentWithFullscreen) => Promise<void>;
19
+ export declare const isSupported: (doc: DocumentWithFullscreen, isIOS?: boolean) => boolean;
20
+ export declare const exitIosSafariVideoElementFullscreen: (videoElement: HTMLVideoElement) => void;
21
+ export declare const getDocumentFullscreenElement: () => Element | undefined;
22
+ export declare const checkIsFullscreen: () => boolean;
23
+ export declare const registerFullscreenChangeEvent: (callback: () => void) => void;
24
+ export declare const removeFullscreenChangeEvent: (callback: () => void) => void;
25
+ export declare const requestLockScreenOrientation: (videoSize?: {
26
+ width: number;
27
+ height: number;
28
+ }) => Promise<void>;
29
+ 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,5 @@
1
+ import type { IControlInfo } from "../types";
2
+ export declare function getControlInfo<
3
+ TRefKey extends string,
4
+ Refs extends Record<TRefKey, HTMLElement | undefined>
5
+ >(parentElement: HTMLElement | null, refs: Refs, key: TRefKey, show: boolean): IControlInfo;
@@ -0,0 +1,2 @@
1
+ import type { HotKeyMapData } from "../types";
2
+ export declare const getHotKeyMapData: () => HotKeyMapData;
@@ -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,6 @@
1
+ interface Params {
2
+ getFullscreenTarget: () => HTMLElement;
3
+ fullScreenChangeHandler: (forced?: boolean) => void;
4
+ }
5
+ export declare const useIosSafariFullscreen: ({ getFullscreenTarget, fullScreenChangeHandler }: Params) => void;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { IStore } from "../../store";
2
+ interface Params {
3
+ store: IStore;
4
+ getFullscreenTarget: () => HTMLElement;
5
+ }
6
+ export declare const useIosSafariFullscreenSubtitles: ({ store, getFullscreenTarget }: Params) => void;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Writable } from "svelte/store";
2
+ export declare const handleStartedByKeyboard: (startedByKeyboard$: Writable<boolean>, startedByKeyboard: boolean, btnRef: HTMLElement | undefined) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const isVertical: (angle: number) => boolean;
@@ -0,0 +1,10 @@
1
+ type Check = {
2
+ notificationShowed: (notificationId: string) => void;
3
+ canShowNotification: (notificationId: string) => boolean;
4
+ };
5
+ type Settings = {
6
+ timeout: number;
7
+ maxShowCount: number;
8
+ };
9
+ export declare const getNotificationManager: ({ maxShowCount, timeout }: Settings) => Check;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const roundFps: (fps: number) => number | "";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Помогает защитится от XSS атак
3
+ * @param html string
4
+ */
5
+ export declare const sanitizeHtml: (html: string) => string;
@@ -0,0 +1,5 @@
1
+ export declare const sortByWeightAsc: (a: {
2
+ weight: number;
3
+ }, b: {
4
+ weight: number;
5
+ }) => number;
@@ -0,0 +1,9 @@
1
+ export declare class StackFixedSize {
2
+ private top;
3
+ private bottom;
4
+ private size;
5
+ private readonly maxSize;
6
+ constructor(maxSize: number);
7
+ push(value: number): void;
8
+ getValuesFromBottom(): number[];
9
+ }
@@ -0,0 +1,5 @@
1
+ export declare class StackNode {
2
+ value: number;
3
+ next: StackNode | null;
4
+ constructor(value: number);
5
+ }
@@ -0,0 +1,3 @@
1
+ export declare const subtitleLanguages: Record<string, string>;
2
+ export declare const iso3LettersTo2: Record<string, keyof typeof subtitleLanguages>;
3
+ export declare const getLanguageName: (code: string) => string | undefined;
@@ -0,0 +1,10 @@
1
+ import type { ITextTrack } from "@vkontakte/videoplayer-core";
2
+ export declare class NativeSubtitles {
3
+ private readonly video;
4
+ constructor(video: HTMLVideoElement);
5
+ private getTracksArray;
6
+ attach(track: ITextTrack, showing?: boolean): void;
7
+ detachAll(): void;
8
+ updateSrc(track: ITextTrack): void;
9
+ getCurrentShowingId(): string | null;
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare const createTimeout: (delayMs?: number) => {
2
+ add: (fn: VoidFunction) => void;
3
+ clear: () => void;
4
+ };
@@ -0,0 +1,3 @@
1
+ import type { ControlBlocksRefs } from "../types";
2
+ import { type IUIState } from "../store";
3
+ export declare const updateControlBlocks: (videoElement: HTMLVideoElement | null, controlBlocks: IUIState["controlBlocks"], controlBlocskRef: ControlBlocksRefs, showControlBlock: boolean) => void;
@@ -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,58 @@
1
+ import type { 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 getPreferredStreamLanguage: () => string | null;
13
+ export declare const savePreferredStreamLanguage: (language: string) => void;
14
+ export declare const getPreferredSubtitlesLanguage: () => string | null;
15
+ export declare const savePreferredSubtitlesLanguage: (language?: string) => void;
16
+ export declare const savePreferredRate: (rate: PlaybackRate) => void;
17
+ export declare const getPreferredRate: () => PlaybackRate | undefined;
18
+ export declare const savePreferredAutoplayNext: (autoplayNext: boolean) => void;
19
+ export declare const getPreferredAutoplayNext: () => boolean;
20
+ export type PreferredQualitySettingsType = "traffic_saving" | "high_quality" | "auto_quality" | "exact_video";
21
+ export type PreferredQualitySettingsValue = {
22
+ type: Exclude<PreferredQualitySettingsType, "exact_video">;
23
+ videoId?: number;
24
+ } | {
25
+ type: "exact_quality";
26
+ quality: VideoQuality;
27
+ videoId?: number;
28
+ };
29
+ export type DefaultPreferredQualitySettingsValue = Exclude<PreferredQualitySettingsValue, {
30
+ type: "exact_quality";
31
+ }>;
32
+ export type QualitySettingsAppliesTo = "as-default" | "to-video";
33
+ export declare const getPreferredQualitySettings: (videoId: number | undefined) => (PreferredQualitySettingsValue & {
34
+ appliesTo: QualitySettingsAppliesTo;
35
+ }) | null;
36
+ export declare const migrateSettingsToLegacyWay: (videoId?: number) => void;
37
+ export declare const savePreferredQualitySettings: (value: PreferredQualitySettingsValue, appliesTo?: QualitySettingsAppliesTo) => void;
38
+ export declare const savePreferredDefaultQualitySettings: (value: DefaultPreferredQualitySettingsValue) => void;
39
+ export declare const removePreferredQualitySettingsByVideo: () => void;
40
+ export declare const getPreferredDefaultQualitySettings: () => DefaultPreferredQualitySettingsValue | null;
41
+ type IUserSalt = string & {};
42
+ type IVideoId = string & {};
43
+ export interface IVideoPrefs {
44
+ [userSalt: IUserSalt]: IVideoPrefsUser;
45
+ }
46
+ export interface IVideoPrefsUser {
47
+ [videoId: IVideoId]: IVideoPrefsUserVideo;
48
+ }
49
+ export interface IVideoPrefsUserVideo {
50
+ updatedTs: number;
51
+ subtitleTrackId?: string;
52
+ audioTrackId?: string;
53
+ }
54
+ export declare const getUserVideoPrefs: (userSalt: IUserSalt, videoId: IVideoId) => IVideoPrefsUserVideo | null;
55
+ export declare const saveUserVideoPrefs: (userSalt: IUserSalt, videoId: IVideoId, settings: Omit<IVideoPrefsUserVideo, "updatedTs">) => void;
56
+ export declare function markPreviewTrackCloseTooltipAsShown(): void;
57
+ export declare function previewTrackCloseTooltipShown(): boolean;
58
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { IVKVideoPlayerConfig } from "../types";
2
+ export declare function overrideVideoConfig<
3
+ Base extends Partial<IVKVideoPlayerConfig>,
4
+ Override extends Partial<IVKVideoPlayerConfig>,
5
+ Key extends keyof Partial<IVKVideoPlayerConfig>
6
+ >(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;
@@ -0,0 +1,34 @@
1
+ import type { IAnnotationsApi } from "../../../types";
2
+ /**
3
+ * @deprecated Использовать slotsApi.
4
+ */
5
+ export declare class AnnotationsApi implements IAnnotationsApi {
6
+ private annotationsInside;
7
+ private rootAnnotationsContainer;
8
+ private annotations;
9
+ private subscriptions;
10
+ private mutationObserver;
11
+ private playerSize;
12
+ constructor(annotationsInside: boolean);
13
+ init(container: HTMLElement): void;
14
+ add(annotationName: string, annotation: HTMLElement): void | never;
15
+ get(annotationName: string): HTMLElement | never;
16
+ remove(annotationName: string): void | never;
17
+ clear(): void;
18
+ destroy(): void;
19
+ private isElementExceedsBoundaries;
20
+ /** @deprecated Больше не используется. Контейнер теперь определяется самостоятельно */
21
+ registryRootContainer(container: HTMLElement): void;
22
+ /** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
23
+ addLayer(layerName: string): HTMLElement | never;
24
+ /** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
25
+ getLayer(layerName: string): HTMLElement | undefined;
26
+ /** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
27
+ removeLayer(layerName: string): void;
28
+ /** @deprecated Логики со слоями больше нет. Теперь все аннотации добавляются на единый общий слой */
29
+ clearLayer(layerName: string): void;
30
+ /** @deprecated Метод больше не является публичным */
31
+ detach(): void;
32
+ /** @deprecated Больше нет необходимости переназначать контейнер для аннотаций в ходе работы плеера */
33
+ reattach(): void;
34
+ }
@@ -0,0 +1,7 @@
1
+ export declare const ANNOTATION_EMPTY_ROOT_CONTAINER_ERROR = "Inner error. Unexpectedly root annotation container null reference exception";
2
+ export declare const ANNOTATION_ALREADY_EXIST_ERROR = "Annotation with such name already exists";
3
+ export declare const ANNOTATION_DOESNT_EXIST_ERROR = "Annotation with such name does not exist";
4
+ export declare const ANNOTATION_EXCEED_PLAYER_LIMITS_ERROR = "Annotation exceed player boundaries";
5
+ export declare class AnnotationsError extends Error {
6
+ constructor(message: string);
7
+ }
@@ -0,0 +1,34 @@
1
+ export interface FocusableElement extends HTMLElement {
2
+ disabled?: boolean;
3
+ href?: string;
4
+ tabIndex: number;
5
+ }
6
+ export declare class FocusLock {
7
+ private getActiveElement;
8
+ private focusableElements;
9
+ private isActive;
10
+ private container;
11
+ constructor(getActiveElement: () => HTMLElement | null);
12
+ /**
13
+ * Активирует захват фокуса
14
+ */
15
+ activate(): void;
16
+ /**
17
+ * Деактивирует захват фокуса
18
+ */
19
+ deactivate(): void;
20
+ /**
21
+ * Обновляет список фокусируемых элементов
22
+ */
23
+ updateFocusableElements(): void;
24
+ /**
25
+ * Получает все фокусируемые элементы внутри контейнера
26
+ */
27
+ private getFocusableElements;
28
+ /**
29
+ * Обработчик клавиши Tab
30
+ */
31
+ private handleTabKey;
32
+ destroy(): void;
33
+ setContainer(container: HTMLElement): void;
34
+ }
@@ -0,0 +1,17 @@
1
+ export declare class FocusManager {
2
+ private shadowRoot;
3
+ private lastFocusedNode;
4
+ private focusLock;
5
+ constructor(shadowRoot: ShadowRoot);
6
+ private init;
7
+ private handleFocusChange;
8
+ /**
9
+ * Восстанавливает фокус на последнем сфокусированном элементе в плеере.
10
+ */
11
+ restoreFocus: () => void;
12
+ destroy(): void;
13
+ getLastFocusedNode(): HTMLElement | null;
14
+ activateLock(): void;
15
+ deactivateLock(): void;
16
+ setContainerForFocusLock(container: HTMLElement): void;
17
+ }
@@ -0,0 +1,2 @@
1
+ import type { InterfaceLanguage } from "@vkontakte/videoplayer-shared";
2
+ export declare const selectNavigatorLanguage: (available: InterfaceLanguage[]) => InterfaceLanguage | undefined;
@@ -0,0 +1,16 @@
1
+ import type { MediaSessionApiActionHandler, MediaSessionApiMetadata } from "../../types";
2
+ import type { IStore } from "../../store";
3
+ export declare class MediaSessionApi {
4
+ private subscription;
5
+ private readonly logger;
6
+ private readonly log;
7
+ constructor();
8
+ isSupported(): boolean;
9
+ setMetaData({ title, artist, thumbUrl }: MediaSessionApiMetadata): void;
10
+ updateActionHandlers(actionHandlers: MediaSessionApiActionHandler[]): void;
11
+ private resetActionHandlers;
12
+ private setActionHandlers;
13
+ attachToStore(store?: IStore): void;
14
+ clearSubscriptions(): void;
15
+ destroy(): void;
16
+ }
@@ -0,0 +1,47 @@
1
+ import { ValueSubject } from "@vkontakte/videoplayer-shared";
2
+ import type { IDpipConfig } from "../../../config";
3
+ import type { ExternalPictureInPictureEventHandlers, IPictureInPictureApi, PictureInPictureSettings } from "../../../types";
4
+ import { PictureInPictureType } from "../../../types";
5
+ export declare class DocumentPictureInPictureApiSvelte implements IPictureInPictureApi {
6
+ readonly settings: PictureInPictureSettings;
7
+ private playerDomElement;
8
+ private playerParentShadowRoot;
9
+ private playerDummyElement;
10
+ private svelteContext;
11
+ private pipWindow;
12
+ info: {
13
+ isActive$: ValueSubject<boolean>;
14
+ isEnabled$: ValueSubject<boolean>;
15
+ type: PictureInPictureType;
16
+ };
17
+ /**
18
+ * Обычный pip может быть открыт браузером через медиа-сессию
19
+ */
20
+ private pipActive;
21
+ private readonly pipApi;
22
+ constructor(settings: PictureInPictureSettings);
23
+ get dpipConfig(): IDpipConfig;
24
+ /**
25
+ * Флаг показывает, есть ли в целом возможность использовать dpip в данном браузере, поддерживается ли это.
26
+ */
27
+ isSupported(): boolean;
28
+ /**
29
+ * Флаг показывает, находится ли пользователь в режиме dpip.
30
+ */
31
+ isActive(): boolean;
32
+ setPlayerDomElement(playerDomElement: HTMLElement, playerParentShadowRoot: ShadowRoot): void;
33
+ setContext(svelteContext: Map<unknown, unknown>): void;
34
+ request(): Promise<void>;
35
+ exit(): Promise<void>;
36
+ dispose(): Promise<void>;
37
+ /**
38
+ * Флаг определяет может ли пользователь переходить в dpip на уровне бизнес логике.
39
+ */
40
+ setEnabled(enabled: boolean): void;
41
+ assignPlayerContainer(playerContainer: HTMLElement): void;
42
+ updateVideoElement(): void;
43
+ setExternalEventHandlers(externalEventHandlers: ExternalPictureInPictureEventHandlers): void;
44
+ private get initialSize();
45
+ private createStretchedContainer;
46
+ }
47
+ export declare function isInstanceOfDocumentPictureInPictureApi(pictureInPictureApi?: IPictureInPictureApi): pictureInPictureApi is DocumentPictureInPictureApiSvelte;
@@ -0,0 +1,3 @@
1
+ import type { IDpipConfig } from "../../../config";
2
+ import type { IPictureInPictureApi } from "../../../types";
3
+ export declare const createPiPApi: (initiallyEnabled: boolean, dpipConfig?: IDpipConfig | boolean) => IPictureInPictureApi | undefined;
@@ -0,0 +1,4 @@
1
+ export { isInstanceOfDocumentPictureInPictureApi } from "./documentPictureInPictureApi.svelte";
2
+ export { isInstanceOfPictureInPictureApi } from "./pictureInPictureApi";
3
+ export { createPiPApi } from "./factory";
4
+ export { isPiPSupported, isDpipSupported } from "./utils";
@@ -0,0 +1,49 @@
1
+ import { ValueSubject } from "@vkontakte/videoplayer-shared";
2
+ import type { ExternalPictureInPictureEventHandlers, IPictureInPictureApi, PictureInPictureSettings } from "../../../types";
3
+ import { PictureInPictureType } from "../../../types";
4
+ export declare class PictureInPictureApi implements IPictureInPictureApi {
5
+ private isRequested;
6
+ private videoElement;
7
+ private playerContainer;
8
+ private svelteContext;
9
+ private externalEventHandlers;
10
+ private readonly eventHandlers;
11
+ info: {
12
+ isActive$: ValueSubject<boolean>;
13
+ isEnabled$: ValueSubject<boolean>;
14
+ type: PictureInPictureType;
15
+ };
16
+ constructor({ enabled }: PictureInPictureSettings);
17
+ /**
18
+ * Флаг показывает, есть ли в целом возможность использовать pip в данном браузере, поддерживается ли это.
19
+ */
20
+ isSupported(): boolean;
21
+ /**
22
+ * Флаг показывает, находится ли пользователь в режиме pip.
23
+ */
24
+ isActive(): boolean;
25
+ setContext(svelteContext: Map<unknown, unknown>): void;
26
+ revealPictureInPicture(): Promise<void>;
27
+ request(): Promise<void>;
28
+ exit(): Promise<void>;
29
+ assignPlayerContainer(playerContainer: HTMLElement): void;
30
+ updateVideoElement(): void;
31
+ private addEventHandlers;
32
+ setExternalEventHandlers(externalEventHandlers: ExternalPictureInPictureEventHandlers): void;
33
+ private removeEventHandlers;
34
+ dispose(): Promise<void>;
35
+ private onEnterPictureInPicture;
36
+ private onLeavePictureInPicture;
37
+ private onResize;
38
+ /**
39
+ * Флаг определяет может ли пользователь переходить в pip на уровне бизнес логике.
40
+ */
41
+ setEnabled(enabled: boolean): void;
42
+ /**
43
+ * для сафари нужно корректно обновить состояние пипа, потому что если мы попали сюда
44
+ * из за креша провайдера + клика на выход из пип-а, то сафари может не успеть прислать
45
+ * leavepictureinpicture на старый элемент из за чего UI застрянет в неправильном состоянии
46
+ */
47
+ private waitForSafariLeavePictureInPicture;
48
+ }
49
+ export declare function isInstanceOfPictureInPictureApi(pictureInPictureApi?: IPictureInPictureApi): pictureInPictureApi is PictureInPictureApi;
@@ -0,0 +1,6 @@
1
+ import type { DebouncedFn } from "@vkontakte/videoplayer-shared";
2
+ export interface PictureInPictureEventHandlers {
3
+ enterpictureinpicture: (event: Event) => void;
4
+ leavepictureinpicture: (event?: Event) => void;
5
+ resize: DebouncedFn<(event: Event) => void>;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { type SafeAny } from "@vkontakte/videoplayer-shared";
2
+ import type { PictureInPictureResizeEvent } from "../../../types";
3
+ import type { IDpipConfig } from "../../../config";
4
+ export declare const isPiPSupported: () => boolean;
5
+ export declare const isDpipSupported: () => boolean;
6
+ export declare const isPiPEvent: (e: SafeAny) => e is PictureInPictureEvent;
7
+ export declare const isPiPResizeEvent: (e: Event) => e is PictureInPictureResizeEvent;
8
+ export declare const isDpipEnabledByConfig: (value?: IDpipConfig | boolean) => boolean;
9
+ export declare const styleSheetToString: (styleSheet: CSSStyleSheet) => string;
10
+ export declare const createStyleNode: (textContent: string, id: string) => Node;
@@ -0,0 +1,53 @@
1
+ import type { IStore } from "../../store";
2
+ import type { IPlayerControlsRef } from "../../types";
3
+ /**
4
+ * Если смотреть по порядку расположения типов, то чем дальше тип, тем выше у него zIndex.
5
+ *
6
+ * over_video - слот будет находиться над видео;
7
+ * over_controls - слот будет находиться над контролами, но под меню настроек.
8
+ */
9
+ export type SlotOverlay = "over_video" | "over_controls";
10
+ export declare const SLOT_NAME = "annotation";
11
+ export type HideControlsWhenIntersectedOptions = {
12
+ observedSlotElementId: string;
13
+ controlsToObserve: (keyof IPlayerControlsRef)[];
14
+ };
15
+ type AddOptions = {
16
+ id: string;
17
+ overlay: SlotOverlay;
18
+ hideAllControls?: boolean;
19
+ controlsBehaviour?: HideControlsWhenIntersectedOptions;
20
+ };
21
+ type AddReturnType = {
22
+ success: true;
23
+ } | {
24
+ success: false;
25
+ message: string;
26
+ };
27
+ export declare class SlotsApi {
28
+ private shadowRootContainer;
29
+ private slots;
30
+ private store;
31
+ private disabledIds;
32
+ constructor(disabledIds: string[]);
33
+ init(shadowRootContainer: HTMLElement, store: IStore | undefined): void;
34
+ add(elementParam: HTMLElement | (() => HTMLElement), options: AddOptions): AddReturnType;
35
+ private setupSlotStyles;
36
+ /**
37
+ * Запускаем отслеживание пересечения между переданным элементом внутри слота и контролами.
38
+ */
39
+ private runHidingControlsWhenIntersected;
40
+ /**
41
+ * Ищем внутри рутового элемента слота элемент, с которым хотим отслеживать пересечение контролов.
42
+ * Приходится делать через mutationObserver, так как данный элемент в силу асинхронной работы внешнего
43
+ * фреймворка может появиться позже.
44
+ * @param slotRootElement Рутовый элемент слота.
45
+ * @param slotElementId Идентификатор элемента внутри слота, с которым хотим отслеживать пересечение контролов.
46
+ * @param slotId Идентификатор слота.
47
+ */
48
+ private findSlotElement;
49
+ remove(id: string): void;
50
+ destroy(): void;
51
+ haveSlots(): boolean;
52
+ }
53
+ export {};