ios同时监听多个视频结束通知(playToEndTime)如何区分过滤


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];
        }
    }

}

要赞😊

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。