iOS Video Backgrounds
Kai Schaller
18812

Thank you, good information

To me the information I needed.

Have I applied so as AVPlayerViewController.

- (void) viewDidLoad {

NSURL * videoURL = [[NSBundle mainBundle] URLForResource: @ “video” withExtension: @ “mov”];

self.aPlayer = [[AVPlayer alloc] initWithURL: videoURL];

self.aPlayerVC = [[AVPlayerViewController alloc] init];

self.aPlayerVC.player = self.aPlayer;

self.aPlayerVC.showsPlaybackControls = NO;

self.aPlayerVC.view.frame = self.view.frame;

[self.view insertSubview: self.aPlayerVC.view atIndex: 0];

[self.aPlayer play];

[[NSNotificationCenter defaultCenter] addObserver: self selector:selector (loopVideo :) name: AVPlayerItemDidPlayToEndTimeNotification object: [self.aPlayer currentItem]];

}

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

AVPlayerItem *item = [notification object];

[item seekToTime: kCMTimeZero];

[self.aPlayer play];

}