private bool PlayNSUrl(NSUrl nsUrl) {
if(nsUrl!=null) {
if(playerController !=null && this.State==MediaState.Playing) {
// if player is already playing, stop it.
Stop();
}
// TODO check if we are paused on the same file or not, to re-start player data.
if(playerController == null) {
try {
using (var pool = new NSAutoreleasePool ()) {
var thread = new Thread (ShowMediaPlayer);
thread.Start (nsUrl);
};
} catch (Exception) {
SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error trying to get media file [" + nsUrl +"]");
}
}
/*
if(playerController != null) {
// Start Playing.
bool playing = playerController.Play();
if(playing) {
this.State = MediaState.Playing;
}
return playing;
}
*/
return true;
} else {
INotification notificationService = (INotification)IPhoneServiceLocator.GetInstance ().GetService ("notify");
if (notificationService != null) {
notificationService.StartNotifyAlert ("Media Alert", "Media file cannot be reproduced on on this device.", "OK");
}
return false;
}
}