-
Notifications
You must be signed in to change notification settings - Fork 28
Support isLooping for audio player #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Published version: @draftbit/[email protected] |
@@ -97,6 +101,7 @@ const HeadlessAudioPlayer = React.forwardRef< | |||
|
|||
const { sound } = await Audio.Sound.createAsync(finalSource); | |||
setCurrentSound(sound); | |||
sound.setIsLoopingAsync(isLooping); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only set the value when the audio is reloaded (audio source changes). Maybe we should have a separate useEffect that updates the looping state
React.useEffect(() => {
currentSound?.setIsLoopingAsync(isLooping);
}, [isLooping])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this one now since we have the other useEffect @sieu-db. Calling setCurrentSound
will cause the other useEffect to run
sound.setIsLoopingAsync(isLooping); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise all good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, got it, thanks
packages/core/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.tsx
Outdated
Show resolved
Hide resolved
packages/core/src/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.ts
Outdated
Show resolved
Hide resolved
… sieu/p-5279-add-loop-prop-audio-player
Published version: @draftbit/[email protected] |
Adjust this one 🙏 @YoussefHenna |
Published version: @draftbit/[email protected] |
Overview
Demo
Screen.Recording.2024-08-09.at.20.04.58.mov