Ejemplo n.º 1
0
 public static void ReleaseAll()
 {
     if (Vlc != null)
     {
         Vlc.Dispose();
     }
 }
Ejemplo n.º 2
0
        public async Task <VideoAudioInfo> Execute(Stream thumbnailStream)
        {
            ThumbnailStream = thumbnailStream;
            LibVlcManager.LoadLibVlc(AppDomain.CurrentDomain.BaseDirectory + @"..\..\libvlc");
            Vlc vlc = new Vlc(new[] { "-I", "dummy", "--ignore-config", "--no-video-title" });

            Console.WriteLine($"LibVlcManager: {LibVlcManager.GetVersion()}s");
            mediaPlayer = vlc.CreateMediaPlayer();
            mediaPlayer.SetVideoDecodeCallback(LockCB, unLockCB, DisplayCB, IntPtr.Zero);
            mediaPlayer.SetVideoFormatCallback(VideoFormatCallback, VideoCleanupCallback);
            mediaPlayer.Playing += MediaPlayer_Playing;
            mediaPlayer.Media    = vlc.CreateMediaFromLocation(FilePath);

            await Task.Run(() =>
            {
                mediaPlayer.Play();
                mediaPlayer.IsMute = true;
                Stopwatch s        = new Stopwatch();
                s.Start();
                while (waiting)
                {
                    Thread.Sleep(100);
                }
                s.Stop();
                TimeSpan sec = new TimeSpan(s.ElapsedTicks);
                Console.WriteLine(sec.ToString());
                mediaPlayer.Dispose();
                vlc.Dispose();
            });

            _VideoAudioInfo.Resolution = JsonConvert.SerializeObject(_VideoResolution);
            //_VideoAudioInfo.Thumbnail = ThumbnailStream;
            return(_VideoAudioInfo);
        }
Ejemplo n.º 3
0
 public static void ReleaseAll()
 {
     Vlc?.Dispose();
 }