English 中文(简体)
Some files won t stream from lighttpd to Droid
原标题:

We are running into some odd issues with streaming certain files in our app. After lots and lots of testing we ve narrowed it down to what seems like some sort of issue between lighttpd and Droid, and it s not just our app but the built in player as well.

If you point the Droid browser to http://stream29l.grooveshark.com/collinSong.mp3 it does not work. The same file hosted on Apache at http://staging.api.grooveshark.com/collinSong.mp3 streams perfectly. The files are identical. Both URLs work on other phones running 1.5 and 1.6, and on the emulator running 2.0.1.

The lighttpd URL fails whether playing over wifi or over 3G.

My guess is that there s something funky going on at the network level that Droid is not tolerant of, but I m at the end of what I can debug. Any ideas?

UPDATE: I installed lighttpd on my laptop running CentOS and set it up to serve those same files (sorry, not accessible to the outside world) and the Droid can serve them fine. It s got to be a specific configuration issue with our server, or a difference in lighttpd versions. Right now my laptop is running 1.4.22 and our production server is running 1.5.0. Our production server also has the following configs set that gave me problems setting on my laptop (note: I may be missing modules, etc):

server.max-fds = 7000
server.network-backend = "gthread-aio"
server.stat-cache-engine = "fam"

the server also has these additional modules installed:

                            "mod_proxy_core",
                            "mod_proxy_backend_http",
                            "mod_proxy_backend_fastcgi",

I m going to try getting modules and configs to match 100% and see if that reproduces the problem tomorrow. If not, I ll try upgrading my laptop to 1.5.0 and see if that does it.

In the meantime, does anyone know of issues related to the above configs?

UPDATE 2: I upgraded to 1.5.0 on my laptop, streaming collinSong.mp3 still worked. Adding: server.network-backend = "gthread-aio" did not break streaming. However this line did: server.stat-cache-engine = "fam"

Commenting out the above line makes streaming work from my laptop, and having it enabled makes it not work. I actually got our admin to remove that line from the config and restart lighty (he said we didn t need that setting anyway), but the problem persists.

So next I tried leaving stat-cache-engine commented out on my laptop and adding these lines: "mod_proxy_core", "mod_proxy_backend_http", "mod_proxy_backend_fastcgi" Once again streaming on my laptop broke after enabling these, and works when I turn them off. Unfortunately, these are apparently needed for the threading model we are using on the server, so I can t experiment with turning them off in production. I don t know if this gives any sort of clues to anyone else, but it s all I have.

I d love to get in touch with a developer at Motorola because it seems to be a bug with the platform; works fine on other android devices, PCs, iPhones, Blackberries, and Nokia phones, but not Droid.

问题回答

I don t really have an answer for you but after some very basic inspection I can tell you that staging (Apache) is returning a 200 with the entire file and stream29l (lighttpd) is returning a 206 with a partial file. Perhaps droid doesn t support streaming?

I no longer have the Droid so I can t test this myself, but a good way to do it would be to set up a proxy and configure the Droid to use it so you can inspect the request and response from both servers. Quick testing from firefox doesn t show any big difference between the responses, so it looks like only testing from a droid would be helpful.

Fiddler is an excellent proxy that allows you to examine every aspect of the client-server transaction.

Here are the HTTP headers returned. At least they return the same content length.

http://stream29l.grooveshark.com/collinSong.mp3 returns:

HTTP/1.1·200·OK(CR)(LF)
Content-Type:·audio/mpeg(CR)(LF)
ETag:·"3368448790"(CR)(LF)
Accept-Ranges:·bytes(CR)(LF)
Last-Modified:·Tue,·22·Dec·2009·17:27:55·GMT(CR)(LF)
Content-Length:·3854464(CR)(LF)
Connection:·close(CR)(LF)
Date:·Sat,·02·Jan·2010·19:01:18·GMT(CR)(LF)
Server:·lighttpd/1.5.0(CR)(LF)
(CR)(LF)

http://staging.api.grooveshark.com/collinSong.mp3 returns

HTTP/1.1·200·OK(CR)(LF)
Date:·Sat,·02·Jan·2010·19:02:30·GMT(CR)(LF)
Server:·Apache/2.2.14·(EL)(CR)(LF)
Last-Modified:·Mon,·21·Dec·2009·22:13:36·GMT(CR)(LF)
ETag:·"ac811e-3ad080-47b446696e400"(CR)(LF)
Accept-Ranges:·bytes(CR)(LF)
Content-Length:·3854464(CR)(LF)
Connection:·close(CR)(LF)
Content-Type:·audio/mpeg(CR)(LF)
X-Pad:·avoid·browser·bug(CR)(LF)
(CR)(LF)

See Rex Swain s HTTP Viewer.

On the Motorola Milestone (European UMTS Droid) running 2.0 both streams work without problems. I will retest this page after I receive my 2.0.1 update.





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签