I have an Android TV application that works with MPEG-TS files (in the Amlogic field).
We have 1 hour files, for example, 13.mpeg, 14.mpeg ... 24.mpeg, etc. (one file for every hour).
I have a problem rewinding the file of the current hour, for example, if it is 12:50 now, the 12.mpeg file is constantly updated with new data, but if I rewind to 12:48 from 12:50, the player will only grow until 12:50, and then he will think that the file has been completed and switched to OnCompletionListener
when the file is actually already updated before 12:52. Thus, the player does not detect updated data, only the data that was recorded until the point requested by you requests.
I suspected the Content-Length HTTP header, but it is updated with every response, so technically the player should know about the new content. It either ignores the information or only works according to the first answer or something else that I cannot understand.
Here is a snippet that I use to simply rewind:
MainActivity.mediaPlayer.reset(); MainActivity.mediaPlayer.setDataSource(newPlayUrl); MainActivity.mediaPlayer.prepareAsync(); MainActivity.mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { MainActivity.mediaPlayer.start(); MainActivity.mediaPlayer.seekTo(ts * 1000); paused = false; } });
My question is: is there a way to tell the player the request for an updated file in the background so that rewinding can work correctly?
source share