mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 00:38:27 +00:00
[Glitch] fix: Fix autoplay not working properly in AudioModal, #34841
Port 54ad57ea95 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -442,11 +442,14 @@ export const Audio: React.FC<{
|
||||
if (typeof startMuted !== 'undefined') {
|
||||
audioRef.current.muted = startMuted;
|
||||
}
|
||||
}, [setDuration, startTime, startVolume, startMuted]);
|
||||
|
||||
const handleCanPlayThrough = useCallback(() => {
|
||||
if (startPlaying) {
|
||||
void audioRef.current.play();
|
||||
resumeAudio();
|
||||
void audioRef.current?.play();
|
||||
}
|
||||
}, [setDuration, startTime, startVolume, startMuted, startPlaying]);
|
||||
}, [startPlaying, resumeAudio]);
|
||||
|
||||
const seekBy = (time: number) => {
|
||||
if (!audioRef.current) {
|
||||
@@ -591,6 +594,7 @@ export const Audio: React.FC<{
|
||||
onPause={handlePause}
|
||||
onProgress={handleProgress}
|
||||
onLoadedData={handleLoadedData}
|
||||
onCanPlayThrough={handleCanPlayThrough}
|
||||
onTimeUpdate={handleTimeUpdate}
|
||||
onVolumeChange={handleVolumeChange}
|
||||
crossOrigin='anonymous'
|
||||
|
||||
Reference in New Issue
Block a user