omansak / libvideo

A lightweight .NET library to download YouTube videos.
BSD 2-Clause "Simplified" License
538 stars 163 forks source link

How do you show download progress? #238

Closed maaa3 closed 2 years ago

maaa3 commented 2 years ago

Im making a Windows Forms youtube downloader application with libvideo, and i was wondering how i show download progress (e.g. 50% downloaded)? Sorry if this isn't the right place to ask

marnagy commented 2 years ago

Hello @Ma0us ,

I personally download from stream using buffer and in while loop fill the buffer. In the loop, I keep track of amount of bytes read in total. Total amount of bytes to be downloaded is stored in stream.ContentLength.

I use this in CLI with progress bar, so you will need to modify the code, but I hope it will be a good starting place. Link to my project: method you need is on line 369.

Hope this helps.

omansak commented 2 years ago

https://github.com/omansak/libvideo/blob/master/docs/README.md

on the bottom