Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Player Gestures #329

Merged
merged 13 commits into from
Jul 30, 2020
Prev Previous commit
Next Next commit
resolved offline song issue
  • Loading branch information
Shresth Pratap Singh authored and Shresth Pratap Singh committed Jul 21, 2020
commit ad4873ddad334f98ab0dadbe06cb12c487ddc993
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ class AudioPlayerViewController: UIViewController {
playerQueueContainer.header.arrowHead.addTarget(self, action: #selector(handleArrowHeadTap), for: .touchDown)
playerQueueContainer.header.tapDelegate = self
layoutPlayerQueue()

if offlineMode{
loadSong()
playPlayer()
observer = player.addPeriodicTimeObserver(forInterval: CMTimeMakeWithSeconds(1, preferredTimescale: 1), queue: DispatchQueue.main, using: { [weak self] (time) in
self?.updatePlayingSong(time)
})
}


let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))
self.playerContainer.addGestureRecognizer(panRecognizer)
panRecognizer.cancelsTouchesInView = true
Expand All @@ -89,6 +81,14 @@ class AudioPlayerViewController: UIViewController {
setupPlayer()
setupRemoteCommandCenter()

if offlineMode{
loadSong()
playPlayer()
observer = player.addPeriodicTimeObserver(forInterval: CMTimeMakeWithSeconds(1, preferredTimescale: 1), queue: DispatchQueue.main, using: { [weak self] (time) in
self?.updatePlayingSong(time)
})
}

}

func setupPlayer(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ extension OfflineFilesViewController : OfflineFilesView {

let audioPlayerVc = self.viewController(viewControllerClass: AudioPlayerViewController.self,
from: StoryBoardIdentifiers.videoPlayer)
AudioPlayerDataModel.shared.configure(items: items,URLs, with: currentIndex)
audioPlayerVc.offlineMode = true
AudioPlayerDataModel.shared.setupQueueMetadata()
AudioPlayerDataModel.shared.configure(items: items,URLs, with: currentIndex)
if #available(iOS 13.0, *) {
audioPlayerVc.isModalInPresentation = true
}
Expand Down
2 changes: 1 addition & 1 deletion AmahiAnywhere/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 61f513bfe95231a9fec4a3a23bc3a645bf8f94a6

COCOAPODS: 1.9.3
COCOAPODS: 1.9.1