StreamingKit
StreamingKit copied to clipboard
Can i get catch downloaded data progress
Hello @tumtumtum : How can i track downloaded data progress (buffering progress indicator) like this image.
+1
— Sent from Mailbox
On Tue, Jan 13, 2015 at 6:07 AM, Nguyễn Hữu Anh [email protected] wrote:
Hello @tumtumtum : How can i track downloaded data progress (buffering progress indicator) like this image.
Reply to this email directly or view it on GitHub: https://github.com/tumtumtum/StreamingKit/issues/173
yes this is same as #157
+1
this is a very important feature, we are waiting you @tumtumtum :)
+1
The current architecture of the library doesn't allow it to report this. The STKCoreFoundationDataSource is built on top of CFReadStream which has no methods for reporting how much data is buffered - it can just tell the you when data is available and let you read it out of the stream.
To report how much buffered data was available the STKCoreFoundationDataSource class would have to be expanded to automatically pull all the buffered data out of the CFReadStream into a new class buffer before handing it over to the library client. That's a lot of extra memory allocation and copying data around - to say nothing of threading issues - for a (relatively) small new feature. It would be possible to sub-class one of the top level DataSources but would be simpler in the base class which makes it a more major alteration that impacts all users with extra overhead.
+1
@richardgroves you seem pessimistic on this, but I would argue this is a pretty core feature of a streaming library. Have any architecture changes allowed this to be possible, or does anyone have a fork that has this functionality?
I think the buffering info required isn't about the internal read buffers of CFReadStream or TCP (which would be tiny) but how much read ahead buffering has been done for the steam. It is relatively easy to write a DataSource that provides this info especially if it's a simple read ahead buffer that gets thrown away when seeking. If you want something that tracks he buffer even after seeking then it's a bit more complicated.
Thanks for the reply @tumtumtum the library is great!
When you say It is relatively easy to write a DataSource that provides this info
it's not easy for me. I'm a very experienced cocoa developer but the reason I'm using a library like this in the first place is that I'm not as confident with low-level code.
Is there an example you could point me to? I'm sure I'm not alone in wanting this feature but not being sure where to start with subclassing DataSource
. Ideally the STKAudioPlayer
would have a bufferedProgress
propery which would give the duration in seconds where the latest buffered bit is — not supporting seek would be totally fine for a first pass.
Is there a stable fork that adds this functionality?
@tumtumtum long time no see, any update on new version
any update here?
im working on it.
I believe the download progress is
float p = (float)currentlyPlayingEntry.dataSource.position/(float)currentlyPlayingEntry.dataSource.length;
correct me if I'm wrong.