@vkontakte/videoplayer 1.1.91 → 1.1.92-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.
Files changed (62) hide show
  1. package/es2015.cjs +35 -39
  2. package/es2015.esm.js +35 -39
  3. package/esnext.cjs +35 -39
  4. package/esnext.esm.js +34 -38
  5. package/evergreen.esm.js +34 -38
  6. package/package.json +5 -5
  7. package/types/VKVideoPlayer/index.svelte.d.ts +0 -1
  8. package/types/components/Menus/constants/contextMenuItemIds.d.ts +0 -1
  9. package/types/components/Menus/constants/settingsMenuItemIds.d.ts +0 -1
  10. package/types/components/Menus/subMenuTabs/rootMenuItems.d.ts +0 -1
  11. package/types/components/Menus/subMenuTabs/types.d.ts +0 -1
  12. package/types/components/Root/types.d.ts +3 -4
  13. package/types/config.d.ts +9 -4
  14. package/types/constans/keyboard.d.ts +2 -0
  15. package/types/store/composition.d.ts +31 -0
  16. package/types/store/index.d.ts +1 -1
  17. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.module.d.ts +3 -0
  18. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.store.d.ts +26 -0
  19. package/types/store/modules/fakeIsPlayingStore/fakeIsPlayingStore.token.d.ts +3 -0
  20. package/types/store/modules/fakeIsPlayingStore/index.d.ts +3 -0
  21. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.module.d.ts +3 -0
  22. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.store.d.ts +50 -0
  23. package/types/store/modules/graphIsOpenedStore/graphIsOpenedStore.token.d.ts +3 -0
  24. package/types/store/modules/graphIsOpenedStore/index.d.ts +3 -0
  25. package/types/store/modules/index.d.ts +18 -0
  26. package/types/store/modules/infrastructure/index.d.ts +3 -0
  27. package/types/store/modules/infrastructure/infrastructure.module.d.ts +21 -0
  28. package/types/store/modules/infrastructure/infrastructure.token.d.ts +26 -0
  29. package/types/store/modules/interactiveControlsOpacityStore/index.d.ts +3 -0
  30. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.module.d.ts +3 -0
  31. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.store.d.ts +34 -0
  32. package/types/store/modules/interactiveControlsOpacityStore/interactiveControlsOpacityStore.token.d.ts +3 -0
  33. package/types/store/modules/notificationsStore/index.d.ts +3 -0
  34. package/types/store/modules/notificationsStore/notificationsStore.module.d.ts +3 -0
  35. package/types/store/modules/notificationsStore/notificationsStore.store.d.ts +34 -0
  36. package/types/store/modules/notificationsStore/notificationsStore.token.d.ts +3 -0
  37. package/types/store/modules/pictureInPictureStore/index.d.ts +3 -0
  38. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.module.d.ts +3 -0
  39. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.store.d.ts +42 -0
  40. package/types/store/modules/pictureInPictureStore/pictureInPictureStore.token.d.ts +3 -0
  41. package/types/store/modules/seekToInteractiveDisabledTooltipStore/index.d.ts +3 -0
  42. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.module.d.ts +3 -0
  43. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.store.d.ts +26 -0
  44. package/types/store/modules/seekToInteractiveDisabledTooltipStore/seekToInteractiveDisabledTooltipStore.token.d.ts +3 -0
  45. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/index.d.ts +3 -0
  46. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.module.d.ts +3 -0
  47. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.store.d.ts +44 -0
  48. package/types/store/modules/showInteractiveTimeIndicatorTooltipStore/showInteractiveTimeIndicatorTooltipStore.token.d.ts +3 -0
  49. package/types/store/modules/utils.d.ts +6 -0
  50. package/types/store/types.d.ts +14 -8
  51. package/types/store/utils.d.ts +5 -5
  52. package/types/types/index.d.ts +12 -54
  53. package/types/utils/webAPI/pictureInPictureApi/documentPictureInPictureApi.svelte.d.ts +5 -2
  54. package/types/store/micro/base.d.ts +0 -8
  55. package/types/store/micro/fakeIsPlaying.d.ts +0 -10
  56. package/types/store/micro/graphIsOpened.d.ts +0 -13
  57. package/types/store/micro/index.d.ts +0 -2
  58. package/types/store/micro/interactiveControlsOpacity.d.ts +0 -10
  59. package/types/store/micro/notifications.d.ts +0 -9
  60. package/types/store/micro/pictureInPicture.d.ts +0 -8
  61. package/types/store/micro/seekToInteractiveDisabledTooltip.d.ts +0 -10
  62. package/types/store/micro/showInteractiveTimeIndicatorTooltip.d.ts +0 -15
@@ -0,0 +1,6 @@
1
+ import type { IDIContainer, InjectionToken } from "@vkontakte/videoplayer-shared";
2
+ export type Module<T> = {
3
+ token: InjectionToken<T>;
4
+ factory: (container: IDIContainer) => T;
5
+ };
6
+ export declare const registerModules: <T extends any[]>(container: IDIContainer, modules: { [K in keyof T] : Module<T[K]> }) => void;
@@ -15,19 +15,21 @@ import type { FocusManager } from "../utils/webAPI/focusManager";
15
15
  import type { ISDKConfig, IUIConfig } from "../config";
16
16
  import type { IUIStatistics } from "../services/statistics";
17
17
  import type { DebugData } from "./utils";
18
+ import type { ICompositionResult } from "./composition";
18
19
  export interface SetQualityInfo {
19
20
  appliesTo?: QualitySettingsAppliesTo;
20
21
  changeReason?: "default" | "limit-changed";
21
22
  byUser?: boolean;
22
23
  }
23
- export interface IAdsState {
24
- position: Writable<number>;
25
- duration: Writable<number>;
26
- playbackState: Writable<AdsPlaybackState>;
27
- canSkip: Writable<boolean>;
28
- secondsToWatchBeforeSkip: Writable<number>;
29
- postrollPassed: Writable<boolean>;
24
+ export interface IAdsStateValues {
25
+ position: number;
26
+ duration: number;
27
+ playbackState: AdsPlaybackState;
28
+ canSkip: boolean;
29
+ secondsToWatchBeforeSkip: number;
30
+ postrollPassed: boolean;
30
31
  }
32
+ export type IAdsState = { [K in keyof IAdsStateValues] : Writable<IAdsStateValues[K]> };
31
33
  export interface IUIState {
32
34
  t: (key: Key, params?: Record<string, string>) => string;
33
35
  isMinimalView$: Writable<boolean>;
@@ -259,7 +261,6 @@ export interface IStoreInternalActions {
259
261
  setLiveWaitingRecord: (state: boolean) => void;
260
262
  clearDelayedBufferingCheckTimeout: () => void;
261
263
  getDebugTextData: () => string;
262
- getTraceTextData: () => string;
263
264
  getDebugPanelData: () => DebugData;
264
265
  getVideoElement: () => HTMLVideoElement | null;
265
266
  startLogging: () => void;
@@ -356,6 +357,7 @@ export interface IStore {
356
357
  callbacks?: IVKVideoPlayerCallbacks;
357
358
  setUiCallbacks: (uiCallbacks: IVKVideoPlayerUICallbacks) => void;
358
359
  initAdmanWrapper: VoidFunction;
360
+ resetAdsState: VoidFunction;
359
361
  updateAdmanWrapperSubscriptions: VoidFunction;
360
362
  updateStatisticsSubscriptions: VoidFunction;
361
363
  updateAppTracerSubscriptions: VoidFunction;
@@ -363,6 +365,10 @@ export interface IStore {
363
365
  getPlayer: () => IPlayer;
364
366
  destroy(): void;
365
367
  }
368
+ export type EnrichedStore = IStore & {
369
+ stores: ICompositionResult["stores"];
370
+ destroyComposedStore: () => void;
371
+ };
366
372
  export interface IStoreParams {
367
373
  interfaceLanguage: InterfaceLanguage | string;
368
374
  isCyrillicRelatedInterface: boolean;
@@ -1,13 +1,12 @@
1
1
  import type { Readable } from "svelte/store";
2
2
  import type { IValueObservable } from "@vkontakte/videoplayer-shared";
3
3
  import type { IPlayer, IConfig, IObservable } from "@vkontakte/videoplayer-core";
4
- import type { IStore } from "./types";
5
- import type { AdditionalButtonDeprecated, IMicroStores } from "../types";
4
+ import type { EnrichedStore, IAdsStateValues, IStore } from "./types";
5
+ import { type AdditionalButtonDeprecated } from "../types";
6
6
  import type { AdditionalDesktopControlPanelButton } from "../components/Controls/types";
7
7
  import type { ISDKConfig } from "../config";
8
- export declare const setStores: (store: IStore, microStores: IMicroStores) => void;
9
- export declare const getStore: () => IStore;
10
- export declare const getMicroStores: () => IMicroStores;
8
+ export declare const setStores: (store: EnrichedStore) => void;
9
+ export declare const getStore: () => EnrichedStore;
11
10
  /**
12
11
  * Создаёт readable store svelte'а из `IObservableValue` sdk
13
12
  */
@@ -51,3 +50,4 @@ export declare class SubtitlesDownloader {
51
50
  destroy(): void;
52
51
  isDestroyed(): boolean;
53
52
  }
53
+ export declare const getAdsDefaultStateValues: () => IAdsStateValues;
@@ -1,13 +1,11 @@
1
1
  import type { VideoQuality, VideoFormat, ISources, IExternalTextTrack, IAudioStream } from "@vkontakte/videoplayer-core";
2
- import type { IValueObservable, InterfaceLanguage, Subscription, IRectangle, DevNullEntry } from "@vkontakte/videoplayer-shared";
3
- import type { Chapter, Manifest, ManifestVideo, VideoInfo, Interactives, IInteractiveOptions } from "@vkontakte/videoplayer-interactive";
2
+ import type { IValueObservable, InterfaceLanguage, IRectangle, DevNullEntry } from "@vkontakte/videoplayer-shared";
3
+ import type { Chapter, Manifest, ManifestVideo, VideoInfo, IInteractiveOptions } from "@vkontakte/videoplayer-interactive";
4
4
  import type { PlaybackState } from "@vkontakte/videoplayer-core";
5
5
  import type { MediascopePixelTypes, SeekAction, ThinOneStat } from "@vkontakte/videoplayer-statistics";
6
6
  import type { Writable, Readable } from "svelte/store";
7
- import type { IDpipConfig, ISDKConfig, IUIConfig } from "../config";
8
- import type { IStore } from "../store";
7
+ import type { IDpipConfig, ISDKConfig } from "../config";
9
8
  import type { Controls, GridTypes } from "../constans";
10
- import { type SeekToInteractiveDisabledTooltipKey } from "../constans";
11
9
  import type { Key } from "../translation/types";
12
10
  import type { IUIStatistics } from "../services/statistics";
13
11
  import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem } from "../components/Menus/subMenuTabs/types";
@@ -41,6 +39,7 @@ export interface IVKVideoPlayerCallbacks {
41
39
  onPlay?: () => void;
42
40
  onLooped?: () => void;
43
41
  onPause?: () => void;
42
+ onFinished?: () => void;
44
43
  onVolumeChange?: (volume: number) => void;
45
44
  onFullscreenEnter?: () => void;
46
45
  onFullscreenExit?: () => void;
@@ -157,6 +156,12 @@ export interface IVKVideoPlayerCallbacks {
157
156
  onTitleChanged?: (value?: IControlInfo) => void;
158
157
  onControlWillChange?: (params: ControlWillChangeParams) => void;
159
158
  onPreviewTimelineActiveChanged?: (active: boolean) => void;
159
+ onSubtitlesInfo?: (value: {
160
+ subtitlesLineCount?: number;
161
+ bottomOffest: number;
162
+ height: number;
163
+ visible: boolean;
164
+ }) => void;
160
165
  };
161
166
  adsInfo?: {
162
167
  onLoadStarted?: () => void;
@@ -488,12 +493,13 @@ export interface ExternalPictureInPictureEventHandlers {
488
493
  resize?: (size: Size) => void;
489
494
  }
490
495
  export interface IPictureInPictureApi {
496
+ info: IPictureInPictureApiInfo;
497
+ dpipConfig?: IDpipConfig;
491
498
  isSupported(): boolean;
492
499
  isActive(): boolean;
493
500
  setContext(svelteContext: Map<unknown, unknown>): void;
494
501
  request(): Promise<void>;
495
502
  exit(): Promise<void>;
496
- info: IPictureInPictureApiInfo;
497
503
  setEnabled(enabled: boolean): void;
498
504
  dispose(): Promise<void>;
499
505
  assignPlayerContainer(playerContainer: HTMLElement): void;
@@ -605,54 +611,6 @@ export declare enum EpisodesModes {
605
611
  COUNT = "COUNT",
606
612
  SHORT = "SHORT"
607
613
  }
608
- export type IToggleable<T> = T & {
609
- toggle: () => void;
610
- };
611
- type MicroStoreWritableBase<T = unknown> = Writable<T>;
612
- type ToggleableMicroStore = IToggleable<MicroStoreWritableBase<boolean | null>>;
613
- export type PictureInPictureMicroStore = {
614
- isActive$: Writable<boolean>;
615
- isEnabled$: Writable<boolean>;
616
- type$: Writable<PictureInPictureType | undefined>;
617
- };
618
- export type NotificationsMicroStore = {
619
- notificationsToShow$: Writable<Partial<Record<NotificationId, boolean>>>;
620
- showNotification: (id: NotificationId) => void;
621
- closeNotification: (id: NotificationId) => void;
622
- };
623
- export type PreviewPlayerMicroStore = {
624
- timelineActive$: Writable<boolean>;
625
- };
626
- export interface IMicroStores {
627
- fakeIsPlaying$: ToggleableMicroStore;
628
- interactiveControlsOpacity$: ToggleableMicroStore;
629
- seekToInteractiveDisabledTooltip$: MicroStoreWritableBase<SeekToInteractiveDisabledTooltipKey>;
630
- showInteractiveTimeIndicatorTooltip$: MicroStoreWritableBase<boolean> & {
631
- set: (newValue: boolean, useTimeout: boolean) => void;
632
- clearTimeout: () => void;
633
- };
634
- graphIsOpened$: ToggleableMicroStore;
635
- pictureInPicture$: PictureInPictureMicroStore;
636
- notifications$: NotificationsMicroStore;
637
- previewPlayer$: PreviewPlayerMicroStore;
638
- }
639
- export interface InitMicroStoreParams {
640
- store: IStore;
641
- microStores: IMicroStores;
642
- uiConfig: IUIConfig;
643
- interactiveController?: Interactives;
644
- interactiveData?: IInteractiveData;
645
- }
646
- export interface IMicroStore<StateName extends keyof IMicroStores = keyof IMicroStores> {
647
- readonly stateName: StateName;
648
- state$: IMicroStores[StateName];
649
- subscription: Subscription;
650
- init: (initStoreParams: InitMicroStoreParams) => Subscription;
651
- }
652
- export type IMicroStoresRoot = {
653
- subscribers: IMicroStore[];
654
- stores: IMicroStores;
655
- };
656
614
  export type Position = {
657
615
  top?: number;
658
616
  left?: number;
@@ -1,8 +1,9 @@
1
1
  import { ValueSubject } from "@vkontakte/videoplayer-shared";
2
+ import type { IDpipConfig } from "../../../config";
2
3
  import type { ExternalPictureInPictureEventHandlers, IPictureInPictureApi, PictureInPictureSettings } from "../../../types";
3
4
  import { PictureInPictureType } from "../../../types";
4
5
  export declare class DocumentPictureInPictureApiSvelte implements IPictureInPictureApi {
5
- private readonly initialSize;
6
+ readonly settings: PictureInPictureSettings;
6
7
  private playerDomElement;
7
8
  private playerParentShadowRoot;
8
9
  private playerDummyElement;
@@ -18,7 +19,8 @@ export declare class DocumentPictureInPictureApiSvelte implements IPictureInPict
18
19
  */
19
20
  private pipActive;
20
21
  private readonly pipApi;
21
- constructor({ enabled, initialSize }: PictureInPictureSettings);
22
+ constructor(settings: PictureInPictureSettings);
23
+ get dpipConfig(): IDpipConfig;
22
24
  /**
23
25
  * Флаг показывает, есть ли в целом возможность использовать dpip в данном браузере, поддерживается ли это.
24
26
  */
@@ -39,6 +41,7 @@ export declare class DocumentPictureInPictureApiSvelte implements IPictureInPict
39
41
  assignPlayerContainer(playerContainer: HTMLElement): void;
40
42
  updateVideoElement(): void;
41
43
  setExternalEventHandlers(externalEventHandlers: ExternalPictureInPictureEventHandlers): void;
44
+ private get initialSize();
42
45
  private createStretchedContainer;
43
46
  }
44
47
  export declare function isInstanceOfDocumentPictureInPictureApi(pictureInPictureApi?: IPictureInPictureApi): pictureInPictureApi is DocumentPictureInPictureApiSvelte;
@@ -1,8 +0,0 @@
1
- import { Subscription } from "@vkontakte/videoplayer-shared";
2
- import type { IMicroStore, IMicroStores, InitMicroStoreParams } from "../../types";
3
- export declare class BaseMicroStore<StateName extends keyof IMicroStores = keyof IMicroStores> implements IMicroStore {
4
- readonly stateName: StateName;
5
- state$: IMicroStores[StateName];
6
- subscription: Subscription;
7
- init({ store, microStores, interactiveController, interactiveData }: InitMicroStoreParams): Subscription;
8
- }
@@ -1,10 +0,0 @@
1
- import { type Writable } from "svelte/store";
2
- import { BaseMicroStore } from "./base";
3
- import type { InitMicroStoreParams, IToggleable } from "../../types";
4
- import type { Subscription } from "@vkontakte/videoplayer-shared";
5
- type ToggleableMicroStore = IToggleable<Writable<boolean | null>>;
6
- export default class FakeIsPlaying extends BaseMicroStore {
7
- readonly stateName = "fakeIsPlaying$";
8
- state$: ToggleableMicroStore;
9
- init(initStoreParams: InitMicroStoreParams): Subscription;
10
- }
@@ -1,13 +0,0 @@
1
- import { type Writable } from "svelte/store";
2
- import type { Subscription } from "@vkontakte/videoplayer-shared";
3
- import { BaseMicroStore } from "./base";
4
- import type { InitMicroStoreParams, IToggleable } from "../../types";
5
- import { GridTypes } from "../../constans";
6
- type ToggleableMicroStore = IToggleable<Writable<boolean | null>>;
7
- export default class GraphIsOpened extends BaseMicroStore {
8
- readonly stateName = "graphIsOpened$";
9
- private graphMadePause;
10
- state$: ToggleableMicroStore;
11
- checkIfShouldHide: (currentGridType: GridTypes) => boolean;
12
- init(initStoreParams: InitMicroStoreParams): Subscription;
13
- }
@@ -1,2 +0,0 @@
1
- import type { IMicroStoresRoot } from "../../types";
2
- export declare const createMicroStoresRoot: () => IMicroStoresRoot;
@@ -1,10 +0,0 @@
1
- import { type Writable } from "svelte/store";
2
- import { BaseMicroStore } from "./base";
3
- import type { InitMicroStoreParams, IToggleable } from "../../types";
4
- import type { Subscription } from "@vkontakte/videoplayer-shared";
5
- type ToggleableMicroStore = IToggleable<Writable<boolean | null>>;
6
- export default class InteractiveControlsOpacity extends BaseMicroStore {
7
- readonly stateName = "interactiveControlsOpacity$";
8
- state$: ToggleableMicroStore;
9
- init(initStoreParams: InitMicroStoreParams): Subscription;
10
- }
@@ -1,9 +0,0 @@
1
- import { BaseMicroStore } from "./base";
2
- import { type InitMicroStoreParams, type NotificationsMicroStore } from "../../types";
3
- import type { Subscription } from "@vkontakte/videoplayer-shared";
4
- export default class Notifications extends BaseMicroStore {
5
- readonly stateName = "notifications$";
6
- private notificationManager;
7
- state$: NotificationsMicroStore;
8
- init(initStoreParams: InitMicroStoreParams): Subscription;
9
- }
@@ -1,8 +0,0 @@
1
- import { BaseMicroStore } from "./base";
2
- import type { InitMicroStoreParams, PictureInPictureMicroStore } from "../../types";
3
- import type { Subscription } from "@vkontakte/videoplayer-shared";
4
- export default class PictureInPicture extends BaseMicroStore {
5
- readonly stateName = "pictureInPicture$";
6
- state$: PictureInPictureMicroStore;
7
- init(initStoreParams: InitMicroStoreParams): Subscription;
8
- }
@@ -1,10 +0,0 @@
1
- import { BaseMicroStore } from "./base";
2
- import { type Writable } from "svelte/store";
3
- import type { SeekToInteractiveDisabledTooltipKey } from "../../constans";
4
- import type { InitMicroStoreParams } from "../../types";
5
- import type { Subscription } from "@vkontakte/videoplayer-shared";
6
- export default class SeekToInteractiveDisabledTooltip extends BaseMicroStore {
7
- readonly stateName = "seekToInteractiveDisabledTooltip$";
8
- state$: Writable<SeekToInteractiveDisabledTooltipKey>;
9
- init(initStoreParams: InitMicroStoreParams): Subscription;
10
- }
@@ -1,15 +0,0 @@
1
- import { type Writable } from "svelte/store";
2
- import { BaseMicroStore } from "./base";
3
- import type { InitMicroStoreParams } from "../../types";
4
- import type { Subscription } from "@vkontakte/videoplayer-shared";
5
- type ShowInteractiveTimeIndicatorTooltipState = Writable<boolean> & {
6
- set: (newValue: boolean, useTimeout?: boolean) => void;
7
- clearTimeout: () => void;
8
- };
9
- export default class ShowInteractiveTimeIndicatorTooltip extends BaseMicroStore {
10
- readonly stateName = "showInteractiveTimeIndicatorTooltip$";
11
- private timeout;
12
- state$: ShowInteractiveTimeIndicatorTooltipState;
13
- init(initStoreParams: InitMicroStoreParams): Subscription;
14
- clearTimeout(): void;
15
- }