示例#1
0
        public void Stop()
        {
            LibVlc.libvlc_media_player_stop(MediaPlayerHandle);

            playing = false;
            paused  = false;
        }
示例#2
0
        public VlcException()
            : base()
        {
            IntPtr errorPointer = LibVlc.libvlc_errmsg();

            _err = errorPointer == IntPtr.Zero ? "VLC Exception"
                : Marshal.PtrToStringAuto(errorPointer);
        }
示例#3
0
 public VlcMediaPlayer(VlcMedia media)
 {
     MediaPlayerHandle = LibVlc.libvlc_media_player_new_from_media(media.MediaHandle);
     if (MediaPlayerHandle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
示例#4
0
        public void Pause()
        {
            LibVlc.libvlc_media_player_pause(MediaPlayerHandle);

            if (playing)
            {
                paused ^= true;
            }
        }
示例#5
0
        public void Play()
        {
            int ret = LibVlc.libvlc_media_player_play(MediaPlayerHandle);

            if (ret == -1)
            {
                throw new VlcException();
            }

            playing = true;
            paused  = false;
        }
示例#6
0
 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();
     }
 }
示例#7
0
        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);
            }
        }
示例#8
0
 public void Dispose()
 {
     LibVlc.libvlc_media_player_release(MediaPlayerHandle);
 }
示例#9
0
 public void AddOption(string option)
 {
     LibVlc.libvlc_media_add_option(MediaHandle, Encoding.UTF8.GetBytes(option));
 }
示例#10
0
 public void Dispose()
 {
     LibVlc.libvlc_media_release(MediaHandle);
 }
示例#11
0
 public void Dispose()
 {
     LibVlc.libvlc_release(InstanceHandle);
 }