I want to add the subtitle function to mediaplayer in Android. Below are some notes,
Without the support of the server, we just performed a local parsing. If we had resolved all the data from the very beginning, such as hundreds of data records, it would easily cause problems and cause ANR, remember that mediaplayer has a nucachedfilesource2 item when parsing files. You can load files to the memory in batches to speed up playback, load more data when the playing position reaches the end of the Data. After the experiment, the effect is much better than the original one.
There is also the function of searching. At the beginning, it was just silly to use sequential searching. The efficiency was too low, and the playback function of mediaplayer was also remembered. You can set the position pointer of subtitles, seek sets this pointer and finds the position after the pointer, which is much more efficient. There is no way to paste the code and paste it later.