@vkontakte/videoplayer 1.1.47-dev.f76cced4.0 → 1.1.48-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/videoplayer",
3
- "version": "1.1.47-dev.f76cced4.0",
3
+ "version": "1.1.48-beta.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -49,9 +49,9 @@
49
49
  "**/*.d.ts"
50
50
  ],
51
51
  "dependencies": {
52
- "@vkontakte/videoplayer-core": "2.0.114-dev.8971454f.0",
53
- "@vkontakte/videoplayer-interactive": "1.0.22-dev.55fd61d6.0",
54
- "@vkontakte/videoplayer-shared": "1.0.46-dev.9c2f91d3.0",
55
- "@vkontakte/videoplayer-statistics": "1.0.61-dev.26c8946e.0"
52
+ "@vkontakte/videoplayer-core": "2.0.115-beta.0",
53
+ "@vkontakte/videoplayer-interactive": "1.0.23-beta.0",
54
+ "@vkontakte/videoplayer-shared": "^1.0.46",
55
+ "@vkontakte/videoplayer-statistics": "1.0.62-beta.0"
56
56
  }
57
57
  }
@@ -6,6 +6,7 @@ import { type PlaybackRate } from '@vkontakte/videoplayer-core';
6
6
  import type { IStatContext } from '@vkontakte/videoplayer-statistics';
7
7
  import { AnnotationsApi } from '../utils/webAPI/annotationsApi/annotationsApi';
8
8
  import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem } from '../components/Menus/types';
9
+ import type { AdditionalButton } from '../components/Controls/types';
9
10
  export declare class VKVideoPlayer extends HTMLElement {
10
11
  private svelteStubComponent?;
11
12
  private svelteRootComponent?;
@@ -54,7 +55,6 @@ export declare class VKVideoPlayer extends HTMLElement {
54
55
  private createPlayerWithCurrentVideo;
55
56
  private playPrevChapter;
56
57
  private seekToInteractive;
57
- private toggleGraph;
58
58
  private initInteractives;
59
59
  initPlayer(videoConfig: IVKVideoPlayerConfig, sdkConfig?: Partial<ISDKConfig>): void;
60
60
  private isOneVideoPlaylist;
@@ -93,5 +93,8 @@ export declare class VKVideoPlayer extends HTMLElement {
93
93
  updateAdditionalContextItem(itemId: string, fields: Partial<Omit<AdditionalContextMenuItem, 'id'>>): void;
94
94
  addAdditionalContextItem(newItem: AdditionalContextMenuItem): void;
95
95
  removeAdditionalContextItem(itemId: string): void;
96
+ updateAdditionalButton(itemId: string, fields: Partial<Omit<AdditionalButton, 'id' | 'type'>>): void;
97
+ addAdditionalButton(newButton: AdditionalButton): void;
98
+ removeAdditionalButton(itemId: string): void;
96
99
  updateStatContext(statContext: Partial<IStatContext>): void;
97
100
  }
@@ -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,4 @@
1
+ import { DesktopButtonsLeftIds } from './desktopButtonsLeftIds';
2
+ export declare const desktopButtonsLeftWeights: {
3
+ [key in DesktopButtonsLeftIds]: number;
4
+ };
@@ -0,0 +1,9 @@
1
+ export declare enum DesktopButtonsRightIds {
2
+ LOGO = "vkLogo",
3
+ VOLUME = "volume",
4
+ SUBTITLES = "subtitles",
5
+ SETTINGS = "settings",
6
+ CONTEXT = "context",
7
+ FULLSCREEN = "fullscreen",
8
+ CHROMECAST = "chromecast"
9
+ }
@@ -0,0 +1,4 @@
1
+ import { DesktopButtonsRightIds } from './desktopButtonsRightIds';
2
+ export declare const desktopButtonsRightWeights: {
3
+ [key in DesktopButtonsRightIds]: number;
4
+ };
@@ -0,0 +1,37 @@
1
+ import type { ComponentType } from 'svelte';
2
+ import { GridTypes } from '../../constans';
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: ComponentType;
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
+ tooltipText?: string;
27
+ disabledTooltipContent?: string;
28
+ className?: string;
29
+ }
30
+ export interface AdditionalDesktopControlPanelButton extends BaseAdditionalButton {
31
+ type: ControlButtonType.DESKTOP_CONTROL_PANEL_RIGHT;
32
+ tooltipText?: string;
33
+ disabledTooltipContent?: string;
34
+ hideOnDesktopGridTypes?: GridTypes[];
35
+ }
36
+ export type AdditionalButton = AdditionalDesktopControlPanelButton;
37
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AdditionalDesktopControlPanelButton, DesktopControlPanelButton } from '../types';
2
+ export declare const isInnerButtonGuard: (btn: DesktopControlPanelButton | AdditionalDesktopControlPanelButton) => btn is DesktopControlPanelButton;
package/types/config.d.ts CHANGED
@@ -102,12 +102,14 @@ export interface IUIConfig {
102
102
  saveDebugInfoToFile: boolean;
103
103
  saveTraceInfoToFile: boolean;
104
104
  additionalButtons: boolean;
105
+ additionalButtonsDesktopControlPanelRight: boolean;
105
106
  additionalSettingsMenuItems: boolean;
106
107
  additionalContextMenuItems: boolean;
107
108
  contextMenuButton: boolean;
108
109
  audioLanguages: boolean;
109
110
  saveRate: boolean;
110
111
  fullscreenInternalTargetPlayerContainer: boolean;
112
+ autoplayNext: boolean;
111
113
  };
112
114
  interactive: {
113
115
  historyMaxLength: number;
@@ -18,7 +18,8 @@ export declare enum Controls {
18
18
  VK_BUTTON = "VK_BUTTON",
19
19
  EPISODE_BUTTON = "EPISODE_BUTTON",
20
20
  INCREMENT_PLAYBACK_RATE = "INCREMENT_PLAYBACK_RATE",
21
- DECREMENT_PLAYBACK_RATE = "DECREMENT_PLAYBACK_RATE"
21
+ DECREMENT_PLAYBACK_RATE = "DECREMENT_PLAYBACK_RATE",
22
+ AUTOPLAY_NEXT_TOGGLE = "AUTOPLAY_NEXT_TOGGLE"
22
23
  }
23
24
  export declare const PLAYER_CONTROLS_HEIGHT = 40;
24
25
  export declare const PLAYER_CONTROLS_DESKTOP_MARGIN_LEFT_ELEMENTS = 4;
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VKVideoPlayer } from './VKVideoPlayer';
2
- import type { IVKVideoPlayerConfig, IControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, IVideoLive, IInteractiveData, AdditionalButton } from './types';
2
+ import type { IVKVideoPlayerConfig, IControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, IVideoLive, IInteractiveData, AdditionalButtonDeprecated } from './types';
3
3
  import { GridTypes } from './constans';
4
4
  import type { LanguagePack, LanguageConfig } from './translation/types';
5
5
  import type { ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek } from '@vkontakte/videoplayer-core';
@@ -7,7 +7,8 @@ import type { Milliseconds, QualityLimits } from '@vkontakte/videoplayer-shared'
7
7
  export { VERSION } from './env';
8
8
  export declare const registerPlayerWebComponent: () => void;
9
9
  export { type AdditionalSettingsMenuItem, MenuItemType, type AdditionalClickSettingsMenuItem, type AdditionalSwitchSettingsMenuItem, type AdditionalContextMenuItem, } from './components/Menus/types';
10
- export type { VKVideoPlayer, IVKVideoPlayerConfig, IControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek, LanguagePack, LanguageConfig, Milliseconds, IVideoLive, IInteractiveData, AdditionalButton, QualityLimits, };
10
+ export { type AdditionalButton, ControlButtonType, } from './components/Controls/types';
11
+ export type { VKVideoPlayer, IVKVideoPlayerConfig, IControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek, LanguagePack, LanguageConfig, Milliseconds, IVideoLive, IInteractiveData, AdditionalButtonDeprecated, QualityLimits, };
11
12
  export { GridTypes, };
12
13
  export { InterfaceLanguage, VKNumericLanguage, loadVKLangPack, } from '@vkontakte/videoplayer-shared';
13
14
  export { VideoQuality, VideoFormat, } from '@vkontakte/videoplayer-core';
@@ -7,12 +7,13 @@ import { type InteractiveRange } from '@vkontakte/videoplayer-interactive';
7
7
  import type { Readable, Writable } from 'svelte/store';
8
8
  import { AdmanWrapper } from '../components/Ads/admanWrapper';
9
9
  import type { LanguageConfig } from '../translation/types';
10
- import type { AdditionalButton, ControlsKeys, HotKeyMapData, IAnnotationsApi, IControlInfo, IDisabledControls, IInteractiveData, IPictureInPictureApi, IPlayerPhase, ITimelinePreviewThumbsData, IVideoEpisode, IVKVideoPlayerCallbacks, IVKVideoPlayerUICallbacks, Position, VideoPlaybackRate, VideoQualityForRender, VideoQualityUI, VideoSubtitle, VideoSubtitleParsed } from '../types';
10
+ import type { AdditionalButtonDeprecated, ControlsKeys, HotKeyMapData, IAnnotationsApi, IControlInfo, IDisabledControls, IInteractiveData, IPictureInPictureApi, IPlayerPhase, ITimelinePreviewThumbsData, IVideoEpisode, IVKVideoPlayerCallbacks, IVKVideoPlayerUICallbacks, Position, VideoPlaybackRate, VideoQualityForRender, VideoQualityUI, VideoSubtitle, VideoSubtitleParsed } from '../types';
11
11
  import { AdsPlaybackState, PictureInPictureType } from '../types';
12
12
  import type { DebugData } from './utils';
13
13
  import { GridTypes, type PlayPrevChapterDisabledTooltipKey } from '../constans';
14
14
  import { UIOneStat } from '../services/statistics';
15
15
  import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem, ContextMenuItem, SettingsMenuItem } from '../components/Menus/types';
16
+ import type { AdditionalButton, AdditionalDesktopControlPanelButton } from '../components/Controls/types';
16
17
  export interface IAdsState {
17
18
  position: Writable<number>;
18
19
  duration: Writable<number>;
@@ -45,6 +46,7 @@ export interface IUIState {
45
46
  vkLogo: Writable<IControlInfo | undefined>;
46
47
  interactiveTimeIndicator: Writable<IControlInfo | undefined>;
47
48
  timeline: Writable<IControlInfo | undefined>;
49
+ autoplayNextToggle: Writable<IControlInfo | undefined>;
48
50
  disabledControls$: IDisabledControls;
49
51
  additionalButtons: Writable<IControlInfo | undefined>[];
50
52
  };
@@ -88,11 +90,13 @@ export interface IUIState {
88
90
  pictureInPictureType$: Readable<PictureInPictureType>;
89
91
  currentGridType$: Readable<GridTypes>;
90
92
  interactiveHideMobileControls: Writable<boolean>;
91
- additionalButtons$: Readable<AdditionalButton[]>;
93
+ additionalButtonsDeprecated$: Readable<AdditionalButtonDeprecated[]>;
94
+ additionalDesktopControlPanelRightButtons$: Readable<AdditionalDesktopControlPanelButton[]>;
92
95
  additionalSettingsMenuItems$: Readable<SettingsMenuItem[]>;
93
96
  additionalContextMenuItems$: Readable<ContextMenuItem[]>;
94
97
  overlayContainer$: Writable<HTMLDivElement | undefined>;
95
98
  startedByKeyboard$: Writable<boolean>;
99
+ autoplayNextEnabled$: Writable<boolean>;
96
100
  }
97
101
  export interface IWebApi {
98
102
  pictureInPictureApi?: IPictureInPictureApi;
@@ -175,6 +179,7 @@ export interface IStore {
175
179
  internal: {
176
180
  preload: () => void;
177
181
  firstStart: (showAds: boolean) => void;
182
+ play: () => void;
178
183
  pause: () => void;
179
184
  togglePlay: () => void;
180
185
  toggleMuted: () => void;
@@ -234,6 +239,7 @@ export interface IStore {
234
239
  stopPlayer?: () => void;
235
240
  setLooped: (isLooped: boolean) => void;
236
241
  reportProblem: () => void;
242
+ setAutoplayNextEnabled: (autoplayNext: boolean) => void;
237
243
  };
238
244
  external: {
239
245
  firstStart: (showAds: boolean) => void;
@@ -253,6 +259,9 @@ export interface IStore {
253
259
  updateAdditionalContextItem: (itemId: string, fields: Partial<Omit<AdditionalContextMenuItem, 'id'>>) => void;
254
260
  addAdditionalContextItem: (newItem: AdditionalContextMenuItem) => void;
255
261
  removeAdditionalContextItem: (itemId: string) => void;
262
+ updateAdditionalButton: (itemId: string, fields: Partial<Omit<AdditionalButton, 'id' | 'type'>>) => void;
263
+ addAdditionalButton: (newButton: AdditionalButton) => void;
264
+ removeAdditionalButton: (itemId: string) => void;
256
265
  };
257
266
  };
258
267
  callbacks?: IVKVideoPlayerCallbacks;
@@ -285,7 +294,7 @@ interface IStoreParams {
285
294
  hasInteractiveBranches?: boolean;
286
295
  disabledControls: ControlsKeys;
287
296
  playPrevChapterDisabledTooltip: PlayPrevChapterDisabledTooltipKey;
288
- additionalButtons: AdditionalButton[];
297
+ additionalButtons: Array<AdditionalButtonDeprecated | AdditionalDesktopControlPanelButton>;
289
298
  additionalSettingsMenuItems: AdditionalSettingsMenuItem[];
290
299
  additionalContextMenuItems: AdditionalContextMenuItem[];
291
300
  looped?: boolean;
@@ -4,5 +4,5 @@ export declare class BaseMicroStore<StateName extends keyof IMicroStores = keyof
4
4
  readonly stateName: StateName;
5
5
  state$: IMicroStores[StateName];
6
6
  subscription: Subscription;
7
- init({ store, microStores, config }: InitMicroStoreParams): Subscription;
7
+ init({ store, microStores, interactiveController, config }: InitMicroStoreParams): Subscription;
8
8
  }
@@ -0,0 +1,15 @@
1
+ import { BaseMicroStore } from './base';
2
+ import type { InitMicroStoreParams } from '../../types';
3
+ import { GridTypes } from '../../constans';
4
+ export default class GraphIsOpened extends BaseMicroStore {
5
+ readonly stateName = "graphIsOpened$";
6
+ private graphMadePause;
7
+ state$: {
8
+ toggle: () => void;
9
+ set(this: void, value: boolean | null): void;
10
+ update(this: void, updater: import("svelte/store").Updater<boolean | null>): void;
11
+ subscribe(this: void, run: import("svelte/store").Subscriber<boolean | null>, invalidate?: import("svelte/store").Invalidator<boolean | null> | undefined): import("svelte/store").Unsubscriber;
12
+ };
13
+ checkIfShouldHide: (currentGridType: GridTypes) => boolean;
14
+ init(initStoreParams: InitMicroStoreParams): import("@vkontakte/videoplayer-shared").Subscription;
15
+ }
@@ -2,7 +2,8 @@ import type { Readable } from 'svelte/store';
2
2
  import type { IValueObservable } from '@vkontakte/videoplayer-shared';
3
3
  import type { IPlayer, IConfig, IObservable } from '@vkontakte/videoplayer-core';
4
4
  import type { IStore } from '.';
5
- import type { IMicroStores } from '../types';
5
+ import type { AdditionalButtonDeprecated, IMicroStores } from '../types';
6
+ import type { AdditionalDesktopControlPanelButton } from '../components/Controls/types';
6
7
  export declare const setStores: (store: IStore, microStores: IMicroStores) => void;
7
8
  export declare const getStore: () => IStore;
8
9
  export declare const getMicroStores: () => IMicroStores;
@@ -33,6 +34,8 @@ export type DebugData = {
33
34
  };
34
35
  export declare const constructDebugPanelData: (player: IPlayer, config: IConfig, store: IStore) => DebugData;
35
36
  export declare const fetchVideoFile: (url: string, filename: string) => void;
37
+ export declare const isDeprecatedAdditionalButtonGuard: (btn: AdditionalButtonDeprecated | AdditionalDesktopControlPanelButton) => btn is AdditionalButtonDeprecated;
38
+ export declare const isAdditionalButtonGuard: (btn: AdditionalButtonDeprecated | AdditionalDesktopControlPanelButton) => btn is AdditionalDesktopControlPanelButton;
36
39
  export declare const createDequeCache: <T>() => {
37
40
  add: (key: string, value: T) => void;
38
41
  find: (key: string) => [string, T] | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { VideoQuality, VideoFormat, ISources, IExternalTextTrack } from '@vkontakte/videoplayer-core';
2
2
  import type { IValueObservable, InterfaceLanguage, Subscription } from '@vkontakte/videoplayer-shared';
3
- import type { Manifest, VideoInfo, InteractiveProjectInfo } from '@vkontakte/videoplayer-interactive';
3
+ import type { Manifest, VideoInfo, Interactives, InteractiveProjectInfo } from '@vkontakte/videoplayer-interactive';
4
4
  import { PlaybackState } from '@vkontakte/videoplayer-core';
5
5
  import type { Writable, Readable } from 'svelte/store';
6
6
  import type { ISDKConfig } from '../config';
@@ -69,6 +69,7 @@ export interface IVKVideoPlayerCallbacks {
69
69
  onLogoClicked?: () => void;
70
70
  onCopyEmbedCodeClicked?: () => string;
71
71
  onVSIDChanged?: (vsid?: string) => void;
72
+ onAutoplaySoundProhibited?: () => void;
72
73
  uiInfo?: {
73
74
  onControlsVisibleChanged?: (value?: boolean) => void;
74
75
  onIsMobileChanged?: (value?: boolean) => void;
@@ -183,7 +184,12 @@ export interface IInteractiveData {
183
184
  projectInfo?: InteractiveProjectInfo;
184
185
  tooltipHelpHintActive?: boolean;
185
186
  }
186
- export interface AdditionalButton {
187
+ /**
188
+ * @deprecated
189
+ *
190
+ * Старый механизм добавления кнопок, будет удален в будущих релизах
191
+ */
192
+ export interface AdditionalButtonDeprecated {
187
193
  iconUrl: string;
188
194
  onClick?: (event?: MouseEvent) => void;
189
195
  tooltip?: string;
@@ -230,7 +236,7 @@ export interface IVKVideoPlayerConfig {
230
236
  showThumbTimer?: boolean;
231
237
  is3DVideo?: boolean;
232
238
  callbacks?: IVKVideoPlayerCallbacks;
233
- additionalButtons?: AdditionalButton[];
239
+ additionalButtons?: AdditionalButtonDeprecated[];
234
240
  additionalSettingsMenuItems?: AdditionalSettingsMenuItem[];
235
241
  additionalContextMenuItems?: AdditionalContextMenuItem[];
236
242
  refDomain?: string;
@@ -271,6 +277,7 @@ export interface IPlayerControlsRef {
271
277
  vkLogo?: HTMLElement;
272
278
  interactiveTimeIndicator?: HTMLElement;
273
279
  timeline?: HTMLElement;
280
+ autoplayNextToggle?: HTMLElement;
274
281
  }
275
282
  export interface IPlayerDesktopControlsWidth {
276
283
  prevButton: number;
@@ -474,11 +481,13 @@ export interface IMicroStores {
474
481
  set: (newValue: boolean, useTimeout: boolean) => void;
475
482
  clearTimeout: () => void;
476
483
  };
484
+ graphIsOpened$: ToggleableMicroStore;
477
485
  }
478
486
  export interface InitMicroStoreParams {
479
487
  store: IStore;
480
488
  microStores: IMicroStores;
481
489
  config: IVKVideoPlayerConfig;
490
+ interactiveController?: Interactives;
482
491
  }
483
492
  export interface IMicroStore<StateName extends keyof IMicroStores = keyof IMicroStores> {
484
493
  readonly stateName: StateName;
@@ -1 +1 @@
1
- export declare const roundFps: (fps: number) => "" | 50 | 60 | 120 | 240;
1
+ export declare const roundFps: (fps: number) => 60 | "" | 50 | 120 | 240;
@@ -0,0 +1,5 @@
1
+ export declare const sortByWeightAsc: (a: {
2
+ weight: number;
3
+ }, b: {
4
+ weight: number;
5
+ }) => number;
@@ -13,3 +13,5 @@ export declare const getPreferredStreamLanguage: () => string | undefined;
13
13
  export declare const savePreferredStreamLanguage: (language: string) => void;
14
14
  export declare const savePreferredRate: (rate: PlaybackRate) => void;
15
15
  export declare const getPreferredRate: () => PlaybackRate | undefined;
16
+ export declare const savePreferredAutoplayNext: (autoplayNext: boolean) => void;
17
+ export declare const getPreferredAutoplayNext: () => boolean;