private void PlayVideo(GameVideo gameVideo)
        {
            var vlcExecutable = VlcUtilities.GetVlcExecutablePath();
            var cmdArgs       = gameVideo.GetVlcCmdArguments();

            Process.Start(vlcExecutable, cmdArgs);
        }
Beispiel #2
0
        /// <summary>
        /// Installs the YouTube VLC addon if not already installed.
        /// </summary>
        public static void VerifyYoutubeAddon()
        {
            // Look for Launchbox's VLC distro
            var vlcEnvironment  = Environment.Is64BitOperatingSystem ? "x64" : "x86";
            var vlcAddonsFolder = VlcUtilities.GetVlcAddonsFolderPath();

            var youtubeAddonPath = "";

            // Check if the YouTube VLC addon is installed
            if (Directory.Exists(vlcAddonsFolder))
            {
                var files = Directory.GetFiles(vlcAddonsFolder, "youtube.luac", SearchOption.AllDirectories);
                // I'll assume it's the first one in the array
                if (files.Length != 0)
                {
                    youtubeAddonPath = files[0];
                }
            }
            else
            {
                Directory.CreateDirectory(vlcAddonsFolder);
            }

            // If we don't have the YouTube addon OR the file is more than a month old, then let's download it.
            // This is because YouTube transmission protocols change over time, and VLC developers are quite
            // keep up by updating their YouTube add-on file.
            if (youtubeAddonPath == "" ||
                (DateTime.Now - File.GetLastWriteTime(youtubeAddonPath)).TotalDays > 30)
            {
                using (var client = new WebClient())
                {
                    client.DownloadFile(YoutubeVlcAddonUrl, vlcAddonsFolder + "\\youtube.luac");
                }
            }

            // All done. Now VLC should be able to play YouTube videos!
        }