1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
This commit is contained in:
Daniel Barber 2021-06-19 17:46:39 -04:00
parent d39a2aa78b
commit fdec6664d7
2 changed files with 6 additions and 6 deletions

View File

@ -35,12 +35,12 @@ class MediaInfoController {
MPNowPlayingInfoPropertyMediaType: NSNumber(value: MPNowPlayingInfoMediaType.audio.rawValue),
MPNowPlayingInfoPropertyIsLiveStream: NSNumber(value: false),
] as [String : Any]
if let elapsedTime = App.store.state.playerState.elapsedTimeMs {
nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] =
NSNumber(value: elapsedTime / 1000)
}
if #available(OSX 10.13.2, *) {
_ = KingfisherManager.shared.retrieveImage(
with: .provider(provider),
@ -67,7 +67,7 @@ class MediaInfoController {
extension MediaInfoController: StoreSubscriber {
typealias StoreSubscriberStateType = PlayerState?
func newState(state: StoreSubscriberStateType) {
guard let song = state?.currentSong else { return }

View File

@ -13,7 +13,7 @@ import Kingfisher
class PlayerStateInfoController {
let commandCenter = MPRemoteCommandCenter.shared()
init() {
App.store.subscribe(self) {
$0.select { $0.playerState.state }
@ -36,12 +36,12 @@ class PlayerStateInfoController {
App.mpdClient.nextTrack()
return .success
}
commandCenter.previousTrackCommand.addTarget { _ in
App.mpdClient.prevTrack()
return .success
}
commandCenter.changePlaybackPositionCommand.addTarget { event in
let changeEvent = event as! MPChangePlaybackPositionCommandEvent