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

Bugfix/ios dynamic island glitch on nowplayinginfo clearing #432

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

- Fixed an issue on iOS where the dynamic island (iphone 14 plus and higher) briefly disappeared when updating the nowPlayingInfo on for example backgrounding the app.
- Fixed an issue on Android when using Expo, where the Expo plugin would not add THEOplayer's Maven repo to the project's repositories list.

## [8.6.0] - 24-10-25
Expand Down
9 changes: 7 additions & 2 deletions ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class THEOplayerRCTNowPlayingManager {
func updateNowPlaying() {
// Reset any existing playing info
self.nowPlayingInfo = [:]
self.clearNowPlayingOnInfoCenter()

// Gather new playing info
if let player = self.player,
Expand All @@ -66,13 +65,19 @@ class THEOplayerRCTNowPlayingManager {
self.updateArtWork(artWorkUrlString) { [weak self] in
self?.processNowPlayingToInfoCenter()
}
} else {
self.clearNowPlayingOnInfoCenter()
}
}

private func processNowPlayingToInfoCenter() {
let nowPlayingInfo = self.nowPlayingInfo
DispatchQueue.main.async {
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
if !nowPlayingInfo.isEmpty {
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
} else {
MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
}
}
}

Expand Down
Loading