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); }
private static void Initialize() { if (IsInitialized) { return; } Vlcs = new List <Vlc>(); LibVlcManager.LoadLibVlc(LibVlcPath); IsInitialized = true; }
public void Dispose() { if (_pointer == IntPtr.Zero) { return; } LibVlcManager.ReleaseTrackDescriptionList(_pointer); _pointer = IntPtr.Zero; _list.Clear(); }