How to play an incomplete audio stream?
#1
Question 
Hey folks,

I'm trying to play an incomplete audio stream. When my plugin starts, the stream is being downloaded but I don't want to wait until it is completed to play it.

I've tried three approaches:
1) Just download the first 1MB, then play it while downloading in another thread. This fails, because xbmc stops after it hits the file size the cache had at the time the player starts.

2) Create a sparse file the size of the final file, then do the same as 1). Now xbmc hangs for a while until it starts to play, presumably because it scans the file for content, which takes a while.

3) Create a sparse file, download the first MB like in 1), but also the last 32kb of the file. Then download the rest in another thread like before. Now xbmc won't hang and scan the file, but still won't play the content that downloaded after the player started. Instead it will play the first MB, and then the last 32kb and quit!

This is driving me a bit crazy. I've glanced at the xbmc sources, and I think a workaround may possibly be to pass READ_NO_CACHE to CFile::Open, but I don't think I can do that from within Python.

Does anyone have a suggestion for me? And no, I don't want to just pass the stream to xbmc; that's the whole point of my plugin ;-).

Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
How to play an incomplete audio stream?0