Skip to content

Commit

Permalink
Feat(p-video-player): Initial volume knob
Browse files Browse the repository at this point in the history
  • Loading branch information
Vija02 committed Oct 15, 2024
1 parent 9d465dc commit 49e5d47
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions plugins/video-player/view/Remote/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import {
Box,
Button,
Heading,
Input,
Slider,
SliderFilledTrack,
SliderMark,
SliderThumb,
SliderTrack,
Stack,
Text,
useDisclosure,
Expand Down Expand Up @@ -32,8 +38,10 @@ const VideoPlayerRemote = () => {
const pluginApi = usePluginAPI();

const mutableSceneData = pluginApi.scene.useValtioData();
const mutableRendererData = pluginApi.renderer.useValtioData();

const videos = pluginApi.scene.useData((x) => x.pluginData.videos);
const volume = pluginApi.renderer.useData((x) => x.volume);

const [input, setInput] = useState("");
const [isError, setIsError] = useState(false);
Expand Down Expand Up @@ -93,6 +101,36 @@ const VideoPlayerRemote = () => {
}}
/>

<Box>
<Slider
id="slider"
value={volume ?? 1}
min={0}
max={1}
step={0}
colorScheme="teal"
onChange={(v) => {
mutableRendererData.volume = v;
}}
height={{ base: "70vh", md: "100%" }}
width={{ base: "80px", md: "100%" }}
>
<SliderMark value={0.25} mt="1" ml="-2.5" fontSize="sm">
25%
</SliderMark>
<SliderMark value={0.5} mt="1" ml="-2.5" fontSize="sm">
50%
</SliderMark>
<SliderMark value={0.75} mt="1" ml="-2.5" fontSize="sm">
75%
</SliderMark>
<SliderTrack>
<SliderFilledTrack />
</SliderTrack>
<SliderThumb />
</Slider>
</Box>

<Text fontSize="lg" mt={2} fontWeight="bold">
Loaded Videos
</Text>
Expand Down

0 comments on commit 49e5d47

Please sign in to comment.