From 91751abc870109e0a2667dfffbd2baa2e4cf997b Mon Sep 17 00:00:00 2001 From: Paul <9328123+paul-rinaldi@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:33:24 -0500 Subject: [PATCH] feat(ios): add live key to now playing dict to decorate when livestream playing (#3922) Co-authored-by: Paul --- ios/Video/NowPlayingInfoCenterManager.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ios/Video/NowPlayingInfoCenterManager.swift b/ios/Video/NowPlayingInfoCenterManager.swift index 674c2491..157502ed 100644 --- a/ios/Video/NowPlayingInfoCenterManager.swift +++ b/ios/Video/NowPlayingInfoCenterManager.swift @@ -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 } }