Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Lockscreen info not displayed anymore #106

Closed
dylancom opened this issue May 6, 2021 · 10 comments · Fixed by #108
Closed

bug: Lockscreen info not displayed anymore #106

dylancom opened this issue May 6, 2021 · 10 comments · Fixed by #108

Comments

@dylancom
Copy link
Contributor

dylancom commented May 6, 2021

Since I recently upgraded to the latest pod of this project, the lock screen doesn't show info anymore (artist, title & artwork).
I also tested the Example project to make sure it's not related to my code and also there I don't see any lock screen info.

I found that self.mediaInfo is nil at: https://github.com/tanhakabir/SwiftAudioPlayer/blob/master/Source/SAPlayerPresenter.swift#L123

@tanhakabir
Copy link
Owner

Will look into today!

@dylancom
Copy link
Contributor Author

dylancom commented May 7, 2021

@tanhakabir I found that I was using 3.0.0 before and if I switch back to 3.0.0 the lockscreen is working fine again.

The lockscreen info missing seems to be introduced as of 4.0.0

@tanhakabir
Copy link
Owner

Thanks for testing that for me! I'm having a couple issues with my Apple Dev account right now so I can't test on device but just to confirm you are sending lockscreen info on start correct? I see that the latest example app wasn't

tanhakabir added a commit that referenced this issue May 7, 2021
@tanhakabir
Copy link
Owner

pushed a fix to the example app to pass in the lockscreen info

@dylancom
Copy link
Contributor Author

dylancom commented May 7, 2021

@tanhakabir no thanks, I was hoping I could push a PR myself but haven't found the fix yet.
Yes I'm using SAPlayer.shared.startSavedAudio(withSavedUrl: url, mediaInfo: info) from the start.
What I found is that handleLockscreenInfo(info) get's called with the correct info, but inside attachForUpdates() self.mediaInfo seems to remain nil.

The updated example still doesn't seem to show the provided mediaInfo.

@tanhakabir
Copy link
Owner

Hmm I'm not reproing that at the moment but once I can fix my dev account I can check on my device to confirm

@dezinezync
Copy link

I am also able to reliably reproduce @dylancom's issue against the master branch.

@dezinezync
Copy link

dezinezync commented May 8, 2021

I've traced it down to func handlePlayStreamedAudio(withRemoteUrl url: URL, bitrate: SAPlayerBitrate) inside SAPlayerPresenter line 94.

It calls handleClear() which removes the media info from the presenter.

Update: disabling the handleClear from there, and manually calling clear on the player before starting the next playback resolves the issue. So handleClear needs to be updated to manage existing valid mediaInfo instead of setting it to nil.

@dylancom
Copy link
Contributor Author

dylancom commented May 8, 2021

@dezinezync good catch. So it seems to be introduced by this commit: 542f65f
(The start of adding queuing functionality)

@dezinezync
Copy link

Can confirm, this fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants