Xcode - Objective C - AVPlayer programmatically - play local video, with standard/system skin

Henning picture Henning · Mar 1, 2016 · Viewed 25.6k times · Source

Can anyone help me with code for setting up and playing local videofile, using AVPlayer in Xcode? (using AVPlayerLayer, and AVPlayerViewController) All done programmatically and with standard/system videoskin?

Regards Henning

Answer

Chirag Desai picture Chirag Desai · Mar 1, 2016
AVPlayer *player = [AVPlayer playerWithURL:"YOUR URL"];

// create a player view controller
AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];
[self presentViewController:controller animated:YES completion:nil];
controller.player = player;
[player play];

hope this help for you.....