Android VideoPlayer not setting invisible

Hello, I have been bashing my head with android and its video players for quite a while. After few days on this specific problem I gave up and registered here.

My problem is that I need videoplayer in the top of the screen, and I want it to go fullscreen after button is pressed. Also, I want all this to happen on the same UI stack. Using FormsVideoLibrary I managed to achieve this, sort of.

Now I have this issue on emulator:

Going out of full screen videoplayer does not dissaper (after setting IsVisible= false), instead it freezes, displaying frame on stop, and apears on top of videoplayer that should play.

On Device:
The problem happening on emulator does not occur, instead the first video player is set on top of another, even when it IsVisible = false ( parent view is also IsVisible = false)

Some of the code that is executed after fullscreen button is pressed >

         private void ChangeScape()
                    if (isitlandscape == false)
                        isitlandscape = true;
                        MessagingCenter.Send(this, "allowLandScapePortrait");                    
                        videoPlayer.Stop();    // pause() does same
                        CurrentPosition = videoPlayer.Position;
// setting everything invisible                 
                        MainVideoStack.IsVisible = false;
                        videoPlayer.IsEnabled = false;
                        videoPlayer.IsVisible = false;
                        videoPlayer.IsTabStop = false; // trying everything here
                        MainCanvasStack.IsVisible = false;
                        ThirdPageListViewXaml.IsVisible = false;
                        MainStackButtons.IsVisible = false;
                        secondstack.IsVisible = true; // full screen video with its ui elements 

                        VideoPlayerTwoControl(); // runs video

                    else if(isitlandscape == true)
                        isitlandscape = false;
                        CurrentPosition = videoPlayertwo.Position;
//setting elements to false
                        secondstack.IsVisible = false;
                        videoPlayertwo.IsVisible = false;
                        videoPlayertwo.IsEnabled = false;
//turning on elements 
                        MainVideoStack.IsVisible = true;
                        MainCanvasStack.IsVisible = true;
                        ThirdPageListViewXaml.IsVisible = true;
                        MainStackButtons.IsVisible = true;      
                        MessagingCenter.Send(this, "preventLandScape");
                        // TODO should start playing video

Anyone can give me something? I feel like its some stupid mistake. On the bright side, atleast I can play 2 videos on top of each other, YaY!


  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post a basic demo so that we can test with it?

  • Awkward123Awkward123 Member
    edited February 18

    Well, as I though, I am just not experienced enough. I made a global model to pass data between UI stacks. This solves my issues mostly. Now I Just get this weird bug. If I play video and then tap to go full screen, in code I stop video player, open new UI page and run video. Somehow the stoped videoplayer from previous UI is still on top of my current UI screen.

    EDIT. This happens on android version 7 (24 API ), android 9 on emulator this doesnt happen.

Sign In or Register to comment.