Merge pull request #1037 from react-native-community/feature/exoplayer-repeat

Make ExoPlayer send onEnd when repeat is on
This commit is contained in:
Hampton Maxwell 2018-05-28 21:27:11 -07:00 committed by GitHub
commit cc9498d72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -471,6 +471,12 @@ class ReactExoplayerView extends FrameLayout implements
// which they seeked. // which they seeked.
updateResumePosition(); updateResumePosition();
} }
// When repeat is turned on, reaching the end of the video will not cause a state change
// so we need to explicitly detect it.
if (reason == ExoPlayer.DISCONTINUITY_REASON_PERIOD_TRANSITION
&& player.getRepeatMode() == Player.REPEAT_MODE_ONE) {
eventEmitter.end();
}
} }
@Override @Override