您的位置:首页 > 其它

avplayer视频重复循环播放,视频重播

2017-09-26 15:41 986 查看
在视频播放完成的监听方法中执行重播方法

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidPlayToEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];

- (void)playerItemDidPlayToEnd:(NSNotification *)notification{

    [self rerunPlayVideo];

}

//视频重播

-(void)rerunPlayVideo{

    if (!self.player) {

        return;

    }

    CGFloat a=0;

    NSInteger dragedSeconds = floorf(a);

    CMTime dragedCMTime = CMTimeMake(dragedSeconds, 1);

    [self.player seekToTime:dragedCMTime];

    [self.player play];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息