1

I was wondering if there is a way to get the progress of a download for a youtube video using the libvideo for .net

I'm downloading using the following code:

var youtube = YouTube.Default;
var video = youtube.GetVideo(link);
string fileExt = video.Format.ToString();
if (!fileExt.StartsWith("."))
    fileExt = "." + fileExt;

if (!output.EndsWith(fileExt))
    output += fileExt;

File.WriteAllBytes(output, video.GetBytes());

Edit: To be more specific, is there a way to get a readable stream to a youtube video using libvideo?

Yaron
  • 173
  • 2
  • 12
  • This might be helpful : http://stackoverflow.com/questions/15467135/how-to-learn-writeallbytes-progress – Sybren Aug 01 '16 at 20:15

1 Answers1

1

the

video.Stream();

returns an unreaedable stream. to get a readable stream use a VideoClient.

VideoClient videoClient = new VideoClient();
using (var Stream = videoClient.Stream(video))
{
    ...
}
Yaron
  • 173
  • 2
  • 12