public static VlcMedia CreateFromFileDescriptor(VlcInstance instance, int fd) { VlcMedia m = new VlcMedia(); m.Handle = LibVlc.libvlc_media_new_fd(instance.Handle, fd); return(m); }
public static VlcMedia CreateFromFilepath(VlcInstance instance, string file) { VlcMedia m = new VlcMedia(); m.Handle = LibVlc.libvlc_media_new_path(instance.Handle, file); return(m); }
public static VlcMedia CreateFromUrl(VlcInstance instance, string url) { VlcMedia m = new VlcMedia(); m.Handle = LibVlc.libvlc_media_new_location(instance.Handle, url); return(m); }
public VlcMediaPlayer() { instance = new VlcInstance(); Handle = LibVlc.libvlc_media_player_new(instance.Handle); IsKeyInputConsumed = false; IsMouseInputConsumed = false; RegisterEvents(); }
public void Dispose() { DeregisterEvents(); LibVlc.libvlc_media_player_release(Handle); if (instance != null) { instance.Dispose(); } }
private void VideoLengthChanged(IntPtr userdata) { Length = LibVlc.libvlc_media_player_get_length(this.Handle); LengthString = Utils.GetLongTimeAsString(Length); if (LengthChanged != null) { LengthChanged(this, new EventArgs()); } }
public void Stop() { LibVlc.libvlc_media_player_stop(Handle); Status = PlayingStatus.STOPPED; if (PlayingStatusChanged != null) { PlayingStatusChanged(this, new PlayingStatusEventArgs(Status)); } }
public void Play() { LibVlc.libvlc_media_player_play(Handle); Status = PlayingStatus.PLAYING; if (PlayingStatusChanged != null) { PlayingStatusChanged(this, new PlayingStatusEventArgs(Status)); } }
private void RegisterEvents() { EventManager = LibVlc.libvlc_media_player_event_manager(Handle); vlcLengthChangedDelegate = new LibVlc.EventCallbackDelegate(VideoLengthChanged); LibVlc.libvlc_event_attach(EventManager, LibVlc.libvlc_event_type_t.libvlc_MediaPlayerLengthChanged, vlcLengthChangedDelegate, IntPtr.Zero); vlcPositionChangedDelegate = new LibVlc.EventCallbackDelegate(VideoPositionChanged); LibVlc.libvlc_event_attach(EventManager, LibVlc.libvlc_event_type_t.libvlc_MediaPlayerPositionChanged, vlcPositionChangedDelegate, IntPtr.Zero); vlcTimeChangedDelegate = new LibVlc.EventCallbackDelegate(VideoTimeChanged); LibVlc.libvlc_event_attach(EventManager, LibVlc.libvlc_event_type_t.libvlc_MediaPlayerTimeChanged, vlcTimeChangedDelegate, IntPtr.Zero); }
public void Pause() { if (Status != PlayingStatus.PLAYING) { return; } LibVlc.libvlc_media_player_pause(Handle); Status = PlayingStatus.PAUSED; if (PlayingStatusChanged != null) { PlayingStatusChanged(this, new PlayingStatusEventArgs(Status)); } }
public void Dispose() { LibVlc.libvlc_media_release(Handle); }
public void SetVolume(double volume) { int volumePercent = (int)Math.Round(volume * 100); LibVlc.libvlc_audio_set_volume(Handle, volumePercent); }
public void SetMedia(VlcMedia media) { LibVlc.libvlc_media_player_set_media(Handle, media.Handle); }
public VlcMediaPlayer(VlcMedia media) { Handle = LibVlc.libvlc_media_player_new_from_media(media.Handle); IsKeyInputConsumed = false; IsMouseInputConsumed = false; }
public VlcInstance() { Handle = LibVlc.libvlc_new(0, null); }