From 3bd818d0d94459ae83eb36b203e03e10b706d401 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 18 Jun 2024 11:37:33 -0500 Subject: [PATCH] feat(ios): add live key to now playing dict to decorate when livestream playing --- ios/Video/NowPlayingInfoCenterManager.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ios/Video/NowPlayingInfoCenterManager.swift b/ios/Video/NowPlayingInfoCenterManager.swift index 674c249180..157502ed9a 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 } }