Yaron
Yaron

Reputation: 173

libvideo get youtube video readable stream

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?

Upvotes: 1

Views: 1620

Answers (1)

Yaron
Yaron

Reputation: 173

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))
{
    ...
}

Upvotes: 1

Related Questions