Skip to content

Commit

Permalink
Merge branch 'develop' into release/v7.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanhaevre committed Aug 14, 2024
2 parents 78bd7f5 + 8bb33a4 commit 120485a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Fixed an issue on Android where the notification background would be displayed in low resolution on recent Android versions.

### Added

- Added support on iOS for 'album' and 'artist' in the nowPlayingInfo.

## [7.8.0] - 24-08-09

### Added
Expand Down
14 changes: 14 additions & 0 deletions ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class THEOplayerRCTNowPlayingManager {
self.updatePlaybackState()
self.nowPlayingInfo = [String : Any]()
self.updateTitle(metadata.title)
self.updateArtist(metadata.metadataKeys?["artist"] as? String)
self.updateAlbum(metadata.metadataKeys?["album"] as? String)
self.updateSubtitle(metadata.metadataKeys?["subtitle"] as? String)
self.updateDuration(player.duration)
self.updateMediaType() // video
Expand Down Expand Up @@ -106,6 +108,18 @@ class THEOplayerRCTNowPlayingManager {
}
}

private func updateArtist(_ metadataArtist: String?) {
if let artist = metadataArtist {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = artist
}
}

private func updateAlbum(_ metadataAlbum: String?) {
if let album = metadataAlbum {
self.nowPlayingInfo[MPMediaItemPropertyAlbumTitle] = album
}
}

private func updateSubtitle(_ metadataSubtitle: String?) {
if let subtitle = metadataSubtitle {
self.nowPlayingInfo[MPMediaItemPropertyArtist] = subtitle
Expand Down

0 comments on commit 120485a

Please sign in to comment.