Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player- once complete video again not play #382

Open
VadivelChinnasamy opened this issue Jan 11, 2017 · 17 comments
Open

Player- once complete video again not play #382

VadivelChinnasamy opened this issue Jan 11, 2017 · 17 comments
Labels
Milestone

Comments

@VadivelChinnasamy
Copy link

I use this lib to integrate and load video first time it played and restart is not available and if once complete video then no option to play again and if play again it not play a video(not more then onetime play a video)

@rayworks
Copy link
Contributor

Maybe you can check this issues/291.

@brianwernick
Copy link
Owner

Are you calling restart() and seeing this issue?

@Arlem
Copy link

Arlem commented Jan 24, 2017

I'm seeing this issue too, these are my setup details:

  • ExoMedia version: 3.1.1
  • Device OS version: 4.4
  • Devide Manufacturer: Zidoo
  • Device Name: X9

My code is really simple:

@Override
public void onCompletion() {
    Log.d("onCompletion", "player restart:" + Boolean.toString(player.restart()));
}

Logcat:

D/onCompletion: player restart:true
I/OMXClient: Using client-side OMX mux.
E/BufferQueue: [unnamed-30723-0] connect: already connected (cur=1, req=3)
E/MediaCodec: native_window_api_connect returned an error: Invalid argument (-22)
E/dalvikvm: Could not find class 'android.media.MediaCodec$CodecException', referenced from method com.google.android.exoplayer.MediaCodecTrackRenderer$DecoderInitializationException.getDiagnosticInfoV21
W/dalvikvm: VFY: unable to resolve instanceof 166 (Landroid/media/MediaCodec$CodecException;) in Lcom/google/android/exoplayer/MediaCodecTrackRenderer$DecoderInitializationException;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x0000
E/ExoPlayerImplInternal: Internal track renderer error.
   com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.MediaCodecTrackRenderer$DecoderInitializationException: Decoder init failed: OMX.MS.AVC.Decoder, MediaFormat(1, video/avc, -1, 109288, 1920, 1080, 0, 1.0, -1, -1, null, 60000000, false, -1, -1, -1, -1, -1)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.notifyAndThrowDecoderInitError(MediaCodecTrackRenderer.java:427)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:413)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:800)
      at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.onInputFormatChanged(MediaCodecVideoTrackRenderer.java:333)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:540)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:523)
      at com.google.android.exoplayer.SampleSourceTrackRenderer.doSomeWork(SampleSourceTrackRenderer.java:128)
      at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:432)
      at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:211)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:136)
      at android.os.HandlerThread.run(HandlerThread.java:61)
      at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
   Caused by: com.google.android.exoplayer.MediaCodecTrackRenderer$DecoderInitializationException: Decoder init failed: OMX.MS.AVC.Decoder, MediaFormat(1, video/avc, -1, 109288, 1920, 1080, 0, 1.0, -1, -1, null, 60000000, false, -1, -1, -1, -1, -1)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:413at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:800at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.onInputFormatChanged(MediaCodecVideoTrackRenderer.java:333at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:540at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:523at com.google.android.exoplayer.SampleSourceTrackRenderer.doSomeWork(SampleSourceTrackRenderer.java:128at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:432at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:211at android.os.Handler.dispatchMessage(Handler.java:98at android.os.Looper.loop(Looper.java:136at android.os.HandlerThread.run(HandlerThread.java:61at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40Caused by: java.lang.IllegalStateException
      at android.media.MediaCodec.native_configure(Native Method)
      at android.media.MediaCodec.configure(MediaCodec.java:262)
      at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.configureCodec(MediaCodecVideoTrackRenderer.java:328)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:402)
      at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:800at com.google.android.exoplayer.MediaCodecVideoTrackRenderer.onInputFormatChanged(MediaCodecVideoTrackRenderer.java:333at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:540at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:523at com.google.android.exoplayer.SampleSourceTrackRenderer.doSomeWork(SampleSourceTrackRenderer.java:128at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:432at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:211at android.os.Handler.dispatchMessage(Handler.java:98at android.os.Looper.loop(Looper.java:136at android.os.HandlerThread.run(HandlerThread.java:61at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)

This is the video I'm trying to restart, it's a 1920x1080 mp4.

@brianwernick
Copy link
Owner

OK, I'll look in to this when I have some time (soon)

@Arlem
Copy link

Arlem commented Jan 24, 2017

It does work sometimes; I would exclude network connection problems, since the files are served from a local webserver.

I will test with more device at the same moment tomorrow.

@brianwernick
Copy link
Owner

Yeah, It looks like something is not getting cleaned up correctly and therefore entering a bad state.

@Arlem
Copy link

Arlem commented Jan 25, 2017

I ran some tests with 5 devices contemporaneously.
The number rappresents the number of restart executed before the exception was raised; e.g. 4 means that the video played 4 times (as the first video in onPreparedListener + 3 restart) and the fourth restart API was Fatal; after the Exception, the application was stopped and re-run via Android Studio:

Zidoo X9 1 4.4.4: 4, 4, 1
Zidoo X9 2 4.4.4: 6, 5, 7
Sony Xperia Z3 Tablet Compact 5.1.1, Sony Xperia Z2 Tablet 5.0.2, LG G Flex 2 6.0.1: 80 and counting

Sadly I don't have other KitKat devices to test this issue, could also be device specific.

@brianwernick
Copy link
Owner

I have a Nexus 4 with 4.4.4 on it, so I'll verify if that is or isn't the issue.

@brianwernick
Copy link
Owner

I'm not seeing this on the 4.0 branch with my Nexus 4 (4.4.4), would you mind checking with the listed devices?

@Arlem
Copy link

Arlem commented Feb 21, 2017

Hi @brianwernick , still crashing with a very similar error:

E/MediaCodec: native_window_api_connect returned an error: Invalid argument (-22)
E/dalvikvm: Could not find class 'android.media.MediaCodec$CodecException', referenced from method com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException.getDiagnosticInfoV21
W/dalvikvm: VFY: unable to resolve instanceof 168 (Landroid/media/MediaCodec$CodecException;) in Lcom/google/android/exoplayer2/mediacodec/MediaCodecRenderer$DecoderInitializationException;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x0000
E/ExoPlayerImplInternal: Renderer error.
  com.google.android.exoplayer2.ExoPlaybackException
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.throwDecoderInitError(MediaCodecRenderer.java:376)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:363)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:770)
      at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:341)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readFormat(MediaCodecRenderer.java:501)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:484)
      at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:464)
      at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:300)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:136)
      at android.os.HandlerThread.run(HandlerThread.java:61)
      at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
   Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MS.AVC.Decoder, Format(1, null, video/avc, -1, null, [1920, 1080, -1.0], [-1, -1])
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:363) 
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:770) 
      at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:341) 
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readFormat(MediaCodecRenderer.java:501) 
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:484) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:464) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:300) 
      at android.os.Handler.dispatchMessage(Handler.java:98) 
      at android.os.Looper.loop(Looper.java:136) 
      at android.os.HandlerThread.run(HandlerThread.java:61) 
      at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) 
   Caused by: java.lang.IllegalStateException
      at android.media.MediaCodec.native_configure(Native Method)
      at android.media.MediaCodec.configure(MediaCodec.java:262)
      at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.configureCodec(MediaCodecVideoRenderer.java:327)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:352)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:770) 
      at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:341) 
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readFormat(MediaCodecRenderer.java:501) 
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:484) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:464) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:300) 
      at android.os.Handler.dispatchMessage(Handler.java:98) 
      at android.os.Looper.loop(Looper.java:136) 
      at android.os.HandlerThread.run(HandlerThread.java:61) 
      at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)

@Aditya94A
Copy link
Contributor

Aditya94A commented May 24, 2017

Any updates on this? This bug comes up even in the most simplistic setup (as in the README)

I'm using a temporary workaround:

player.setOnCompletionListener(() -> player.restart());

@broakenmedia
Copy link

Also finding this, just setup purely from the example. Can watch a video half way, then drag it back to the beginning and everything works fine, however if it hits the end, it can no longer be re-played

@electrolobzik
Copy link

Any updates on this? Is there any workaround in case I don't want the video to start immediately after finish (so restart() is not suitable)?

@AlaaZarifa
Copy link

AlaaZarifa commented Jul 6, 2017

In my case, I added a button with replay icon and I made GONE by default, once the video finishes, I show it and inside its onClick I restat the video!

 videoView.setOnCompletionListener(new OnCompletionListener() {
          @Override
          public void onCompletion() {
            videoView.pause();
            videoView.getVideoControls().hide();
            videoView.seekTo(0);
            replay.setVisibility(View.VISIBLE);
             replay.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                replay.setVisibility(View.GONE);
                videoView.restart();
              }
            });

@eygraber
Copy link
Contributor

eygraber commented Sep 7, 2017

On a Pixel with Oreo. Not seeing anything in the logs, but when a video finishes the progress bar shows and I cannot start playing it again.

The only way I can get it to work is to call reset and setVideoURI in the completion listener (not very ideal or intuitive).

@ravirajjak
Copy link

@brianwernick video keeps on playing in loop what we need is once played on completion it should stop and onclick of play button it should play again.

@zsmb13
Copy link

zsmb13 commented May 5, 2021

This is still happening, including in 5.0. Once the video runs to the end, seeking to the middle results in an infinite loading spinner.

@brianwernick brianwernick moved this to Triage in ExoMedia Sep 22, 2022
@brianwernick brianwernick added this to the 5.0.0 milestone Sep 22, 2022
@brianwernick brianwernick moved this from Triage to To do in ExoMedia Sep 22, 2022
@brianwernick brianwernick moved this from To do to In progress in ExoMedia Apr 4, 2023
@brianwernick brianwernick modified the milestones: 5.0.0, 5.1.0 Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

No branches or pull requests