fix playOrPauseAudioAction logic

This commit is contained in:
nixzhu
2015-11-27 10:52:33 +08:00
parent aa87df68b0
commit c8160bcea7
@@ -834,12 +834,36 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate {
if let strongSelf = self {
if let audioPlayer = YepAudioService.sharedManager.audioPlayer where audioPlayer.playing {
//
if let playingFeedAudio = YepAudioService.sharedManager.playingFeedAudio, audioPlayer = YepAudioService.sharedManager.audioPlayer where audioPlayer.playing {
audioPlayer.pause()
cell.audioPlaying = false
if let playbackTimer = YepAudioService.sharedManager.playbackTimer {
playbackTimer.invalidate()
}
let feedID = playingFeedAudio.feedID
for index in 0..<strongSelf.feeds.count {
let feed = strongSelf.feeds[index]
if feed.id == feedID {
let indexPath = NSIndexPath(forRow: index, inSection: Section.Feed.rawValue)
if let cell = strongSelf.feedsTableView.cellForRowAtIndexPath(indexPath) as? FeedSocialWorkCell {
cell.audioPlaying = false
}
break
}
}
}
//
if let playingFeedAudio = YepAudioService.sharedManager.playingFeedAudio where playingFeedAudio.feedID == feed.id {
//
} else {
//
let audioPlayedDuration = strongSelf.audioPlayedDurationOfFeedAudio(feedAudio)
YepAudioService.sharedManager.playAudioWithFeedAudio(feedAudio, beginFromTime: audioPlayedDuration, delegate: strongSelf, success: {
println("playAudioWithFeedAudio success!")