swiftavaudioplayermpremotecommandcenter

How to set the playback time from MPRemoteCommandEvent?


I have code callback:

commandCenter.changePlaybackPositionCommand.addTarget { (event) -> MPRemoteCommandHandlerStatus in

        self.player.currentTime = ???
        self.setupNowPlaying(img: self.image)
        return .success
    }

and it gets called. But how do I set the actual time where it should start playing from. The event does not seem to give me the time where the user dragged to. How do I get that value?


Solution

  • The event does not seem to give me the time where the user dragged to

    Yes it does. The event has a positionTime.