feat(ios): add live key to now playing dict to decorate when livestream playing (#3922)

Co-authored-by: Paul <paul@dnconsulting.dev>
This commit is contained in:
Paul 2024-06-21 15:33:24 -05:00 committed by GitHub
parent c1c7a056f1
commit 91751abc87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -226,6 +226,12 @@ class NowPlayingInfoCenterManager {
})
}
if CMTIME_IS_INDEFINITE(currentItem.asset.duration) {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true
} else {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = false
}
nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = currentItem.duration.seconds
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = currentItem.currentTime().seconds
nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = player.rate
@ -245,6 +251,11 @@ class NowPlayingInfoCenterManager {
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = currentItem.currentTime().seconds.rounded()
nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = player.rate
if CMTIME_IS_INDEFINITE(currentItem.asset.duration) {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true
} else {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = false
}
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
}
}