-Fixed main player multiwindow pauses when focus changes.
This commit is contained in:
parent
b0a09c7876
commit
7219c8d33c
|
@ -150,6 +150,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (DEBUG) Log.d(TAG, "onResume() called");
|
if (DEBUG) Log.d(TAG, "onResume() called");
|
||||||
|
if (isInMultiWindow()) return;
|
||||||
if (playerImpl.getPlayer() != null && activityPaused && playerImpl.wasPlaying()
|
if (playerImpl.getPlayer() != null && activityPaused && playerImpl.wasPlaying()
|
||||||
&& !playerImpl.isPlaying()) {
|
&& !playerImpl.isPlaying()) {
|
||||||
playerImpl.onPlay();
|
playerImpl.onPlay();
|
||||||
|
@ -184,7 +185,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (DEBUG) Log.d(TAG, "onPause() called");
|
if (DEBUG) Log.d(TAG, "onPause() called");
|
||||||
|
if (isInMultiWindow()) return;
|
||||||
if (playerImpl != null && playerImpl.getPlayer() != null && !activityPaused) {
|
if (playerImpl != null && playerImpl.getPlayer() != null && !activityPaused) {
|
||||||
playerImpl.wasPlaying = playerImpl.isPlaying();
|
playerImpl.wasPlaying = playerImpl.isPlaying();
|
||||||
playerImpl.onPause();
|
playerImpl.onPause();
|
||||||
|
@ -342,6 +343,10 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isInMultiWindow() {
|
||||||
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isInMultiWindowMode();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Playback Parameters Listener
|
// Playback Parameters Listener
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue