@vkontakte/videoplayer 1.0.8 → 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
package/package.json CHANGED
@@ -1,22 +1,51 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer",
3
- "version": "1.0.8",
3
+ "version": "1.0.95-dev.e4134bc49.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
7
7
  "license": "GPL-3.0",
8
- "main": "esnext.cjs.js",
9
- "module": "esnext.esm.js",
10
- "types": "index.d.ts",
8
+ "main": "./esnext.cjs",
9
+ "module": "./esnext.esm.js",
10
+ "types": "./types/index.d.ts",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./types/index.d.ts",
15
+ "import": "./esnext.esm.js",
16
+ "require": "./esnext.cjs"
17
+ },
18
+ "./evergreen": {
19
+ "types": "./types/index.d.ts",
20
+ "import": "./evergreen.esm.js",
21
+ "require": "./evergreen.cjs"
22
+ },
23
+ "./esnext": {
24
+ "types": "./types/index.d.ts",
25
+ "import": "./esnext.esm.js",
26
+ "require": "./esnext.cjs"
27
+ },
28
+ "./es2015": {
29
+ "types": "./types/index.d.ts",
30
+ "import": "./es2015.esm.js",
31
+ "require": "./es2015.cjs"
32
+ },
33
+ "./evergreen.esm.js": "./evergeen.esm.js",
34
+ "./esnext.esm.js": "./esnext.esm.js",
35
+ "./esnext.cjs": "./esnext.cjs",
36
+ "./es2015.esm.js": "./es2015.esm.js",
37
+ "./es2015.cjs": "./es2015.cjs"
38
+ },
11
39
  "files": [
12
- "*.cjs.js",
40
+ "*.cjs",
13
41
  "*.esm.js",
14
42
  "**/*.d.ts"
15
43
  ],
16
44
  "dependencies": {
17
- "@vkontakte/videoplayer-core": "2.0.48",
18
- "@vkontakte/videoplayer-shared": "1.0.12",
19
- "@vkontakte/videoplayer-statistics": "1.0.14",
20
- "lodash": "4.17.21"
45
+ "@adtech/rbadman": "2.2.57",
46
+ "@vkontakte/videoplayer-core": "2.0.164-dev.e4134bc49.0",
47
+ "@vkontakte/videoplayer-interactive": "1.0.70-dev.e4134bc49.0",
48
+ "@vkontakte/videoplayer-shared": "1.0.93-dev.e4134bc49.0",
49
+ "@vkontakte/videoplayer-statistics": "1.0.110-dev.e4134bc49.0"
21
50
  }
22
51
  }
@@ -0,0 +1,2 @@
1
+ import { type Constructor } from "@vkontakte/videoplayer-shared";
2
+ export declare const HTMLElement: Constructor<HTMLElement>;
@@ -0,0 +1,5 @@
1
+ import type { IVKVideoPlayerConfig } from "../types";
2
+ type IDefaultVideoConfig = Required<Pick<IVKVideoPlayerConfig, "preload" | "autoplay" | "repeat" | "loop" | "fromTime" | "canRewindLive" | "showAds" | "interfaceLanguage" | "isCyrillicRelatedInterface" | "logoClickable" | "logoHidden" | "isTouch" | "isMediaSessionEnabled" | "isPictureInPictureEnabled" | "isAudioDisabled" | "callbacks" | "saveRate" | "volumeMultiplier" | "showEndScreen" | "showAutoplayNext" | "showNextPrevButtons">>;
3
+ export declare const defaultVideoConfig: IDefaultVideoConfig;
4
+ export type EnsuredVideoConfig = IVKVideoPlayerConfig & IDefaultVideoConfig;
5
+ export {};
@@ -0,0 +1,211 @@
1
+ import type { ISDKConfig } from "../config";
2
+ import type { LanguageConfig } from "../translation/types";
3
+ import type { IUpdatableVKVideoPlayerConfig, IVideoData, IVKVideoPlayerConfig } from "../types";
4
+ import { type QualityLimits, type Seconds } from "@vkontakte/videoplayer-shared";
5
+ import type { InterfaceLanguage } from "@vkontakte/videoplayer-shared";
6
+ import type { PlaybackRate } from "@vkontakte/videoplayer-core";
7
+ import { type IStatContext } from "@vkontakte/videoplayer-statistics";
8
+ import { ThinOneStat } from "@vkontakte/videoplayer-statistics";
9
+ import { AnnotationsApi } from "../utils/webAPI/annotationsApi/annotationsApi";
10
+ import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem } from "../components/Menus/subMenuTabs/types";
11
+ import type { AdditionalButton } from "../components/Controls/types";
12
+ import { SlotsApi } from "../utils/webAPI/slotsApi";
13
+ import { HTMLElement } from "./HTMLElement";
14
+ export declare class VKVideoPlayer extends HTMLElement {
15
+ private svelteStubComponent?;
16
+ private svelteRootComponent?;
17
+ /**
18
+ * Слой, который живет на протяжении жизни плеера, не уничтожается между переключениями видео.
19
+ */
20
+ private sveltePersistentLayerComponent?;
21
+ private svelteErrorComponent?;
22
+ private store?;
23
+ private statistics?;
24
+ private appTracer?;
25
+ private admanWrapper?;
26
+ private _shadowRoot;
27
+ private playerContainer;
28
+ private rootContainer;
29
+ private stateContainer;
30
+ private shadowRootContainer;
31
+ private playerId;
32
+ private uiConfig;
33
+ private coreConfig;
34
+ private statisticsConfig;
35
+ private metaConfig;
36
+ private interactiveController;
37
+ private interactiveContainer;
38
+ private graphMadePause;
39
+ private currentPlayingVideoIndex;
40
+ private needToRepeatPlaylist;
41
+ private videoConfig;
42
+ private pictureInPictureApi;
43
+ private mediaSessionApi;
44
+ private unsubscribePlayerPhaseSubscription;
45
+ private readonly logger;
46
+ private readonly log;
47
+ private readonly subscription;
48
+ private readonly interactiveSubscription;
49
+ annotationsApi: AnnotationsApi | undefined;
50
+ slotsApi: SlotsApi | undefined;
51
+ private focusManager;
52
+ private prevIsid;
53
+ private isInited;
54
+ private videoStarted;
55
+ private postponedInitParams;
56
+ private internalsExposure;
57
+ private shadowDOMCallbacksDisabled;
58
+ private readonly fatalError$;
59
+ constructor();
60
+ private connectedCallback;
61
+ private updatePersistentLayerProps;
62
+ private disconnectedCallback;
63
+ private initPlayerRootContainers;
64
+ private needToShowNextPrevButtons;
65
+ private isNextButtonActive;
66
+ private isPrevButtonActive;
67
+ private isControlDisabled;
68
+ private getNextVideoInfo;
69
+ private readonly createOneStat;
70
+ private createThinOneStat;
71
+ private createStatisticsForVideo;
72
+ private createAppTracerForVideo;
73
+ private createAdsParamsForVideo;
74
+ private createPlayer;
75
+ private readonly handleDomReady;
76
+ private readonly firstStart;
77
+ private initVideo;
78
+ private initQualitySettings;
79
+ private get shouldLoop();
80
+ private get isMobile();
81
+ private get useMinimalViewForDpip();
82
+ get shouldKeepPlayerElement(): boolean;
83
+ get shouldUseDpip(): boolean;
84
+ private addPlayerInfoSubscriptions;
85
+ playNextVideo(): void;
86
+ playPrevVideo(): void;
87
+ toggleFullscreen(): void;
88
+ /**
89
+ * !!! Сейчас нее будет полноценно работать,
90
+ * потому что часть полей которые реально относятся к видео передаются в videoConfig
91
+ * А videoConfig формируется в слое интеграции.
92
+ * В частности: adsParams, canDownload, failoverHosts, volumeMultiplier...
93
+ * @private
94
+ */
95
+ private updatePlayerWithCurrentVideo;
96
+ private createPlayerWithCurrentVideo;
97
+ private playPrevChapter;
98
+ private seekToInteractive;
99
+ private initInteractives;
100
+ private checkVideosList;
101
+ /**
102
+ * Lagacy comment:
103
+ * А это из-за проблем архитектуры
104
+ * videoConfig - настройки экземпляра плеера для конкретного видео, sdkConfig.ui – настройки поведения плеера для всех
105
+ * Фичи включаются как суперпозиция этих двух конфигов.
106
+ * Из-за того что Root и Store – два источника правды синхронизировать конфиги придётся здесь переопределением дописывая поля из sdkConfig в videoConfig
107
+ * TODO: структурировать поток данных в рамках VP-958: Конфиги -> стор -> Root
108
+ */
109
+ private overrideVideoConfigFromUIConfig;
110
+ initPlayer(videoConfig: IVKVideoPlayerConfig, sdkConfig?: Partial<ISDKConfig>): void;
111
+ updatePlayer(videoConfig: IUpdatableVKVideoPlayerConfig): void;
112
+ private isOneVideoPlaylist;
113
+ private updateRootPropsAfterPlaylistChanged;
114
+ private updateVideos;
115
+ /**
116
+ * Обновление плейлиста. Будут перезаписаны все видео до текущего
117
+ */
118
+ updatePrevVideos(videos: IVideoData[]): void;
119
+ /**
120
+ * Обновление плейлиста. Будут перезаписаны все видео после текущего
121
+ */
122
+ updateNextVideos(videos: IVideoData[]): void;
123
+ private initMediaSession;
124
+ private setupMediaSessionForVideo;
125
+ private setupMediaSessionForAds;
126
+ moveTo(container: HTMLElement): void;
127
+ play(): void;
128
+ pause(): void;
129
+ stop(): void;
130
+ setMuted(muted: boolean): void;
131
+ toggleSubtitle(): void;
132
+ changeSubtitle(enabled: boolean, id?: string): void;
133
+ hideControls(): void;
134
+ showControls(): void;
135
+ setPiPEnabled(enabled: boolean): void;
136
+ setVolume(volume: number): void;
137
+ setRepeat(repeat: boolean): void;
138
+ seekTime(time: number): void;
139
+ private readonly seekTimeInternal;
140
+ seekEpisodeStartTime(time: number): void;
141
+ returnFocusToEpisodes(): void;
142
+ setPlaybackRate(playbackRate: PlaybackRate): void;
143
+ setAutoQualityLimits(limits: QualityLimits): void;
144
+ /** включение режима автоматического качества (это не тоггл!) */
145
+ setAutoQuality(): void;
146
+ /**
147
+ * __тоггл режима экономии трафика__
148
+ *
149
+ * - при включении так же будет включен режим автоматического качества
150
+ * (если был выключен, например, ручным выбором качества пользователем)
151
+ */
152
+ toggleTrafficSaving(value: boolean): void;
153
+ /**
154
+ * __тоггл режима высокого качества__
155
+ *
156
+ * - при включении так же будет включен режим автоматического качества
157
+ * (если был выключен, например, ручным выбором качества пользователем)
158
+ */
159
+ toggleHighQuality(value: boolean): void;
160
+ changeAudioStream(id: string): void;
161
+ addLanguage(config: LanguageConfig): void;
162
+ setLanguage(language: InterfaceLanguage | string): Promise<void>;
163
+ private replaceVideoDataInConfig;
164
+ setLiveStart(videoData: IVideoData): void;
165
+ setLiveWaitingStart(): void;
166
+ /**
167
+ * Идёт доигрывание трансляции
168
+ */
169
+ private isLiveTailPlaying;
170
+ /**
171
+ * @param forceImmediate Позволяет немедленно показать состояние ожидания, не дожидаясь окончания доигрывания буффера и попыток получить поток
172
+ */
173
+ setLiveWaitingRecover(forceImmediate?: boolean): void;
174
+ setLiveWaitingRecord(): void;
175
+ setLiveEnd(videoData: IVideoData, autoplay?: boolean): void;
176
+ setLiveLowLatency(isLowLatency: boolean): void;
177
+ setLooped(looped: boolean): void;
178
+ getDebugData(): string;
179
+ getDeviceId(): string | undefined;
180
+ replayInteractiveVideo(): void;
181
+ replayInteractiveChapter(callback?: () => void): Promise<void>;
182
+ showInteractiveIndicatorTooltip(newValue: boolean, useTimeout?: boolean): void;
183
+ switchToActiveLive(): void;
184
+ updateAdditionalSettingsItem(itemId: string, fields: Partial<Omit<AdditionalSettingsMenuItem, "id" | "type">>): void;
185
+ addAdditionalSettingsItem(newItem: AdditionalSettingsMenuItem): void;
186
+ removeAdditionalSettingsItem(itemId: string): void;
187
+ updateAdditionalContextItem(itemId: string, fields: Partial<Omit<AdditionalContextMenuItem, "id">>): void;
188
+ addAdditionalContextItem(newItem: AdditionalContextMenuItem): void;
189
+ removeAdditionalContextItem(itemId: string): void;
190
+ updateAdditionalButton(itemId: string, fields: Partial<Omit<AdditionalButton, "id" | "type">>): void;
191
+ addAdditionalButton(newButton: AdditionalButton): void;
192
+ removeAdditionalButton(itemId: string): void;
193
+ updateStatContext(statContext: Partial<IStatContext | ThinOneStat.IStatContext>): void;
194
+ handleTimerNextVideo(state: boolean): void;
195
+ togglePictureInPicture(): void;
196
+ focus(): void;
197
+ /**
198
+ * Восстанавливает фокус на последнем сфокусированном элементе в плеере.
199
+ */
200
+ restoreFocus(): void;
201
+ /**
202
+ * Обработка внешнего события клавиатуры.
203
+ * Метод preventDefault не будет вызван при обработке внешего события.
204
+ * @param {KeyboardEvent} event Событие из внешнего обработчика
205
+ * @returns {boolean} Было ли событие обработано внутри плеера
206
+ */
207
+ handleExternalKeyboardEvent(event: KeyboardEvent): boolean;
208
+ setAutoplayNext(autoplayNext: boolean): void;
209
+ getTotalViewTime(): Seconds | undefined;
210
+ private unmountComponent;
211
+ }
@@ -0,0 +1,84 @@
1
+ import type { AdsTimeRemained } from "../../types";
2
+ import { AdsSection, type AdmanInitParams } from "../../types";
3
+ import { type ILogger } from "@vkontakte/videoplayer-shared";
4
+ import { Subject } from "@vkontakte/videoplayer-shared";
5
+ import type { IAdsState } from "../../store";
6
+ import type { ExternalActions, IConfig, IPlayerState } from "./types";
7
+ export declare class AdmanWrapper {
8
+ private adman;
9
+ private initialVolume;
10
+ private readonly volumeMultiplier;
11
+ private videoElement;
12
+ private currentAdSection;
13
+ private actions;
14
+ private adsState;
15
+ private playerState;
16
+ private ordIds;
17
+ private isDestroyed;
18
+ private readonly log;
19
+ private loadPromise?;
20
+ private loadTimeout;
21
+ private initTimeout;
22
+ private runtimeTimeout;
23
+ private useAdmanFromNPM;
24
+ private isVsidOriginal;
25
+ private preserveMutedState;
26
+ private stopAdmanOnSwitch;
27
+ private watchDogTimeout;
28
+ private externalApi?;
29
+ events: {
30
+ init$: Subject<number>;
31
+ loadStarted$: Subject<void>;
32
+ loadEnded$: Subject<void>;
33
+ loadError$: Subject<void>;
34
+ ready$: Subject<void>;
35
+ slotRequested$: Subject<string | void>;
36
+ started$: Subject<AdsSection>;
37
+ timeRemained$: Subject<AdsTimeRemained>;
38
+ paused$: Subject<void>;
39
+ resumed$: Subject<void>;
40
+ ended$: Subject<{
41
+ section: AdsSection;
42
+ ordIds: string[];
43
+ }>;
44
+ empty$: Subject<void>;
45
+ skipped$: Subject<void>;
46
+ clicked$: Subject<AdsSection>;
47
+ closed$: Subject<AdsSection>;
48
+ error$: Subject<string>;
49
+ };
50
+ constructor(logger: ILogger, config: IConfig);
51
+ init(actions: ExternalActions, adsState: IAdsState, playerState: IPlayerState): void;
52
+ loadAdman: (abortSignal: AbortSignal) => Promise<void>;
53
+ private loadAdmanMailRu;
54
+ private loadAdmanNPM;
55
+ onAdmanLoadingError(): void;
56
+ initAdman(initParams: AdmanInitParams): Promise<void>;
57
+ private switchToVideo;
58
+ private setPostrollPassed;
59
+ togglePlay(): void;
60
+ setInitialVolume(volume: number): void;
61
+ setVolume(volume: number): void;
62
+ setFullscreen(isFullscreen: boolean): void;
63
+ startPreroll(): void;
64
+ startPostroll(): void;
65
+ private onAdsReady;
66
+ private onAdStarted;
67
+ private onAdTimeRemained;
68
+ private onAdPaused;
69
+ private onAdPlayed;
70
+ private onAdMidrollPoint;
71
+ private onAdSkipped;
72
+ private onAdClosed;
73
+ private onAdCompleted;
74
+ private onAdClicked;
75
+ private onAdError;
76
+ private startWatchDog;
77
+ private stopWatchDog;
78
+ play(): void;
79
+ pause(): void;
80
+ skip(): void;
81
+ setPosition(position: number, duration: number): void;
82
+ destroy(): void;
83
+ private safeExternalCall;
84
+ }
@@ -0,0 +1,20 @@
1
+ import type { Milliseconds } from "@vkontakte/videoplayer-shared";
2
+ import type { Readable } from "svelte/store";
3
+ export type ExternalActions = {
4
+ switchFromAdsToVideo: (callPlay?: boolean) => void;
5
+ switchFromVideoToAds: () => void;
6
+ setMuted: (muted: boolean) => void;
7
+ };
8
+ export type IPlayerState = {
9
+ vsid: Readable<string | undefined>;
10
+ };
11
+ export interface IConfig {
12
+ loadTimeout: Milliseconds;
13
+ initTimeout: Milliseconds;
14
+ runtimeTimeout: Milliseconds;
15
+ useAdmanFromNPM: boolean;
16
+ volumeMultiplier: number;
17
+ isVsidOriginal: boolean;
18
+ preserveMutedState: boolean;
19
+ stopAdmanOnSwitch: boolean;
20
+ }
@@ -0,0 +1,6 @@
1
+ import type { ILogger } from "@vkontakte/videoplayer-shared";
2
+ import type { IAdsConfig } from "../../config";
3
+ import { AdmanWrapper } from "./admanWrapper";
4
+ type AdmanWrapperFactory = (logger: ILogger, adsConfig: IAdsConfig) => AdmanWrapper;
5
+ export declare const createAdmanWrapper: AdmanWrapperFactory;
6
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare enum DesktopButtonsLeftIds {
2
+ PREV = "prevButton",
3
+ PLAY = "playButton",
4
+ REPLAY = "replayButton",
5
+ NEXT = "nextButton",
6
+ INTERACTIVE_PREV = "playPrevChapterButton",
7
+ INTERACTIVE_SEEK = "seekToInteractiveButton",
8
+ INTERACTIVE_GRAPH = "interactiveGraphButton",
9
+ LIVE = "liveButton"
10
+ }
@@ -0,0 +1,2 @@
1
+ import { DesktopButtonsLeftIds } from "./desktopButtonsLeftIds";
2
+ export declare const desktopButtonsLeftWeights: { [key in DesktopButtonsLeftIds] : number };
@@ -0,0 +1,11 @@
1
+ export declare enum DesktopButtonsRightIds {
2
+ LOGO = "vkLogo",
3
+ AUTOPLAY_NEXT = "autoplayNext",
4
+ VOLUME = "volume",
5
+ SUBTITLES = "subtitles",
6
+ SETTINGS = "settings",
7
+ CONTEXT = "context",
8
+ FULLSCREEN = "fullscreen",
9
+ CHROMECAST = "chromecast",
10
+ QOE = "qoe"
11
+ }
@@ -0,0 +1,2 @@
1
+ import { DesktopButtonsRightIds } from "./desktopButtonsRightIds";
2
+ export declare const desktopButtonsRightWeights: { [key in DesktopButtonsRightIds] : number };
@@ -0,0 +1,41 @@
1
+ import type { GridTypes } from "../../constans";
2
+ import type { TmpComponentType } from "../../types/tmp";
3
+ export declare enum ControlButtonType {
4
+ DESKTOP_CONTROL_PANEL_LEFT = "desktop-control-panel-left",
5
+ DESKTOP_CONTROL_PANEL_RIGHT = "desktop-control-panel-right"
6
+ }
7
+ interface BaseButton {
8
+ id: string;
9
+ weight: number;
10
+ disabled?: boolean;
11
+ }
12
+ interface BaseInnerButton extends BaseButton {
13
+ buttonComponent: TmpComponentType;
14
+ buttonComponentProps?: Record<string, unknown>;
15
+ ariaKeyShortCut?: string;
16
+ ariaExpanded?: boolean;
17
+ }
18
+ interface BaseAdditionalButton extends BaseButton {
19
+ icon: string;
20
+ testId?: string;
21
+ onClick?: () => void;
22
+ ariaLabel: string;
23
+ }
24
+ export interface DesktopControlPanelButton extends BaseInnerButton {
25
+ type: ControlButtonType.DESKTOP_CONTROL_PANEL_LEFT | ControlButtonType.DESKTOP_CONTROL_PANEL_RIGHT;
26
+ tooltipEnabled?: boolean;
27
+ mouseEnter?: () => void;
28
+ mouseLeave?: () => void;
29
+ tooltipText?: string;
30
+ disabledTooltipContent?: string;
31
+ className?: string;
32
+ }
33
+ export interface AdditionalDesktopControlPanelButton extends BaseAdditionalButton {
34
+ type: ControlButtonType.DESKTOP_CONTROL_PANEL_RIGHT;
35
+ tooltipText?: string;
36
+ disabledTooltipContent?: string;
37
+ hideOnDesktopGridTypes?: GridTypes[];
38
+ disableMouseupTooltipShow?: boolean;
39
+ }
40
+ export type AdditionalButton = AdditionalDesktopControlPanelButton;
41
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AdditionalDesktopControlPanelButton, DesktopControlPanelButton } from "../types";
2
+ export declare const isInnerButtonGuard: (btn: DesktopControlPanelButton | AdditionalDesktopControlPanelButton) => btn is DesktopControlPanelButton;
@@ -0,0 +1,8 @@
1
+ export declare enum IconSize {
2
+ XS = "12",
3
+ S = "16",
4
+ M = "24",
5
+ ML = "32",
6
+ L = "48"
7
+ }
8
+ export declare const DEFAULT_ICON_COLOR = "var(--btn-color, #fff)";
@@ -0,0 +1,2 @@
1
+ import type { IconSize } from "./constants";
2
+ export declare const getSizeStyle: (size: IconSize) => string;
@@ -0,0 +1,11 @@
1
+ export declare enum ContextMenuItemIds {
2
+ COPY_LINK = "copy-link",
3
+ COPY_LINK_TIMESTAMP = "copy-link-timestamp",
4
+ COPY_EMBED_CODE = "copy-embed-code",
5
+ PIP = "pip",
6
+ VIDEO_LOOP = "video-loop",
7
+ ROTATE = "rotate",
8
+ REPORT = "report",
9
+ SAVE_DEBUG = "save-debug",
10
+ DEBUG_INFO = "debug-info"
11
+ }
@@ -0,0 +1,2 @@
1
+ import { ContextMenuItemIds } from "./contextMenuItemIds";
2
+ export declare const contextMenuItemWeights: { [key in ContextMenuItemIds] : number };
@@ -0,0 +1 @@
1
+ export declare const defaultSubMenuMinWidth = 137;
@@ -0,0 +1,4 @@
1
+ export * from "./settingsMenuItemWeights";
2
+ export * from "./settingsMenuItemIds";
3
+ export * from "./defaultSubMenuMinWidth";
4
+ export * from "./topOffset";
@@ -0,0 +1,3 @@
1
+ export declare enum OpenSubMenuItemsIds {
2
+ QUALITY_DETAIL = "quality-detail-sub"
3
+ }
@@ -0,0 +1,11 @@
1
+ export declare enum SettingsMenuItemIds {
2
+ QUALITY = "quality-settings",
3
+ AUDIO_TRACKS = "audio-language-settings",
4
+ PLAYBACK_RATE = "playback-rate-settings",
5
+ SUBTITLES = "subtitles-settings",
6
+ TRAFFIC_SAVING = "traffic-saving-settings",
7
+ DOWNLOAD = "download",
8
+ REPORT = "report",
9
+ COPY_DATA = "copy-data",
10
+ DEBUG_INFO = "debug-info"
11
+ }
@@ -0,0 +1,2 @@
1
+ import { SettingsMenuItemIds } from "./settingsMenuItemIds";
2
+ export declare const settingsMenuItemWeights: { [key in SettingsMenuItemIds] : number };
@@ -0,0 +1,8 @@
1
+ export declare enum SubMenuIds {
2
+ QUALITY = "quality-sub",
3
+ QUALITY_DETAIL = "quality-detail-sub",
4
+ DEFAULT_QUALITY_APPLIANCE = "default_quality_applies_to_sub",
5
+ AUDIO_TRACKS = "audio-language-sub",
6
+ PLAYBACK_RATE = "playback-rate-sub",
7
+ SUBTITLES = "subtitles-sub"
8
+ }
@@ -0,0 +1 @@
1
+ export declare const topOffset: number;
@@ -0,0 +1,33 @@
1
+ import { RootMenuId, type SettingsMenuItem } from "./types";
2
+ import { type VideoPlaybackRate, type VideoSubtitle } from "../../../types";
3
+ import type { IAudioStream, PlaybackRate, VideoQuality } from "@vkontakte/videoplayer-core";
4
+ import type { QualitySettingsAppliesTo } from "../../../utils/userSettings";
5
+ export type Context = {
6
+ currentPlaybackRate: number;
7
+ availablePlaybackRates: VideoPlaybackRate[];
8
+ selectPlaybackRate: (playbackRate: PlaybackRate) => void;
9
+ trafficSavingEnabled: boolean;
10
+ toggleTrafficSaving: (value: boolean, appliesTo: QualitySettingsAppliesTo) => void;
11
+ currentQuality: VideoQuality;
12
+ isAutoQualityEnabled: boolean;
13
+ isMobile: boolean;
14
+ currentAudioStream: IAudioStream | undefined;
15
+ availableAudioStreams: IAudioStream[];
16
+ qualityDetailsSubMenuEnabled: boolean;
17
+ currentSubtitle: Omit<VideoSubtitle, "selected">;
18
+ onDownloadClick: () => void;
19
+ onReportProblemClick: () => void;
20
+ onCopyDataClick: () => void;
21
+ toggleShowDebugInfo: () => void;
22
+ };
23
+ /**
24
+ * Мапа элементов меню, которые показываются на первом уровне.
25
+ */
26
+ export declare const RootMenuItemMap: Record<RootMenuId, (context: Context) => SettingsMenuItem>;
27
+ type Params = {
28
+ items: RootMenuId[];
29
+ context: Context;
30
+ additionalSettingsMenuItems: SettingsMenuItem[];
31
+ };
32
+ export declare const getRootMenuItems: ({ items, context, additionalSettingsMenuItems }: Params) => SettingsMenuItem[];
33
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type Context, type SubMenuItem } from "./types";
2
+ import type { QualitySettingsAppliesTo } from "../../../utils/userSettings";
3
+ export type QualityHandler = (params: {
4
+ labelWithQuality: boolean;
5
+ appliesTo: QualitySettingsAppliesTo;
6
+ selected: boolean;
7
+ }, context: Context) => SubMenuItem;
8
+ type DefaultHandler = (context: Context) => SubMenuItem;
9
+ /**
10
+ * В данном файле определяем элементы меню, которые могут использоваться в разных подменю.
11
+ */
12
+ export declare const getMenuItemForAnotherQuality: DefaultHandler;
13
+ export declare const getMenuItemForAutoQuality: QualityHandler;
14
+ export declare const getMenuItemForQualityApplience: DefaultHandler;
15
+ export declare const getMenuItemForHighQuality: QualityHandler;
16
+ export declare const getMenuItemForTrafficSaving: QualityHandler;
17
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SubMenuId, type Context, type SubMenuData } from "./types";
2
+ type Params = {
3
+ subMenuId: SubMenuId | null;
4
+ context: Context;
5
+ };
6
+ export declare const getSubMenuData: ({ subMenuId, context }: Params) => ReturnType<SubMenuData>[];
7
+ export {};