Commit 6a13e9ea authored by Benjamin Adolphi's avatar Benjamin Adolphi Committed by Felix Paul Kühne

VLCKit: Reset time, remaining time and position of VLCMediaPlayer when media is changed

When the VLCMediaPlayer switches between two media, there is a short period of time when the new media is set but when the time, remaining time and position are still set to the last time and position of the previous media. This is visible on tvOS where there is a short time when switching media where the new title is already being displayed but the old time and position is still being shown. This commit resets the time, remaining time and position of the VLCMediaPlayer when its media has changed.
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <>
parent 9bedef79
......@@ -1212,9 +1212,20 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (void)mediaPlayerMediaChanged:(VLCMedia *)newMedia
[self willChangeValueForKey:@"media"];
if (_media != newMedia)
if (_media != newMedia) {
_media = newMedia;
[self willChangeValueForKey:@"time"];
[self willChangeValueForKey:@"remainingTime"];
[self willChangeValueForKey:@"position"];
_cachedTime = [VLCTime nullTime];
_cachedRemainingTime = [VLCTime nullTime];
_position = 0.0f;
[self didChangeValueForKey:@"position"];
[self didChangeValueForKey:@"remainingTime"];
[self didChangeValueForKey:@"time"];
[self didChangeValueForKey:@"media"];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment