Ios 重复3秒钟的电影以获取帮助视图?

Ios 重复3秒钟的电影以获取帮助视图?,ios,objective-c,Ios,Objective C,我们想制作一部3-4秒长的电影,它可以重复播放,就像在苹果提示应用程序中一样。在这里,你可以看到一些在重复多次的电影中使用iPhone的例子 我猜他们不是在使用动画(并为其创建许多图像),而是在使用某种电影播放器-问题是,什么是最好的播放器-所以它看起来像一个gif,没有播放器工具栏(play/stop/等) 谢谢。使用AVPlayer连续播放视频,看起来就像gif连续播放一样 -(void)startPlaybackForItemWithURL{ // First create an

我们想制作一部3-4秒长的电影,它可以重复播放,就像在苹果提示应用程序中一样。在这里,你可以看到一些在重复多次的电影中使用iPhone的例子

我猜他们不是在使用动画(并为其创建许多图像),而是在使用某种电影播放器-问题是,什么是最好的播放器-所以它看起来像一个
gif
没有播放器工具栏(play/stop/等)


谢谢。

使用AVPlayer连续播放视频,看起来就像gif连续播放一样

-(void)startPlaybackForItemWithURL{
    // First create an AVPlayerItem
    // Subscribe to the AVPlayerItem's DidPlayToEndTime notification.
    NSString*thePath=[[NSBundle mainBundle] pathForResource:@"vegas" ofType:@"mov"];
    NSURL*theurl=[NSURL fileURLWithPath:thePath];
    AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:theurl];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem];

    player = [[AVPlayer alloc] initWithPlayerItem:playerItem];

    AVPlayerLayer *layer = [AVPlayerLayer layer];

    [layer setPlayer:player];
    [layer setFrame:CGRectMake(0, 0, 443, 239)];
    [layer setBackgroundColor:[UIColor clearColor].CGColor];
    [layer setVideoGravity:AVLayerVideoGravityResizeAspectFill];

    [viewVideo.layer addSublayer:layer];

    [player play];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:player];
}