dotnet-maui-videoplayer icon indicating copy to clipboard operation
dotnet-maui-videoplayer copied to clipboard

Video thumbnails on Android

Open EdwardMcFlurry opened this issue 2 years ago • 4 comments

I have noticed that the Controls on Android fades away after few seconds unless you tap on the Video whereas on iOS/Mac there's a fixed Play button at the centre of the Video with a thumbnail behind it.

Could there be a way to have either thumbnails for each Video or perhaps have Controls fixed without fading away as the end-user might think that there's no Video to play. Screenshot 2022-09-13 at 12 08 51 Mine

EdwardMcFlurry avatar Sep 13 '22 10:09 EdwardMcFlurry

Hi @EdwardMcFlurry

By default, an Android MediaController hides itself after 3 seconds. In order to make it visible throughout video playback you'll have to override the MediaController.Hide method:

    public class MyMediaController : MediaController
    {
        public MyMediaController(Context context) : base(context)
        {
        }
 
        public override void Hide()
        {
        }
 
        public void HideController()
        {
            base.Hide();
        }
    }

Having an empty Hide method ensures that the transport controls never fade out. Then, instead of creating a new MediaController, create a new MyMediaController:

_mediaController = new MyMediaController(_context);

The problem this creates is that in some scenarios the transport controls will still be showing even when you navigate away from the page. That's the purpose of the HideController method - it forces the transport controls to disappear. You just need to call this method at an appropriate point in the page lifecycle.

davidbritch avatar Sep 15 '22 08:09 davidbritch

Hi @davidbritch

Thank you so much for the response and I'll give it a try and see if it won't be ideal for my scenario or perhaps at least look for ways of having the thumbnails for Android.

😀

EdwardMcFlurry avatar Sep 15 '22 09:09 EdwardMcFlurry

You tricked me with the bottom image, I tried to click the play button.

99067718 avatar Sep 27 '22 14:09 99067718

@99067718 I'm sorry 😂 for the trick...

EdwardMcFlurry avatar Sep 28 '22 15:09 EdwardMcFlurry