apivideo / api.video-reactnative-player

React Native video player
https://api.video
MIT License
17 stars 2 forks source link

[Bug]: Can't call requestFullScreen() method on Android #17

Open bilal-prog opened 1 year ago

bilal-prog commented 1 year ago

Version

1.0.1

Environment that reproduces the issue

"react-native": "0.69.4", "@api.video/react-native-player": "^1.0.1",

Is it reproducible in the example application?

Yes

Reproduction steps

demo: https://drive.google.com/file/d/1IvTTAbM1jnXvr2WqAa4jY2wedXrrdO1X/view?usp=share_link

Expected result

NONE

Actual result

NONE

Additional context

No response

Relevant logs output

No response

olivierapivideo commented 1 year ago

Hi @bilal-prog We were not able to reproduce your issue. Can you send us the relevant part of your code?

bilal-prog commented 1 year ago

<VideoPlayer ref={ref} muted={isMuted} videoParams={video?.videoParams} autoplay={false} videoId={video?.videoId} onPlay={() => setIsPlaying(true)} onPause={() => setIsPlaying(false)} onReady={() => setIsReady(true)} onVolumeChange={volume => { console.log( =====================onVolumeChange: ${volume}===================, ); }} onError={e => console.log('video e', e)} />

bilal-prog commented 1 year ago

useEffect(() => { //request full screen when it's playing (working on ios / it works in second time for android not in the first time) if (isPalying) { setTimeout(() => ref.current?.requestFullscreen(), 100); } }, [isPalying]);

bilal-prog commented 1 year ago

Hi @olivierapivideo the problem is in requestFullScreen() method (I think it's a bug in react-native-webveiw)

charlestbell commented 3 months ago

I had the same issue. It may be a platform limitation, not sure.

I ended up adding an inline player on Android, and the user has to click fullscreen from there if they want it.

I do wish the maintainers would weigh in.

olivierapivideo commented 1 month ago

Hi there,

First of all, we're sorry it's taken so long to respond to this issue.

Unfortunately, this problem cannot be corrected at present. Using a webview on Android requires the user to have interacted with its content before executing a requestFullscreen. This is a browser security issue that cannot be overridden. In the coming weeks, we plan to release a major version of the RN player based not on a webview but on our 2 native players for Android and IOS. This migration will fix the issues with such restrictions.

We apologize for the inconvenience.