I would like to create music player, with a textView displaying lyrics of MP3 being played. The lyrics should displayed in center from right to left side, in sync with music. Any suggestions on how I can do this?
-
What data do you have? Your phone will never be able to link text in a string to music without clues about what comes when. And, also important, when does it end. Then, the accepted answer to this question might help you: http://stackoverflow.com/questions/8970927/marquee-set-speed – Jochem Jun 20 '12 at 12:47
-
I am going to play my own educational material => text and form of text is no problem. – vlkpo Jun 20 '12 at 13:38
2 Answers
I tried Ramakrishna's code from Marquee Set Speed and it is working great! Exactly what I was looking for. I need just prepare for each sentence, its starting time and duration. It is possible to get the current playback position in milliseconds from MediaPlayer so ...
Although it is not a real answer I would suggest one way I would try to implement it. First of all you have to make sure you have all information needed to do the job. As already mentioned you need at least the text and for every word/sentence a starting time (I also would prefer a duration). Then I would use two or more TextViews to display the words/sentences in two rows. Together with the starting time and duration (or the next starting time) you will be able to determine the overall duration of effects like fade in/out, color highlighting etc. Now you should be able to show the text nearly synchronously to the music. Thats all (theoretically)!
Now you can start and play with the number of chars in a row or the number of chars for a fixed time interval. Because I have not tested this myself I cant say if it is possible to change effects in real time or if they are fixed the time they were created.
But it all sounds fun and I'm interested in the outcome. Good luck.

- 937
- 7
- 22
-
It is not what I want, but solution which looks practicable. If I will not find another solution I will try to do it this way. Thank you. ...maybe it would be more comfortable to see static sentence. – vlkpo Jun 20 '12 at 13:42