尝试流式传输时在 Mediaplayer 上准备失败
我试图在 Android 2.3.3 中使用以下代码流式传输 MP3 文件:
player = new MediaPlayer();
String uri = "http://192.168.2.102:8080/sound/test.mp3";
player.setDataSource(uri);
player.prepare();
出于某种原因,每次调用准备时都会收到以下 IOException: java.io.IOException: 准备失败。: status=0x1 我直接在浏览器中测试了该链接,它可以工作。 我还在清单中添加了互联网权限。
有人知道我做错了什么吗?
谢谢你的帮助
I am trying to stream an MP3-file with the following code in Android 2.3.3:
player = new MediaPlayer();
String uri = "http://192.168.2.102:8080/sound/test.mp3";
player.setDataSource(uri);
player.prepare();
for some reason every time I call prepare I get the following IOException: java.io.IOException: Prepare failed.: status=0x1
I tested the link directly in a browser and it works.
I also added the Internet permission in the manifest.
Anyone know what I am doing wrong?
thanks for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题似乎是我尝试流式传输的 MP3 文件没有附加 ID3 标签,而 Android 不喜欢这样......
It seems like the problem was that there was no ID3 tag attached to the MP3 file I was trying to stream, and Android doesn't like that...