Good day,
I'm developing an app with Xamarin.Forms and I'm trying to play a video. I have been googling for the past two days and almost every discussion has the same/similar possible solutions but they don't seem to work for my case. I followed this recipe.
I added the video to my Resources folder and it's Build Action is set to Content, I also tried BundleResource. My problem is the video is not showing but it plays sound in the background. I've been battling for some time now. I have an iPad Air, version 9.0.2.
Here's my code.
public interface IPlayVideo
{
void Play();
}
[assembly: Dependency (typeof(PlayVideoClass))]
namespace PlayVideo.iOS
{
public class PlayVideoClass: UIViewController, IPlayVideo
{
MPMoviePlayerController moviePlayer;
#region IPlayVideo implementation
public void Play ()
{
moviePlayer = new MPMoviePlayerController (NSUrl.FromFilename ("ivtrakker.mp4"));
View.AddSubview (moviePlayer.View);
moviePlayer.SetFullscreen (true, true);
moviePlayer.Play ();
}
#endregion
}
}
Under my button click I have the following code.
DependencyService.Get<IPlayVideo>().Play();
Thank you, I'd appreciate any help in the right direction.