I am using wkwebview to play embedded youtube videos, i am using custom renderer for this.
In portrait mode i am displaying the video only in upper half of the device. (By setting Heightrequest property of the Native element in OnSizeAllocated.)
On rotating the device i change the value of Heightrequest property of the Native element in OnSizeAllocated method to display the video in entire screen.
My app start in portrait mode.
Problem:
When i play the video in portrait mode and then rotate the device to landscape mode, resizing occur well but
video gets paused for some time (blank screen with activity indicator) before continuing.
Same happens in revers i.e from Landscape to portrait mode. (again blank screen with activity indicator).
Some time video restarts on rotating the device.If i do not reset the Heightrequest property of the Native element in OnSizeAllocated then every thing works fine. (i.e smooth transition), but the video plays in small size even in landscape mode.
I have also tried wkWebView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;, but nothing works.
I tested this on iPhone 6s (ios 13) device as well as on its simulator (ios 12).
It shows no problem on iPhone XS max, iPhone 8 simulation, but on iPhone- X, XR, 5s, SE, 7, 6, 6s simulator (ios 12)
One thing i observed is that if i set Heightrequest property as follows for
webView.HeightRequest = this.Height - 70
(For landscape)
it works properly (only in iPhone 6s) i.e smooth transition without any pause.
but in that case the video size is small.
Please help.