public void Stop() { if (playing) { LibVlc.libvlc_media_player_stop(player); LibVlc.libvlc_media_player_release(player); playing = false; player = IntPtr.Zero; } else { throw new InvalidOperationException("VLC is not currently playing media"); } }