Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Created September 7, 2017 16:53
Show Gist options
  • Save sjehutch/f29edfd92b3ced0f896b3cc9f4bdad32 to your computer and use it in GitHub Desktop.
Save sjehutch/f29edfd92b3ced0f896b3cc9f4bdad32 to your computer and use it in GitHub Desktop.
play video Xamarin IOS
private void onPrimaryViewClick(object sender, EventArgs e)
{
var pathOfVideoFile = NSBundle.MainBundle.PathForResource("Videos/sizzlereel", "mov");
NSUrl pathUrl = NSUrl.FromFilename (pathOfVideoFile);
AVPlayer player = new AVPlayer(pathUrl);
AVPlayerViewController playerController = new AVPlayerViewController();
this.moviePlayer = new MPMoviePlayerController(pathUrl);
this.moviePlayer.ControlStyle = MPMovieControlStyle.Embedded;
this.moviePlayer.SourceType = MPMovieSourceType.File;
this.AddSubview(this.moviePlayer.View);
this.moviePlayer.Fullscreen = true;
this.moviePlayer.Play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment