Skip to content

Commit

Permalink
Merge pull request #432 from THEOplayer/bugfix/ios-dynamic-island-gli…
Browse files Browse the repository at this point in the history
…tch-on-nowplayinginfo-clearing

Bugfix/ios dynamic island glitch on nowplayinginfo clearing
  • Loading branch information
wvanhaevre authored Oct 30, 2024
2 parents aae4aa8 + 979c1fd commit 70b1721
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 70b1721

Please sign in to comment.