잠금화면 플레이어

- 재생시간 표시 및 이전/다음 버튼 변경
This commit is contained in:
Yu Sung 2024-12-18 17:02:50 +09:00
parent fb1bac83ae
commit 3c32c68b5f
1 changed files with 6 additions and 6 deletions

View File

@ -300,11 +300,11 @@ final class ContentPlayerPlayManager: NSObject, ObservableObject {
if let player = player {
//
nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = player.currentItem?.duration ?? .zero
nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = player.currentItem?.asset.duration.seconds ?? .zero
// progressBar
nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = player.rate
//
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = player.currentTime
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = player.currentTime().seconds
}
center.nowPlayingInfo = nowPlayingInfo
@ -325,14 +325,14 @@ final class ContentPlayerPlayManager: NSObject, ObservableObject {
return .success
}
center.skipForwardCommand.isEnabled = true
center.skipForwardCommand.addTarget { [unowned self] (commandEvent) -> MPRemoteCommandHandlerStatus in
center.seekForwardCommand.isEnabled = true
center.seekForwardCommand.addTarget { [unowned self] (commandEvent) -> MPRemoteCommandHandlerStatus in
self.playNextContent()
return .success
}
center.skipBackwardCommand.isEnabled = true
center.skipBackwardCommand.addTarget { [unowned self] (commandEvent) -> MPRemoteCommandHandlerStatus in
center.seekBackwardCommand.isEnabled = true
center.seekBackwardCommand.addTarget { [unowned self] (commandEvent) -> MPRemoteCommandHandlerStatus in
self.playPreviousContent()
return .success
}