Daniel Vicory
d72c2ae144
feat(fullscreen videos): Support fullscreen video on Android (#325)
* Extract WebChromeClient from an anonymous class
* Support fullscreen videos on Android
Forces landscape mode while playing.
* Use sticky immersive mode for fullscreen videos
No longer forces landscape mode as that is a problem for portrait videos - allow
the user to rotate as necessary.
Only supports KitKat or greater, and falls back to leaving the status and navigation
bars visible for lower than KitKat. This is the easiest way to prevent issues with
resizing the video during playback.
Also implement a lifecyle event listener which means if a user backgrounds the app
or locks the screen with the video fullscreen, the UI visibility is re-applied.
* Add allowsFullscreenVideo prop to control whether videos can be fullscreen on Android
Luckily, we're able to change the WebChromeClient on demand in response to prop changes
without seeming to do any harm. If you switch to disallow fullscreen, it will attempt
to close the currently fullscreened video (if there is one) so users aren't stuck.
I did notice a bug that if you go from fullscreen allowed, to fullscreen disallowed,
the fullscreen button will remain on the video. Tapping the button will have no effect.