作为标题,我如何在没有vitamio的情况下在安卓上流式传输m3u8音频?(在安卓2.3+上)。我已经看到一些应用程序可以像VLC或aqua播放器一样流式传输我的链接http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4,但我无法设置mMediaPlayer来复制它。
发布于 2014-01-09 07:17:46
使用VideoView播放您的音频和轻松的音乐:)
myVideoView = (VideoView)this.findViewById(R.id.myVideoView);
MediaController mc = new MediaController(this);
myVideoView.setMediaController(mc);
urlStream = "http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4";
runOnUiThread(new Runnable() {
@Override
public void run() {
myVideoView.setVideoURI(Uri.parse(urlStream));
}
});发布于 2013-11-26 23:22:02
您的m3u8不是真正的HLS文件。它只是一个指向单个MP3的播放列表指针
http://4metest1-4me.weebo.it/ios/Dance_of_the_Yao_People_3_JIDMQ7.mp3您可以使用媒体播放器直接从源文件进行流式传输,也可以在代码中解析文件m3u8文件以提取单独的URL
url url = new URL(" http://4metest1-view.4me.it/api/xpublisher/resources/weebopublisher/getContentDescriptor.m3u8?clientId=4metest1&contentId=b55f7d74-cd81-48ce-9390-d9ffd5c49281&channelType=STREAMHTTPIOS&v=4");
InputStream m3u8 = (InputStream) url.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(M3U8));
for(int i = 0; i < 2; ++i)
{
br.readLine();
}|
readLine(); //this parses the third line of the playlist
br.close();
url = new URL(baseURL.concat(target)); https://stackoverflow.com/questions/20220208
复制相似问题