Retrieving buffering progress
Currently there is a VLCMediaPlayerStateBuffering
state in VLCMediaPlayer
. In my app which stream media from network, it enter this buffering state for a long time.
In libvlc, there is a event->u.media_player_buffering.new_cache
which is the progress of buffering, which would greatly help this case.
I've tried to add my own event:
static void HandleMediaBufferChanged(const libvlc_event_t * event, void * self)
{
float newBuffer = event->u.media_player_buffering.new_cache;
@autoreleasepool {
[[VLCEventManager sharedManager] callOnMainThreadObject:(__bridge id)(self)
withMethod:@selector(mediaPlayerBufferChanged:)
withArgumentAsObject:@(newBuffer)];
[[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:(__bridge id)(self)
withDelegateMethod:@selector(mediaPlayerBufferChanged:)
withNotificationName:VLCMediaPlayerBufferChanged];
}
}
But it seems all events collapsed to one event: the app only get notified when the progress is 0% or 100%, even the buffering take some time. I wonder if there is any mistake on above lines, and can we have this feature in future VLCKit?