Use audio.ended in MessageAudio.tsx

This commit is contained in:
Fedor Indutny 2021-09-16 08:02:23 -07:00 committed by GitHub
parent a5f44bc46c
commit 59ca63cd2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,7 +180,9 @@ export const MessageAudio: React.FC<Props> = (props: Props) => {
activeAudioID === id && activeAudioContext === renderingContext;
const waveformRef = useRef<HTMLDivElement | null>(null);
const [isPlaying, setIsPlaying] = useState(isActive && !audio.paused);
const [isPlaying, setIsPlaying] = useState(
isActive && !(audio.paused || audio.ended)
);
const [currentTime, setCurrentTime] = useState(
isActive ? audio.currentTime : 0
);