I\'m currently developing a video player for android. I\'ve created a simple textview that shows the current subtitle.
The problem is: MediaPlayer getCu
1) Parse the subtitle file
2) Make use of CounterTimer class in set it to player.getDuration() then set an interval of your choice in on tick method (which is called on tick of every interval ) get the current position of your player using player.getCurrentPosition(); (Remember this will return you time in millisecond). Please also remember to store and keep millisecondsLeft.
3) convert it into your desired format and match it with time hashmap or array you have taken.
4) Update your TextView which is overlaid on player with the suitable Text.
5) cancel the Timer for duration period then(you can implement a new Timer with duration time).
6) After Duration timer finishes in onFinish() you can start the old timer with millisecondLeft time what you saved in STEP 2.
Thats it ;)
In case anyone needs, I did my solution.
I developed the subtitles module. To get the accurate milliseconds, I made a synchronizer for system and player timers.
Every 20 seconds of video playback I do this procedure:
Now, if I want the current movie milliseconds:
Easy, and resulted in synchronized subtitles ;)