Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created July 15, 2013 13:36
Show Gist options
  • Save prashantvc/5999982 to your computer and use it in GitHub Desktop.
Save prashantvc/5999982 to your computer and use it in GitHub Desktop.
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.MediaPlayer;
using MonoTouch.ObjCRuntime;
using MonoTouch.MessageUI;
namespace VideoPlayer
{
public partial class VideoPlayerViewController : UIViewController
{
public VideoPlayerViewController () : base ("VideoPlayerViewController", null)
{
}
public override void DidReceiveMemoryWarning ()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning ();
// Release any cached data, images, etc that aren't in use.
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
}
MPMoviePlayerViewController player;
//MPMoviePlayerViewController player;
partial void PlayButtonPressed (NSObject sender)
{
var url = NSUrl.FromFilename("candle.mp4");
player = new MPMoviePlayerViewController (url);
player.MoviePlayer.RepeatMode= MPMovieRepeatMode.One;
NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("finishPlayback:"), MPMoviePlayerController.PlaybackDidFinishNotification, player.MoviePlayer);
PresentMoviePlayerViewController(player);
}
[Export("finishPlayback:")]
public void Method (NSNotification notification)
{
Console.WriteLine ("Notification");
player.MoviePlayer.Play ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment