florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
740 stars 337 forks source link

Music Stops when app is background after one song played [IOS] #344

Closed kalismeras61 closed 3 years ago

kalismeras61 commented 3 years ago

Flutter Version

My version : latest stable

Lib Version

My version : Latest

Platform (Android / iOS / web) + version

Platform : IOS 13.7

Describe the bug

Music doesn't continue when app is background. It is only playing one song and then stopping playing.

sivaram16 commented 3 years ago

I am also facing same issue any solution ? @kalismeras61 @florent37

kalismeras61 commented 3 years ago

@ThalapathySiva I fixed the issue.

Use, below func.

func deinitMediaPlayerNotifEvent() {     
        commandCenter.playCommand.isEnabled = false   
        commandCenter.playCommand.removeTarget(self)
        commandCenter.pauseCommand.isEnabled = false   
        commandCenter.pauseCommand.removeTarget(self)
        commandCenter.previousTrackCommand.isEnabled = false   
        commandCenter.previousTrackCommand.removeTarget(self)
        commandCenter.nextTrackCommand.isEnabled = false   
        commandCenter.nextTrackCommand.removeTarget(self)     
}

I am also facing same issue any solution ? @kalismeras61 @florent37

sivaram16 commented 3 years ago

could you tell me where to use this function? @kalismeras61

kalismeras61 commented 3 years ago

could you tell me where to use this function? @kalismeras61

You have to change this here;

https://github.com/florent37/Flutter-AssetsAudioPlayer/blob/master/darwin/Classes/Music.swift

sivaram16 commented 3 years ago

isn't this added in latest version ? should we change it manually.. thanks for your reply...

kalismeras61 commented 3 years ago

It is added, but it is wrong. You should fork this repository and change it.

bacr commented 3 years ago

Why this issue is closed?