@vkontakte/videoplayer 1.1.88 → 1.1.89-dev.fdf6110f.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.88",
3
+ "version": "1.1.89-dev.fdf6110f.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -25,16 +25,6 @@
25
25
  "import": "./esnext.esm.js",
26
26
  "require": "./esnext.cjs"
27
27
  },
28
- "./es2024": {
29
- "types": "./types/index.d.ts",
30
- "import": "./es2024.esm.js",
31
- "require": "./es2024.cjs"
32
- },
33
- "./es2018": {
34
- "types": "./types/index.d.ts",
35
- "import": "./es2018.esm.js",
36
- "require": "./es2018.cjs"
37
- },
38
28
  "./es2015": {
39
29
  "types": "./types/index.d.ts",
40
30
  "import": "./es2015.esm.js",
@@ -43,8 +33,6 @@
43
33
  "./evergreen.esm.js": "./evergeen.esm.js",
44
34
  "./esnext.esm.js": "./esnext.esm.js",
45
35
  "./esnext.cjs": "./esnext.cjs",
46
- "./es2018.esm.js": "./es2018.esm.js",
47
- "./es2018.cjs": "./es2018.cjs",
48
36
  "./es2015.esm.js": "./es2015.esm.js",
49
37
  "./es2015.cjs": "./es2015.cjs"
50
38
  },
@@ -55,9 +43,9 @@
55
43
  ],
56
44
  "dependencies": {
57
45
  "@adtech/rbadman": "2.2.57",
58
- "@vkontakte/videoplayer-core": "2.0.157",
59
- "@vkontakte/videoplayer-interactive": "1.0.63",
60
- "@vkontakte/videoplayer-shared": "1.0.86",
61
- "@vkontakte/videoplayer-statistics": "1.0.103"
46
+ "@vkontakte/videoplayer-core": "2.0.158-dev.fdf6110f.0",
47
+ "@vkontakte/videoplayer-interactive": "1.0.64-dev.fdf6110f.0",
48
+ "@vkontakte/videoplayer-shared": "1.0.87-dev.fdf6110f.0",
49
+ "@vkontakte/videoplayer-statistics": "1.0.104-dev.fdf6110f.0"
62
50
  }
63
51
  }
@@ -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 {};
@@ -1,10 +1,10 @@
1
1
  import type { ISDKConfig } from "../config";
2
2
  import type { LanguageConfig } from "../translation/types";
3
- import type { IVideoData, IVKVideoPlayerConfig } from "../types";
3
+ import type { IUpdatableVKVideoPlayerConfig, IVideoData, IVKVideoPlayerConfig } from "../types";
4
4
  import { type QualityLimits, type Seconds } from "@vkontakte/videoplayer-shared";
5
- import { InterfaceLanguage } from "@vkontakte/videoplayer-shared";
6
- import { type PlaybackRate } from "@vkontakte/videoplayer-core";
7
- import type { IStatContext } from "@vkontakte/videoplayer-statistics";
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
8
  import { ThinOneStat } from "@vkontakte/videoplayer-statistics";
9
9
  import { AnnotationsApi } from "../utils/webAPI/annotationsApi/annotationsApi";
10
10
  import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem } from "../components/Menus/subMenuTabs/types";
@@ -22,6 +22,8 @@ export declare class VKVideoPlayer extends HTMLElement {
22
22
  private store?;
23
23
  private microStoresRoot?;
24
24
  private statistics?;
25
+ private appTracer?;
26
+ private admanWrapper?;
25
27
  private _shadowRoot;
26
28
  private playerContainer;
27
29
  private rootContainer;
@@ -50,6 +52,7 @@ export declare class VKVideoPlayer extends HTMLElement {
50
52
  private focusManager;
51
53
  private prevIsid;
52
54
  private isInited;
55
+ private videoStarted;
53
56
  private postponedInitParams;
54
57
  private internalsExposure;
55
58
  private shadowDOMCallbacksDisabled;
@@ -64,19 +67,49 @@ export declare class VKVideoPlayer extends HTMLElement {
64
67
  private isPrevButtonActive;
65
68
  private isControlDisabled;
66
69
  private getNextVideoInfo;
67
- private createOneStat;
70
+ private readonly createOneStat;
68
71
  private createThinOneStat;
72
+ private createStatisticsForVideo;
73
+ private createAppTracerForVideo;
74
+ private createAdsParamsForVideo;
69
75
  private createPlayer;
76
+ private readonly handleDomReady;
77
+ private readonly firstStart;
78
+ private initVideo;
79
+ private initQualitySettings;
80
+ private get shouldLoop();
81
+ private get isMobile();
70
82
  private get useMinimalViewForDpip();
83
+ private get shouldKeepPlayerElement();
71
84
  private addPlayerInfoSubscriptions;
72
85
  playNextVideo(): void;
73
86
  playPrevVideo(): void;
87
+ /**
88
+ * !!! Сейчас нее будет полноценно работать,
89
+ * потому что часть полей которые реально относятся к видео передаются в videoConfig
90
+ * А videoConfig формируется в слое интеграции.
91
+ * В частности: adsParams, canDownload, failoverHosts, volumeMultiplier...
92
+ * @private
93
+ */
94
+ private updatePlayerWithCurrentVideo;
74
95
  private createPlayerWithCurrentVideo;
75
96
  private playPrevChapter;
76
97
  private seekToInteractive;
77
98
  private initInteractives;
99
+ private checkVideosList;
100
+ /**
101
+ * Lagacy comment:
102
+ * А это из-за проблем архитектуры
103
+ * videoConfig - настройки экземпляра плеера для конкретного видео, sdkConfig.ui – настройки поведения плеера для всех
104
+ * Фичи включаются как суперпозиция этих двух конфигов.
105
+ * Из-за того что Root и Store – два источника правды синхронизировать конфиги придётся здесь переопределением дописывая поля из sdkConfig в videoConfig
106
+ * TODO: структурировать поток данных в рамках VP-958: Конфиги -> стор -> Root
107
+ */
108
+ private overrideVideoConfigFromUIConfig;
78
109
  initPlayer(videoConfig: IVKVideoPlayerConfig, sdkConfig?: Partial<ISDKConfig>): void;
110
+ updatePlayer(videoConfig: IUpdatableVKVideoPlayerConfig): void;
79
111
  private isOneVideoPlaylist;
112
+ private updateRootPropsAfterPlaylistChanged;
80
113
  private updateVideos;
81
114
  /**
82
115
  * Обновление плейлиста. Будут перезаписаны все видео до текущего
@@ -102,6 +135,7 @@ export declare class VKVideoPlayer extends HTMLElement {
102
135
  setVolume(volume: number): void;
103
136
  setRepeat(repeat: boolean): void;
104
137
  seekTime(time: number): void;
138
+ private readonly seekTimeInternal;
105
139
  seekEpisodeStartTime(time: number): void;
106
140
  returnFocusToEpisodes(): void;
107
141
  setPlaybackRate(playbackRate: PlaybackRate): void;
@@ -125,6 +159,7 @@ export declare class VKVideoPlayer extends HTMLElement {
125
159
  changeAudioStream(id: string): void;
126
160
  addLanguage(config: LanguageConfig): void;
127
161
  setLanguage(language: InterfaceLanguage | string): Promise<void>;
162
+ private replaceVideoDataInConfig;
128
163
  setLiveStart(videoData: IVideoData): void;
129
164
  setLiveWaitingStart(): void;
130
165
  /**
@@ -1,9 +1,9 @@
1
1
  import type { AdsTimeRemained } from "../../types";
2
- import { AdsSection } from "../../types";
2
+ import { AdsSection, type AdmanInitParams } from "../../types";
3
3
  import { type ILogger } from "@vkontakte/videoplayer-shared";
4
4
  import { Subject } from "@vkontakte/videoplayer-shared";
5
5
  import type { IAdsState } from "../../store";
6
- import type { AdmanInitParams, ExternalActions, IConfig, IPlayerState } from "./types";
6
+ import type { ExternalActions, IConfig, IPlayerState } from "./types";
7
7
  export declare class AdmanWrapper {
8
8
  private adman;
9
9
  private initialVolume;
@@ -16,6 +16,7 @@ export declare class AdmanWrapper {
16
16
  private ordIds;
17
17
  private isDestroyed;
18
18
  private readonly log;
19
+ private loadPromise?;
19
20
  private loadTimeout;
20
21
  private initTimeout;
21
22
  private runtimeTimeout;
@@ -48,7 +49,7 @@ export declare class AdmanWrapper {
48
49
  constructor(logger: ILogger, config: IConfig);
49
50
  init(actions: ExternalActions, adsState: IAdsState, playerState: IPlayerState): void;
50
51
  loadAdman: (abortSignal: AbortSignal) => Promise<void>;
51
- loadAdmanMailRu: (abortSignal: AbortSignal) => Promise<void>;
52
+ private loadAdmanMailRu;
52
53
  private loadAdmanNPM;
53
54
  onAdmanLoadingError(): void;
54
55
  initAdman(initParams: AdmanInitParams): Promise<void>;
@@ -5,26 +5,6 @@ export type ExternalActions = {
5
5
  switchFromVideoToAds: () => void;
6
6
  setMuted: (muted: boolean) => void;
7
7
  };
8
- export type AdsParams = Record<string, unknown>;
9
- export interface IAdmanInitParamsExternalApi {
10
- videoGetAds?: (p: AdsParams) => Promise<Record<string, unknown> | null>;
11
- videoTrackAdEvent?: (sectionKey: string, bannerId: string) => Promise<void>;
12
- }
13
- export type AdmanInitParams = {
14
- width: number;
15
- height: number;
16
- isFullscreen: boolean;
17
- isAutoplay: boolean;
18
- slotId: number;
19
- params?: AdsParams;
20
- duration: number;
21
- previewParam?: number;
22
- adsContainer: HTMLElement;
23
- adsVideoElement: HTMLVideoElement;
24
- paramsOverride?: AdsParams;
25
- externalApi?: IAdmanInitParamsExternalApi;
26
- json?: Record<string, unknown>;
27
- };
28
8
  export type IPlayerState = {
29
9
  vsid: Readable<string | undefined>;
30
10
  };
@@ -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 {};
@@ -1,39 +1,20 @@
1
- import type { IExternalTextTrack, ISources, PlaybackRate } from "@vkontakte/videoplayer-core";
2
1
  import type { IStore } from "../../store";
3
- import type { IMicroStoresRoot, IVideoLive, IVKVideoPlayerConfig } from "../../types";
2
+ import type { AdmanInitParams, IMicroStoresRoot, IVideoData, IVKVideoPlayerConfig } from "../../types";
4
3
  import type { IUIConfig } from "../../config";
5
4
  import type { Interactives } from "@vkontakte/videoplayer-interactive";
6
5
  import type KeyboardControls from "../KeyboardControls.svelte";
7
- import type { QualityLimits } from "@vkontakte/videoplayer-shared";
8
- import type { AdmanInitParams } from "../Ads/types";
6
+ import type { AdmanWrapper } from "../Ads/admanWrapper";
9
7
  export interface RootProps {
10
- sources: ISources | undefined;
8
+ videoData: IVideoData;
11
9
  store: IStore;
10
+ admanWrapper: AdmanWrapper;
12
11
  microStoresRoot: IMicroStoresRoot;
13
12
  videoConfig: IVKVideoPlayerConfig;
14
13
  uiConfig: IUIConfig;
15
- title: string;
16
- thumbUrl: string | undefined;
17
14
  interactiveContainer: HTMLElement | undefined;
18
15
  interactiveController: Interactives | undefined;
19
- subtitles: Omit<IExternalTextTrack, "type">[] | undefined;
20
- subtitlesForcedLanguage?: string;
21
- live: IVideoLive | undefined;
22
- preload: boolean;
23
16
  autoplay: boolean;
24
- volume?: number | undefined;
25
- muted?: boolean | undefined;
26
- fromTime: number;
27
- canRewindLive: boolean;
28
- showAds: boolean;
29
- adsSlotId?: number | undefined;
30
17
  adsParams?: AdmanInitParams["params"];
31
- adsAutoplayParam?: boolean;
32
- adsExternalApi?: AdmanInitParams["externalApi"];
33
- adsJson?: AdmanInitParams["json"];
34
- duration?: number | undefined;
35
- logoClickable: boolean;
36
- logoHidden: boolean;
37
18
  isMobile: boolean;
38
19
  showNextPrevButtons?: boolean;
39
20
  nextButtonActive?: boolean;
@@ -41,44 +22,25 @@ export interface RootProps {
41
22
  endScreenVideoTitle?: string | undefined;
42
23
  endScreenVideoThumb?: string | undefined;
43
24
  isOneVideoPlaylist?: boolean;
44
- supportLink: string;
45
25
  shadowRootContainer: HTMLElement;
46
26
  outerContainerRef: HTMLElement;
47
27
  fullScreenTarget?: HTMLElement | undefined;
48
- failoverHosts?: string[] | undefined;
49
- showMiniTimer?: boolean;
50
- saveRate: boolean;
51
28
  seekToInteractive?: () => void;
52
29
  playPrevChapter?: () => void;
53
- volumeMultiplier: number;
54
- showEndScreen?: boolean;
55
- showAutoplayNext: boolean;
56
30
  keyboardControls?: KeyboardControls | undefined;
57
31
  needToRepeatPlaylist?: boolean;
58
32
  getVideoDeeplink?: (timestamp: number) => string;
33
+ firstStart: (external?: boolean) => void;
34
+ seekTime: (Seconds: number) => void;
35
+ onDomReady: VoidFunction;
59
36
  }
60
37
  export interface RootExports {
61
- play: () => void;
62
- pause: () => void;
63
- setMuted: (muted: boolean) => void;
64
- toggleSubtitle: () => void;
65
- changeSubtitle: (enabled: boolean, id?: string) => void;
66
- changeAudioStream: (id: string) => void;
67
- hideControls: () => void;
68
- showControls: () => void;
69
- setVolume: (volume: number) => void;
70
- seekTime: (time: number) => void;
71
- seekEpisodeStartTime: (time: number) => void;
72
- returnFocusToEpisodes: () => void;
73
- setPlaybackRate: (playbackRate: PlaybackRate) => void;
74
- setAutoQualityLimits: (limits: QualityLimits) => void;
38
+ setPlayerStarted: (value: boolean) => void;
39
+ videoContainer?: HTMLElement;
75
40
  keyboardControls?: {
76
41
  focus: () => void;
77
42
  handleExternalKeyboardEvent: (event: KeyboardEvent) => boolean;
78
43
  };
79
- setAutoQuality: () => void;
80
- toggleTrafficSaving: (value: boolean) => void;
81
- toggleHighQuality: (value: boolean) => void;
82
44
  }
83
45
  export interface PersistentLayerExports {
84
46
  startVideoChangedAnimation: (prev: boolean) => void;
package/types/config.d.ts CHANGED
@@ -25,8 +25,34 @@ export interface IDpipConfig {
25
25
  minimalView?: boolean;
26
26
  initialSize?: Size;
27
27
  }
28
+ export interface IAdsConfig {
29
+ enable: ForceOrRelay;
30
+ loadTimeout: Milliseconds;
31
+ initTimeout: Milliseconds;
32
+ runtimeTimeout: Milliseconds;
33
+ slot?: number;
34
+ /** @deprecated, Вместо этого используйте paramsOverride: { preview } */
35
+ preview?: number;
36
+ paramsOverride?: Record<string, unknown>;
37
+ isMobileGoToSiteButton: boolean;
38
+ useAdmanFromNPM: boolean;
39
+ volumeMultiplier: number;
40
+ isVsidOriginal: boolean;
41
+ /**
42
+ * Включает режим переиспользования видеоэлемента рекламы между инстансами плеера
43
+ * (нужно для передачи разрешений браузера от одного плеера другому, например: стартовать со звуком)
44
+ * (Врядли имеет смысл без такого же включенного флага в настройках ядра)
45
+ */
46
+ reuseOwnVideoElement: boolean;
47
+ /**
48
+ * Бывает, что баннер без звука или не смог с ним стартануть
49
+ * Этот флаг регулирует нужно ли передавать сомтояние мьюта в основной плеер
50
+ */
51
+ preserveMutedState: boolean;
52
+ }
28
53
  export interface IUIConfig {
29
54
  isMobile: ForceOrRelay;
55
+ keepPlayerElement: boolean;
30
56
  disableInvisibleComponentsTimeout: Milliseconds;
31
57
  debugLog: boolean | {
32
58
  tag?: string;
@@ -42,31 +68,7 @@ export interface IUIConfig {
42
68
  defaultLanguage: InterfaceLanguage;
43
69
  downloadVKLanguages: boolean;
44
70
  updateBuiltinLanguages: boolean;
45
- ads: {
46
- enable: ForceOrRelay;
47
- loadTimeout: Milliseconds;
48
- initTimeout: Milliseconds;
49
- runtimeTimeout: Milliseconds;
50
- slot?: number;
51
- /** @deprecated, Вместо этого используйте paramsOverride: { preview } */
52
- preview?: number;
53
- paramsOverride?: Record<string, unknown>;
54
- isMobileGoToSiteButton: boolean;
55
- useAdmanFromNPM: boolean;
56
- volumeMultiplier: number;
57
- isVsidOriginal: boolean;
58
- /**
59
- * Включает режим переиспользования видеоэлемента рекламы между инстансами плеера
60
- * (нужно для передачи разрешений браузера от одного плеера другому, например: стартовать со звуком)
61
- * (Врядли имеет смысл без такого же включенного флага в настройках ядра)
62
- */
63
- reuseOwnVideoElement: boolean;
64
- /**
65
- * Бывает, что баннер без звука или не смог с ним стартануть
66
- * Этот флаг регулирует нужно ли передавать сомтояние мьюта в основной плеер
67
- */
68
- preserveMutedState: boolean;
69
- };
71
+ ads: IAdsConfig;
70
72
  /**
71
73
  * Если нет ранее сохранённого значения громкости будет использовано это
72
74
  */
@@ -218,6 +220,8 @@ export interface IUIConfig {
218
220
  * При наведение на зону таймлайна таймлайн приподнимается от границ окна плеера.
219
221
  */
220
222
  usePreviewTimelineWithHovering: boolean;
223
+ /** добавляет перехват кликов (`event.stopPropagation()`) на уровне Root компонента плеера */
224
+ rootStopPropagation: boolean;
221
225
  };
222
226
  /**
223
227
  * Отключает вызов колбэка uiInfo.onPlayerSizeChanged при ресайзе обычного pip
package/types/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  import { VKVideoPlayer } from "./VKVideoPlayer/index.svelte";
2
- import type { IVKVideoPlayerConfig, IControlInfo, ITimelinePreviewThumbsData, IUpcomingLiveViewControlInfo, IVKVideoPlayerCallbacks, IVideoData, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, IVideoLive, IInteractiveData, AdditionalButtonDeprecated, IVideoEpisode, VideoPlayerView } from "./types";
2
+ import type { AdsParams, IAdmanInitParamsExternalApi, IVKVideoPlayerConfig, IUpdatableVKVideoPlayerConfig, IControlInfo, ITimelinePreviewThumbsData, IUpcomingLiveViewControlInfo, IVKVideoPlayerCallbacks, IVideoData, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, IVideoLive, IInteractiveData, AdditionalButtonDeprecated, IVideoEpisode, VideoPlayerView } from "./types";
3
3
  import type { LanguagePack, LanguageConfig } from "./translation/types";
4
- import type { LogoType as VKLogoType, ISDKConfig, IDpipConfig } from "./config";
5
- import type { AdsParams, IAdmanInitParamsExternalApi } from "./components/Ads/types";
4
+ import type { LogoType as VKLogoType, IAdsConfig, ISDKConfig, IDpipConfig } from "./config";
6
5
  import type { ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek } from "@vkontakte/videoplayer-core";
7
6
  import type { Milliseconds, QualityLimits } from "@vkontakte/videoplayer-shared";
8
7
  export { VERSION } from "./env";
9
8
  export declare const registerPlayerWebComponent: () => void;
10
9
  export { type AdditionalSettingsMenuItem, MenuItemType, type AdditionalClickSettingsMenuItem, type AdditionalSwitchSettingsMenuItem, type AdditionalContextMenuItem } from "./components/Menus/subMenuTabs/types";
11
10
  export { type AdditionalButton, ControlButtonType } from "./components/Controls/types";
12
- export type { VKVideoPlayer, IVKVideoPlayerConfig, IControlInfo, ITimelinePreviewThumbsData, IUpcomingLiveViewControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek, LanguagePack, LanguageConfig, Milliseconds, IVideoLive, IInteractiveData, AdditionalButtonDeprecated, QualityLimits, IVideoEpisode, IDpipConfig, ISDKConfig, VideoPlayerView, IAdmanInitParamsExternalApi, VKLogoType };
11
+ export type { VKVideoPlayer, IVKVideoPlayerConfig, IUpdatableVKVideoPlayerConfig, IControlInfo, ITimelinePreviewThumbsData, IUpcomingLiveViewControlInfo, IVKVideoPlayerCallbacks, IVideoData, AdsParams, HotKeyMapData, HotKeyMapItem, HotKeyMapGroup, ISources, IDashSource, URLSource, RawSource, URLSourceWithSeek, LanguagePack, LanguageConfig, Milliseconds, IVideoLive, IInteractiveData, AdditionalButtonDeprecated, QualityLimits, IAdsConfig, IVideoEpisode, IDpipConfig, ISDKConfig, VideoPlayerView, IAdmanInitParamsExternalApi, VKLogoType };
13
12
  export { GridTypes } from "./constans";
14
13
  export { PlayerPhase } from "./types";
15
14
  export { isPiPSupported, isDpipSupported } from "./utils/webAPI/pictureInPictureApi";