Merge pull request #1509 from karyogamy/main-video-player-fix
Main video player fix
This commit is contained in:
commit
43e7be9b86
2 changed files with 10 additions and 7 deletions
|
@ -1147,11 +1147,11 @@ public abstract class BasePlayer implements
|
||||||
|
|
||||||
@Player.RepeatMode
|
@Player.RepeatMode
|
||||||
public int getRepeatMode() {
|
public int getRepeatMode() {
|
||||||
return simpleExoPlayer.getRepeatMode();
|
return simpleExoPlayer == null ? Player.REPEAT_MODE_OFF : simpleExoPlayer.getRepeatMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRepeatMode(@Player.RepeatMode final int repeatMode) {
|
public void setRepeatMode(@Player.RepeatMode final int repeatMode) {
|
||||||
simpleExoPlayer.setRepeatMode(repeatMode);
|
if (simpleExoPlayer != null) simpleExoPlayer.setRepeatMode(repeatMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPlaybackSpeed() {
|
public float getPlaybackSpeed() {
|
||||||
|
|
|
@ -153,8 +153,11 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
if (DEBUG) Log.d(TAG, "onNewIntent() called with: intent = [" + intent + "]");
|
if (DEBUG) Log.d(TAG, "onNewIntent() called with: intent = [" + intent + "]");
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
if (intent != null) {
|
||||||
|
playerState = null;
|
||||||
playerImpl.handleIntent(intent);
|
playerImpl.handleIntent(intent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
@ -219,11 +222,10 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
getWindow().getAttributes().screenBrightness);
|
getWindow().getAttributes().screenBrightness);
|
||||||
|
|
||||||
if (playerImpl == null) return;
|
if (playerImpl == null) return;
|
||||||
if (isBackPressed) {
|
if (!isBackPressed) {
|
||||||
playerImpl.destroy();
|
|
||||||
} else {
|
|
||||||
playerImpl.minimize();
|
playerImpl.minimize();
|
||||||
}
|
}
|
||||||
|
playerImpl.destroy();
|
||||||
|
|
||||||
isInMultiWindow = false;
|
isInMultiWindow = false;
|
||||||
isBackPressed = false;
|
isBackPressed = false;
|
||||||
|
@ -465,7 +467,8 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
onFullScreenButtonClicked();
|
onFullScreenButtonClicked();
|
||||||
break;
|
break;
|
||||||
case PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_NONE:
|
case PlayerHelper.MinimizeMode.MINIMIZE_ON_EXIT_MODE_NONE:
|
||||||
destroy();
|
default:
|
||||||
|
// No action
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue