diff --git a/src/components/player/atoms/NextEpisodeButton.tsx b/src/components/player/atoms/NextEpisodeButton.tsx index 3d760900..bdb8faf6 100644 --- a/src/components/player/atoms/NextEpisodeButton.tsx +++ b/src/components/player/atoms/NextEpisodeButton.tsx @@ -1,5 +1,5 @@ import classNames from "classnames"; -import React, { useCallback } from "react"; +import React, { useCallback, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { Icon, Icons } from "@/components/Icon"; @@ -80,6 +80,12 @@ export function NextEpisodeButton(props: { props.onChange?.(metaCopy); }, [setDirectMeta, nextEp, meta, props, setShouldStartFromBeginning]); + useEffect(() => { + if (time >= duration && meta && nextEp) { + loadNextEpisode(); + } + }, [time, duration, meta, nextEp, loadNextEpisode]); + const startCurrentEpisodeFromBeginning = useCallback(() => { if (!meta || !meta.episode) return; const metaCopy = { ...meta };