itube-specs 0.0.789 → 0.0.791
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.
|
@@ -22,10 +22,14 @@ import type { Player, PlayerOptions, VideoSource, LocaleCode, AdsOptions, Previe
|
|
|
22
22
|
import { AdvertsHelper } from '@/utils/adverts-helper';
|
|
23
23
|
import { AdSpotType, ThumbSize } from '../../runtime';
|
|
24
24
|
import type { IVideoData, IVideoCard } from '../../types';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
25
|
+
import playIcon from '~/assets/icons/player/play.svg?raw';
|
|
26
|
+
import fullscreenIcon from '~/assets/icons/player/fullscreen.svg?raw';
|
|
27
|
+
import seekIcon from '~/assets/icons/player/seek.svg?raw';
|
|
28
|
+
import settingsIcon from '~/assets/icons/player/settings.svg?raw';
|
|
29
|
+
import channelAvatarIcon from '~/assets/icons/player/channel-avatar.svg?raw';
|
|
30
|
+
import actionsIcon from '~/assets/icons/player/actions.svg?raw';
|
|
31
|
+
import locationIcon from '~/assets/icons/player/location.svg?raw';
|
|
32
|
+
import modelsIcon from '~/assets/icons/player/models.svg?raw';
|
|
29
33
|
|
|
30
34
|
const props = defineProps<{
|
|
31
35
|
data: IVideoData
|
|
@@ -76,39 +80,46 @@ function onSourceChange(): void {
|
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
|
|
83
|
+
// Ключ localStorage, под которым плеер (опция persist) хранит громкость/mute и состояние
|
|
84
|
+
// тумблера autoplay-next.
|
|
85
|
+
const PLAYER_PERSIST_KEY = 'itube-player';
|
|
86
|
+
|
|
87
|
+
// Иконки плеера сырыми <svg> (?raw): itube-modern-player принимает не имя/компонент, а
|
|
88
|
+
// строку svg — options.icons и sceneGroups[].icon.svg. currentColor у иконок — чтобы цвет
|
|
89
|
+
// задавал сам плеер (solid/inverted, перекраска в меню сцен). bigPlay идёт и в SSR-заглушку
|
|
90
|
+
// (renderPlaceholder читает icons.bigPlay). seek одна — «назад» отражается через scaleX(-1)
|
|
91
|
+
// в стилях (.imp-*--seek-back svg).
|
|
92
|
+
const PLAYER_ICONS = {
|
|
93
|
+
play: playIcon,
|
|
94
|
+
bigPlay: playIcon,
|
|
95
|
+
fullscreen: fullscreenIcon,
|
|
96
|
+
settings: settingsIcon,
|
|
97
|
+
seekForward: seekIcon,
|
|
98
|
+
seekBack: seekIcon,
|
|
99
|
+
};
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
// Аватар-заглушка канала для чанка previewMeta ховер-превью (просто кружок, как в дизайне).
|
|
102
|
+
const CHANNEL_META_ICON = channelAvatarIcon;
|
|
89
103
|
|
|
90
|
-
//
|
|
91
|
-
const
|
|
104
|
+
// Иконки типов сцен по id группы (timelinesGroups).
|
|
105
|
+
const SCENE_ICONS: Record<string, string> = {
|
|
106
|
+
actions: actionsIcon,
|
|
107
|
+
locations: locationIcon,
|
|
108
|
+
scene: modelsIcon,
|
|
109
|
+
};
|
|
92
110
|
|
|
93
111
|
const PLAYER_LOCALES: LocaleCode[] = ['en', 'ru', 'de', 'es', 'it', 'ja', 'ko', 'zh', 'pt', 'ar', 'hi'];
|
|
94
112
|
const playerLanguage = computed<LocaleCode>(() =>
|
|
95
113
|
PLAYER_LOCALES.includes(locale.value as LocaleCode) ? locale.value as LocaleCode : 'en'
|
|
96
114
|
);
|
|
97
115
|
|
|
98
|
-
// Иконки типов сцен (inline через ?raw — в меню перекрашиваются под currentColor).
|
|
99
|
-
const SCENE_ICON: Record<string, string> = {
|
|
100
|
-
actions: actionsIcon,
|
|
101
|
-
locations: locationIcon,
|
|
102
|
-
scene: modelsIcon,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
116
|
// timelinesGroups уже очищены клинером ({ id, title, scenes }) — добавляем только иконку по id.
|
|
106
117
|
const sceneGroups = computed<SceneGroup[] | undefined>(() => {
|
|
107
118
|
const groups = props.data.timelinesGroups;
|
|
108
119
|
if (!groups?.length) return undefined;
|
|
109
120
|
|
|
110
121
|
return groups.map((group) => {
|
|
111
|
-
const icon =
|
|
122
|
+
const icon = SCENE_ICONS[group.id];
|
|
112
123
|
return icon ? { ...group, icon: { svg: icon } } : group;
|
|
113
124
|
});
|
|
114
125
|
});
|
|
@@ -217,8 +228,7 @@ const options = computed<Omit<PlayerOptions, 'source'>>(() => ({
|
|
|
217
228
|
// Порядок правого кластера: sceneTypes → gear (настройки) → fullscreen (последней).
|
|
218
229
|
order: ['sceneTypes', 'gear', 'fullscreen'],
|
|
219
230
|
},
|
|
220
|
-
|
|
221
|
-
icons: { play: PLAY_ICON, bigPlay: PLAY_ICON, fullscreen: FULLSCREEN_ICON, settings: SETTINGS_ICON, seekForward: SEEK_ICON, seekBack: SEEK_ICON },
|
|
231
|
+
icons: PLAYER_ICONS,
|
|
222
232
|
// Заголовок дропдауна выбора типа сцен (дефолт «Scene type»).
|
|
223
233
|
labels: { sceneTypes: t('timeline_markers') },
|
|
224
234
|
// Запоминаем громкость/mute в localStorage.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { IRawVideoData, IVideoData, ISceneGroup, ITimelineGroup } from '../../../types';
|
|
2
2
|
|
|
3
3
|
// «locations» → «Locations», «living_room» → «Living room».
|
|
4
|
-
const humanize = (value
|
|
5
|
-
const text = value.replace(/_/g, ' ').trim();
|
|
4
|
+
const humanize = (value?: string | null): string => {
|
|
5
|
+
const text = (value ?? '').replace(/_/g, ' ').trim();
|
|
6
6
|
return text ? text.charAt(0).toUpperCase() + text.slice(1) : text;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -13,13 +13,16 @@ const cleanTimelineGroups = (raw: ITimelineGroup[] | null): ISceneGroup[] | null
|
|
|
13
13
|
const groups = raw
|
|
14
14
|
.filter((group) => Array.isArray(group?.actions) && group.actions.length > 0)
|
|
15
15
|
.map((group) => ({
|
|
16
|
-
id: group.name,
|
|
16
|
+
id: group.name || '',
|
|
17
17
|
title: humanize(group.name),
|
|
18
|
-
scenes: group.actions
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
scenes: group.actions
|
|
19
|
+
.filter((action) => action?.title)
|
|
20
|
+
.map((action) => ({
|
|
21
|
+
start: Number(action.duration) || 0,
|
|
22
|
+
title: humanize(action.title),
|
|
23
|
+
})),
|
|
24
|
+
}))
|
|
25
|
+
.filter((group) => group.scenes.length > 0);
|
|
23
26
|
|
|
24
27
|
return groups.length ? groups : null;
|
|
25
28
|
};
|