Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Video plays only sound but no visual.

$
0
0

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.

https://developer.xamarin.com/recipes/ios/media/video_and_photos/play_a_video_using_mpmovieplayercontroller/

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.


Viewing all articles
Browse latest Browse all 91519

Trending Articles