bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
2.01k stars 845 forks source link

Audio playing background service #455

Closed SivaGiga closed 3 years ago

SivaGiga commented 4 years ago

I'm using audioplayers plugin to play local asset file. It's working fine with play, pause and stop. But when audio is playing if I get a call, it's not stopping, or if I move to another app without closing audio playing app, like YouTube and play video. Simultaneously it's also playing..how to handle this??

trt14 commented 4 years ago

I'm Also I have this issue !

+1

coder-Aayush commented 4 years ago

Same issue

scullabyte commented 4 years ago

Background audio works in ios 0.13.5 for me. I think it stopped working in .14.0.

alakhsingh commented 4 years ago

@SivaGiga Are you testing your app in an Android smartphone?

cg-manish commented 4 years ago

Background audio works in ios 0.13.5 for me. I think it stopped working in .14.0.

I am going to use this library in upcoming project. Does this library support background audio play and show player in notifications and lock screen? My use case is to play remote and local audio files.

alakhsingh commented 4 years ago

@surpriso1997 Notification at the moment is only implemented for IOS. IOS stops the audio the moment you move out of the app although, in Android, the audio keeps playing but you do not have notifications to control the player.

cg-manish commented 4 years ago

@alakhsingh do you know if those features are going to be implemented in the near future?

alakhsingh commented 4 years ago

@surpriso1997 Not sure. If you need it right now then you can audio_service plugin which also supports audio playing in the background and android lock screen audio control too. Although, I would say audioplayers is much simpler to use and the examples and code is more clear to get started easily. It might take audioplayers some time to support these features.

rizerzero commented 4 years ago

Same issue. This plugin is the most simple and stable I have tested, The only missing feature is the background service which is, unfortunately, a key feature. Good luck.

cg-manish commented 4 years ago

@alakhsingh There is issue in audio service plugin that there is compatibility issue between audio service and audioplayers.

alakhsingh commented 4 years ago

@surpriso1997 , I don't think compatibility is an issue. I did implement audioplayers plugin with audioservice plugin. It works perfectly fine. There are some audio player states which might be different but yeah, it does work.

MasjZam commented 4 years ago

Background audio in iOS works, you just need to enable the "Audio, AirPlay and Picture in Picture" background mode capability for your specified target - https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio

luanpotter commented 3 years ago

We should probably add that link to our troubleshooting guide! Thanks @MasjZam for figuring it out

luanpotter commented 3 years ago

Closed by #709