@vkontakte/videoplayer 1.1.96-dev.cd28586c7.0 → 1.1.96-dev.dc17075f7.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/es2015.cjs +10 -10
- package/es2015.esm.js +10 -10
- package/esnext.cjs +10 -10
- package/esnext.esm.js +10 -10
- package/evergreen.esm.js +10 -10
- package/package.json +5 -5
- package/types/VKVideoPlayer/index.svelte.d.ts +3 -7
- package/types/components/Ads/admanWrapper.d.ts +2 -1
- package/types/components/Ads/types.d.ts +1 -1
- package/types/components/Menus/subMenuTabs/types.d.ts +0 -7
- package/types/components/Menus/utils/getSubMenusStack.svelte.d.ts +0 -1
- package/types/config.d.ts +4 -3
- package/types/index.d.ts +1 -1
- package/types/store/composition.d.ts +10 -2
- package/types/store/connectors/statisticsConnector.d.ts +15 -0
- package/types/store/index.d.ts +1 -1
- package/types/store/modules/index.d.ts +9 -3
- package/types/store/modules/infrastructure/index.d.ts +1 -1
- package/types/store/modules/infrastructure/infrastructure.module.d.ts +6 -1
- package/types/store/modules/infrastructure/infrastructure.token.d.ts +5 -1
- package/types/store/modules/languageStore/index.d.ts +9 -0
- package/types/store/modules/languageStore/languageStore.module.d.ts +3 -0
- package/types/store/modules/languageStore/languageStore.store.d.ts +51 -0
- package/types/store/modules/languageStore/languageStore.token.d.ts +6 -0
- package/types/store/modules/playbackRateStore/index.d.ts +6 -0
- package/types/store/modules/playbackRateStore/playbackRateStore.module.d.ts +8 -0
- package/types/store/modules/playbackRateStore/playbackRateStore.store.d.ts +61 -0
- package/types/store/modules/playbackRateStore/playbackRateStore.token.d.ts +6 -0
- package/types/store/modules/qualityStore/index.d.ts +6 -0
- package/types/store/modules/qualityStore/qualityStore.module.d.ts +8 -0
- package/types/store/modules/qualityStore/qualityStore.store.d.ts +37 -0
- package/types/store/modules/qualityStore/qualityStore.token.d.ts +6 -0
- package/types/store/modules/subtitlesStore/index.d.ts +9 -0
- package/types/store/modules/subtitlesStore/subtitlesStore.module.d.ts +8 -0
- package/types/store/modules/subtitlesStore/subtitlesStore.store.d.ts +130 -0
- package/types/store/modules/subtitlesStore/subtitlesStore.token.d.ts +6 -0
- package/types/store/types.d.ts +16 -9
- package/types/translation/types.d.ts +1 -0
- package/types/types/index.d.ts +0 -4
- package/types/utils/parseExperiment.d.ts +8 -0
- package/types/store/modules/highlightedMenuItemsStore/highlightedMenuItems.module.d.ts +0 -3
- package/types/store/modules/highlightedMenuItemsStore/highlightedMenuItems.store.d.ts +0 -21
- package/types/store/modules/highlightedMenuItemsStore/highlightedMenuItems.token.d.ts +0 -5
- package/types/store/modules/highlightedMenuItemsStore/index.d.ts +0 -3
- package/types/utils/sanitizeSvg.d.ts +0 -5
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subtitles Store Module
|
|
3
|
+
*
|
|
4
|
+
* Управляет состоянием субтитров: выбор, отображение, скачивание и парсинг.
|
|
5
|
+
*/
|
|
6
|
+
import type { Readable, Writable } from "svelte/store";
|
|
7
|
+
import type { IPlayer, ITextTrack } from "@vkontakte/videoplayer-core";
|
|
8
|
+
import type { ISubscription, ITracer } from "@vkontakte/videoplayer-shared";
|
|
9
|
+
import type { AppTracer } from "@vkontakte/videoplayer-shared";
|
|
10
|
+
import { Subject } from "@vkontakte/videoplayer-shared";
|
|
11
|
+
import type { VideoSubtitle, VideoSubtitleParsed, AvailableVideoSubtitle } from "../../../types";
|
|
12
|
+
import type { IUIConfig } from "../../../config";
|
|
13
|
+
import type { TSignature } from "../../../translation/types";
|
|
14
|
+
/**
|
|
15
|
+
* Зависимости модуля subtitles
|
|
16
|
+
*/
|
|
17
|
+
export interface Deps {
|
|
18
|
+
/** Плеер */
|
|
19
|
+
player: IPlayer;
|
|
20
|
+
/** UI конфиг */
|
|
21
|
+
uiConfig: IUIConfig;
|
|
22
|
+
/** Подписки */
|
|
23
|
+
subscription: ISubscription;
|
|
24
|
+
/** Функция перевода */
|
|
25
|
+
t: TSignature;
|
|
26
|
+
/** Стор языка интерфейса */
|
|
27
|
+
interfaceLanguage$: Readable<string>;
|
|
28
|
+
/** Стор точной позиции */
|
|
29
|
+
positionExact$: Readable<number>;
|
|
30
|
+
/** Стор скорости воспроизведения */
|
|
31
|
+
currentPlaybackRate$: Readable<number>;
|
|
32
|
+
/** Стор playing состояния */
|
|
33
|
+
isPlaying$: Readable<boolean>;
|
|
34
|
+
/** Стор minimal view */
|
|
35
|
+
isMinimalView$: Readable<boolean>;
|
|
36
|
+
/** Стор video id */
|
|
37
|
+
videoId$: Writable<number | undefined>;
|
|
38
|
+
/** Видео элемент */
|
|
39
|
+
getVideoElement: () => HTMLVideoElement | null;
|
|
40
|
+
/** Колбэки */
|
|
41
|
+
callbacks: {
|
|
42
|
+
onSubtitleOn?: (lang: string, id: string) => void;
|
|
43
|
+
onSubtitleOff?: () => void;
|
|
44
|
+
onAvailableSubtitlesChanged?: (subtitles: AvailableVideoSubtitle[]) => void;
|
|
45
|
+
};
|
|
46
|
+
/** Функция для получения сервиса статистики */
|
|
47
|
+
getStatisticsService?: () => {
|
|
48
|
+
oneStat?: {
|
|
49
|
+
logError: (params: {
|
|
50
|
+
errorType: string;
|
|
51
|
+
fatal: boolean;
|
|
52
|
+
}) => void;
|
|
53
|
+
};
|
|
54
|
+
} | undefined;
|
|
55
|
+
/** Функция для получения AppTracer для error reporting */
|
|
56
|
+
getAppTracer?: () => AppTracer | undefined;
|
|
57
|
+
/** Tracer для логирования */
|
|
58
|
+
tracer: ITracer;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Состояние модуля subtitles
|
|
62
|
+
*/
|
|
63
|
+
export interface SubtitlesStoreState {
|
|
64
|
+
/** Текущие выбранные субтитры */
|
|
65
|
+
currentSubtitle$: Readable<Omit<VideoSubtitle, "selected">>;
|
|
66
|
+
/** Доступные текстовые треки */
|
|
67
|
+
availableTextTracks$: Readable<ITextTrack[]>;
|
|
68
|
+
/** Список доступных субтитров для UI */
|
|
69
|
+
availableSubtitlesList$: Readable<VideoSubtitle[]>;
|
|
70
|
+
/** Текущие субтитры для отображения */
|
|
71
|
+
currentSubtitleCaptions$: Readable<VideoSubtitleParsed["texts"]>;
|
|
72
|
+
/** Видимость авто-субтитров */
|
|
73
|
+
isAutoSubtitleCaptionVisible$: Writable<boolean>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Экшены модуля subtitles для внутреннего использования
|
|
77
|
+
*/
|
|
78
|
+
export interface SubtitlesStoreInternalActions {
|
|
79
|
+
/** Установить субтитры */
|
|
80
|
+
setSubtitle: (subtitle: VideoSubtitle | undefined, external: boolean) => void;
|
|
81
|
+
/** Переключить субтитры */
|
|
82
|
+
toggleSubtitle: (external: boolean) => void;
|
|
83
|
+
/** Включить субтитры */
|
|
84
|
+
subtitleOn: (external: boolean, id?: string) => void;
|
|
85
|
+
/** Выключить субтитры */
|
|
86
|
+
subtitleOff: (external: boolean) => void;
|
|
87
|
+
/** Установить форсированный язык субтитров */
|
|
88
|
+
setForcedSubtitlesLanguage: (language: string) => void;
|
|
89
|
+
/** Обновить доступные субтитры */
|
|
90
|
+
updateAvailableSubtitles: () => void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Экшены модуля subtitles для внешнего использования
|
|
94
|
+
*/
|
|
95
|
+
export interface SubtitlesStoreExternalActions {
|
|
96
|
+
/** Установить субтитры */
|
|
97
|
+
setSubtitle: (subtitle: VideoSubtitle | undefined) => void;
|
|
98
|
+
/** Переключить субтитры */
|
|
99
|
+
toggleSubtitle: () => void;
|
|
100
|
+
/**
|
|
101
|
+
* Изменить субтитры
|
|
102
|
+
*/
|
|
103
|
+
changeSubtitle: (enabled: boolean, id?: string) => void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Результат создания subtitles store
|
|
107
|
+
*/
|
|
108
|
+
export interface SubtitlesStore {
|
|
109
|
+
/** Состояние */
|
|
110
|
+
state: SubtitlesStoreState;
|
|
111
|
+
/** Экшены для внутреннего использования */
|
|
112
|
+
actions: SubtitlesStoreInternalActions;
|
|
113
|
+
/** Экшены для внешнего использования */
|
|
114
|
+
externalActions: SubtitlesStoreExternalActions;
|
|
115
|
+
/** События для статистики */
|
|
116
|
+
events: {
|
|
117
|
+
actionSetSubtitle$: Subject<string>;
|
|
118
|
+
actionSubtitlesSwitched$: Subject<{
|
|
119
|
+
enabled: boolean;
|
|
120
|
+
lang: string;
|
|
121
|
+
auto: boolean;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
124
|
+
/** Очистка ресурсов */
|
|
125
|
+
destroy(): void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Создаёт subtitles store
|
|
129
|
+
*/
|
|
130
|
+
export declare const createSubtitlesStore: (deps: Deps) => SubtitlesStore;
|
package/types/store/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ChromecastState, IAudioStream, IConfig as ICoreInitVideoConfig, IExternalTextTrack, IOptionalTuningConfig, IPlayer, ISources, ITextTrack, IVideoStream, PlaybackRate, PlaybackState, VideoFormat } from "@vkontakte/videoplayer-core";
|
|
2
2
|
import type { InteractiveRange } from "@vkontakte/videoplayer-interactive";
|
|
3
|
-
import type { AppTracer, IError, ILogger, InterfaceLanguage, InternalsExposure, IRectangle, IValueObservable, QualityLimits, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
3
|
+
import type { AppTracer, IError, ILogger, InterfaceLanguage, InternalsExposure, IRectangle, IRootTracer, ISubject, ITracer, IValueObservable, IValueSubject, QualityLimits, VideoQuality } from "@vkontakte/videoplayer-shared";
|
|
4
4
|
import type { SeekAction, ThinOneStat } from "@vkontakte/videoplayer-statistics";
|
|
5
5
|
import type { Readable, Writable } from "svelte/store";
|
|
6
|
-
import type { AdditionalButtonDeprecated, AdsPlaybackState, ControlBlocksRefs, ControlsKeys, HotKeyMapData, IAnnotationsApi, IControlInfo, IDisabledControls, IInteractiveData, IPictureInPictureApi, IPlayerControlsRef, IPlayerPhase, ITimelinePreviewThumbsData, IVideoEpisode, IVKVideoPlayerCallbacks, IVKVideoPlayerUICallbacks,
|
|
6
|
+
import type { AdditionalButtonDeprecated, AdsPlaybackState, ControlBlocksRefs, ControlsKeys, HotKeyMapData, IAnnotationsApi, IControlInfo, IDisabledControls, IInteractiveData, IPictureInPictureApi, IPlayerControlsRef, IPlayerPhase, ITimelinePreviewThumbsData, IVideoEpisode, IVKVideoPlayerCallbacks, IVKVideoPlayerUICallbacks, Position, Size, VideoPlaybackRate, VideoPlayerView, VideoQualityForRender, VideoQualityUI, VideoSubtitle, VideoSubtitleParsed } from "../types";
|
|
7
7
|
import type { AdmanWrapper } from "../components/Ads/admanWrapper";
|
|
8
|
-
import type { Key
|
|
8
|
+
import type { Key } from "../translation/types";
|
|
9
9
|
import type { QualitySettingsAppliesTo } from "../utils/userSettings";
|
|
10
10
|
import type { GridTypes, PlayPrevChapterDisabledTooltipKey } from "../constans";
|
|
11
11
|
import type { AdditionalButton, AdditionalDesktopControlPanelButton } from "../components/Controls/types";
|
|
@@ -153,7 +153,7 @@ export interface IPlayerState {
|
|
|
153
153
|
positionWithScrubbing$: Readable<number>;
|
|
154
154
|
duration$: Readable<number>;
|
|
155
155
|
playbackState$: Readable<PlaybackState | undefined>;
|
|
156
|
-
|
|
156
|
+
isBuffering$: Readable<boolean>;
|
|
157
157
|
isPlaying$: Readable<boolean>;
|
|
158
158
|
isLoaderVisible: Readable<boolean>;
|
|
159
159
|
bufferedProgress$: Readable<number>;
|
|
@@ -272,8 +272,7 @@ export interface IStoreInternalActions {
|
|
|
272
272
|
holdCamera(): void;
|
|
273
273
|
releaseCamera(): void;
|
|
274
274
|
downloadVideo: () => void;
|
|
275
|
-
|
|
276
|
-
setLanguage: (language: InterfaceLanguage | string) => void;
|
|
275
|
+
setLanguage: (language: InterfaceLanguage | string) => Promise<void>;
|
|
277
276
|
nextMovie: (movieId: number) => void;
|
|
278
277
|
correctSeekTimeToInteractive: (time: number) => number;
|
|
279
278
|
replayInteractive?: () => void;
|
|
@@ -334,18 +333,25 @@ export interface IStoreInitVideoConfig extends ICoreInitVideoConfig {
|
|
|
334
333
|
canDownload?: boolean;
|
|
335
334
|
previewThumbsData?: ITimelinePreviewThumbsData;
|
|
336
335
|
subtitles?: Omit<IExternalTextTrack, "type">[];
|
|
337
|
-
subtitlesForcedLanguage?: string;
|
|
338
336
|
unitedVideoId?: number;
|
|
339
337
|
videoEpisodes?: IVideoEpisode[];
|
|
340
338
|
}
|
|
339
|
+
export interface IStoreEvents {
|
|
340
|
+
actionRewind$: ISubject<void>;
|
|
341
|
+
actionSeek$: IValueSubject<SeekAction | ThinOneStat.ActionSeekType>;
|
|
342
|
+
actionQuality$: ISubject<ThinOneStat.ActionQualityType>;
|
|
343
|
+
nextMovie$: ISubject<number>;
|
|
344
|
+
}
|
|
341
345
|
export interface IStore {
|
|
342
346
|
initVideo: (config: IStoreInitVideoConfig) => void;
|
|
343
347
|
videoId$: Writable<number | undefined>;
|
|
344
348
|
playerPhase: IPlayerPhase;
|
|
345
349
|
interfaceLanguage$: Readable<InterfaceLanguage | string>;
|
|
350
|
+
interfaceLanguageUpdated$: ISubject<void>;
|
|
346
351
|
isCyrillicRelatedInterface$: Readable<boolean>;
|
|
347
352
|
interactiveData?: IInteractiveData;
|
|
348
|
-
vsid$:
|
|
353
|
+
vsid$: Writable<string | undefined>;
|
|
354
|
+
events: IStoreEvents;
|
|
349
355
|
state: IPlayerState;
|
|
350
356
|
ui: IUIState;
|
|
351
357
|
ads: IAdsState;
|
|
@@ -360,7 +366,6 @@ export interface IStore {
|
|
|
360
366
|
initOnFinishedCallback: VoidFunction;
|
|
361
367
|
resetAdsState: VoidFunction;
|
|
362
368
|
updateAdmanWrapperSubscriptions: VoidFunction;
|
|
363
|
-
updateStatisticsSubscriptions: VoidFunction;
|
|
364
369
|
updateAppTracerSubscriptions: VoidFunction;
|
|
365
370
|
updateTracerSubscriptions: VoidFunction;
|
|
366
371
|
getLogger: () => ILogger;
|
|
@@ -416,4 +421,6 @@ export interface IStoreParams {
|
|
|
416
421
|
getAdmanWrapper: () => AdmanWrapper | undefined;
|
|
417
422
|
logger: ILogger;
|
|
418
423
|
adsEnabled: boolean;
|
|
424
|
+
tracer: ITracer;
|
|
425
|
+
rootTracer: IRootTracer;
|
|
419
426
|
}
|
package/types/types/index.d.ts
CHANGED
|
@@ -628,7 +628,3 @@ export interface Caption {
|
|
|
628
628
|
value: string;
|
|
629
629
|
}
|
|
630
630
|
export type NotificationId = "slow_video";
|
|
631
|
-
export declare enum PlaybackStateExtended {
|
|
632
|
-
BUFFERING = "buffering"
|
|
633
|
-
}
|
|
634
|
-
export type PlaybackStateRealistic = PlaybackState | PlaybackStateExtended;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @docs https://confluence.vk.team/pages/viewpage.action?pageId=1405044928
|
|
3
|
+
*
|
|
4
|
+
* в поле `meta` ключи экспериментов придут в 2-х возможных форматах
|
|
5
|
+
* 1. `feature.<feature_name>.experiment`
|
|
6
|
+
* 2. `feature.<feature_name>.experiment.<config_name>`
|
|
7
|
+
*/
|
|
8
|
+
export declare const parseExperiment: (experiment: string, index: number) => Record<string, string | true>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HighlightedMenuItems Store
|
|
3
|
-
*
|
|
4
|
-
* Управляет подсветкой пунктов меню настроек.
|
|
5
|
-
*/
|
|
6
|
-
import type { Writable } from "svelte/store";
|
|
7
|
-
import type { MenuItemHighlight, RootMenuId } from "../../../components/Menus/subMenuTabs/types";
|
|
8
|
-
export interface HighlightedMenuItemsStoreState {
|
|
9
|
-
items$: Writable<Partial<Record<RootMenuId, MenuItemHighlight>> | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export interface HighlightedMenuItemsStoreActions {
|
|
12
|
-
/** Установить подсвеченные пункты меню */
|
|
13
|
-
setHighlightedMenuItems(items: Partial<Record<RootMenuId, MenuItemHighlight>> | undefined): void;
|
|
14
|
-
/** Очистить подсветку */
|
|
15
|
-
clear(): void;
|
|
16
|
-
}
|
|
17
|
-
export interface HighlightedMenuItemsStore {
|
|
18
|
-
state: HighlightedMenuItemsStoreState;
|
|
19
|
-
actions: HighlightedMenuItemsStoreActions;
|
|
20
|
-
}
|
|
21
|
-
export declare const createHighlightedMenuItemsStore: () => HighlightedMenuItemsStore;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "@vkontakte/videoplayer-shared";
|
|
2
|
-
export declare const HIGHLIGHTED_MENU_ITEMS_STORE_TOKEN: InjectionToken<HIGHLIGHTED_MENU_ITEMS_STORE_STORE>;
|
|
3
|
-
import type { HighlightedMenuItemsStore } from "./highlightedMenuItems.store";
|
|
4
|
-
type HIGHLIGHTED_MENU_ITEMS_STORE_STORE = HighlightedMenuItemsStore;
|
|
5
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export type { HighlightedMenuItemsStoreState, HighlightedMenuItemsStore, HighlightedMenuItemsStoreActions } from "./highlightedMenuItems.store";
|
|
2
|
-
export { highlightedMenuItemsModule } from "./highlightedMenuItems.module";
|
|
3
|
-
export { HIGHLIGHTED_MENU_ITEMS_STORE_TOKEN } from "./highlightedMenuItems.token";
|