Esempio n. 1
0
        /// <summary>
        /// Capture a lot of bitmaps and convert them to video.
        /// </summary>
        /// <param name="region"></param>
        /// <param name="offset"></param>
        public async void CaptureVideo(Rectangle region, Point offset)
        {
            MemoryStream stream;
            var          toast = -1;

            // Create a new toast which closing event gonna stop the recording
            toast = ToastService.Create(Resources.StopRecording, Color.OrangeRed, 0, () =>
            {
                toast = ToastService.Create(Resources.Encoding, 0);
                CaptureService.StopRecording();
            });

            // Use Mpeg if enabled
            if (ConfigService.Current.EnableMpeg)
            {
                stream = await CaptureService.RecordMpeg(region, offset);
            }
            else
            {
                stream = await CaptureService.RecordGif(region, offset);
            }

            ToastService.Remove(toast);

            // Generate filename and start the upload(s)
            var url = await UploadAll(stream, ConfigService.Current.EnableMpeg? "mp4" : "gif");

            stream.Dispose();

            CopyUrl(url);
            Complete(url != null); // Exits the application
        }
Esempio n. 2
0
        /// <summary>
        /// Capture a lot of bitmaps and convert them to video.
        /// </summary>
        /// <param name="region"></param>
        public async void CaptureVideo(Rectangle region)
        {
            MemoryStream stream;
            var          toast = -1;

            // Create a new toast which closing event gonna stop the recording
            toast = ToastService.Create(Resources.StopRecording, Color.OrangeRed, 0, () =>
            {
                toast = ToastService.Create(Resources.Encoding, 0);
                CaptureService.StopRecording();
            });

            stream = await CaptureService.RecordVideo(region, Config.VideoExt, SettingsService.Current.SafeVideoFps);

            ToastService.Remove(toast);

            // Generate filename and start the upload(s)
            var url = await UploadAll(stream, Config.VideoExt);

            stream.Dispose();

            CopyUrl(url);
            Complete(url != null); // Exits the application
        }