@cloud-ru/ds-site-media 0.0.0-stage → 1.1.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/CHANGELOG.md +10 -0
- package/LICENSE +201 -0
- package/README.md +167 -2
- package/dist/cjs/components/SiteImage/SiteImage.d.ts +10 -0
- package/dist/cjs/components/SiteImage/SiteImage.js +8 -0
- package/dist/cjs/components/SiteImage/index.d.ts +1 -0
- package/dist/cjs/components/SiteImage/index.js +17 -0
- package/dist/cjs/components/SiteVideo/SiteVideo.d.ts +15 -0
- package/dist/cjs/components/SiteVideo/SiteVideo.js +16 -0
- package/dist/cjs/components/SiteVideo/VideoContent.d.ts +4 -0
- package/dist/cjs/components/SiteVideo/VideoContent.js +27 -0
- package/dist/cjs/components/SiteVideo/index.d.ts +1 -0
- package/dist/cjs/components/SiteVideo/index.js +17 -0
- package/dist/cjs/components/SiteVideo/styles.module.css +15 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/constants.d.ts +31 -0
- package/dist/cjs/constants.js +34 -0
- package/dist/cjs/helperComponents/EmbedPlayer/EmbedPlayer.d.ts +10 -0
- package/dist/cjs/helperComponents/EmbedPlayer/EmbedPlayer.js +108 -0
- package/dist/cjs/helperComponents/EmbedPlayer/index.d.ts +1 -0
- package/dist/cjs/helperComponents/EmbedPlayer/index.js +17 -0
- package/dist/cjs/helperComponents/EmbedPlayer/styles.module.css +15 -0
- package/dist/cjs/helperComponents/NativePlayer/NativePlayer.d.ts +2 -0
- package/dist/cjs/helperComponents/NativePlayer/NativePlayer.js +106 -0
- package/dist/cjs/helperComponents/NativePlayer/hooks.d.ts +13 -0
- package/dist/cjs/helperComponents/NativePlayer/hooks.js +140 -0
- package/dist/cjs/helperComponents/NativePlayer/index.d.ts +1 -0
- package/dist/cjs/helperComponents/NativePlayer/index.js +17 -0
- package/dist/cjs/helperComponents/NativePlayer/styles.module.css +39 -0
- package/dist/cjs/helperComponents/NativePlayer/types.d.ts +6 -0
- package/dist/cjs/helperComponents/NativePlayer/types.js +2 -0
- package/dist/cjs/helperComponents/NativePlayer/utils.d.ts +19 -0
- package/dist/cjs/helperComponents/NativePlayer/utils.js +24 -0
- package/dist/cjs/helperComponents/PlayerError/PlayerError.d.ts +5 -0
- package/dist/cjs/helperComponents/PlayerError/PlayerError.js +15 -0
- package/dist/cjs/helperComponents/PlayerError/index.d.ts +1 -0
- package/dist/cjs/helperComponents/PlayerError/index.js +17 -0
- package/dist/cjs/helperComponents/PlayerError/styles.module.css +32 -0
- package/dist/cjs/helperComponents/SpeedSelect/SpeedSelect.d.ts +7 -0
- package/dist/cjs/helperComponents/SpeedSelect/SpeedSelect.js +30 -0
- package/dist/cjs/helperComponents/SpeedSelect/index.d.ts +1 -0
- package/dist/cjs/helperComponents/SpeedSelect/index.js +17 -0
- package/dist/cjs/helperComponents/SpeedSelect/styles.module.css +7 -0
- package/dist/cjs/helperComponents/Toolbar/PlaybackControls.d.ts +6 -0
- package/dist/cjs/helperComponents/Toolbar/PlaybackControls.js +23 -0
- package/dist/cjs/helperComponents/Toolbar/Timeline.d.ts +2 -0
- package/dist/cjs/helperComponents/Toolbar/Timeline.js +23 -0
- package/dist/cjs/helperComponents/Toolbar/TimelinePreview.d.ts +8 -0
- package/dist/cjs/helperComponents/Toolbar/TimelinePreview.js +21 -0
- package/dist/cjs/helperComponents/Toolbar/Toolbar.d.ts +14 -0
- package/dist/cjs/helperComponents/Toolbar/Toolbar.js +19 -0
- package/dist/cjs/helperComponents/Toolbar/ToolbarButton.d.ts +12 -0
- package/dist/cjs/helperComponents/Toolbar/ToolbarButton.js +14 -0
- package/dist/cjs/helperComponents/Toolbar/hooks/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Toolbar/hooks/index.js +17 -0
- package/dist/cjs/helperComponents/Toolbar/hooks/useTimeline.d.ts +10 -0
- package/dist/cjs/helperComponents/Toolbar/hooks/useTimeline.js +32 -0
- package/dist/cjs/helperComponents/Toolbar/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Toolbar/index.js +17 -0
- package/dist/cjs/helperComponents/Toolbar/styles.module.css +115 -0
- package/dist/cjs/helperComponents/Toolbar/types.d.ts +5 -0
- package/dist/cjs/helperComponents/Toolbar/types.js +2 -0
- package/dist/cjs/helperComponents/Toolbar/utils/getTimeByKey.d.ts +1 -0
- package/dist/cjs/helperComponents/Toolbar/utils/getTimeByKey.js +20 -0
- package/dist/cjs/helperComponents/Toolbar/utils/getTimeByPointer.d.ts +5 -0
- package/dist/cjs/helperComponents/Toolbar/utils/getTimeByPointer.js +7 -0
- package/dist/cjs/helperComponents/Toolbar/utils/index.d.ts +6 -0
- package/dist/cjs/helperComponents/Toolbar/utils/index.js +22 -0
- package/dist/cjs/helperComponents/Toolbar/utils/restart.d.ts +2 -0
- package/dist/cjs/helperComponents/Toolbar/utils/restart.js +7 -0
- package/dist/cjs/helperComponents/Toolbar/utils/seek.d.ts +2 -0
- package/dist/cjs/helperComponents/Toolbar/utils/seek.js +6 -0
- package/dist/cjs/helperComponents/Toolbar/utils/setVolume.d.ts +2 -0
- package/dist/cjs/helperComponents/Toolbar/utils/setVolume.js +10 -0
- package/dist/cjs/helperComponents/Toolbar/utils/toggleMute.d.ts +2 -0
- package/dist/cjs/helperComponents/Toolbar/utils/toggleMute.js +9 -0
- package/dist/cjs/helperComponents/VideoPlayButton/VideoPlayButton.d.ts +10 -0
- package/dist/cjs/helperComponents/VideoPlayButton/VideoPlayButton.js +18 -0
- package/dist/cjs/helperComponents/VideoPlayButton/index.d.ts +1 -0
- package/dist/cjs/helperComponents/VideoPlayButton/index.js +17 -0
- package/dist/cjs/helperComponents/VideoPlayButton/styles.module.css +100 -0
- package/dist/cjs/hocs/withPlayerClassName.d.ts +3 -0
- package/dist/cjs/hocs/withPlayerClassName.js +15 -0
- package/dist/cjs/hooks/useFullscreen.d.ts +6 -0
- package/dist/cjs/hooks/useFullscreen.js +32 -0
- package/dist/cjs/hooks/usePlayerState.d.ts +11 -0
- package/dist/cjs/hooks/usePlayerState.js +60 -0
- package/dist/cjs/hooks/useSpriteFrames.d.ts +2 -0
- package/dist/cjs/hooks/useSpriteFrames.js +32 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/locale/index.d.ts +83 -0
- package/dist/cjs/locale/index.js +46 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/shared/types.d.ts +8 -0
- package/dist/cjs/shared/types.js +2 -0
- package/dist/cjs/style.css +323 -0
- package/dist/cjs/types.d.ts +15 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils/embed.d.ts +8 -0
- package/dist/cjs/utils/embed.js +74 -0
- package/dist/cjs/utils/format.d.ts +2 -0
- package/dist/cjs/utils/format.js +17 -0
- package/dist/cjs/utils/fullscreen.d.ts +5 -0
- package/dist/cjs/utils/fullscreen.js +29 -0
- package/dist/cjs/utils/index.d.ts +6 -0
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/loadSpriteFrames.d.ts +3 -0
- package/dist/cjs/utils/loadSpriteFrames.js +9 -0
- package/dist/cjs/utils/source.d.ts +5 -0
- package/dist/cjs/utils/source.js +19 -0
- package/dist/cjs/utils/sprite.d.ts +3 -0
- package/dist/cjs/utils/sprite.js +41 -0
- package/dist/cjs/utils/url.d.ts +1 -0
- package/dist/cjs/utils/url.js +15 -0
- package/dist/esm/components/SiteImage/SiteImage.d.ts +10 -0
- package/dist/esm/components/SiteImage/SiteImage.js +5 -0
- package/dist/esm/components/SiteImage/index.d.ts +1 -0
- package/dist/esm/components/SiteImage/index.js +1 -0
- package/dist/esm/components/SiteVideo/SiteVideo.d.ts +15 -0
- package/dist/esm/components/SiteVideo/SiteVideo.js +10 -0
- package/dist/esm/components/SiteVideo/VideoContent.d.ts +4 -0
- package/dist/esm/components/SiteVideo/VideoContent.js +21 -0
- package/dist/esm/components/SiteVideo/index.d.ts +1 -0
- package/dist/esm/components/SiteVideo/index.js +1 -0
- package/dist/esm/components/SiteVideo/styles.module.css +15 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/constants.d.ts +31 -0
- package/dist/esm/constants.js +31 -0
- package/dist/esm/helperComponents/EmbedPlayer/EmbedPlayer.d.ts +10 -0
- package/dist/esm/helperComponents/EmbedPlayer/EmbedPlayer.js +102 -0
- package/dist/esm/helperComponents/EmbedPlayer/index.d.ts +1 -0
- package/dist/esm/helperComponents/EmbedPlayer/index.js +1 -0
- package/dist/esm/helperComponents/EmbedPlayer/styles.module.css +15 -0
- package/dist/esm/helperComponents/NativePlayer/NativePlayer.d.ts +2 -0
- package/dist/esm/helperComponents/NativePlayer/NativePlayer.js +100 -0
- package/dist/esm/helperComponents/NativePlayer/hooks.d.ts +13 -0
- package/dist/esm/helperComponents/NativePlayer/hooks.js +101 -0
- package/dist/esm/helperComponents/NativePlayer/index.d.ts +1 -0
- package/dist/esm/helperComponents/NativePlayer/index.js +1 -0
- package/dist/esm/helperComponents/NativePlayer/styles.module.css +39 -0
- package/dist/esm/helperComponents/NativePlayer/types.d.ts +6 -0
- package/dist/esm/helperComponents/NativePlayer/types.js +1 -0
- package/dist/esm/helperComponents/NativePlayer/utils.d.ts +19 -0
- package/dist/esm/helperComponents/NativePlayer/utils.js +20 -0
- package/dist/esm/helperComponents/PlayerError/PlayerError.d.ts +5 -0
- package/dist/esm/helperComponents/PlayerError/PlayerError.js +9 -0
- package/dist/esm/helperComponents/PlayerError/index.d.ts +1 -0
- package/dist/esm/helperComponents/PlayerError/index.js +1 -0
- package/dist/esm/helperComponents/PlayerError/styles.module.css +32 -0
- package/dist/esm/helperComponents/SpeedSelect/SpeedSelect.d.ts +7 -0
- package/dist/esm/helperComponents/SpeedSelect/SpeedSelect.js +24 -0
- package/dist/esm/helperComponents/SpeedSelect/index.d.ts +1 -0
- package/dist/esm/helperComponents/SpeedSelect/index.js +1 -0
- package/dist/esm/helperComponents/SpeedSelect/styles.module.css +7 -0
- package/dist/esm/helperComponents/Toolbar/PlaybackControls.d.ts +6 -0
- package/dist/esm/helperComponents/Toolbar/PlaybackControls.js +17 -0
- package/dist/esm/helperComponents/Toolbar/Timeline.d.ts +2 -0
- package/dist/esm/helperComponents/Toolbar/Timeline.js +17 -0
- package/dist/esm/helperComponents/Toolbar/TimelinePreview.d.ts +8 -0
- package/dist/esm/helperComponents/Toolbar/TimelinePreview.js +15 -0
- package/dist/esm/helperComponents/Toolbar/Toolbar.d.ts +14 -0
- package/dist/esm/helperComponents/Toolbar/Toolbar.js +13 -0
- package/dist/esm/helperComponents/Toolbar/ToolbarButton.d.ts +12 -0
- package/dist/esm/helperComponents/Toolbar/ToolbarButton.js +11 -0
- package/dist/esm/helperComponents/Toolbar/hooks/index.d.ts +1 -0
- package/dist/esm/helperComponents/Toolbar/hooks/index.js +1 -0
- package/dist/esm/helperComponents/Toolbar/hooks/useTimeline.d.ts +10 -0
- package/dist/esm/helperComponents/Toolbar/hooks/useTimeline.js +29 -0
- package/dist/esm/helperComponents/Toolbar/index.d.ts +1 -0
- package/dist/esm/helperComponents/Toolbar/index.js +1 -0
- package/dist/esm/helperComponents/Toolbar/styles.module.css +115 -0
- package/dist/esm/helperComponents/Toolbar/types.d.ts +5 -0
- package/dist/esm/helperComponents/Toolbar/types.js +1 -0
- package/dist/esm/helperComponents/Toolbar/utils/getTimeByKey.d.ts +1 -0
- package/dist/esm/helperComponents/Toolbar/utils/getTimeByKey.js +17 -0
- package/dist/esm/helperComponents/Toolbar/utils/getTimeByPointer.d.ts +5 -0
- package/dist/esm/helperComponents/Toolbar/utils/getTimeByPointer.js +4 -0
- package/dist/esm/helperComponents/Toolbar/utils/index.d.ts +6 -0
- package/dist/esm/helperComponents/Toolbar/utils/index.js +6 -0
- package/dist/esm/helperComponents/Toolbar/utils/restart.d.ts +2 -0
- package/dist/esm/helperComponents/Toolbar/utils/restart.js +4 -0
- package/dist/esm/helperComponents/Toolbar/utils/seek.d.ts +2 -0
- package/dist/esm/helperComponents/Toolbar/utils/seek.js +3 -0
- package/dist/esm/helperComponents/Toolbar/utils/setVolume.d.ts +2 -0
- package/dist/esm/helperComponents/Toolbar/utils/setVolume.js +7 -0
- package/dist/esm/helperComponents/Toolbar/utils/toggleMute.d.ts +2 -0
- package/dist/esm/helperComponents/Toolbar/utils/toggleMute.js +6 -0
- package/dist/esm/helperComponents/VideoPlayButton/VideoPlayButton.d.ts +10 -0
- package/dist/esm/helperComponents/VideoPlayButton/VideoPlayButton.js +12 -0
- package/dist/esm/helperComponents/VideoPlayButton/index.d.ts +1 -0
- package/dist/esm/helperComponents/VideoPlayButton/index.js +1 -0
- package/dist/esm/helperComponents/VideoPlayButton/styles.module.css +100 -0
- package/dist/esm/hocs/withPlayerClassName.d.ts +3 -0
- package/dist/esm/hocs/withPlayerClassName.js +9 -0
- package/dist/esm/hooks/useFullscreen.d.ts +6 -0
- package/dist/esm/hooks/useFullscreen.js +29 -0
- package/dist/esm/hooks/usePlayerState.d.ts +11 -0
- package/dist/esm/hooks/usePlayerState.js +57 -0
- package/dist/esm/hooks/useSpriteFrames.d.ts +2 -0
- package/dist/esm/hooks/useSpriteFrames.js +29 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/locale/index.d.ts +83 -0
- package/dist/esm/locale/index.js +43 -0
- package/dist/esm/shared/types.d.ts +8 -0
- package/dist/esm/shared/types.js +1 -0
- package/dist/esm/style.css +323 -0
- package/dist/esm/types.d.ts +15 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils/embed.d.ts +8 -0
- package/dist/esm/utils/embed.js +69 -0
- package/dist/esm/utils/format.d.ts +2 -0
- package/dist/esm/utils/format.js +13 -0
- package/dist/esm/utils/fullscreen.d.ts +5 -0
- package/dist/esm/utils/fullscreen.js +26 -0
- package/dist/esm/utils/index.d.ts +6 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/loadSpriteFrames.d.ts +3 -0
- package/dist/esm/utils/loadSpriteFrames.js +6 -0
- package/dist/esm/utils/source.d.ts +5 -0
- package/dist/esm/utils/source.js +14 -0
- package/dist/esm/utils/sprite.d.ts +3 -0
- package/dist/esm/utils/sprite.js +37 -0
- package/dist/esm/utils/url.d.ts +1 -0
- package/dist/esm/utils/url.js +12 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +57 -3
- package/src/components/SiteImage/SiteImage.tsx +16 -0
- package/src/components/SiteImage/index.ts +1 -0
- package/src/components/SiteVideo/SiteVideo.tsx +28 -0
- package/src/components/SiteVideo/VideoContent.tsx +29 -0
- package/src/components/SiteVideo/index.ts +1 -0
- package/src/components/SiteVideo/styles.module.scss +19 -0
- package/src/components/index.ts +2 -0
- package/src/constants.ts +36 -0
- package/src/helperComponents/EmbedPlayer/EmbedPlayer.tsx +179 -0
- package/src/helperComponents/EmbedPlayer/index.ts +1 -0
- package/src/helperComponents/EmbedPlayer/styles.module.scss +18 -0
- package/src/helperComponents/NativePlayer/NativePlayer.tsx +168 -0
- package/src/helperComponents/NativePlayer/hooks.ts +115 -0
- package/src/helperComponents/NativePlayer/index.ts +1 -0
- package/src/helperComponents/NativePlayer/styles.module.scss +41 -0
- package/src/helperComponents/NativePlayer/types.ts +7 -0
- package/src/helperComponents/NativePlayer/utils.ts +29 -0
- package/src/helperComponents/PlayerError/PlayerError.tsx +18 -0
- package/src/helperComponents/PlayerError/index.ts +1 -0
- package/src/helperComponents/PlayerError/styles.module.scss +29 -0
- package/src/helperComponents/SpeedSelect/SpeedSelect.tsx +67 -0
- package/src/helperComponents/SpeedSelect/index.ts +1 -0
- package/src/helperComponents/SpeedSelect/styles.module.scss +9 -0
- package/src/helperComponents/Toolbar/PlaybackControls.tsx +104 -0
- package/src/helperComponents/Toolbar/Timeline.tsx +55 -0
- package/src/helperComponents/Toolbar/TimelinePreview.tsx +33 -0
- package/src/helperComponents/Toolbar/Toolbar.tsx +42 -0
- package/src/helperComponents/Toolbar/ToolbarButton.tsx +46 -0
- package/src/helperComponents/Toolbar/hooks/index.ts +1 -0
- package/src/helperComponents/Toolbar/hooks/useTimeline.ts +43 -0
- package/src/helperComponents/Toolbar/index.ts +1 -0
- package/src/helperComponents/Toolbar/styles.module.scss +138 -0
- package/src/helperComponents/Toolbar/types.ts +1 -0
- package/src/helperComponents/Toolbar/utils/getTimeByKey.ts +18 -0
- package/src/helperComponents/Toolbar/utils/getTimeByPointer.ts +11 -0
- package/src/helperComponents/Toolbar/utils/index.ts +6 -0
- package/src/helperComponents/Toolbar/utils/restart.ts +6 -0
- package/src/helperComponents/Toolbar/utils/seek.ts +5 -0
- package/src/helperComponents/Toolbar/utils/setVolume.ts +10 -0
- package/src/helperComponents/Toolbar/utils/toggleMute.ts +9 -0
- package/src/helperComponents/VideoPlayButton/VideoPlayButton.tsx +39 -0
- package/src/helperComponents/VideoPlayButton/index.ts +1 -0
- package/src/helperComponents/VideoPlayButton/styles.module.scss +112 -0
- package/src/hocs/withPlayerClassName.ts +11 -0
- package/src/hooks/useFullscreen.ts +39 -0
- package/src/hooks/usePlayerState.ts +80 -0
- package/src/hooks/useSpriteFrames.ts +39 -0
- package/src/index.ts +4 -0
- package/src/locale/index.ts +47 -0
- package/src/shared/types.ts +8 -0
- package/src/types.ts +15 -0
- package/src/utils/embed.ts +95 -0
- package/src/utils/format.ts +16 -0
- package/src/utils/fullscreen.ts +34 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/loadSpriteFrames.ts +8 -0
- package/src/utils/source.ts +22 -0
- package/src/utils/sprite.ts +48 -0
- package/src/utils/url.ts +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NativePlayer';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: absolute;
|
|
5
|
+
inset: 0;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
border-radius: inherit;
|
|
8
|
+
|
|
9
|
+
&:fullscreen {
|
|
10
|
+
border-radius: 0;
|
|
11
|
+
background: base.$sn-theme-color-neutral-background;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mount {
|
|
16
|
+
position: absolute;
|
|
17
|
+
inset: 0;
|
|
18
|
+
|
|
19
|
+
> .player {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.media,
|
|
27
|
+
.poster {
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.media {
|
|
34
|
+
object-fit: contain;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.poster {
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: 0;
|
|
40
|
+
object-fit: cover;
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VideoPlayerProps } from '../../types';
|
|
2
|
+
import { getSourceType } from '../../utils';
|
|
3
|
+
|
|
4
|
+
/** Управление рисует DS; video.js отвечает за загрузку и воспроизведение медиа. */
|
|
5
|
+
export function getVideoPlayerOptions({
|
|
6
|
+
src,
|
|
7
|
+
poster,
|
|
8
|
+
autoPlay = false,
|
|
9
|
+
muted = false,
|
|
10
|
+
loop = false,
|
|
11
|
+
}: VideoPlayerProps) {
|
|
12
|
+
return {
|
|
13
|
+
sources: [{ src, type: getSourceType(src) }],
|
|
14
|
+
poster,
|
|
15
|
+
autoplay: autoPlay,
|
|
16
|
+
muted: muted || autoPlay,
|
|
17
|
+
loop,
|
|
18
|
+
preload: autoPlay ? 'auto' : 'metadata',
|
|
19
|
+
playsinline: true,
|
|
20
|
+
fill: true,
|
|
21
|
+
controls: false,
|
|
22
|
+
children: ['mediaLoader', 'liveTracker'],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Запрет autoplay и отмена запроса не делают источник недоступным. */
|
|
27
|
+
export function isPlaybackInterrupted(error: unknown) {
|
|
28
|
+
return error instanceof Error && (error.name === 'NotAllowedError' || error.name === 'AbortError');
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../../constants';
|
|
4
|
+
import { siteMediaLocale } from '../../locale';
|
|
5
|
+
import styles from './styles.module.scss';
|
|
6
|
+
|
|
7
|
+
type PlayerErrorProps = { onRetry?(): void };
|
|
8
|
+
|
|
9
|
+
export function PlayerError({ onRetry }: PlayerErrorProps) {
|
|
10
|
+
const { t } = siteMediaLocale.useTranslations();
|
|
11
|
+
return (
|
|
12
|
+
<div className={styles.root} role='status' data-test-id={TEST_IDS.error}>
|
|
13
|
+
<div className={styles.title}>{t('errorTitle')}</div>
|
|
14
|
+
<div className={styles.description}>{t('errorDescription')}</div>
|
|
15
|
+
{onRetry && <Button label={t('retry')} onClick={onRetry} data-test-id={TEST_IDS.retry} />}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PlayerError';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: absolute;
|
|
5
|
+
inset: 0;
|
|
6
|
+
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: base.$sn-primitive-dimension-12;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
|
|
13
|
+
padding: base.$sn-primitive-dimension-16;
|
|
14
|
+
|
|
15
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
16
|
+
text-align: center;
|
|
17
|
+
|
|
18
|
+
background: base.$sn-theme-color-neutral-background;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title {
|
|
22
|
+
@include base.composite-var(base.$sn-regular, 'title', 'm');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.description {
|
|
26
|
+
color: base.$sn-theme-color-available-version-textSecondary;
|
|
27
|
+
|
|
28
|
+
@include base.composite-var(base.$sn-regular, 'body', 's');
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
import { ChevronDownSVG, ChevronUpSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { Droplist, ItemId } from '@cloud-ru/ds-list';
|
|
4
|
+
import { useRef, useState } from 'react';
|
|
5
|
+
import Player from 'video.js/dist/types/player';
|
|
6
|
+
|
|
7
|
+
import { PLAYBACK_RATES, TEST_IDS } from '../../constants';
|
|
8
|
+
import { siteMediaLocale } from '../../locale';
|
|
9
|
+
import { formatRate } from '../../utils';
|
|
10
|
+
import styles from './styles.module.scss';
|
|
11
|
+
|
|
12
|
+
type SpeedSelectProps = { player: Player; rate: number };
|
|
13
|
+
|
|
14
|
+
export function SpeedSelect({ player, rate }: SpeedSelectProps) {
|
|
15
|
+
const { t } = siteMediaLocale.useTranslations();
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
18
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
19
|
+
|
|
20
|
+
const handleChange = (value: ItemId) => {
|
|
21
|
+
player.playbackRate(Number(value));
|
|
22
|
+
setOpen(false);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div ref={containerRef} className={styles.root}>
|
|
27
|
+
<Droplist
|
|
28
|
+
items={PLAYBACK_RATES.map(value => ({
|
|
29
|
+
id: String(value),
|
|
30
|
+
content: { label: formatRate(value) },
|
|
31
|
+
'data-test-id': `${TEST_IDS.speedOption}-${value}`,
|
|
32
|
+
}))}
|
|
33
|
+
selection={{ mode: 'single', value: String(rate), onChange: handleChange }}
|
|
34
|
+
open={open}
|
|
35
|
+
onOpenChange={setOpen}
|
|
36
|
+
placement='top-end'
|
|
37
|
+
trigger='click'
|
|
38
|
+
triggerElemRef={triggerRef}
|
|
39
|
+
container={containerRef}
|
|
40
|
+
className={styles.menu}
|
|
41
|
+
size='s'
|
|
42
|
+
label={t('speed')}
|
|
43
|
+
closeDroplistOnItemClick
|
|
44
|
+
disableSpanWrapper
|
|
45
|
+
data-test-id={TEST_IDS.speedMenu}
|
|
46
|
+
>
|
|
47
|
+
{({ onKeyDown }) => (
|
|
48
|
+
<Button
|
|
49
|
+
innerRef={triggerRef}
|
|
50
|
+
label={formatRate(rate)}
|
|
51
|
+
icon={open ? <ChevronUpSVG /> : <ChevronDownSVG />}
|
|
52
|
+
iconPosition='after'
|
|
53
|
+
view='simple'
|
|
54
|
+
appearance='neutral'
|
|
55
|
+
size='s'
|
|
56
|
+
minWidth={false}
|
|
57
|
+
aria-label={t('speed')}
|
|
58
|
+
aria-haspopup='menu'
|
|
59
|
+
aria-expanded={open}
|
|
60
|
+
onKeyDown={onKeyDown}
|
|
61
|
+
data-test-id={TEST_IDS.speed}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
</Droplist>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SpeedSelect';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { RepeatSVG } from '@cloud-ru/ds-icons/interface/product';
|
|
2
|
+
import {
|
|
3
|
+
FullScreenSVG,
|
|
4
|
+
NormalScreenSVG,
|
|
5
|
+
PausePlayerSVG,
|
|
6
|
+
PlayPlayerSVG,
|
|
7
|
+
RewindAheadSVG,
|
|
8
|
+
RewindSVG,
|
|
9
|
+
SoundOffSVG,
|
|
10
|
+
SoundOnSVG,
|
|
11
|
+
} from '@cloud-ru/ds-icons/interface/web';
|
|
12
|
+
import { Slider } from '@cloud-ru/ds-slider';
|
|
13
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
14
|
+
|
|
15
|
+
import { SEEK_STEP, TEST_IDS } from '../../constants';
|
|
16
|
+
import { siteMediaLocale } from '../../locale';
|
|
17
|
+
import { formatTime } from '../../utils';
|
|
18
|
+
import { SpeedSelect } from '../SpeedSelect';
|
|
19
|
+
import styles from './styles.module.scss';
|
|
20
|
+
import type { ToolbarProps } from './Toolbar';
|
|
21
|
+
import { ToolbarButton } from './ToolbarButton';
|
|
22
|
+
import { restart, seek, setVolume, toggleMute } from './utils';
|
|
23
|
+
|
|
24
|
+
type PlaybackControlsProps = Omit<ToolbarProps, 'frames' | 'visible'> & { compact: boolean };
|
|
25
|
+
|
|
26
|
+
export function PlaybackControls({
|
|
27
|
+
player,
|
|
28
|
+
state,
|
|
29
|
+
compact,
|
|
30
|
+
fullscreen,
|
|
31
|
+
onTogglePlay,
|
|
32
|
+
onToggleFullscreen,
|
|
33
|
+
onPlaybackError,
|
|
34
|
+
}: PlaybackControlsProps) {
|
|
35
|
+
const { t } = siteMediaLocale.useTranslations();
|
|
36
|
+
const { isPlaying, isMuted, volume, currentTime, duration, rate } = state;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={styles.controls}>
|
|
40
|
+
<ToolbarButton
|
|
41
|
+
label={isPlaying ? t('pause') : t('play')}
|
|
42
|
+
showTooltip
|
|
43
|
+
icon={isPlaying ? <PausePlayerSVG /> : <PlayPlayerSVG />}
|
|
44
|
+
onClick={onTogglePlay}
|
|
45
|
+
testId={TEST_IDS.play}
|
|
46
|
+
/>
|
|
47
|
+
<ToolbarButton
|
|
48
|
+
label={isMuted ? t('unmute') : t('mute')}
|
|
49
|
+
showTooltip
|
|
50
|
+
icon={isMuted ? <SoundOffSVG /> : <SoundOnSVG />}
|
|
51
|
+
onClick={() => toggleMute(player, isMuted, volume)}
|
|
52
|
+
testId={TEST_IDS.mute}
|
|
53
|
+
/>
|
|
54
|
+
{!compact && (
|
|
55
|
+
<>
|
|
56
|
+
<div className={styles.volume} data-test-id={TEST_IDS.volume}>
|
|
57
|
+
<Slider
|
|
58
|
+
value={isMuted ? 0 : volume}
|
|
59
|
+
min={0}
|
|
60
|
+
max={100}
|
|
61
|
+
step={1}
|
|
62
|
+
onChange={value => setVolume(player, value)}
|
|
63
|
+
ariaLabelForHandle={t('volume')}
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
<ToolbarButton
|
|
67
|
+
label={t('rewind')}
|
|
68
|
+
icon={<RewindSVG />}
|
|
69
|
+
onClick={() => seek(player, currentTime, duration, -SEEK_STEP)}
|
|
70
|
+
testId={TEST_IDS.rewind}
|
|
71
|
+
/>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
<Typography as='span' variant='label' size='s' className={styles.time} data-test-id={TEST_IDS.time}>
|
|
75
|
+
{formatTime(currentTime) + ' / ' + formatTime(duration)}
|
|
76
|
+
</Typography>
|
|
77
|
+
{!compact && (
|
|
78
|
+
<>
|
|
79
|
+
<ToolbarButton
|
|
80
|
+
label={t('forward')}
|
|
81
|
+
icon={<RewindAheadSVG />}
|
|
82
|
+
onClick={() => seek(player, currentTime, duration, SEEK_STEP)}
|
|
83
|
+
testId={TEST_IDS.forward}
|
|
84
|
+
/>
|
|
85
|
+
<ToolbarButton
|
|
86
|
+
label={t('restart')}
|
|
87
|
+
icon={<RepeatSVG />}
|
|
88
|
+
onClick={() => restart(player, onPlaybackError)}
|
|
89
|
+
testId={TEST_IDS.restart}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
<span className={styles.spacer} />
|
|
94
|
+
<SpeedSelect player={player} rate={rate} />
|
|
95
|
+
<ToolbarButton
|
|
96
|
+
label={fullscreen ? t('exitFullscreen') : t('enterFullscreen')}
|
|
97
|
+
showTooltip
|
|
98
|
+
icon={fullscreen ? <NormalScreenSVG /> : <FullScreenSVG />}
|
|
99
|
+
onClick={onToggleFullscreen}
|
|
100
|
+
testId={TEST_IDS.fullscreen}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Skeleton } from '@cloud-ru/ds-skeleton';
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../../constants';
|
|
4
|
+
import { siteMediaLocale } from '../../locale';
|
|
5
|
+
import { findSpriteFrame, formatTime } from '../../utils';
|
|
6
|
+
import { useTimeline } from './hooks';
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
import { TimelinePreview } from './TimelinePreview';
|
|
9
|
+
import type { ToolbarProps } from './Toolbar';
|
|
10
|
+
|
|
11
|
+
export function Timeline({ player, state, frames }: Pick<ToolbarProps, 'player' | 'state' | 'frames'>) {
|
|
12
|
+
const { t } = siteMediaLocale.useTranslations();
|
|
13
|
+
const { currentTime, duration, buffered } = state;
|
|
14
|
+
const { hover, handlePointerDown, handlePointerMove, handlePointerLeave, handleKeyDown } = useTimeline(
|
|
15
|
+
player,
|
|
16
|
+
currentTime,
|
|
17
|
+
duration,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (duration <= 0) {
|
|
21
|
+
return <Skeleton loading width='100%' height={8} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
{hover && <TimelinePreview position={hover} frame={findSpriteFrame(frames, hover.time)} />}
|
|
27
|
+
<div
|
|
28
|
+
className={styles.timeline}
|
|
29
|
+
role='slider'
|
|
30
|
+
tabIndex={0}
|
|
31
|
+
aria-label={t('seek')}
|
|
32
|
+
aria-valuemin={0}
|
|
33
|
+
aria-valuemax={Math.round(duration)}
|
|
34
|
+
aria-valuenow={Math.round(currentTime)}
|
|
35
|
+
aria-valuetext={formatTime(currentTime)}
|
|
36
|
+
data-test-id={TEST_IDS.timeline}
|
|
37
|
+
onPointerDown={handlePointerDown}
|
|
38
|
+
onPointerMove={handlePointerMove}
|
|
39
|
+
onPointerLeave={handlePointerLeave}
|
|
40
|
+
onKeyDown={handleKeyDown}
|
|
41
|
+
>
|
|
42
|
+
<div className={styles.track}>
|
|
43
|
+
{buffered.map(([start, end]) => (
|
|
44
|
+
<span
|
|
45
|
+
key={start}
|
|
46
|
+
className={styles.buffered}
|
|
47
|
+
style={{ left: (start / duration) * 100 + '%', width: ((end - start) / duration) * 100 + '%' }}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
<span className={styles.viewed} style={{ width: (currentTime / duration) * 100 + '%' }} />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../../constants';
|
|
4
|
+
import { SpriteFrame } from '../../shared/types';
|
|
5
|
+
import { formatTime } from '../../utils';
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
import { TimelinePosition } from './types';
|
|
8
|
+
|
|
9
|
+
type TimelinePreviewProps = { position: TimelinePosition; frame?: SpriteFrame };
|
|
10
|
+
|
|
11
|
+
export function TimelinePreview({ position, frame }: TimelinePreviewProps) {
|
|
12
|
+
const width = frame?.width ?? 64;
|
|
13
|
+
const left = Math.max(0, Math.min(position.offset - width / 2, position.width - width));
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className={styles.tip} style={{ left, width: frame?.width }} data-test-id={TEST_IDS.preview}>
|
|
17
|
+
{frame && (
|
|
18
|
+
<div
|
|
19
|
+
className={styles.tipImage}
|
|
20
|
+
style={{
|
|
21
|
+
width: frame.width,
|
|
22
|
+
height: frame.height,
|
|
23
|
+
backgroundImage: 'url(' + JSON.stringify(frame.imageUrl) + ')',
|
|
24
|
+
backgroundPosition: '-' + frame.x + 'px -' + frame.y + 'px',
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
<Typography as='span' variant='label' size='s' className={styles.tipTime}>
|
|
29
|
+
{formatTime(position.time)}
|
|
30
|
+
</Typography>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
2
|
+
import { ChildThemeProvider, COLOR_SCHEME } from '@cloud-ru/ds-theme';
|
|
3
|
+
import Player from 'video.js/dist/types/player';
|
|
4
|
+
|
|
5
|
+
import { TEST_IDS } from '../../constants';
|
|
6
|
+
import { PlayerState } from '../../hooks/usePlayerState';
|
|
7
|
+
import { SpriteFrame } from '../../shared/types';
|
|
8
|
+
import { PlaybackControls } from './PlaybackControls';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
import { Timeline } from './Timeline';
|
|
11
|
+
|
|
12
|
+
export type ToolbarProps = {
|
|
13
|
+
player: Player;
|
|
14
|
+
state: PlayerState;
|
|
15
|
+
frames: SpriteFrame[];
|
|
16
|
+
visible: boolean;
|
|
17
|
+
fullscreen: boolean;
|
|
18
|
+
onTogglePlay(): void;
|
|
19
|
+
onToggleFullscreen(): void;
|
|
20
|
+
onPlaybackError(error: unknown): void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const DARK_THEME = { colorScheme: COLOR_SCHEME.Dark };
|
|
24
|
+
|
|
25
|
+
export function Toolbar({ frames, visible, ...controlsProps }: ToolbarProps) {
|
|
26
|
+
const { layoutType } = useAdaptiveLayout();
|
|
27
|
+
const { player, state } = controlsProps;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ChildThemeProvider value={DARK_THEME} className={styles.root}>
|
|
31
|
+
<div
|
|
32
|
+
className={styles.toolbar}
|
|
33
|
+
data-visible={visible}
|
|
34
|
+
data-layout-type={layoutType}
|
|
35
|
+
data-test-id={TEST_IDS.toolbar}
|
|
36
|
+
>
|
|
37
|
+
<Timeline player={player} state={state} frames={frames} />
|
|
38
|
+
<PlaybackControls {...controlsProps} compact={isMobileLayout(layoutType)} />
|
|
39
|
+
</div>
|
|
40
|
+
</ChildThemeProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Button, ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
|
|
5
|
+
type ToolbarButtonProps = {
|
|
6
|
+
label: string;
|
|
7
|
+
icon: ReactElement;
|
|
8
|
+
testId: string;
|
|
9
|
+
appearance?: ButtonProps['appearance'];
|
|
10
|
+
showTooltip?: boolean;
|
|
11
|
+
onClick(): void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const TOOLTIP_OPEN_DELAY = 400;
|
|
15
|
+
|
|
16
|
+
export function ToolbarButton({
|
|
17
|
+
label,
|
|
18
|
+
icon,
|
|
19
|
+
testId,
|
|
20
|
+
onClick,
|
|
21
|
+
appearance = 'neutral',
|
|
22
|
+
showTooltip = false,
|
|
23
|
+
}: ToolbarButtonProps) {
|
|
24
|
+
const button = (
|
|
25
|
+
<Button
|
|
26
|
+
view='simple'
|
|
27
|
+
appearance={appearance}
|
|
28
|
+
size='s'
|
|
29
|
+
minWidth={false}
|
|
30
|
+
aria-label={label}
|
|
31
|
+
icon={icon}
|
|
32
|
+
onClick={onClick}
|
|
33
|
+
data-test-id={testId}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (showTooltip) {
|
|
38
|
+
return (
|
|
39
|
+
<Tooltip tip={label} hoverDelayOpen={TOOLTIP_OPEN_DELAY}>
|
|
40
|
+
{button}
|
|
41
|
+
</Tooltip>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return button;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useTimeline';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { KeyboardEvent, PointerEvent, useState } from 'react';
|
|
2
|
+
import Player from 'video.js/dist/types/player';
|
|
3
|
+
|
|
4
|
+
import { TimelinePosition } from '../types';
|
|
5
|
+
import { getTimeByKey, getTimeByPointer } from '../utils';
|
|
6
|
+
|
|
7
|
+
export function useTimeline(player: Player, currentTime: number, duration: number) {
|
|
8
|
+
const [hover, setHover] = useState<TimelinePosition | null>(null);
|
|
9
|
+
|
|
10
|
+
const getPosition = (event: PointerEvent<HTMLDivElement>) =>
|
|
11
|
+
getTimeByPointer(event.clientX, event.currentTarget.getBoundingClientRect(), duration);
|
|
12
|
+
|
|
13
|
+
const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {
|
|
14
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
15
|
+
player.currentTime(getPosition(event).time);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {
|
|
19
|
+
const position = getPosition(event);
|
|
20
|
+
setHover(position);
|
|
21
|
+
|
|
22
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
23
|
+
player.currentTime(position.time);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handlePointerLeave = () => {
|
|
28
|
+
setHover(null);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
32
|
+
const next = getTimeByKey(event.key, currentTime, duration);
|
|
33
|
+
|
|
34
|
+
if (next === undefined) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
player.currentTime(next);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return { hover, handlePointerDown, handlePointerMove, handlePointerLeave, handleKeyDown };
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Toolbar';
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
pointer-events: none;
|
|
5
|
+
|
|
6
|
+
position: absolute;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.toolbar {
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: base.$sn-primitive-dimension-8;
|
|
18
|
+
|
|
19
|
+
padding: 0 base.$sn-primitive-dimension-8 base.$sn-primitive-dimension-8;
|
|
20
|
+
|
|
21
|
+
opacity: 0;
|
|
22
|
+
background: base.$sn-theme-color-neutral-background;
|
|
23
|
+
|
|
24
|
+
transition: opacity 0.15s ease-in-out;
|
|
25
|
+
|
|
26
|
+
&::before {
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
content: '';
|
|
29
|
+
|
|
30
|
+
position: absolute;
|
|
31
|
+
bottom: 100%;
|
|
32
|
+
left: 0;
|
|
33
|
+
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: base.$sn-primitive-dimension-80;
|
|
36
|
+
|
|
37
|
+
background: linear-gradient(to bottom, transparent, base.$sn-theme-color-neutral-background);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-visible='false'] {
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-visible='true'],
|
|
45
|
+
&:focus-within {
|
|
46
|
+
pointer-events: auto;
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.timeline {
|
|
52
|
+
touch-action: none;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
|
|
58
|
+
height: base.$sn-primitive-dimension-16;
|
|
59
|
+
|
|
60
|
+
&:focus-visible {
|
|
61
|
+
outline: base.$sn-primitive-strokeWeight-strokeMedium solid base.$sn-theme-color-primary-accent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.track {
|
|
66
|
+
position: relative;
|
|
67
|
+
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: base.$sn-primitive-dimension-4;
|
|
72
|
+
|
|
73
|
+
background: base.$sn-theme-color-neutral-decor;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.buffered,
|
|
77
|
+
.viewed {
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset-block: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.buffered {
|
|
83
|
+
background: base.$sn-theme-color-neutral-accent;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.viewed {
|
|
87
|
+
left: 0;
|
|
88
|
+
background: base.$sn-theme-color-primary-accent;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.tip {
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
|
|
94
|
+
position: absolute;
|
|
95
|
+
bottom: calc(100% + #{base.$sn-primitive-dimension-8});
|
|
96
|
+
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: base.$sn-primitive-dimension-4;
|
|
100
|
+
align-items: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tipImage {
|
|
104
|
+
border-radius: base.$sn-density-radius-xs;
|
|
105
|
+
background-repeat: no-repeat;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tipTime {
|
|
109
|
+
padding: base.$sn-primitive-dimension-4;
|
|
110
|
+
border-radius: base.$sn-density-radius-2xs;
|
|
111
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
112
|
+
background: base.$sn-theme-color-neutral-background;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.controls {
|
|
116
|
+
display: flex;
|
|
117
|
+
gap: base.$sn-primitive-dimension-12;
|
|
118
|
+
align-items: center;
|
|
119
|
+
min-width: 0;
|
|
120
|
+
|
|
121
|
+
.toolbar[data-layout-type='mobile'] & {
|
|
122
|
+
gap: base.$sn-primitive-dimension-4;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.volume {
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
width: base.$sn-primitive-dimension-128;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.time {
|
|
132
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
133
|
+
white-space: nowrap;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.spacer {
|
|
137
|
+
flex: 1;
|
|
138
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TimelinePosition = { time: number; offset: number; width: number };
|