如何在Android中使用带有MediaPlayer for Audio track的webvtt文件

我有一个.m3u8 URL(用于曲目)和一个.vtt URL(用于曲目详细信息).

我正在 android中开发一个收音机,其中每个音轨的详细信息都附带.vtt文件.

所以我的问题是如何在MediaPlayer中同步track url和.vtt url.

我的收音机播放效果不错,但我无法获得曲目的详细信息.

Q.What is need of using .vtt file?

Ans. Because the radio contains infinite songs and every song has its own details. thats why there is need to synchronize tracks and its details.

这是我的.vtt文件结构.

WEBVTT

1
00:00:00.000 --> 00:03:22.176
NOW PLAYING: <b>Don&#39;t Go</b> - Jon Tarifa
NOTE https://play.unplug.de/images/artwork.php?id=113043444&w=400

2
00:03:22.176 --> 00:06:28.725
NOW PLAYING: <b>Treat You Better</b> - Shawn Mendes
NOTE https://play.unplug.de/images/artwork.php?id=112983776&w=400

3
00:06:28.725 --> 00:09:46.954
NOW PLAYING: <b>Used To Have It All</b> - Fais &amp; Afrojack
NOTE https://play.unplug.de/images/artwork.php?id=113044015&w=400

4
00:09:46.954 --> 00:13:45.330
NOW PLAYING: <b>Hurts</b> - Emeli Sandé
NOTE https://play.unplug.de/images/artwork.php?id=113029897&w=400
...
...

如果有人知道怎么做,请回答.

提前致谢.

最佳答案 如果.vtt文件是一致的,我认为你只需要解析vtt文件中的轨道号,开始 – 结束时间,歌曲,艺术家和缩略图网址.然后,您可以轻松实现trak详细信息之间的同步和跟踪.

点赞