mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-14 20:22:10 +00:00
fix: video not playing on thumb click
This commit is contained in:
parent
05c6c7c64d
commit
4302639220
1 changed files with 4 additions and 8 deletions
|
@ -33,10 +33,6 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
|
|||
const [arrowShow, setArrowShow] = useState(false);
|
||||
|
||||
const showNextImage = () => {
|
||||
if (currentVideoRef.current) {
|
||||
currentVideoRef.current.pause()
|
||||
}
|
||||
|
||||
setMediaIndex((index: number) => {
|
||||
if (index === mediaCount - 1) return 0;
|
||||
|
||||
|
@ -45,10 +41,6 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
|
|||
};
|
||||
|
||||
const showPrevImage = () => {
|
||||
if (currentVideoRef.current) {
|
||||
currentVideoRef.current.pause()
|
||||
}
|
||||
|
||||
setMediaIndex((index: number) => {
|
||||
if (index === 0) return mediaCount - 1;
|
||||
|
||||
|
@ -61,6 +53,10 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
|
|||
}, [gameDetails]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentVideoRef.current) {
|
||||
currentVideoRef.current.pause()
|
||||
}
|
||||
|
||||
if (hasMovies && mediaContainerRef.current) {
|
||||
mediaContainerRef.current.childNodes.forEach((node, index) => {
|
||||
if (index == mediaIndex && node instanceof HTMLVideoElement) {
|
||||
|
|
Loading…
Reference in a new issue