Commit 77e983aa authored by Sébastien Toque's avatar Sébastien Toque
Browse files

VideoPlayerActivity: pause playback if the lockscreen is displayed

parent e4a29f87
......@@ -45,6 +45,7 @@ import org.videolan.vlc.widget.SlidingPanel;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
......@@ -382,6 +383,21 @@ public class VideoPlayerActivity extends Activity {
load();
/*
* if the activity has been paused by pressing the power button,
* pressing it again will show the lock screen.
* But onResume will also be called, even if vlc-android is still in the background.
* To workaround that, pause playback if the lockscreen is displayed
*/
mHandler.postDelayed(new Runnable() {
public void run() {
if (mLibVLC != null && mLibVLC.isPlaying()) {
KeyguardManager km = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
if (km.inKeyguardRestrictedInputMode())
mLibVLC.pause();
}
}}, 500);
showOverlay();
super.onResume();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment