@vkontakte/videoplayer 1.1.71 → 1.1.72-dev.02be9553.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.71",
3
+ "version": "1.1.72-dev.02be9553.0",
4
4
  "author": "vk.com",
5
5
  "description": "Videoplayer based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -55,9 +55,9 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@adtech/rbadman": "2.2.57",
58
- "@vkontakte/videoplayer-core": "2.0.140",
59
- "@vkontakte/videoplayer-interactive": "1.0.46",
60
- "@vkontakte/videoplayer-shared": "1.0.68",
61
- "@vkontakte/videoplayer-statistics": "1.0.86"
58
+ "@vkontakte/videoplayer-core": "2.0.141-dev.02be9553.0",
59
+ "@vkontakte/videoplayer-interactive": "1.0.47-dev.02be9553.0",
60
+ "@vkontakte/videoplayer-shared": "1.0.69-dev.02be9553.0",
61
+ "@vkontakte/videoplayer-statistics": "1.0.87-dev.02be9553.0"
62
62
  }
63
63
  }
@@ -22,6 +22,7 @@ export declare class VKVideoPlayer extends HTMLElement {
22
22
  private playerContainer;
23
23
  private rootContainer;
24
24
  private shadowRootContainer;
25
+ private playerId;
25
26
  private uiConfig;
26
27
  private coreConfig;
27
28
  private statisticsConfig;
@@ -85,6 +86,7 @@ export declare class VKVideoPlayer extends HTMLElement {
85
86
  stop(): void;
86
87
  setMuted(muted: boolean): void;
87
88
  toggleSubtitle(): void;
89
+ changeSubtitle(enabled: boolean, id?: string): void;
88
90
  hideControls(): void;
89
91
  showControls(): void;
90
92
  setPiPEnabled(enabled: boolean): void;
@@ -95,6 +97,22 @@ export declare class VKVideoPlayer extends HTMLElement {
95
97
  returnFocusToEpisodes(): void;
96
98
  setPlaybackRate(playbackRate: PlaybackRate): void;
97
99
  setAutoQualityLimits(limits: QualityLimits): void;
100
+ /** включение режима автоматического качества (это не тоггл!) */
101
+ setAutoQuality(): void;
102
+ /**
103
+ * __тоггл режима экономии трафика__
104
+ *
105
+ * - при включении так же будет включен режим автоматического качества
106
+ * (если был выключен, например, ручным выбором качества пользователем)
107
+ */
108
+ toggleTrafficSaving(value: boolean): void;
109
+ /**
110
+ * __тоггл режима высокого качества__
111
+ *
112
+ * - при включении так же будет включен режим автоматического качества
113
+ * (если был выключен, например, ручным выбором качества пользователем)
114
+ */
115
+ toggleHighQuality(value: boolean): void;
98
116
  addLanguage(config: LanguageConfig): void;
99
117
  setLanguage(language: InterfaceLanguage | string): Promise<void>;
100
118
  setLiveStart(videoData: IVideoData): void;
@@ -78,6 +78,7 @@ export declare class AdmanWrapper {
78
78
  onAdmanLoadingError(): void;
79
79
  initAdman(initParams: AdmanInitParams): void;
80
80
  private switchToVideo;
81
+ private setPostrollPassed;
81
82
  togglePlay(): void;
82
83
  setInitialVolume(volume: number): void;
83
84
  setVolume(volume: number): void;
@@ -58,6 +58,7 @@ export interface RootExports {
58
58
  pause: () => void;
59
59
  setMuted: (muted: boolean) => void;
60
60
  toggleSubtitle: () => void;
61
+ changeSubtitle: (enabled: boolean, id?: string) => void;
61
62
  hideControls: () => void;
62
63
  showControls: () => void;
63
64
  setVolume: (volume: number) => void;
@@ -70,4 +71,7 @@ export interface RootExports {
70
71
  focus: () => void;
71
72
  handleExternalKeyboardEvent: (event: KeyboardEvent) => boolean;
72
73
  };
74
+ setAutoQuality: () => void;
75
+ toggleTrafficSaving: (value: boolean) => void;
76
+ toggleHighQuality: (value: boolean) => void;
73
77
  }
package/types/config.d.ts CHANGED
@@ -146,7 +146,6 @@ export interface IUIConfig {
146
146
  nextPrevButtons: boolean;
147
147
  previewNoEmptySpace: boolean;
148
148
  exposeInternalsToGlobal: boolean;
149
- skipInitialPlaybackRateValue: boolean;
150
149
  qualityDetailsSubMenuEnabled: boolean;
151
150
  forceAutoQualityWhenSevereStallHappens: boolean;
152
151
  showSlowVideoNotification: boolean;
@@ -187,6 +186,10 @@ export interface IUIConfig {
187
186
  * например, звуковой дорожки и субтитров
188
187
  */
189
188
  userVideoPrefs: boolean;
189
+ /**
190
+ * сохраняет выбранные состояния плеера в localStorage только от user actions
191
+ */
192
+ savePreferredStatesOnUserActionOnly: boolean;
190
193
  };
191
194
  interactive: {
192
195
  historyMaxLength: number;
@@ -230,6 +230,7 @@ export interface IStore {
230
230
  setTrafficSavingEnabled: (trafficSavingEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
231
231
  setHighQualityEnabled: (highQualityEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
232
232
  setVolume: (volume: number) => void;
233
+ setMuted: (muted: boolean) => void;
233
234
  startVolumeChanging: () => void;
234
235
  stopVolumeChanging: () => void;
235
236
  setAudioStream: (stream: IAudioStream) => void;
@@ -303,6 +304,7 @@ export interface IStore {
303
304
  setAutoQualityLimits: (limits: QualityLimits) => void;
304
305
  setMuted: (muted: boolean) => void;
305
306
  toggleSubtitle: () => void;
307
+ changeSubtitle: (enabled: boolean, id?: string) => void;
306
308
  setVolume: (volume: number) => void;
307
309
  returnFocusToEpisodes: () => void;
308
310
  updateAdditionalSettingsItem: (itemId: string, fields: Partial<Omit<AdditionalSettingsMenuItem, 'id' | 'type'>>) => void;
@@ -317,6 +319,9 @@ export interface IStore {
317
319
  setLiveLowLatency: (isLowLatency: boolean) => void;
318
320
  hideControls: () => void;
319
321
  showControls: () => void;
322
+ setQuality: (quality: VideoQualityUI) => void;
323
+ setTrafficSavingEnabled: (trafficSavingEnabled: boolean) => void;
324
+ setHighQualityEnabled: (highQualityEnabled: boolean) => void;
320
325
  };
321
326
  };
322
327
  callbacks?: IVKVideoPlayerCallbacks;
@@ -360,10 +365,11 @@ interface IStoreParams {
360
365
  saveRate: boolean;
361
366
  internalsExposure: InternalsExposure | null;
362
367
  playerView?: VideoPlayerView;
368
+ playerId: string;
363
369
  }
364
370
  /**
365
371
  * Store приложения.
366
372
  * Если будет слишком большим - можно разделить его на модули
367
373
  */
368
- export declare const createStore: ({ interfaceLanguage, isCyrillicRelatedInterface, videoId, isClip, isLiveCatchUpMode, statAuthToken, isAudioDisabled, canDownload, callbacks, webApi, videoEpisodes, previewThumbsData, uiConfig, coreConfig, player: playerInstance, disabledControls, isInteractive, interactiveRanges$, isInteractiveTime$, replayInteractive, stopPlayer, hasInteractiveBranches, playPrevChapterDisabledTooltip, additionalButtons, additionalSettingsMenuItems, additionalContextMenuItems, playPrevVideo, playNextVideo, looped, statistics: uiStatistics, saveRate, internalsExposure, playerView, }: IStoreParams) => IStore;
374
+ export declare const createStore: ({ interfaceLanguage, isCyrillicRelatedInterface, videoId, isClip, isLiveCatchUpMode, statAuthToken, isAudioDisabled, canDownload, callbacks, webApi, videoEpisodes, previewThumbsData, uiConfig, coreConfig, player: playerInstance, disabledControls, isInteractive, interactiveRanges$, isInteractiveTime$, replayInteractive, stopPlayer, hasInteractiveBranches, playPrevChapterDisabledTooltip, additionalButtons, additionalSettingsMenuItems, additionalContextMenuItems, playPrevVideo, playNextVideo, looped, statistics: uiStatistics, saveRate, internalsExposure, playerView, playerId, }: IStoreParams) => IStore;
369
375
  export {};
@@ -34,7 +34,8 @@ export interface IVKVideoPlayerCallbacks {
34
34
  onMute?: () => void;
35
35
  onUnmute?: (volume: number) => void;
36
36
  onSubtitleOff?: () => void;
37
- onSubtitleOn?: (lang: string) => void;
37
+ onSubtitleOn?: (lang: string, id: string) => void;
38
+ onAvailableSubtitlesChanged?: (subtitles: AvailableVideoSubtitle[]) => void;
38
39
  onAudioDisabledHint?: () => void;
39
40
  onAudioDoesNotExistHint?: () => void;
40
41
  onEpisodeClicked?: (byKeyboard: boolean) => void;
@@ -78,6 +79,8 @@ export interface IVKVideoPlayerCallbacks {
78
79
  onNextVideoAnnouncementCancel?: () => void;
79
80
  onSetAutoplayNextEnabled?: (state: boolean) => void;
80
81
  onTrafficSavingEnabledChanged?: (isEnabled: boolean) => void;
82
+ onHighQualityEnabledChanged?: (isEnabled: boolean) => void;
83
+ onAutoQualityEnabledChanged?: (isEnabled: boolean) => void;
81
84
  onCurrentPlaybackRateChanged?: (rate: number) => void;
82
85
  onStalledChanged?: (isStalled: boolean) => void;
83
86
  onLogoClicked?: () => void;
@@ -290,6 +293,7 @@ export interface IVKVideoPlayerConfig {
290
293
  volumeMultiplier?: number;
291
294
  saveRate?: boolean;
292
295
  deviceId?: string;
296
+ playerId?: string;
293
297
  showEndScreen?: boolean;
294
298
  showAutoplayNext?: boolean;
295
299
  showNextPrevButtons?: boolean;
@@ -476,6 +480,11 @@ export interface IAnnotationsApi {
476
480
  clear: () => void;
477
481
  destroy: () => void;
478
482
  }
483
+ export type AvailableVideoSubtitle = {
484
+ id: string;
485
+ language: string;
486
+ title: string;
487
+ };
479
488
  export type VideoSubtitle = {
480
489
  value: string;
481
490
  displayValue: string;
@@ -1,11 +1,14 @@
1
1
  import type { IPictureInPictureApi, PictureInPictureSettings } from '../../../types';
2
2
  import { PictureInPictureType } from '../../../types';
3
- import { ValueSubject } from '@vkontakte/videoplayer-shared';
4
- declare const _PICTURE_IN_PICTURE_EVENTS: readonly ["enterpictureinpicture", "leavepictureinpicture", "resize"];
5
- type PictureInPictureEvents = typeof _PICTURE_IN_PICTURE_EVENTS[number];
6
- type PictureInPictureEventHandlers = {
7
- [key in PictureInPictureEvents]: (event: Event) => void;
8
- };
3
+ import { ValueSubject, type DebouncedFn } from '@vkontakte/videoplayer-shared';
4
+ interface PictureInPictureEventHandlers {
5
+ enterpictureinpicture: (event: Event) => void;
6
+ leavepictureinpicture: (event: Event) => void;
7
+ resize: DebouncedFn<(event: Event) => void>;
8
+ }
9
+ interface ExternalPictureInPictureEventHandlers extends Omit<PictureInPictureEventHandlers, 'resize'> {
10
+ resize: (event: Event) => void;
11
+ }
9
12
  export declare class PictureInPictureApi implements IPictureInPictureApi {
10
13
  private isRequested;
11
14
  private videoElement;
@@ -34,7 +37,7 @@ export declare class PictureInPictureApi implements IPictureInPictureApi {
34
37
  assignPlayerContainer(playerContainer: HTMLElement): void;
35
38
  updateVideoElement(): void;
36
39
  private addEventHandlers;
37
- setExternalEventHandlers(externalEventHandlers: Partial<PictureInPictureEventHandlers>): void;
40
+ setExternalEventHandlers(externalEventHandlers: Partial<ExternalPictureInPictureEventHandlers>): void;
38
41
  private removeEventHandlers;
39
42
  dispose(): Promise<void>;
40
43
  private onEnterPictureInPicture;