Iam using Exoplayer to play videos as a playlist continuously in android. When I play low quality mp4 video, it works fine, but when I try to play high quality mp4 video after playing one or two videos in a playlist, the screen does not display anything and the log gives the following exception.
com.google.android.exoplayer.MediaCodecTrackRenderer $ DecoderInitializationException: Decoder Error: OMX.amlogic.avc.decoder.awesome, MediaFormat (video / avc, 198826, 1920, 1080, -1.0, -1, -1, -1, -, eleven)
Even if I loop the same high quality video during the first playback, and then the second time, this is an exception. when the video size exceeds 80 mb, this exception is thrown. Is this a buffer size issue? can someone please guide me. thank you very much
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.adplayertexture);
AdplayerTexture=(TextureView)findViewById(R.id.AdPlayerTexture);
AdplayerTexture.setBackgroundColor(Color.BLACK);
AdplayerTexture.setSurfaceTextureListener(this);
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width,
int height) {
AdPlayerSurface = new Surface( surface);
playMedia(AdPlayerSurface);
}
private void playMedia(Surface surface){
mediaplayer=new ExoPlayer();
mediaplayer.play(this,Videopathlist[CurrentVideoIndex],surface;
mediaplayer.addListener(this);
}
@Override
public void onStateChanged(boolean playWhenReady, int playbackState) {
if (playbackState == ExoPlayer.STATE_ENDED) {
mediaplayer.DestroyPlayer();
AdPlayerSurface.release();
AdPlayerSurface=new Surface(AdplayerTexture.getSurfaceTexture());
CurrentVideoIndex++;
playMedia(AdPlayerSurface);
}
this is the play () function in the root2mediaplayer class
public void playMedia(Activity playerActivity,String mediapath,final long Position,Surface mediasurface){
String Systemroot = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
try{
File myFile=new File(Systemroot + java.io.File.separator + "Videos"
+ java.io.File.separator
+ mediapath);
Uri uri = Uri.fromFile(myFile);
final int numRenderers = 2;
SampleSource sampleSource =
new FrameworkSampleSource(playerActivity, uri, null, numRenderers);
TrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT);
TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
MoviePlayer = ExoPlayer.Factory.newInstance(numRenderers);
MoviePlayer.prepare(videoRenderer, audioRenderer);
MoviePlayer.addListener(this);
MoviePlayer.sendMessage(videoRenderer, MediaCodecVideoTrackRenderer.MSG_SET_SURFACE, mediasurface);
MoviePlayer.seekTo(Position);
MoviePlayer.setPlayWhenReady(true);
}catch(Exception e){
e.printStackTrace();
FileLog("exception in mediaplayer");
}