|
@@ -34,8 +34,10 @@ class PQSelecteMusicView: UIView {
|
|
|
PQNotification.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: avPlayer.currentItem, queue: .main) { [weak self] notify in
|
|
|
BFLog(message: "AVPlayerItemDidPlayToEndTime = \(notify)")
|
|
|
avPlayer.seek(to: CMTime(value: CMTimeValue((self?.currentPlayData?.startTime ?? 0) * 1000), timescale: CMTimeScale(playerTimescale)))
|
|
|
-// avPlayer.play()
|
|
|
-// self?.playStuckPointMusic(itemData: nil)
|
|
|
+
|
|
|
+
|
|
|
+ self?.currentPlayData?.isPlaying = false
|
|
|
+ self?.selectMusicCollection.reloadData()
|
|
|
}
|
|
|
PQNotification.addObserver(forName: .AVPlayerItemNewErrorLogEntry, object: avPlayer.currentItem, queue: .main) { notify in
|
|
|
BFLog(message: "AVPlayerItemNewErrorLogEntry = \(notify)")
|
|
@@ -214,8 +216,8 @@ class PQSelecteMusicView: UIView {
|
|
|
|
|
|
//暂停播放音乐 并刷新 UI
|
|
|
func pausePlayer() {
|
|
|
-
|
|
|
- playStuckPointMusic(itemData: currentPlayData)
|
|
|
+ avPlayer.pause()
|
|
|
+ currentPlayData?.isPlaying = false
|
|
|
selectMusicCollection.reloadData()
|
|
|
}
|
|
|
|
|
@@ -258,9 +260,7 @@ extension PQSelecteMusicView: UICollectionViewDelegate, UICollectionViewDataSour
|
|
|
cell.btnClickHandle = { [weak self] sender, bgmData in
|
|
|
|
|
|
//暂停播放音乐
|
|
|
- self?.musicDatas[indexPath.item].isSelected = true
|
|
|
- self?.playStuckPointMusic(itemData: self?.musicDatas[indexPath.item])
|
|
|
- self?.selectMusicCollection.reloadData()
|
|
|
+ self?.pausePlayer()
|
|
|
|
|
|
if self?.btnClickHandle != nil {
|
|
|
self?.btnClickHandle!(sender, bgmData)
|