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

Urgent: MpMoviePlayerController not playing the video after latest Xamarin.IOS update

$
0
0

Hi All,
The following code in Xamarin IOS was working fine prior to the Xamarin IOS update to v2.0.50727

This is the code in a custom renderer in a Xamarin Forms app

     class WatchVideoRenderer : PageRenderer
    {
        MPMoviePlayerController moviePlayer;

        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            var url =  new NSUrl("http://192.168.12.4:8085/MediaUploads/1/211/520140731170618/DPM202.mp4");
            moviePlayer = new MPMoviePlayerController();
            moviePlayer.ContentUrl = url;
            moviePlayer.View.Frame = new CGRect((float)((NativeView.Bounds.Width - 600) / 2), (float)((NativeView.Bounds.Height - 450) / 2), 600, 400);

            MPMoviePlayerController.Notifications.ObserveLoadStateDidChange(OnLoadStateChanged);
            MPMoviePlayerController.Notifications.ObservePlaybackDidFinish(OnPlaybackComplete);

            View.AddSubview(moviePlayer.View);

            moviePlayer.PrepareToPlay();
            moviePlayer.ShouldAutoplay = true;
            moviePlayer.Play();
        }

        private void OnLoadStateChanged(object sender, NSNotificationEventArgs e)
        {
            if (moviePlayer.LoadState == MPMovieLoadState.Playable)
            {

            }
        }

        private void OnPlaybackComplete(object sender, MPMoviePlayerFinishedEventArgs e)
        {

        }
    }

As i said this was working till day before yesterday, after which I installed 2 updates on Xamarin.IOS & this is now failing. All i see is a black canvas & the video never loads.
No notifications from the MPMoviePlayerController are ever raised.
There is a release of this app scheduled for next week & this last minute bug is causing me headaches. Any help is really appreciated.

Thanks
Supreet


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>