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

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


Hi,

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.

5 Community Answers

Daniel Berger

JW Player Support Agent  
0 rated :

Thank you for the code snippet. It is a little hard for me to see the context of this code or what your actual app behavior is. However, I would suggest that you explore our open source VR SDK demo for code examples.
https://github.com/jwplayer/jwplayer-ios-bestPracticeApps#jwplayer-vr-developer-demo

Binh Nguyen

User  
0 rated :

Thank you for your response. I run the code examples, but it doesn't implement auto rotate feature. What I want is simply switching player to full screen when user rotates their phone from portrait to landscape.

Daniel Berger

JW Player Support Agent  
0 rated :

Thank you for reviewing my code example. Perhaps I am not understanding your desired behavior. In that project, when you set the player to full screen the player rotates to landscape.

Binh Nguyen

User  
0 rated :

In example project: when you click on full screen button -> the player rotates to landscape.
What I want is: when you rotate the phone to landscape -> the player rotates to landscape.

Is this possible? If yes, please provide the code snippet. My code above doesn't work. Thanks.

Daniel Berger

JW Player Support Agent  
0 rated :

Thank you for clarifying. Yes, that behavior is possible. We have this behavior in our open-source iOS project (for your reference)- https://github.com/jwplayer/jwplayer-sdk-ios-demo
Please implement autoresizingMask to your player’s view.

This question has received the maximum number of answers.