Skip to content

Commit 50f08d5

Browse files
authored
fix setIsLoopAsync function (#932)
1 parent 21fcbc0 commit 50f08d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/core/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ const HeadlessAudioPlayer = React.forwardRef<
3939
const [isPlaying, setIsPlaying] = React.useState(false);
4040

4141
React.useEffect(() => {
42-
currentSound?.setIsLoopingAsync(isLooping);
42+
if (
43+
currentSound &&
44+
typeof currentSound?.setIsLoopingAsync === "function"
45+
) {
46+
currentSound.setIsLoopingAsync(isLooping);
47+
}
4348
}, [currentSound, isLooping]);
4449

4550
const updateAudioMode = React.useCallback(async () => {

0 commit comments

Comments
 (0)