Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cancel ongoing download #18

Open
kicortez opened this issue Dec 22, 2023 · 3 comments
Open

How to cancel ongoing download #18

kicortez opened this issue Dec 22, 2023 · 3 comments

Comments

@kicortez
Copy link

kicortez commented Dec 22, 2023

Can you guide me on how to cancel an ongoing download? Calling download again while another is downloading causes a crash. Thanks~

@kicortez
Copy link
Author

Adding crash info:

Screenshot 2023-12-23 at 10 46 41 PM Screenshot 2023-12-23 at 10 48 03 PM

@hileo
Copy link

hileo commented Dec 26, 2023

I have the same problem, how to cancel it manually?😭

@kicortez
Copy link
Author

Hey @hileo . Got more time to work on this, and here's what I came up with.

  1. Add package YoutubeDL-iOS locally. Had to do some changes on the package so I had to add it locally.
  2. Look for the yt_dlp function, 'public func yt_dlp(argv: ...', and make the progress parameter a throwing closure.
  3. Throw an error from the download call. 'try await yt_dlp(argv: argv) { ... '

1  throwing yt_dlp
2  throwing makeProgressHook
3  throw canceled error

I think throwing is the right approach, as the original function already throws. Though I haven't checked deeper on how it affects the process, etc. Let us know what you think. @kewlbear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants