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 19, 2024
1 parent 098a754 commit 0439f3c
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)) {

Check failure on line 229 in ios/Video/NowPlayingInfoCenterManager.swift

View workflow job for this annotation

GitHub Actions / Swift-Lint

Control Statement Violation: `if`, `for`, `guard`, `switch`, `while`, and `catch` statements shouldn't unnecessarily wrap their conditionals or arguments in parentheses (control_statement)
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)) {

Check failure on line 254 in ios/Video/NowPlayingInfoCenterManager.swift

View workflow job for this annotation

GitHub Actions / Swift-Lint

Control Statement Violation: `if`, `for`, `guard`, `switch`, `while`, and `catch` statements shouldn't unnecessarily wrap their conditionals or arguments in parentheses (control_statement)
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = true
} else {
nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = false
}
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
}
}
Expand Down

0 comments on commit 0439f3c

Please sign in to comment.