After video compress couldn't play in exoplayer but success upload to server
Opened this issue · 0 comments
E/ExoPlayerImplInternal: Disable failed. java.lang.IllegalStateException at android.media.MediaCodec.native_flush(Native Method) at android.media.MediaCodec.flush(MediaCodec.java:2297) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:142) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:887) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:880) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:741) at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.onDisabled(MediaCodecAudioRenderer.java:530) at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:175) at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1608) at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1350) at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1314) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:571) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:260) at android.os.HandlerThread.run(HandlerThread.java:67) MediaCodec: Codec reported err 0xe, actionCode 0, while in state 6 ExoPlayerImplInternal: Playback error com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(2, null, null, audio/mp4a-latm, mp4a.40.0, -1, en, [-1, -1, -1.0], [1, 48000]), format_supported=YES at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:555) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:260) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException: Decoder failed: c2.android.aac.decoder at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.createDecoderException(MediaCodecRenderer.java:955) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:839) at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:948) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:478) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:260) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3451) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueOutputBufferIndex(SynchronousMediaCodecAdapter.java:82) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1779) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:824) at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:948) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:478) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:260) at android.os.HandlerThread.run(HandlerThread.java:67)
val compressVideoRequest = CompressVideoRequest.Builder()
.setSourceVideo(AbsoluteFilePathSourceVideo(source))
.setCompressedVideoAbsoluteFilePath(dest)
.setCompressQuality(CompressQuality.MEDIUM)
.setCompressListener(object:CompressListener.DoNothingCompressListener(){
override fun onProgress(percent: Float) {
super.onProgress(percent)
}
})
.build()
val resultCompress = VideoController.getInstance().convertVideo(compressVideoRequest)
if(resultCompress){
var compressUri:Uri? = null
var name:String? = null
var length:Long? = null
val videoFile: File = File(dest)
compressUri = FileProvider.getUriForFile(mContext, "com.nibmeetings.android.provider", videoFile)
name = videoFile.name
length = videoFile.length().div(1024) // Size in KB
var albumFile = AlbumFile()
albumFile.setUri(compressUri)
albumFile.bucketName = name ?: ""
albumFile.mediaType = AlbumFile.TYPE_VIDEO
albumFile.mimeType = "video/mp4"
if (length != null) {
albumFile.size = length
}
objVideo.resume(albumFile)
}
How to solve this?
my android is 11 & 12