swift版本
@objc func onRecevAVPlayerItemDidPlayToEndTimeNotification(noti: Notification) {
if let item = noti.object as? AVPlayerItem,
item == playerItem {
controlView.isHidden = false
controlView.playBtnMode = .replay
}
}
@objc func playToEndTime(note: NSNotification) {
if let welcomePlayerItem = self.welcomePlayerItem, welcomePlayerItem.isEqual(note.object) {
bgPlayer?.volume = self.welcomePlayer?.volume ?? 0.0
}
guard let bgPlayerItem = self.bgPlayerItem, bgPlayerItem.isEqual(note.object) else {
return
}
playBackGround()
}
OC版本
/** 视频播放结束事件监听 */
- (void)videoDidPlayToEnd:(NSNotification *)notify
{
if ([_playerItem isEqual:notify.object]) {
self.playDidEnd = YES;
if (_playerConfiguration.repeatPlay) {
[self _replayVideo];
}else
{
[self _pauseVideo];
}
}
}
要赞😊