Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Android VR JW Player - How to set fullscreen automatically when the device is rotated to landscape


Follow the question here:
https://support.jwplayer.com/customer/en/portal/questions/16833741-vr-jw-player-how-to-set-fullscreen-when-the-device-is-rotated-to-landscape?new=16833741
As it reaches the maximum number of answers so I start a new thread.

I am implementing JW VR Player. My question is how to set fullscreen when the device is rotated to landscape
Here is my code:

@Override
public void onConfigurationChanged(Configuration newConfig) {
// Set fullscreen when the device is rotated to landscape
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE & !mVrVideoView.isFullscreen()) {
mVrVideoView.toggleFullscreen(true);
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT & mVrVideoView.isFullscreen()) {
mVrVideoView.toggleFullscreen(false);
}

super.onConfigurationChanged(newConfig);
}

@Override
public void onFullscreenToggled() {
mCoordinatorLayout.setFitsSystemWindows(!mCoordinatorLayout.getFitsSystemWindows());
}

Current result: When rotating device to landscape, it shows cardboard instruction, when click on back button, video view displays in landscape but not full screen, have padding on top and bottom.
Expected result: similar to clicking on full screen button, video view displays in landscape with fullscreen, no padding.

I asked for Android solution, but Daniel provided link to iOS sample code.

9 Community Answers

George

JW Player Support Agent  
0 rated :

Hi,

This is not built in functionality since the sensors are used to determine the viewport.

Binh Nguyen

User  
0 rated :

Hi,

It means there is no way to prevent from the cardboard instruction screen pop up. Could we simulate the full screen button click event on jwplayer view navigation bar as it does exactly what we want to.

George

JW Player Support Agent  
0 rated :

mVrVideoView.toggleFullscreen(true); doesn’t work for you?

Binh Nguyen

User  
0 rated :

No, it doesn't. mVrVideoView.toggleFullscreen(true) will open cardboard instruction screen first, and then play video with JWVrVideoView.STEREO_MODE_LEFT_RIGHT mode. Please review screen record here:
https://drive.google.com/file/d/0B5vdcUhTdl8eZ2w2RnNUYVpXZ28/view?usp=sharing

What I expect is mVrVideoView.toggleFullscreen(true) will play video with JWVrVideoView.STEREO_MODE_MONO mode without cardboard instruction pop up, like as when fullscreen button is clicked.

Binh Nguyen

User  
0 rated :

We also implement on iOS, it behaves as we want it. The youtube app on android and iOS also do the same.

George

JW Player Support Agent  
0 rated :

Hi,

Indeed, it seems toggleFullscreen() and toggleVRMode() do the same thing. I’ll escalate this to engineering for review

George

JW Player Support Agent  
0 rated :

Hi,

I just looked through the source code and it seems the boolean of toggleFullscreen() is not to define the state of fullscreen but instead to define if the fullscreen will be in Cardboard mode.

You want to use mVrVideoView.toggleFullscreen(false);

Binh Nguyen

User  
0 rated :

Wow, why didn't I try it. It works great.

One more thing, after doing toggle full screen to landscape mode, the onConfigurationChanged() never hit again, it seems that the library calls setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) somewhere. I have to reset it as following:

mVrVideoView.toggleFullscreen(false);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

Thanks a lot, George.

George

JW Player Support Agent  
1 rated :

Anytime, it was an interesting case. Too bad there’s no documentation for the VR SDK, it would save us a lot of time.

This question has received the maximum number of answers.