I want to fit my VideoView to screen size in xamarin forms ios,
I use it but i can't get fit size
MediaPlayer = new MediaPlayer(LibVLC)
{
Media = media,
EnableHardwareDecoding = true,
AspectRatio = $"{App.ScreenWidth}:{App.ScreenHeight}"
};
so I used fullscreen property
MediaPlayer = new MediaPlayer(LibVLC)
{
Media = media,
EnableHardwareDecoding = true,
Fullscreen = true
};
It couldn't give my want result i made custom renderer and overridden OnSizeAllocated() Method, I guessed that changing the videoview size would change the video size as well.
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (width > height)
{
if (height * 16 / 9 > width)
{
VideoView.WidthRequest = width;
VideoView.HeightRequest = width * 9 / 16;
}
else
{
VideoView.HeightRequest = height;
VideoView.WidthRequest = height * 16 / 9;
}
}
else
{
if (width * 9 / 16 > height)
{
VideoView.HeightRequest = height;
VideoView.WidthRequest = height * 16 / 9;
}
else
{
VideoView.WidthRequest = width;
VideoView.HeightRequest = width * 9 / 16;
}
}
}
Likewise I didn't get the desired result In addition, I tried various methods, for example, --fullscreen option, etc.
if i has some mistake, please advice for me
https://github.com/Sunday5214/vlcExample
above link is my example
after I checked answer, i tried solution
MediaPlayer = new MediaPlayer(LibVLC)
{
Media = media,
EnableHardwareDecoding = true,
Scale = 0,
AspectRatio = $"{App.ScreenHeight}:{App.ScreenWidth}"
};
still i couldn't get fullscreen,
i got to know some interest things, if i rotate my phone to landscape then rotate to portrait, i can get full screen
before rotating,
after rotating