|  | @@ -22,6 +22,7 @@ class PQSelecteMusicView: UIView {
 | 
	
		
			
				|  |  |      var currentPlayData: PQVoiceModel?
 | 
	
		
			
				|  |  |      // 当前播放的音频
 | 
	
		
			
				|  |  |      var playerItem: AVPlayerItem?
 | 
	
		
			
				|  |  | +    var playerItemHavObserver: Bool = false
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |      // 按钮点击的回调
 | 
	
		
			
				|  |  |      var btnClickHandle: ((_ sender: UIButton, _ bgmData: Any?) -> Void)?
 | 
	
	
		
			
				|  | @@ -118,8 +119,10 @@ class PQSelecteMusicView: UIView {
 | 
	
		
			
				|  |  |      deinit {
 | 
	
		
			
				|  |  |          PQNotification.removeObserver(self)
 | 
	
		
			
				|  |  |          PQNotification.removeObserver(self.avPlayer.currentItem as Any)
 | 
	
		
			
				|  |  | -        avPlayer.currentItem?.removeObserver(self, forKeyPath: "status")
 | 
	
		
			
				|  |  | -        avPlayer.currentItem?.removeObserver(self, forKeyPath: "error")
 | 
	
		
			
				|  |  | +        if playerItemHavObserver {
 | 
	
		
			
				|  |  | +            avPlayer.currentItem?.removeObserver(self, forKeyPath: "status")
 | 
	
		
			
				|  |  | +            avPlayer.currentItem?.removeObserver(self, forKeyPath: "error")
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          avPlayer.pause()
 | 
	
		
			
				|  |  |          avPlayer.replaceCurrentItem(with: nil)
 | 
	
		
			
				|  |  |          playerItem = nil
 | 
	
	
		
			
				|  | @@ -275,9 +278,12 @@ class PQSelecteMusicView: UIView {
 | 
	
		
			
				|  |  |                  return
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              avPlayer.pause()
 | 
	
		
			
				|  |  | -            playerItem?.removeObserver(self, forKeyPath: "status")
 | 
	
		
			
				|  |  | -            playerItem?.removeObserver(self, forKeyPath: "error")
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  | +            if playerItemHavObserver {
 | 
	
		
			
				|  |  | +                playerItem?.removeObserver(self, forKeyPath: "status")
 | 
	
		
			
				|  |  | +                playerItem?.removeObserver(self, forKeyPath: "error")
 | 
	
		
			
				|  |  | +                playerItemHavObserver = false
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              if itemData!.musicId == currentPlayingInVideoData?.musicId {
 | 
	
		
			
				|  |  |                  itemData?.voiceStatue = .isSelected
 | 
	
		
			
				|  |  |                  currentPlayData = itemData
 | 
	
	
		
			
				|  | @@ -292,6 +298,7 @@ class PQSelecteMusicView: UIView {
 | 
	
		
			
				|  |  |              avPlayer.replaceCurrentItem(with: playerItem)
 | 
	
		
			
				|  |  |              playerItem?.addObserver(self, forKeyPath: "status", options: .new, context: nil)
 | 
	
		
			
				|  |  |              playerItem?.addObserver(self, forKeyPath: "error", options: .new, context: nil)
 | 
	
		
			
				|  |  | +            playerItemHavObserver = true
 | 
	
		
			
				|  |  |              avPlayer.seek(to: CMTime(value: CMTimeValue((itemData?.startTime ?? 0) * playerTimescale), timescale: CMTimeScale(playerTimescale)))
 | 
	
		
			
				|  |  |              avPlayer.play()
 | 
	
		
			
				|  |  |              itemData?.voiceStatue = .isPlaying
 |