getDownloadProgress method

  1. @override
Future<double> getDownloadProgress(
  1. String url
)
override

Gets the download progress for a video. Returns a double between 0.0 and 1.0.

Implementation

@override
Future<double> getDownloadProgress(String url) async {
  try {
    final result = await methodChannel.invokeMethod<double>(
      'getDownloadProgress',
      {'url': url},
    );

    final progress = result ?? 0.0;
    // Also update the stream with this value to ensure consistency
    if (_progressStreamControllers.containsKey(url)) {
      _updateProgressStream(url, progress);
    }

    return progress;
  } catch (e) {
    debugPrint('Error getting download progress: $e');
    return 0.0;
  }
}