StreamingKit icon indicating copy to clipboard operation
StreamingKit copied to clipboard

Can i get catch downloaded data progress

Open Anhnh opened this issue 10 years ago • 15 comments

Hello @tumtumtum : How can i track downloaded data progress (buffering progress indicator) like this image. e57dd190-8f6f-11e4-81ab-e65c2c34f6c3

Anhnh avatar Jan 13 '15 04:01 Anhnh

+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.

e57dd190-8f6f-11e4-81ab-e65c2c34f6c3

Reply to this email directly or view it on GitHub: https://github.com/tumtumtum/StreamingKit/issues/173

syrakozz avatar Jan 13 '15 06:01 syrakozz

yes this is same as #157

syrakozz avatar Jan 22 '15 15:01 syrakozz

+1

dogo avatar Feb 02 '15 14:02 dogo

this is a very important feature, we are waiting you @tumtumtum :)

syrakozz avatar Feb 02 '15 14:02 syrakozz

+1

thuai avatar Jul 09 '15 08:07 thuai

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.

richardgroves avatar Jul 09 '15 09:07 richardgroves

+1

KenmuHuang avatar Mar 19 '16 07:03 KenmuHuang

@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?

tsheaff avatar May 17 '16 17:05 tsheaff

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.

tumtumtum avatar May 17 '16 17:05 tumtumtum

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?

tsheaff avatar May 17 '16 17:05 tsheaff

@tumtumtum long time no see, any update on new version

syrakozz avatar May 18 '16 14:05 syrakozz

any update here?

newbdez33 avatar Jul 04 '17 08:07 newbdez33

im working on it.

newbdez33 avatar Jul 04 '17 10:07 newbdez33

I believe the download progress is

float p = (float)currentlyPlayingEntry.dataSource.position/(float)currentlyPlayingEntry.dataSource.length;

correct me if I'm wrong.

newbdez33 avatar Jul 05 '17 01:07 newbdez33

any update here?

bizibizi avatar Aug 04 '17 08:08 bizibizi