Closed appcapsergen closed 9 months ago
I can't seem to get the audio session to stop as well
Do you mean the audio service? The audio session is handled by a separate package.
This is especially visible on iOS (like in this screenshot), where the media player stays active even though I shut down the video and attempted to shut down the audio session as well.
I don't see any provided screenshot, and I am also not sure what you mean by "the media player". Do you mean chewie? Or do you possibly mean the player in the notification or control center?
If you're talking about the notification or control center, can you confirm whether this issue only happens when using chewie or video_player, and does not happen with the official example/s in this repo?
I just checked through the source code of video_player and it doesn't seem to contain any code that conflicts with my own code for the notification / control center, but it does have code that could potentially conflict with the audio session. So I think I need you to clarify if you really mean the issue is on the audio session side of things.
@ryanheise My apologies, here's the screenshot I do mean the media controls in the notifications enter of an iOS device, yes!
I will test it out now with your example, but I do assume it is the audio session side of things simply because I am able to stop the video, just not the audio (session) of the video that I linked together with this package.
(Both chewie
and this package can use a video_player for playing of a video or audio respectively)
I found the issue and it was honestly pretty stupid (of me) :P
Basically, all I needed to do was call await super.stop();
in the overriden stop method in my custom audio handler...
That solved it 🤦🏼♂️
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.
Documented behaviour
Could not find what it's about, it doesn't give an error, the behavior I want just doesn't happen.
Actual behaviour
In my Flutter app the user is able to play a video, I use the
chewie
package for this. This player uses aVideoPlayerController
(from thevideo_player
package) to somewhat control the video player, which ultimately allows me to use theaudio_service
package to create an audio session. I use this to continue playing the video when the app is paused (in the background or when the phone is locked).The problem I'm faced with now is that when I've started a video with background audio playback successfully, but then want to close that video, I can't seem to get the audio session to stop as well. This is especially visible on iOS (like in this screenshot), where the media player stays active even though I shut down the video and attempted to shut down the audio session as well.
Runtime error
There's no error.
Minimal reproduction project
https://github.com/appcapsergen/audio_service
Reproduction steps
Output of flutter doctor
• No issues found!