Skip to content

mediaplayer time keeps increasing while paused with libvlc and audio input

Summary

When playing this .ogg file with libvlc 4 latest (today's build), and pausing the mediaplayer, libvlc_media_player_get_time keeps returning a new incremented time value, as if the playback was not paused. The libvlc_MediaPlayerTimeChanged does NOT fire.

Minimal project and steps to reproduce

Excuse my C# but

using System;
using System.Diagnostics;
using System.Threading.Tasks;

namespace LibVLCSharp.NetCore.Sample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using var libVLC = new LibVLC(enableDebugLogs: true);
            using var media = new Media(new Uri(@"C:\Users\Martin\Downloads\FAIRY BOT ORCHESTRA - Heaven Can't Wait.ogg"));
            using var mp = new MediaPlayer(libVLC);

            mp.Paused += (s, e) => Debug.WriteLine("Mediaplayer paused on " + mp.Time);

            mp.Play(media);

            await Task.Delay(3000); // wait 3 seconds for playback to start

            mp.Pause();

            while (true)
            {
                await Task.Delay(500);
                Debug.WriteLine(mp.Time);
            }
        }
    }
}

output:

Mediaplayer paused on 1874
2380
2892
3406
3923
4435
4953
5466
5974
6480
6983

This should be rather straightforward to follow. Once paused, we poll for libvlc_media_player_get_time every 500ms.

Does it work on other plaforms? Does it work with the official VLC apps?

This is NOT reproducible in the VLC 4 latest app (windows), this is specific to libvlc.

This is also NOT reproducible with libvlc 3.

I managed to reproduce with both mp3 and ogg files though. I did NOT manage to reproduce with video files (tested webm, mkv, mp4).

FAIRY_BOT_ORCHESTRA_-_Heaven_Can_t_Wait (creative commons license).

Edit: This is still reproducible in the windows libvlc 4 nightly build of January 28th 2025.

Edited by Martin Finkel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information