AntennaPodSP icon indicating copy to clipboard operation
AntennaPodSP copied to clipboard

playing while downloading does not work properly

Open tobybaier opened this issue 11 years ago • 1 comments

In branch playWhileDownloading, I introduced a local NanoHTTPD which streams the media file which is currently downloaded to the mediaPlayer. Unfortunetaly, it works sometimes: when I start the app and tap one episode, it sometimes starts playing the episode from the internal httpd, but not always. In case it does not, mediaPlayer throws an IOException: Prepare failed. Status=0x1

I guess there are some thread problems: the NanoHTTPD runs within DownloadService and is, so that it can use the currently downloaded bytes as a source for what to stream. I wanted to avoid using local temporary files, but maybe that's better, although slower.

I just noticed that DownloadService (holding the NanoHTTPD) and the HttpDownloader (filling the byte array which is delivered by that httpd) are separate Threads, while NanoHTTPD has an internal Thread itself. How can that work with a shared byte array? Probably going for temporary files is better.

tobybaier avatar Mar 26 '14 18:03 tobybaier

Just noticed that Pocket Casts seems to do it with temp files. Quite a neat UI also, by the way :)

tobybaier avatar Mar 26 '14 21:03 tobybaier