Skip to content

Commit

Permalink
solved video player crash issue (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
anubhavpulkit authored Jul 13, 2020
1 parent 29d314f commit 8417420
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ class VideoPlayerViewController: UIViewController {
listenForNotifications()
setUpIndicatorLayers(imageView: rewindIndicator)
setUpIndicatorLayers(imageView: forwardIndicator)

let commandCenter = MPRemoteCommandCenter.shared()

MPRemoteCommandCenter.shared().togglePlayPauseCommand.addTarget(self, action: #selector(playandPause(_:)))
commandCenter.playCommand.addTarget { (_) -> MPRemoteCommandHandlerStatus in
self.playButton.addTarget(self, action: #selector(self.playandPause(_:)), for: .allEvents)
return .success
}
commandCenter.playCommand.isEnabled = true
}

var volumeSwipeMadeOnce = false
Expand Down

0 comments on commit 8417420

Please sign in to comment.