mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +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 [arrowShow, setArrowShow] = useState(false);
|
||||||
|
|
||||||
const showNextImage = () => {
|
const showNextImage = () => {
|
||||||
if (currentVideoRef.current) {
|
|
||||||
currentVideoRef.current.pause()
|
|
||||||
}
|
|
||||||
|
|
||||||
setMediaIndex((index: number) => {
|
setMediaIndex((index: number) => {
|
||||||
if (index === mediaCount - 1) return 0;
|
if (index === mediaCount - 1) return 0;
|
||||||
|
|
||||||
|
@ -45,10 +41,6 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const showPrevImage = () => {
|
const showPrevImage = () => {
|
||||||
if (currentVideoRef.current) {
|
|
||||||
currentVideoRef.current.pause()
|
|
||||||
}
|
|
||||||
|
|
||||||
setMediaIndex((index: number) => {
|
setMediaIndex((index: number) => {
|
||||||
if (index === 0) return mediaCount - 1;
|
if (index === 0) return mediaCount - 1;
|
||||||
|
|
||||||
|
@ -61,6 +53,10 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
|
||||||
}, [gameDetails]);
|
}, [gameDetails]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (currentVideoRef.current) {
|
||||||
|
currentVideoRef.current.pause()
|
||||||
|
}
|
||||||
|
|
||||||
if (hasMovies && mediaContainerRef.current) {
|
if (hasMovies && mediaContainerRef.current) {
|
||||||
mediaContainerRef.current.childNodes.forEach((node, index) => {
|
mediaContainerRef.current.childNodes.forEach((node, index) => {
|
||||||
if (index == mediaIndex && node instanceof HTMLVideoElement) {
|
if (index == mediaIndex && node instanceof HTMLVideoElement) {
|
||||||
|
|
Loading…
Reference in a new issue