Fix bug with playInBackground

This commit is contained in:
Marc-Olivier Duval 2017-10-24 22:42:41 -04:00
parent f7b7f2666a
commit ee5818b6ff

View File

@ -167,9 +167,6 @@ class ReactExoplayerView extends FrameLayout implements
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (playInBackground) {
return;
}
stopPlayback();
}
@ -209,12 +206,14 @@ class ReactExoplayerView extends FrameLayout implements
player.setMetadataOutput(this);
exoPlayerView.setPlayer(player);
audioBecomingNoisyReceiver.setListener(this);
setPlayWhenReady(!isPaused);
playerNeedsSource = true;
PlaybackParameters params = new PlaybackParameters(rate, 1f);
player.setPlaybackParameters(params);
}
setPlayWhenReady(!isPaused);
if (playerNeedsSource && srcUri != null) {
MediaSource mediaSource = buildMediaSource(srcUri, extension);
mediaSource = repeat ? new LoopingMediaSource(mediaSource) : mediaSource;