播放MP3文件,而下载?文件

2023-09-05 09:32:25 作者:孤城àδ影ζ

我想我的Andr​​oid应用程序从互联网上下载一个MP3文件并播放它像一个流,同时下载。这甚至可能吗?我怎么会去这样做呢?

I'd like my Android application to download an mp3 file from the internet and play it like a stream while downloading it. Is this even possible? How would I go about doing it?

基本上我希望用户能够收听即时的文件,但它保留下载到,即使他停止听的SD卡,所以整个MP3文件最终会在SD卡两种方式。

Essentially I want the user to be able to listen to the file instantly, but have it keep downloading to the SD Card even if he stops listening, so the whole mp3 file will end up on the SD Card either way.

推荐答案

有关Android设备2.3和更早版本,你需要完全删除内容处置响应头。这将导致浏览器调用的用户的preference音频播放器。

For Android devices 2.3 and earlier, you need to remove the Content-Disposition response header altogether. This will cause the browser to invoke the audio player of the user's preference.

尝试在这里: http://declinefm.com/archives 选择您所选择的档案,然后点击下载链接。

Try it here: http://declinefm.com/archives select an archive of your choice, and tap the download link.

有关现代的Andr​​oid设备,你可以去除CD标题的分配。

For modern Android devices, you can dispense with the removal of the CD header.

我有一个教程在这里,我写的启发您的文章:

I have a tutorial here that I wrote inspired on your post:

http://rudd-o.com/linux-and-free-software/how-to-properly-stream-audio-from-your-plone-varnish-site

享受!