Read all the previous answers and had no luck.
Working on an android app in which I need to synchronize mp3
audio with text. As the mp3
played it keeps on changing the text. Just like the lyrics highlights on YouTube etc.
first you need to create subtitle file of the audio that you want to play and then add that subtitle file in your media player as
String mimeType = getMimeType("file://mnt/sdcard/BarbieGirl.srt");
// mp.selectTrack(index);
try {
mp.addTimedTextSource(path, mimeType);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for creating subtitle file you can use check this url Create Subtitle .
They use LRC files to generate the lyrics under the mp3
https://en.wikipedia.org/wiki/LRC_(file_format)
Essentially, the lyrics (or whatever) are tagged with times for which they should appear, if the android player you're using is LRC aware, it should automatically overlay the lyrics at the right time intervals, you can even make the lines appear a few words at a time with the extended tagging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With