Android WebView video custom view content is off center after rotation

376 Views Asked by At

When the user clicks the full screen button on a video in a WebView, WebChromeClient calls onShowCustomView with the custom video view. I use this callback to add the view to a fragment and display it full screen.

In a comment on a previous question, it was suggested that I include 'orientation' in the android:configChanges element. As far as I can tell, it is not possible to continue playback using standard Android destroy-recreate activity lifecycle.

However, after rotation, the custom video view provided by WebChromeClient appears to still be full screen, but the actual video player inside it is not positioned correctly (jammed into a corner):

enter image description here

Is there some way to force Android to relayout the video, perhaps in onConfigurationChanged?

0

There are 0 best solutions below