Exemplo n.º 1
0
        protected virtual async Task StartVideoRecorder(string videoName)
        {
            // Refresh all the system information
            SystemInfo.RefreshAll();
            // Download FFMpeg
            var ffmpegPath = await VideoRecorder.DownloadFFMpeg(@"C:\temp");

            // Start the recorder
            var videoRecorderSettings = new VideoRecorderSettings
            {
                VideoFormat     = VideoFormat.xvid,
                VideoQuality    = 6,
                ffmpegPath      = ffmpegPath,
                TargetVideoPath = Path.Combine(TestsMediaPath, $"{SanitizeFileName(videoName)}.mp4")
            };

            _recorder = new VideoRecorder(videoRecorderSettings, r =>
            {
                var testName = TestContext.CurrentContext.Test.ClassName + "." + (_testMethodName ?? "[SetUp]");
                var img      = Capture.MainScreen();
                img.ApplyOverlays(new InfoOverlay(img)
                {
                    RecordTimeSpan      = r.RecordTimeSpan,
                    OverlayStringFormat = @"{rt:hh\:mm\:ss\.fff} / {name} / CPU: {cpu} / RAM: {mem.p.used}/{mem.p.tot} ({mem.p.used.perc}) / " + testName
                }, new MouseOverlay(img));
                return(img);
            });
            await Task.Delay(500);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Initializing...");

            var settings = new VideoRecorderSettings
            {
                OutputDirectory = ConfigurationManager.AppSettings["OutputDirectory"],
                VideoLength     = int.Parse(ConfigurationManager.AppSettings["VideoLength"])
            };

            using (var recorder = new WebcamRecorder(settings))
            {
                Console.WriteLine("Initialized.");
                settings.PrintToConsole();
                Console.WriteLine("Type 'exit' or 'quit' to quit.");
                Console.WriteLine();
                recorder.PrintLocationToConsole();

                string command;
                do
                {
                    command = Console.ReadLine().ToLower();
                }while (command != "exit" && command != "quit");
            }

            Console.WriteLine("Quitting.");
            Environment.Exit(0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method which allows customizing the settings for the video recorder.
        /// By default downloads ffmpeg and sets the path to ffmpeg.
        /// </summary>
        protected virtual async Task AdjustRecorderSettings(VideoRecorderSettings videoRecorderSettings)
        {
            // Download FFMpeg
            var ffmpegPath = await VideoRecorder.DownloadFFMpeg(@"C:\temp");

            videoRecorderSettings.ffmpegPath = ffmpegPath;
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Initializing...");

            var settings = new VideoRecorderSettings
            {
                OutputDirectory = ConfigurationManager.AppSettings["OutputDirectory"],
                VideoLength = int.Parse(ConfigurationManager.AppSettings["VideoLength"])
            };

            using (var recorder = new WebcamRecorder(settings))
            {
                Console.WriteLine("Initialized.");
                settings.PrintToConsole();
                Console.WriteLine("Type 'exit' or 'quit' to quit.");
                Console.WriteLine();
                recorder.PrintLocationToConsole();

                string command;
                do
                {
                    command = Console.ReadLine().ToLower();
                }
                while (command != "exit" && command != "quit");
            }

            Console.WriteLine("Quitting.");
            Environment.Exit(0);
        }