Skip to content

Commit

Permalink
fix(closedcsptionsfeed): complete caption detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rpeterman-gp committed May 11, 2024
1 parent 20c8280 commit ca8c562
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/Player/ClosedCaptionsFeed/ClosedCaptionsFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ const Caption = ({
isCurrent
}: CaptionProps) => {
const { audioElm } = useContext(PlayerContext);
const { currentCue } = useContext(ClosedCaptionsContext);
const { startTime } = cues.at(0);
const { endTime } = cues.at(-1);
const [isComplete, setIsComplete] = useState(audioElm.currentTime > endTime);
Expand Down Expand Up @@ -437,6 +438,10 @@ const Caption = ({
};
const bodyRef = useRef<HTMLDivElement>();

useEffect(() => {
setIsComplete(currentCue?.startTime > endTime);
}, [currentCue?.startTime, endTime]);

useEffect(() => {
const bodyElm = bodyRef.current;

Expand Down

0 comments on commit ca8c562

Please sign in to comment.