Morgan Evans Media Morgan Evans Media - 4 months ago 33x
iOS Question

Xcode Swift - How to make a video open and play on button click

I am very new to Xcode and have very little experience.
Please could someone show me how to code my app so a video open and play on button click? I cant find out how to do this anywhere. Any help would be much appreciated! Thanks, Morgan


I think this code will help you to open Movie player.

NSURL *movieURL = [NSURL URLWithString:@""];
movieController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[self presentMoviePlayerViewControllerAnimated:movieController];
[movieController.moviePlayer play];