public void Stop() { LibVlc.libvlc_media_player_stop(MediaPlayerHandle); playing = false; paused = false; }
public VlcException() : base() { IntPtr errorPointer = LibVlc.libvlc_errmsg(); _err = errorPointer == IntPtr.Zero ? "VLC Exception" : Marshal.PtrToStringAuto(errorPointer); }
public VlcMediaPlayer(VlcMedia media) { MediaPlayerHandle = LibVlc.libvlc_media_player_new_from_media(media.MediaHandle); if (MediaPlayerHandle == IntPtr.Zero) { throw new VlcException(); } }
public void Pause() { LibVlc.libvlc_media_player_pause(MediaPlayerHandle); if (playing) { paused ^= true; } }
public void Play() { int ret = LibVlc.libvlc_media_player_play(MediaPlayerHandle); if (ret == -1) { throw new VlcException(); } playing = true; paused = false; }
public VlcMedia(VlcInstance instance, string url) { if (File.Exists(url)) { MediaHandle = LibVlc.libvlc_media_new_path(instance.InstanceHandle, url); } else { MediaHandle = LibVlc.libvlc_media_new_location(instance.InstanceHandle, url); } if (MediaHandle == IntPtr.Zero) { throw new VlcException(); } }
public VlcInstance(string pathToVlc) { if (string.IsNullOrEmpty(pathToVlc)) { pathToVlc = @"c:\Program Files\VideoLAN\VLC\"; } string aCurrentDirectory = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(pathToVlc); try { InstanceHandle = LibVlc.libvlc_new(0, null); if (InstanceHandle == IntPtr.Zero) { throw new VlcException(); } } finally { Directory.SetCurrentDirectory(aCurrentDirectory); } }
public void Dispose() { LibVlc.libvlc_media_player_release(MediaPlayerHandle); }
public void AddOption(string option) { LibVlc.libvlc_media_add_option(MediaHandle, Encoding.UTF8.GetBytes(option)); }
public void Dispose() { LibVlc.libvlc_media_release(MediaHandle); }
public void Dispose() { LibVlc.libvlc_release(InstanceHandle); }