The completion block from play(fromMarker:toMarker)
does not get called in the background.
#2238
Replies: 7 comments
-
Are you using the SwiftUI I can reproduce this in the sample app in this repo. The SwiftUI view relies on the animation being present in the |
Beta Was this translation helpful? Give feedback.
-
No, I'm using UIKit for this particular API |
Beta Was this translation helpful? Give feedback.
-
Ok, thanks for the info. Could you please share a sample project that demonstrates this issue? Alternatively, could you check locally if changing this line of code in // Remove the progress animation once complete so we know when the animation
// has finished playing (if it doesn't loop infinitely)
timedProgressAnimation.isRemovedOnCompletion = true to: timedProgressAnimation.isRemovedOnCompletion = false |
Beta Was this translation helpful? Give feedback.
-
I investigated this a bit more and found out that the problem was not in the completion block itself, but rather that a new animation cannot be started in the background, which ended up with the completion code also not getting fired. So basically what I want to achieve is not to resync animation that looping with some logic by markers with the sound after entering foreground. Sample project: |
Beta Was this translation helpful? Give feedback.
-
What happens if you try to use the main thready rendering engine rather than the core animation rendering engine, by updating the |
Beta Was this translation helpful? Give feedback.
-
If I use the Core Animation engine, then when I enter background with a currently running animation, it eventually completes with false, but on the main engine, the completion block is not called at all. As for the ability to start a new animation in the background for the main engine, it's the same: not able to start. |
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this issue into a discussion, since it's not totally obvious if starting animations in the background should be supported |
Beta Was this translation helpful? Give feedback.
-
I have an animation with
continuePlaying
as the background behavior, and important login to be called when the animation finishes playing.In my context, the app does not get suspended in the background due to an active audio session with the audio playback background mode enabled. However, for some reason, I receive the completion block only when entering the foreground.
Beta Was this translation helpful? Give feedback.
All reactions