yoheimuta / RxMusicPlayer

A reactive library to make it easy for audio playbacks using RxSwift.
MIT License
58 stars 8 forks source link

I'm emmiting .stop and keeps de reference in background #56

Closed Sk8er22 closed 2 years ago

Sk8er22 commented 2 years ago

Hello,

I have an issue. I have a screen where I instantiate a RxMusiclPlayer with the Item that I need. It works perfectly. But once I leave the viewscreen If I lock the screen keeps showing the panel to reproduce the audio although I have : viewDidDisappear{

        self.emitCommand.onNext(.stop)
        self.player?.player?.pause()
        self.player?.player?.replaceCurrentItem(with: nil)
        self.player = nil

}

Also, I go to another screen that instantiates another RxMusicPlayer. it works perfect but if I lock the screen the player panel over there plays two tracks at the same time.

So it's like AVplayer panel from the lock screen keeps a reference two both RxMusicPlayer?

yoheimuta commented 2 years ago

@Sk8er22 Thank you for reaching out. I'm looking into this.

yoheimuta commented 2 years ago

But once I leave the viewscreen If I lock the screen keeps showing the panel to reproduce the audio although I have :

I could reproduce this problem. I'll fix it by #59.

if I lock the screen the player panel over there plays two tracks at the same time.

I couldn't reproduce this.

So it's like AVplayer panel from the lock screen keeps a reference two both RxMusicPlayer?

No. In theory and my digging locally, the lock screen doesn't have a reference to the RxMusicPlayer.

Sk8er22 commented 2 years ago

Thank you very much! appreciate the library and your work :)

if I lock the screen the player panel over there plays two tracks at the same time. So it's like AVplayer panel from the lock screen keeps a reference two both RxMusicPlayer?

If after apply the fix keeps happening I will upload a video and give you more information, but withfix: Clear the now playing info center dictionary #59 I believe it will get fixed

yoheimuta commented 2 years ago

@Sk8er22 I think so! And uploading a video sounds helpful.

For now, I've cut a release here: https://github.com/yoheimuta/RxMusicPlayer/releases/tag/2.3.2

I'll publish it to cocoapod too shortly.

yoheimuta commented 2 years ago

Updating the cocoapod spec is done.