Exemplo n.º 1
0
        public static VlcMedia CreateFromFileDescriptor(VlcInstance instance, int fd)
        {
            VlcMedia m = new VlcMedia();

            m.Handle = LibVlc.libvlc_media_new_fd(instance.Handle, fd);
            return(m);
        }
Exemplo n.º 2
0
        public static VlcMedia CreateFromFilepath(VlcInstance instance, string file)
        {
            VlcMedia m = new VlcMedia();

            m.Handle = LibVlc.libvlc_media_new_path(instance.Handle, file);
            return(m);
        }
Exemplo n.º 3
0
        public static VlcMedia CreateFromUrl(VlcInstance instance, string url)
        {
            VlcMedia m = new VlcMedia();

            m.Handle = LibVlc.libvlc_media_new_location(instance.Handle, url);
            return(m);
        }
Exemplo n.º 4
0
 public VlcMediaPlayer()
 {
     instance             = new VlcInstance();
     Handle               = LibVlc.libvlc_media_player_new(instance.Handle);
     IsKeyInputConsumed   = false;
     IsMouseInputConsumed = false;
     RegisterEvents();
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     DeregisterEvents();
     LibVlc.libvlc_media_player_release(Handle);
     if (instance != null)
     {
         instance.Dispose();
     }
 }
Exemplo n.º 6
0
        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());
            }
        }
Exemplo n.º 7
0
        public void Stop()
        {
            LibVlc.libvlc_media_player_stop(Handle);

            Status = PlayingStatus.STOPPED;

            if (PlayingStatusChanged != null)
            {
                PlayingStatusChanged(this, new PlayingStatusEventArgs(Status));
            }
        }
Exemplo n.º 8
0
        public void Play()
        {
            LibVlc.libvlc_media_player_play(Handle);

            Status = PlayingStatus.PLAYING;

            if (PlayingStatusChanged != null)
            {
                PlayingStatusChanged(this, new PlayingStatusEventArgs(Status));
            }
        }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
        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));
            }
        }
Exemplo n.º 11
0
 public void Dispose()
 {
     LibVlc.libvlc_media_release(Handle);
 }
Exemplo n.º 12
0
        public void SetVolume(double volume)
        {
            int volumePercent = (int)Math.Round(volume * 100);

            LibVlc.libvlc_audio_set_volume(Handle, volumePercent);
        }
Exemplo n.º 13
0
 public void SetMedia(VlcMedia media)
 {
     LibVlc.libvlc_media_player_set_media(Handle, media.Handle);
 }
Exemplo n.º 14
0
 public VlcMediaPlayer(VlcMedia media)
 {
     Handle               = LibVlc.libvlc_media_player_new_from_media(media.Handle);
     IsKeyInputConsumed   = false;
     IsMouseInputConsumed = false;
 }
Exemplo n.º 15
0
 public VlcInstance()
 {
     Handle = LibVlc.libvlc_new(0, null);
 }