import { useContext } from "react"; import { VideoPlayerContext } from "../VideoPlayer"; import { SpeakerWaveIcon, SpeakerXMarkIcon } from "@heroicons/react/24/solid"; export default function Volume() { const { isMuted, setIsMuted, volume, setVolume, videoRef } = useContext(VideoPlayerContext); return ( <> {/* 音量控制 */}
{ const newVolume = parseFloat(e.target.value); setVolume(newVolume); if (videoRef.current) { videoRef.current.volume = newVolume; } }} className="h-24 w-2 accent-primary-500 [-webkit-appearance:slider-vertical]" />
); }