Hexer10 / youtube_explode_dart

Dart library to interact with many Youtube APIs
https://pub.dev/packages/youtube_explode_dart
BSD 3-Clause "New" or "Revised" License
299 stars 122 forks source link

How to stop or cancel ongoing downloads #244

Closed harrowmykel closed 1 year ago

harrowmykel commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

How can we stop an ongoing stream?

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

How should this be implemented Write here (if you have considered) a way to implement this feature in the current codebase. Additional context Add any other context or screenshots about the feature request here.

Hexer10 commented 1 year ago

You need to subscribe to the stream and then cancel the subscription, for example:

final sub = yt.videos.streams.get(stream).listen((data) {
    // Process the data
  });

// Somewhere else
sub.cancel(); // <-- Stop the download