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
  • Loading branch information
paulrinaldi-dev committed Jun 18, 2024
1 parent 098a754 commit f906ddf
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 let urlAsset = currentItem.asset as? AVURLAsset, urlAsset.url.absoluteString.hasSuffix("m3u8") {
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 let urlAsset = currentItem.asset as? AVURLAsset, urlAsset.url.absoluteString.hasSuffix("m3u8") {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true
} else {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = false
}
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
}
}
Expand Down

0 comments on commit f906ddf

Please sign in to comment.