Skip to content

Commit

Permalink
feat(ios): add live key to now playing dict to decorate when livestre…
Browse files Browse the repository at this point in the history
…am playing (#3922)

Co-authored-by: Paul <[email protected]>
  • Loading branch information
paul-rinaldi and paulrinaldi-dev authored Jun 21, 2024
1 parent c1c7a05 commit 91751ab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ios/Video/NowPlayingInfoCenterManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down

0 comments on commit 91751ab

Please sign in to comment.