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

            Status = PlayingStatus.STOPPED;

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

            Status = PlayingStatus.PLAYING;

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

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