Closed han9over closed 8 years ago
@han9over I got your point. Unlike any other classes, usually we got more than one model or view layers handling audio playback's event.
According to your usage, you have to update UI at one layer and monitor other events at another layer. Hence one delegate limitation seems like a easy fix. But, what if another developer got several view interface to draw according to HysteriaPlayer's event? Should we support multiple delegates?
In fact, HysteriaPlayer did support multiple delegates but have been deprecated.
The result of multiple delegates or separate current delegate into detail delegates bring too much complexity and states to HysteriaPlayer. For developers who using HysteriaPlayer, it became hard to handle.
My point is, library should stay simple at event handling. User should dispatch events to their layer by themselves.
My own app using HysteriaPlayer as well, I had a delegating class handling all events from HysteriaPlayer and I then dispatch these events by NSNotificationCenter
to my layers that needs it.
Thanks.
@saiday understood. Thanks for that explanation. You can close this :). I don't want to open another request, but i'm still unable to figure out, how we can change datasource in realtime without impacting what is currently playing. is it just set the number of items and it gets updated automatically?
Yes, updating your source set from HysteriaPlayerDataSource delegate is the only thing you have to do.
If you updating your source set frequently, you should consider disable HysteriaPlayer's memory cache, or you have to take care item ordering issue by these two methods.
- (void)removeItemAtIndex:(NSInteger)index;
- (void)moveItemFromIndex:(NSInteger)from toIndex:(NSInteger)to;
Is it possible to add a delegate for player status changes (Playing, Buffering, Stopped, etc) and also another delegate for player current playing time so that we can update the UI controls.
if there is already a way available for this, can you please add that to the guide?
Thanks for your help.