Fix updating player item duration for live streams

This commit is contained in:
Arkadiusz Fal 2021-12-17 21:01:18 +01:00
parent c4ca5eb4c7
commit d7058b46d3

View File

@ -502,7 +502,11 @@ final class PlayerModel: ObservableObject {
}
fileprivate func updateNowPlayingInfo() {
let duration: Int? = currentItem.video.live ? nil : Int(currentItem.videoDuration ?? 0)
var duration: Int?
if !currentItem.video.live {
let itemDuration = currentItem.videoDuration ?? 0
duration = itemDuration.isFinite ? Int(itemDuration) : nil
}
var nowPlayingInfo: [String: AnyObject] = [
MPMediaItemPropertyTitle: currentItem.video.title as AnyObject,
MPMediaItemPropertyArtist: currentItem.video.author as AnyObject,