[Android] Video player: delay first player call, prevent ANR
Geoffrey Métais
git at videolan.org
Mon Apr 1 11:41:29 CEST 2019
vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 1 11:20:50 2019 +0200| [e05ad5ac2a1187dc00fecc7c92043fda5c073a8c] | committer: Geoffrey Métais
Video player: delay first player call, prevent ANR
(cherry picked from commit 09fa2ed8a4b48fd3ac10f3b7908f4bc902eae41b)
> https://code.videolan.org/videolan/vlc-android/commit/e05ad5ac2a1187dc00fecc7c92043fda5c073a8c
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 7 ++++++-
1 file changed, 6 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 7a35201d1..d9029e2fe 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2930,7 +2930,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
if (Permissions.checkReadStoragePermission(this, true) && !mSwitchingView)
mHandler.sendEmptyMessage(START_PLAYBACK);
mSwitchingView = false;
- if (mService.getVolume() > 100 && !audioBoostEnabled) mService.setVolume(100);
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() { // delay mediaplayer loading, prevent ANR
+ if (mService.getVolume() > 100 && !audioBoostEnabled) mService.setVolume(100);
+ }
+ });
mService.addCallback(this);
} else {
if (mService != null) mService.removeCallback(this);
More information about the Android
mailing list