3

我的问题是新的 android ICS MediaPlayer 现在分两步下载音乐:

1)它向http服务器发送一个get请求,服务器开始发送mp3文件:

GET /stream/test.mp3 HTTP/1.1
Host: 192.168.30.113
Connection: keep-alive
User-Agent: stagefright/1.2 (Linux;Android 4.0.3)
Accept-Encoding: gzip,deflate

HTTP/1.1 200 OK
Date: Thu, 19 Apr 2012 07:37:29 GMT
Server: Apache/2.2.21 (Win64) PHP/5.3.8
Last-Modified: Sat, 03 Feb 2007 11:17:50 GMT
ETag: "6d0000000400e4-5b415f-428909c5e7a6b"
Accept-Ranges: bytes
Content-Length: 5980511
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: audio/mpeg

2)它关闭第一个连接并重新打开另一个:

GET /stream/test.mp3 HTTP/1.1
Host: 192.168.30.113
Accept: */*

HTTP/1.1 200 OK
Date: Thu, 19 Apr 2012 07:37:41 GMT
Server: Apache/2.2.21 (Win64) PHP/5.3.8
Last-Modified: Sat, 03 Feb 2007 11:17:50 GMT
ETag: "6d0000000400e4-5b415f-428909c5e7a6b"
Accept-Ranges: bytes
Content-Length: 5980511
Content-Type: audio/mpeg

那么,当仅使用一个连接下载 mp3 时,我如何才能返回到 android 2.3.3 中的先前功能?

谢谢。

编辑:我可以看到 MediaPlayer 是基于网络状态的,实际上,取决于连接的速度:wifi 或 3G MediaPlayer 使用这两个连接,但使用 EDGE 它只使用一个。

我认为这可以解释为什么很多用户谈论音乐开始前的缓冲时间很长。

4

1 回答 1

0

Hello I had the same problem and i tried to just send data for the first connection.

GET /stream/test.mp3 HTTP/1.1 Host: 192.168.30.113 Connection: keep-alive User-Agent: stagefright/1.2 (Linux;Android 4.0.3) Accept-Encoding: gzip,deflate

And skip the second connection.

it works well for me hope it helps

于 2012-05-30T14:03:20.640 回答