System.Net.Http.HttpContent.CopyToAsync C# (CSharp) Method

CopyToAsync() public method

public CopyToAsync ( Stream stream ) : System.Threading.Tasks.Task
stream System.IO.Stream
return System.Threading.Tasks.Task
		public Task CopyToAsync (Stream stream)
		{
			return CopyToAsync (stream, null);
		}

Same methods

HttpContent::CopyToAsync ( Stream stream, TransportContext context ) : System.Threading.Tasks.Task

Usage Example

        private Task ConvertStream(HttpContent httpContent, Stream outputStream)
        {
            Task convertTask = new Task(() => {

                var convertSettings = new ConvertSettings {
                    CustomOutputArgs = "-map 0",
                    CustomInputArgs = "-vcodec h264"
                };

                var ffMpeg = new FFMpegConverter();
                ffMpeg.ConvertProgress += FfMpeg_ConvertProgress;
                ffMpeg.LogReceived += FfMpeg_LogReceived;

                //var task = ffMpeg.ConvertLiveMedia(Format.h264, "C:\\Work\\Test\\converted.avi", Format.avi, convertSettings);
                var task = ffMpeg.ConvertLiveMedia(Format.h264, outputStream, Format.mpeg, convertSettings);

                task.Start();

                var ffmpegStream = new FFMPegStream(task);
                var copyTask = httpContent.CopyToAsync(ffmpegStream);
                copyTask.Wait();
                ffmpegStream.Close();

                task.Wait();

                //                ffMpeg.ConvertMedia(@"C:\Work\Test\MyHomeSecureNode\devices\test\video.h264", "C:\\Work\\Test\\converted.avi", Format.avi);

                outputStream.Close();
            });

            convertTask.Start();
            return convertTask;
        }
All Usage Examples Of System.Net.Http.HttpContent::CopyToAsync