LonelyCpp / react-native-youtube-iframe

A wrapper of the Youtube-iframe API built for react native.
https://lonelycpp.github.io/react-native-youtube-iframe/
MIT License
603 stars 153 forks source link

[Android] Full screen videos don't fill the view #200

Closed ds8k closed 2 years ago

ds8k commented 2 years ago

Experiencing a problem where full screen videos on Android don't fill the view.

Steps to reproduce the behavior:

Expected behavior

Screenshots

Smartphone (please complete the following information):

Additional context It looks like the webview needs another render sometimes, as sometimes it shows up right, and rotating to landscape then back also fixes it. The video and trackbar appear to be respecting the original height of the video instead of expanding.

LonelyCpp commented 2 years ago

since the fullscreen mode is fully handled by the YouTube player, this can't be directly solved with this library alone. This is either some bug from the android's webview render or YouTube's iframe fullscreen code.

I found a this thread on rn-webview, where it suggests to change the user agent to get around this bug. https://github.com/react-native-webview/react-native-webview/issues/1444#issuecomment-936592936

Try setting the forceAndroidAutoplay prop to true or directly set a custom user agent string in webViewProps

ds8k commented 2 years ago

@LonelyCpp Yeah that was kind of my worry. I'll give that a shot, thank you!

ds8k commented 2 years ago

@LonelyCpp

directly set a custom user agent string in webViewProps

This fixed it! What a weird bug.

JeffreyVanelderenACA commented 1 year ago

Setting the user agent didn't fix it for me, but if anyone would like to find a way to disable full screen on Android, I dit it using the initialPlayerParams:

<YoutubeIframe
                                initialPlayerParams={{ preventFullScreen: Platform.OS === 'android' }}
 ...
/>