I am developing an app capable of playing an IPTV list. All the contents go with the mkv format and most of them play correctly but some return the following error:
{
"error": Object {
"errorCode": "24001",
"errorException": "com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/x-unknown, null, -1, und, [720, 304, -1.0], [-1, -1]), format_supported=NO_UNSUPPORTED_TYPE",
"errorStackTrace": "com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/x-unknown, null, -1, und, [720, 304, -1.0], [-1, -1]), format_supported=NO_UNSUPPORTED_TYPE
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:566)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:216)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: [-49999], Format(1, null, null, video/x-unknown, null, -1, und, [720, 304, -1.0], [-1, -1])
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:996)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:546)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1450)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:877)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:963)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:779)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:989)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:490)
... 3 more
",
"errorString": "ExoPlaybackException: ERROR_CODE_DECODER_INIT_FAILED",
},
}
This is the code I use with the react-native-video library:
<Video
key={keyload}
ref={(ref) => {setVideo(ref)}}
style={styles.video}
onLoad={(data) => setMetadata(data)}//
source={{
uri: uriLoad, initOptions: ['--codec=avcodec']
}}
onProgress={progress => {setProgress(progress.currentTime)}}
controls={false}
fullscreen={true}
paused={paused}
volume={volumen}
fullscreenAutorotate={true}
selectedVideoTrack={videoTrack}
selectedAudioTrack={audioTrack}
selectedTextTrack={textTrack}
resizeMode={resizemode}
onEnd={() => end()}
isLooping
onError={error => playerError(error)}
onPlaybackStatusUpdat
allowsExternalPlayback
e={status => setStatus(() => status)}//setStatus(() => status)
/>
package.json
{
"name": "someiptv",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@react-native-community/slider": "4.2.3",
"@react-navigation/native": "^6.0.12",
"@react-navigation/native-stack": "^6.8.0",
"expo": "~46.0.9",
"expo-av": "~12.0.4",
"expo-font": "~10.2.0",
"expo-linear-gradient": "~11.4.0",
"expo-screen-orientation": "~4.3.0",
"expo-splash-screen": "~0.16.2",
"expo-sqlite": "~10.3.0",
"expo-status-bar": "~1.4.0",
"lodash.filter": "^4.6.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-marquee": "^0.4.0",
"react-native-paper": "^5.0.0-rc.4",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-system-setting": "^1.7.6",
"react-native-video": "^6.0.0-alpha.3",
"react-native-web": "~0.18.7",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
I have tried with different versions of the library and with different buffer configurations, but nothing works. Does anyone know why this error occurs and how to fix it? Thanks.
Do probably you need to try a different codec list? Because the error code is about a decoding problem https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/PlaybackException.html#ERROR_CODE_DECODER_INIT_FAILED