-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this.player.presentFullscreenPlayer() doesn't work on android #534
Comments
Please share more details, like version of the react-native-video component and a code snippet would be good too @wack17s |
I have the same problem. My react-native-video component is wrapped within a InViewPort component to know if it's visible or not. Something like:
I use the reference to this.player to trigger fullscreen mode (this.player.presentFullscreenPlayer()) I'm using react-native 0.40 and react-native-video 1.0.0. I tested in Android 5.1.1 (Samsung Galaxy J5) and Android 6.0.1 (OnePlus 2 with Oxygen OS) |
RN 0.40, RN Video 1.0.0 |
Can confirm. Tested with RN 0.43.1 with RN Video master on multiple Android devices. The presentFullscreenPlayer does not work on Android. |
This does not seem to be working on Windows either. |
It does work on iOS but not android for me too. |
Not working on Android |
Not working on Android. +1
|
Any update on this? |
Same for me... not working on Android. |
+1 hope to fix it |
This function seems not to be implemented in java |
I don't know if this help, but the way I got around this is by using a dedicated route to play the video fullscreen. So you can play the video fullscreen by:
You would need to have a custom Close/X button on the page to navigate away from to close the video |
@alixeb I use a similar technique that may help. I have a reducer dedicated to the fullscreen video player and a component with a I put this component at the top level of my application (same level as my router) and connect it to the redux store. Then I use redux actions to set the fullscreen video source and show/hide it based on a Some code to help people implement it : // FullscreenVideoPlayer/actions.js
import {createAction} from 'redux-actions';
import * as Constants from './constants';
export const initVideo = createAction(Constants.INIT_VIDEO);
export const resetVideo = createAction(Constants.RESET_VIDEO);
export const showVideo = createAction(Constants.SHOW_VIDEO);
export const hideVideo = createAction(Constants.HIDE_VIDEO);
// FullscreenVideoPlayer/reducer.js
import * as Constants from './constants';
import {handleActions} from 'redux-actions';
const INITIAL_STATE = {
isActive: false,
source: null
};
export default handleActions({
[Constants.INIT_VIDEO]: (state, {payload}) => ({
...INITIAL_STATE,
source: payload
}),
[Constants.SHOW_VIDEO]: (state, {payload}) => ({
...state,
isActive: true
}),
[Constants.HIDE_VIDEO]: (state, {payload}) => ({
...state,
isActive: false
}),
[Constants.RESET_VIDEO]: (state, {payload}) => ({
...INITIAL_STATE
})
}, INITIAL_STATE);
// FullscreenVideoPlayer/index.js (no controls is this snippet but you can add it)
class FullscreenVideoPlayer extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
translateY: new Animated.Value(windowHeight)
};
}
componentWillReceiveProps(nextProps) {
// Reset state when video changes (onLoad will be called and video will start)
if (this.props.source !== nextProps.source) {
this.setState({isLoading: true});
}
// Show / hide the fullscreen mode
if (this.props.isActive !== nextProps.isActive) {
Animated.timing(this.state.translateY, {
toValue: nextProps.isActive ? 0 : windowHeight
}).start(e => {
// Play video on show
if (nextProps.isActive) this.player.onStartPress();
});
}
}
render() {
const {source, isActive} = this.props;
const containerStyle = [
styles.container,
{transform: [
{translateY: this.state.translateY}
]}
];
return (
<Animated.View style={containerStyle}>
{isActive && <StatusBar hidden={true} />}
{source && <VideoPlayer
ref={n => this.player = n}
video={{uri: source}}
customStyles={{wrapper: styles.videoContainer, video: styles.video}}
onLoad={this.handleVideoLoad.bind(this)}
onEnd={this.handleVideoEnd.bind(this)}
onRequestClose={this.handleVideoEnd.bind(this)}
/>}
</Animated.View>
);
}
/**
* On video end, close fullscreen mode
* @param e
*/
handleVideoEnd(e) {
this.props.hideVideo();
}
/**
* On load, play video
* @param e
*/
handleVideoLoad(e) {
this.setState({isLoading: false});
}
}
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
flex: 1,
},
videoContainer: {
flex: 1,
transform: [
{rotateZ: '90deg'},
{translateY: ((PixelRatio.getPixelSizeForLayoutSize(windowHeight) - PixelRatio.getPixelSizeForLayoutSize(windowWidth)) / PixelRatio.get())},
],
height: windowWidth,
width: windowHeight,
backgroundColor: 'black'
},
video: {
height: windowWidth,
alignSelf: "stretch"
},
});
FullscreenVideoPlayer.propTypes = {
source: PropTypes.string,
isActive: PropTypes.bool,
isPlaying: PropTypes.bool,
isLoading: PropTypes.bool,
playerProps: PropTypes.object
};
function select(state) {
return state.fullscreenVideo;
}
export default connect(select, {hideVideo})(FullscreenVideoPlayer);
// App.js render
render() {
return (
<Provider store={store}>
<View style={{flex: 1}}>
<AppNavigator/>
<FullscreenVideoPlayer/>
</View>
</Provider>
);
} Then just use the redux action to set the video src and active status. |
Any update with this? |
Any update? |
same here, I am using presentFullscreenPlayer() is not working on Android. |
Any info about whether this issue's going to be resolved? |
I used the react-native-immersive package and StatusBar from react-native to hide the software buttons and the statusbar to make it fullscreen, hope this helps somebody. |
Would be good to have an official answer on this |
So I had a look at the Java code and I dont think fullscreen ever worked. There is no method in there that ties the JS bridge to a method to do anything for full screen mode. @AndrewJack @isair seem to be common contributors to the Java code base. Maybe they can provider a more official answer. |
I don't think it's implemented for Android. You can achieve the same effect by making the video view fill up the whole screen, and hiding the status bar and software buttons |
Do you have reference code for the default player or exoplayer?
Also does exoplayer currently support full screen?
…On Sep 13, 2017 18:37, "Andrew Jack" ***@***.***> wrote:
I don't think it's implemented for Android.
You can achieve the same effect by making the video view fill up the whole
screen, and hiding the status bar and software buttons
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#534 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUCQeTFDenDojENDcaJhV96ol-D3Wsqks5siFkjgaJpZM4Mg7xP>
.
|
@alvelig I took a look but I am not that familiar with java to be able to implement it. Ive found other resources too: Maybe it will help someone implement it. @SebT would you be able to provide the implementation for the VideoPlayer component? I am finding that my source video does not rotate even with the transform applied. |
Ah nvm guys, I figured out a decent solution, similar to what you said @AndrewJack. The only downside I see, is a state change causes a re-render, and the video does not keep the same instance. So the video restarts. But its a small hitch. |
@SebT Hello! I'am trying play the video fullscreen on android, I looks your comment, I linsten the device's orientation'change and store up it in the state. Then I change the video'width and height from the device's orientation'state and I did't call anther component for the full-screen-video. My vedio still in the same component ; The problem is : When I press a button to full video screen It works;But then I change it back, the video don't play ,there's no picture; I guess if the video did't load or lose something,I'm still studying the RN; Maybe I just miss something basicly; or I did't get the method correctly; I hope to get some suggests; My English is Chinses English, Please understand,thanks; |
@shouwangshe 最后有没有解决全屏的问题? |
@wack17s How is the problem resolved ? |
Found a solution: add this to your package.json in section dependencies:
Then go an follow the Instruction on this Page: https://github.com/tranvinhtruong/react-native-video-player#setting-up-fullscreen-on-android This makes FullScreen work for me on Android. |
@xstable Hi! can you elaborate or share your code? I've follow the guide but still not able to achieve the full screen on android |
Any news on this issue? How can we help? I really need this... @xstable solution only works partially (doesn't have a close button on FullScreen). |
Hi, |
Hi all, if you don't need to implement your own video player and want to display an intent chooser for the user to choose the video player, you can use https://github.com/BondGoat/react-native-native-video-player. I have tried and it worked on iOS and Android. |
any update ? |
Will this be in a future release? the lib is really great, this could be a very useful feature ! |
@hermance @MrHazimAli No ad, but : https://github.com/ScreamZ/react-native-true-sight I made this when I struggled on that issue. This is using react-native-video but add a control layer on it. |
Any success with showing the video full screen on Android? |
`import React, { Component } from 'react';
} const styles = StyleSheet.create({ |
Above code works for me |
You might have a look at my repo. Because here, @IbrahimSulai is working on a build-in Fullscreen functionality, you can take my solution as temporary workaround |
This solution worked for me, but the reference link is to a forked version which has an outdated README. The original branch to react-native-native-video-player can be found here: https://github.com/BondGoat/react-native-native-video-player |
any update? |
How's this issue been going for more than two years? Android really is a second class citizen in react-native world |
Any update with this guys? |
Any update guys ? I use react-native-video version 4.4.4, and seems that I'm still face this issue. It's bit of frustration. |
I handle in a native way using React Method and import in react
React:
Is just a patch while this issue is still open |
Any update? |
@irvin373 |
Hello , |
@irvin373 Can you give me some more detail on your solution? |
@thecao-nucleusstudio I add a post https://medium.com/@irvin373/react-native-fullscreen-player-ac68925c53cc with all the code that you need :) and a very small example in github. |
This comment was marked as spam.
This comment was marked as spam.
Any new updates regarding this issue ? |
This comment was marked as spam.
This comment was marked as spam.
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
hi, button with this.player.presentFullscreenPlayer() handler do nothing on android, ios works good. Any suggestions?
The text was updated successfully, but these errors were encountered: