Skip to content

Commit e335e6a

Browse files
authored
check setIsLoopingAsync function exist (#931)
1 parent bc73b8e commit e335e6a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ const HeadlessAudioPlayer = React.forwardRef<
3939
const [isPlaying, setIsPlaying] = React.useState(false);
4040

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

0 commit comments

Comments
 (0)