google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Failed to play video: com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException #7520

Open jerryisbusy opened 4 years ago

jerryisbusy commented 4 years ago

Hello: I have a video here: https://images2.bestjlb.com/video/jlbapp/5e09875981b2214e548f2eb09aac0e48/2020/06/v2jlboss.TRANSCODE-f98fdbe4fc2027cf4e873572b81eb531(3840x2160)(15534ms).mp4 (First time you visit this video in browser, you will have a error. Refreshing will solve this)

It can be played well from browser and VLC player. But it cannot be played using ExoPlayer (version 2.11.4). The exception i have is :

06-18 13:39:11.049  7939  7939 W System.err: com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException
06-18 13:39:11.049  7939  7939 W System.err:    at com.google.android.exoplayer2.BaseRenderer.createRendererException(BaseRenderer.java:359)
06-18 13:39:11.049  7939  7939 W System.err:    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:735)
06-18 13:39:11.049  7939  7939 W System.err:    at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:599)
06-18 13:39:11.049  7939  7939 W System.err:    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:329)
06-18 13:39:11.049  7939  7939 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
06-18 13:39:11.049  7939  7939 W System.err:    at android.os.Looper.loop(Looper.java:150)
06-18 13:39:11.049  7939  7939 W System.err:    at android.os.HandlerThread.run(HandlerThread.java:61)
06-18 13:39:11.049  7939  7939 W System.err: Caused by: java.lang.IllegalStateException
06-18 13:39:11.050  7939  7939 W System.err:    at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
06-18 13:39:11.050  7939  7939 W System.err:    at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2406)
06-18 13:39:11.050  7939  7939 W System.err:    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1520)
06-18 13:39:11.050  7939  7939 W System.err:    at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:721)
06-18 13:39:11.050  7939  7939 W System.err:    ... 5 more

And here is the output of ffprobe:

ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-06-17T06:05:20.000000Z
    com.android.version: 9
    com.android.capture.fps: 60.000000
  Duration: 00:00:15.54, start: 0.000000, bitrate: 72477 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160, 72220 kb/s, SAR 1:1 DAR 16:9, 59.09 fps, 60 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2020-06-17T06:05:20.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2020-06-17T06:05:20.000000Z
      handler_name    : SoundHandle
icbaker commented 4 years ago

I'm unable to access the media link provided - it 403s for me every time, even after refreshing.

icbaker commented 4 years ago

Ah the link works when I remove the trailing character.

algrid commented 3 years ago

We also have this problem for videos from here https://podcasts.apple.com/us/podcast/ted-talks-daily-sd-video/id160892972

But it's device-specific, the crash report comes from a Moto g8 user.

elgsylvain85 commented 3 years ago

Hi,

I experienced the same error and after a whole day of debugging, I understood that the problem came from the video resource I was loading (in my case, the https request was subjected to basic authentication before returning the video) and like "VideoPlayerController.network (...)" launches the request in parameter in the hope that it directly returns a video resource then it crashes if it is not the case. Please, review your logic in more detail and try even with free videos on the Internet or locally compatible.