VLCMediaPlayer does not leave VLCMediaPlayerStateBuffering state
I recently started working with the MobileVLCKit project and it looks to be performing well, aside from one issue. It seems like once the player starts playing, it remains in the VLCMediaPlayerStateBuffering
state indefinitely, even though the video is playing fine.
Here's my code to initialize the video player:
NSURL * const videoURL = [NSURL URLWithString:@"https://avplayer-load-test.s3.us-west-2.amazonaws.com/2-video.mp4"];
VLCMediaPlayer * const player = [[VLCMediaPlayer alloc] init];
[player setDelegate:self];
[player setDrawable:[self videoView]];
_player = player;
[player setMedia:[VLCMedia mediaWithURL:videoURL]];
[player play];
Here's my delegate method callbacks:
#pragma mark - VLCMediaPlayerDelegate
-(void)mediaPlayerTimeChanged:(NSNotification *)aNotification {
VLCMediaPlayer * const player = [self player];
NSLog(@"Player time changed to: %f (%d)",[[[player time] value] integerValue] / 1000.0,[player isPlaying]);
}
-(void)mediaPlayerStateChanged:(NSNotification *)aNotification {
VLCMediaPlayer * const player = [self player];
NSLog(@"Player state changed to: %@ (%d)",VLCMediaPlayerStateToString([player state]),[player isPlaying]);
}
Here is a copy of the log messages:
2022-01-13 19:52:56.982657-0600 vlctest[23805:30492414] creating player instance using shared library
2022-01-13 19:52:57.020005-0600 vlctest[23805:30492414] Player state changed to: VLCMediaPlayerStateBuffering (0)
2022-01-13 19:52:57.388004-0600 vlctest[23805:30492414] Player state changed to: VLCMediaPlayerStateESAdded (0)
2022-01-13 19:52:57.414657-0600 vlctest[23805:30492414] Player state changed to: VLCMediaPlayerStateBuffering (1)
2022-01-13 19:52:57.546051-0600 vlctest[23805:30492414] Metal API Validation Enabled
2022-01-13 19:52:57.644338-0600 vlctest[23805:30492414] Player state changed to: VLCMediaPlayerStateBuffering (1)
2022-01-13 19:52:57.674079-0600 vlctest[23805:30492414] Player time changed to: 0.000000 (1)
2022-01-13 19:52:58.089819-0600 vlctest[23805:30492414] Player time changed to: 0.405000 (1)
2022-01-13 19:52:58.587665-0600 vlctest[23805:30492414] Player time changed to: 0.903000 (1)
2022-01-13 19:52:58.839468-0600 vlctest[23805:30492414] Player time changed to: 1.155000 (1)
2022-01-13 19:52:59.338875-0600 vlctest[23805:30492414] Player time changed to: 1.655000 (1)
2022-01-13 19:52:59.589400-0600 vlctest[23805:30492414] Player time changed to: 1.905000 (1)
2022-01-13 19:52:59.839531-0600 vlctest[23805:30492414] Player time changed to: 2.155000 (1)
2022-01-13 19:53:00.089640-0600 vlctest[23805:30492414] Player time changed to: 2.406000 (1)
2022-01-13 19:53:00.589103-0600 vlctest[23805:30492414] Player time changed to: 2.905000 (1)
2022-01-13 19:53:00.839174-0600 vlctest[23805:30492414] Player time changed to: 3.155000 (1)
2022-01-13 19:53:01.338347-0600 vlctest[23805:30492414] Player time changed to: 3.654000 (1)
I am using the Cocoapods version 3.3.18b8
, although I noticed this issue was present on 3.3.17
as well.
It seems to me like libvlc
is calling HandleMediaInstanceStateChanged
over and over with the event type libvlc_MediaPlayerBuffering
, so I am not sure whether this issue is something with this project or the behaviour of libvlc
. That being said, would like to hear if this is happening for others or if it is some sort of isolated issue with my project.