[Android] Videoplayer: Sanity check

Geoffrey Métais git at videolan.org
Wed Mar 20 11:35:05 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 20 11:34:06 2019 +0100| [49b0faaffeae29f76a933dc97ef63c4158f254b3] | committer: Geoffrey Métais

Videoplayer: Sanity check

setRequestedOrientation can fail on Oreo

> https://code.videolan.org/videolan/vlc-android/commit/49b0faaffeae29f76a933dc97ef63c4158f254b3
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index f98549e66..ab7675954 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -350,7 +350,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
         this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
 
         // 100 is the value for screen_orientation_start_lock
-        setRequestedOrientation(getScreenOrientation(mScreenOrientation));
+        try {
+            setRequestedOrientation(getScreenOrientation(mScreenOrientation));
+        } catch (IllegalStateException ignored) {
+            Log.w(TAG, "onCreate: failed to set orientation");
+        }
         // Extra initialization when no secondary display is detected
         mIsTv = AndroidDevices.showTvUi(this);
         if (mDisplayManager.isPrimary()) {



More information about the Android mailing list