public static void ReleaseAll() { if (Vlc != null) { Vlc.Dispose(); } }
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); }
public static void ReleaseAll() { Vlc?.Dispose(); }