ExoMedia: Looping is broken

Using the latest commit in the 3.0 branch, the following code doesn’t do anything (most likely because ExoPlayer is in STATE_IDLE):

// in a subclass of EMVideoView
setOnCompletionListener(new OnCompletionListener() {
  @Override
  public void onCompletion() {
    seekTo(0);
    start();
  }
});

I’ve verified that onCompletion is actually called, and I set a breakpoint on EMExoPlayer.onPlayerStateChanged. After the video finishes playing, it is called twice, both times with ExoPlayer.STATE_IDLE.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

and this is the “onPlayPauseClick” function of the DefaultControls.java:

protected void onPlayPauseClick() {
    if (callback != null && callback.onPlayPauseClicked()) {
        return;
    }

    if (bus != null) {
        bus.post(new EMMediaPlayPauseEvent());
        if (busPostHandlesEvent) {
            return;
        }
    }

    //toggles the playback
    boolean playing = videoView.isPlaying();
    if (playing) {
        videoView.pause();
    } else {
        if (videoView.getCurrentPosition() >= videoView.getDuration()) {
            videoView.restart();
            return;
        }
        videoView.start();
    }
}