public static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Set libvlc.dll and libvlccore.dll directory path VlcContext.LibVlcDllsPath = @"C:\Projets\vlc-1.1.11"; // CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64; // Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = @"C:\Projets\vlc-1.1.11\pugins"; //CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64; // Ignore the VLC configuration file VlcContext.StartupOptions.IgnoreConfig = true; // Enable file based logging VlcContext.StartupOptions.LogOptions.LogInFile = true; // Shows the VLC log console (in addition to the applications window) VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true; // Set the log level for the VLC instance VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug; // Initialize the VlcContext VlcContext.Initialize(); Application.Run(new VlcPlayer()); // Close the VlcContext VlcContext.CloseAll(); }
private void InitVlcContext() { VlcContext.CloseAll(); //Set libvlc.dll and libvlccore.dll directory path VlcContext.LibVlcDllsPath = LibVlcDllsPath; //Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = LibVlcPluginsPath; //Set the startup options (http://wiki.videolan.org/VLC_command-line_help) if (Options != null) { var optionList = Options.Split(' '); foreach (var option in optionList) { VlcContext.StartupOptions.AddOption(option); } } //Set debug options VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = DebugMode; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = DebugMode; VlcContext.StartupOptions.LogOptions.Verbosity = DebugMode ? VlcLogVerbosities.Debug : VlcLogVerbosities.None; VlcContext.Initialize(); }
public static void Shutdown() { if (IsInitialized) { VlcContext.CloseAll(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Set libvlc.dll and libvlccore.dll directory path //VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86; //Set the vlc plugins directory path //VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_X86; VlcContext.LibVlcDllsPath = @"VLCPortable\App\vlc\"; VlcContext.LibVlcPluginsPath = @"VLCPortable\App\vlc\plugins\"; //Set the startup options VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = true; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true; VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug; //Initialize the VlcContext VlcContext.Initialize(); Application.Run(new Form1()); //Close the VlcContext VlcContext.CloseAll(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool isAMD64 = System.IO.Directory.Exists(CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64); bool isX86 = System.IO.Directory.Exists(CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86); if (isAMD64 || isX86) { try { if (isAMD64) { //Set libvlc.dll and libvlccore.dll directory path VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64; //Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64; } else { //Set libvlc.dll and libvlccore.dll directory path VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86; //Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_X86; } //Set the startup options VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = true; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true; VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None; //Initialize the VlcContext VlcContext.Initialize(); } catch (Exception ex) { MessageBox.Show("Failed loading the optional VLC library. Channel previewing may not work correctly. Do you have the latest version of VLC installed? " + ex.Message); } } else { MessageBox.Show("VLC DLL files not found in either of the standard locations: " + CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64 + " or " + CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86); } Application.Run(new Main()); if (isAMD64 || isX86) { try { //Close the VlcContexttry VlcContext.CloseAll(); } catch (Exception) { } } }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool dispose) { if (dispose) { DisposePlayer(); VlcContext.CloseAll(); } }
public override void Unload() { Reset(); if (_player != null) { _player.Stop(); } _player = null; _media = null; VlcContext.CloseAll(); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); InitVLC(); Application.Run(new MainForm()); VlcContext.CloseAll(); }
public void initVLC() { if (Environment.Is64BitOperatingSystem) { VlcContext.LibVlcDllsPath = @"VLC\x86"; // Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = @"VLC\x86\plugins"; } else { // Set libvlc.dll and libvlccore.dll directory path VlcContext.LibVlcDllsPath = @"VLC\x86"; // Set the vlc plugins directory path VlcContext.LibVlcPluginsPath = @"VLC\x86\plugins"; } // Ignore the VLC configuration file VlcContext.StartupOptions.IgnoreConfig = true; // Enable file based logging VlcContext.StartupOptions.LogOptions.LogInFile = true; // Shows the VLC log console (in addition to the applications window) VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false; // Set the log level for the VLC instance //VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Warnings; VlcContext.StartupOptions.AddOption("--ffmpeg-hw"); // Disable showing the movie file name as an overlay VlcContext.StartupOptions.AddOption("--no-video-title-show"); VlcContext.StartupOptions.AddOption("--rtsp-tcp"); VlcContext.StartupOptions.AddOption("--rtsp-mcast"); // VlcContext.StartupOptions.AddOption("--rtsp-host=192.168.10.35"); // VlcContext.StartupOptions.AddOption("--sap-addr=192.168.10.35"); VlcContext.StartupOptions.AddOption("--rtsp-port=8554"); VlcContext.StartupOptions.AddOption("--rtp-client-port=8554"); VlcContext.StartupOptions.AddOption("--sout-rtp-rtcp-mux"); VlcContext.StartupOptions.AddOption("--rtsp-wmserver"); VlcContext.StartupOptions.AddOption("--file-caching=18000"); VlcContext.StartupOptions.AddOption("--sout-rtp-caching=18000"); VlcContext.StartupOptions.AddOption("--sout-rtp-port=8554"); VlcContext.StartupOptions.AddOption("--sout-rtp-proto=tcp"); VlcContext.StartupOptions.AddOption("--network-caching=1000"); // Pauses the playback of a movie on the last frame VlcContext.StartupOptions.AddOption("--play-and-pause"); VlcContext.CloseAll(); // Initialize the VlcContext VlcContext.Initialize(); }
private void exitMediaPlayer() { if (myVlcControl.IsPlaying) { myVlcControl.Stop(); } if (VlcContext.IsInitialized) { VlcContext.CloseAll(); } _allowKeyPressMonitoring = false; PageNavigation.Instance.NavigateBack(_callingPage); }
private void UIRootView_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (this.clock != null) { this.clock.Controller.Stop(); } this.mainClock.Controller.Stop(); this.ClockMouse.Controller.Stop(); if (myVlcControl.IsPlaying) { myVlcControl.Stop(); } // Config.Write(App.FileName, App.setting); this.Tcp_Server = null; VlcContext.CloseAll(); }
private static void TakeDownVlcContext() { VlcContext.CloseAll(); }
/// <summary> /// Main window closing event /// </summary> /// <param name="sender">Event sender. </param> /// <param name="e">Event arguments. </param> private void MainWindowOnClosing(object sender, CancelEventArgs e) { // Close the context. VlcContext.CloseAll(); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public override void Dispose() { this.player.Dispose(); VlcContext.CloseAll(); }
public void ShutDown() { VlcContext.CloseAll(); }
protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); try { if (e.Args.Length == 0) { Shutdown(); return; } //MessageBox.Show("edw"); var source = new TaskCompletionSource <object>(); var handleSource = new TaskCompletionSource <object>(); bool exited = false; client = new TcpProcessInteropClient(int.Parse(e.Args[0])); client.Register("initialize", payload => { //MessageBox.Show("init"); if (exited) { return(null); } source = new TaskCompletionSource <object>(); var path = payload[0].ToString(); _arguments = payload[1].ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); bool init = false; if (!File.Exists(Path.Combine(path, "libvlc.dll"))) { Current.Shutdown(); return(null); } var pluginsPath = Path.Combine(path, "plugins"); VlcContext.LibVlcDllsPath = path; VlcContext.LibVlcPluginsPath = pluginsPath; VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.LogOptions.LogInFile = false; VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false; VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None; VlcContext.StartupOptions.AddOption("--input-timeshift-granularity=0"); VlcContext.StartupOptions.AddOption("--auto-preparse"); VlcContext.StartupOptions.AddOption("--album-art=0"); //VlcContext.StartupOptions.AddOption("--overlay=1"); //VlcContext.StartupOptions.AddOption("--deinterlace=-1"); //VlcContext.StartupOptions.AddOption("--network-caching=1500"); foreach (var arg in _arguments) { try { //MessageBox.Show(arg); VlcContext.StartupOptions.AddOption(arg.ToString()); } catch { } } try { VlcContext.Initialize(); init = true; } catch (Exception) { //MessageBox.Show(ex.Message); Application.Current.Shutdown(); } source.SetResult(null); return(init ? new object[] { } : null); }); client.Register("shutdown", async args => { exited = true; if (source != null) { await source.Task; } await Dispatcher.BeginInvoke(new Action(() => { if (_vlc != null) { _vlc.Stop(); _vlc.Dispose(); } if (VlcContext.IsInitialized) { VlcContext.CloseAll(); } Shutdown(); })); return(new object[] { }); }); client.Register("handle", async args => { if (exited) { return(null); } await Dispatcher.BeginInvoke(new Action(() => { if (_vlc != null) { _vlc.Dispose(); } _vlc = new VlcControlHeadless((IntPtr)long.Parse(args[0].ToString())); SetupPlayer(); })); return(new object[] { }); }); client.Subscribe("play", args => { if (!string.IsNullOrEmpty(args[0].ToString())) { _duration = TimeSpan.FromSeconds(0); var split = args[0].ToString().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); //var split2 = _arguments.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); _currentMedia = new LocationMedia(split[0]); SetHandlersForMedia(_currentMedia); _vlc.Media = _currentMedia; if (split.Length > 1) { foreach (var extra in split.Skip(1)) { //MessageBox.Show(extra); _currentMedia.AddOption(extra); } } } else { _vlc.Play(); } }); client.Subscribe("position", args => { _vlc.Position = float.Parse(args[0].ToString()); }); client.Subscribe("pause", args => { _vlc.Pause(); }); client.Subscribe("next", args => { try { if (_currentMedia as LocationMedia == null) { return; } var subitems = (_currentMedia as LocationMedia).SubItems; var cmedia = _vlc.Media as LocationMedia; if (cmedia == null) { return; } var index = subitems.IndexOf(subitems.First(m => m.MRL == cmedia.MRL)); if (subitems.Count > 0 && index < subitems.Count - 1) { _vlc.Next(); } } catch { } }); client.Subscribe("previous", args => { try { if (_currentMedia as LocationMedia == null) { return; } var subitems = (_currentMedia as LocationMedia).SubItems; var cmedia = _vlc.Media as LocationMedia; if (cmedia == null) { return; } var index = subitems.IndexOf(subitems.First(m => m.MRL == cmedia.MRL)); if (subitems.Count > 0 && index > 0) { _vlc.Previous(); } } catch { } }); client.Subscribe("next-subtitle", args => { if (_vlc.VideoProperties.SpuDescription.Next != null && _vlc.VideoProperties.SpuDescription.Next.Id != _vlc.VideoProperties.CurrentSpuIndex) { _vlc.VideoProperties.CurrentSpuIndex = _vlc.VideoProperties.SpuDescription.Next.Id; } else { _vlc.VideoProperties.CurrentSpuIndex = -1; } _vlc.VideoProperties.SetSubtitleFile(null); }); client.Subscribe("set-subtitles", args => { var title = args[0].ToString(); if (title == "-1" && _subtitles?.Any(kv => kv.Key.ToString() == title) == true) { _vlc.VideoProperties.CurrentSpuIndex = -1; _vlc.VideoProperties.SetSubtitleFile(null); } else if (_subtitles.Count > 1) { _vlc.VideoProperties.CurrentSpuIndex = _subtitles.Keys.Skip(1).First(); _vlc.VideoProperties.SetSubtitleFile(null); } }); if (await client.ConnectAsync(5000)) { client.Start(); } else { Shutdown(); } } catch (Exception ex) { //MessageBox.Show(ex.Message); } }