android MediaExtractor MediaCodec seek

2019-08-08 20:13发布

问题:

Question again, guys.

I use MediaExtractor and MediaCodec to play MP4 file on android device. Everything works fine until I try to add Extractor.seekto().

If I just play mp3 file with my player,seeking functions well. However, when I try it with MP4 file, the video is not updated. I tried to debug the code, finding out that the mPlayerExtractor.getSampleTrackIndex() always returns 1 (Refer to the audio track).

But I do not know how to fix it.

I cannot put all my code here. So please give me some advise first. Thanks a lot.

Update: I can seek backward for both mp4 file and webm file. If I seek forward with webm file, The video starts to play after the same time of jumped time of the seeking operation. For mp4 file, it just never starts again.