Example
Objective-C
NSURL *url = [[NSURL alloc] initWithString:@"YOUR URL"]; // url can be remote or local
AVPlayer *player = [AVPlayer playerWithURL:url];
// create a player view controller
AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];
[self presentViewController:controller animated:YES completion:nil];
controller.player = player;
[player play];
Swift
let player = AVPlayer(URL: url) // url can be remote or local
let playerViewController = AVPlayerViewController()
// creating a player view controller
playerViewController.player = player
self.presentViewController(playerViewController, animated: true) {
playerViewController.player!.play()
}