Created
March 7, 2016 09:45
-
-
Save phucnm/4f68c8760ffe5ddc60b0 to your computer and use it in GitHub Desktop.
Play video with AVPlayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]; | |
AVPlayer *player = [AVPlayer playerWithURL:videoURL]; | |
AVPlayerViewController *playerViewController = [AVPlayerViewController new]; | |
playerViewController.player = player; | |
[self presentViewController:playerViewController animated:YES completion:nil]; | |
NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]; | |
AVPlayer *player = [AVPlayer playerWithURL:videoURL]; | |
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player]; | |
playerLayer.frame = self.view.bounds; | |
[self.view.layer addSublayer:playerLayer]; | |
[player play]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment