My fullscreen video webview almost always closes immediately after opening, sometimes it works. You can see the screen flashing to full screen and back to original almost everytime i click the fullscreen button on a youtube video. What could be the reason for this?
The webview is displayed in a tablayout/viewpager setup with some other fragments.
I have used this code to display the video: https://github.com/cprcrack/VideoEnabledWebView
And now I am using this one https://github.com/GoogleChrome/chromium-webview-samples/blob/master/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/MainActivity.java
They produce exactly the same behavior.
Logs when full screen fails and goes back to normal right after opening:
07-14 17:41:06.694 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 0
07-14 17:41:06.786 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 1
07-14 17:41:06.803 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:07.512 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 0
07-14 17:41:07.592 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 1
07-14 17:41:07.615 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:07.709 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@3e22579 nm : com.linkhubapp ic=null
07-14 17:41:07.709 I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
07-14 17:41:07.713 D/InputTransport: Input channel constructed: fd=152
07-14 17:41:07.714 D/InputTransport: Input channel destroyed: fd=159
07-14 17:41:07.714 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:07.751 D/ViewRootImpl@33432e1[GroupActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true -1176543232} surfaceGenerationChanged=false
07-14 17:41:07.911 D/ViewRootImpl@33432e1[GroupActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x7 surface={isValid=true -1273339904} surfaceGenerationChanged=true
07-14 17:41:07.921 D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [1440x2560]-format:1
07-14 17:41:07.922 D/ViewRootImpl@33432e1[GroupActivity]: mHardwareRenderer.updateSurface() mSurface={isValid=true -1273339904}
07-14 17:41:07.974 D/SurfaceView: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,875][1440,1685] result=0x7 surface={Surface(name=null)/@0xb9ffb70 isValid=true -1178691584}
07-14 17:41:08.047 D/SurfaceView: Relayout returned: oldFrame=[0,875][1440,1685] newFrame=[0,875][1440,1685] result=0x5 surface={Surface(name=null)/@0xb9ffb70 isValid=false 0}
07-14 17:41:08.095 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:08.163 D/ViewRootImpl@33432e1[GroupActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true -1273339904} surfaceGenerationChanged=false
07-14 17:41:08.232 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@1772e0f nm : com.linkhubapp ic=null
07-14 17:41:08.232 I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
07-14 17:41:08.233 D/InputTransport: Input channel constructed: fd=173
07-14 17:41:08.233 D/InputTransport: Input channel destroyed: fd=152
Logs when full screen succeeds:
07-14 17:41:27.987 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 0
07-14 17:41:28.023 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 1
07-14 17:41:28.048 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:28.496 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 0
07-14 17:41:28.571 D/ViewRootImpl@33432e1[GroupActivity]: ViewPostImeInputStage processPointer 1
07-14 17:41:28.616 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:28.719 V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@80b2646 nm : com.linkhubapp ic=null
07-14 17:41:28.719 I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
07-14 17:41:28.725 D/InputTransport: Input channel constructed: fd=155
07-14 17:41:28.725 D/InputTransport: Input channel destroyed: fd=173
07-14 17:41:28.725 D/InputMethodManager: HSI from window - flag : 0 Pid : 6392
07-14 17:41:28.766 D/ViewRootImpl@33432e1[GroupActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true -1273339904} surfaceGenerationChanged=false
07-14 17:41:28.956 D/ViewRootImpl@33432e1[GroupActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true -1273339904} surfaceGenerationChanged=false
07-14 17:41:29.036 D/SurfaceView: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,875][1440,1685] result=0x7 surface={Surface(name=null)/@0xc360d2 isValid=true -1273337856}
07-14 17:41:29.089 D/SurfaceView: Relayout returned: oldFrame=[0,875][1440,1685] newFrame=[0,875][1440,1685] result=0x1 surface={Surface(name=null)/@0xc360d2 isValid=true -1311279104}
EDIT: It seems to be happening only on youtube. Tested Vimeo vs youtube. Vimeo opens everytime.