                                                             queue: DispatchQueue.main,
                                                             using: progressHandler)
         }
+    }
+    
+    private func configNotifications() {
+        //添加播放完成和播放失败通知
+        NotificationCenter.default.addObserver(self, selector: #selector(didPlayToEndTime), name: Notification.Name.AVPlayerItemDidPlayToEndTime, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(failedToPlayToEndTime), name: Notification.Name.AVPlayerItemFailedToPlayToEndTime, object: nil)
+    }
+    
+    //MARK: - Notification Methods
+    @objc private func didPlayToEndTime() {
+        didPlayToEndTimeHandler?()
+    }
+    
+    @objc private func failedToPlayToEndTime() {
+        failedToPlayToEndTimeHandler?()
     }
 }
 


        // Do any additional setup after loading the view.
        configTimeObserver()
    }

    override open func didReceiveMemoryWarning() {

    
    //MARK: - Life Cycle
    deinit {
        // Remove Observers
        if let _timeObserver = _timeObserver {
            _player.removeTimeObserver(_timeObserver)
        }
        
        NotificationCenter.default.removeObserver(self)
    }
    
    override open func loadView() {
