Forum Xamarin.Forms

Video plays only sound but no visual.

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 ();


Under my button click I have the following code.


Thank you, I'd appreciate any help in the right direction.


  • ElleAttwellElleAttwell USMember

    Hi All

    I finally got this to work. In my case the following line of code did not do the job, somehow it was not adding the view and sending it to the front. Hence I could hear sound but no visual, I'm not sure why.

    View.AddSubview (moviePlayer.View);

    So I used this one instead, which did the trick. I can now play videos.

    UIApplication.SharedApplication.KeyWindow.RootViewController.Add (moviePlayer.View);


  • Do you know how to manage to get this working for Android in Xamarin.Forms as well? The RootViewController is for iOS specific.

  • RavinderJangraRavinderJangra USMember ✭✭✭
Sign In or Register to comment.