Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix: remove video source cancelled exception

Predidite2bb61ed9fb6
diff --git a/lib/pages/download/download_controller.dart b/lib/pages/download/download_controller.dart
index 465f37a5..e0cfac3d 100644
--- a/lib/pages/download/download_controller.dart
+++ b/lib/pages/download/download_controller.dart
@@ -361,8 +361,6 @@ abstract class _DownloadController with Store {
m3u8Url = source.url;
} on VideoSourceTimeoutException {
KazumiLogger().w('DownloadController: WebView resolution timed out');
- } on VideoSourceCancelledException {
- KazumiLogger().i('DownloadController: WebView resolution cancelled');
} catch (e) {
KazumiLogger()
.e('DownloadController: WebView resolution failed', error: e);
diff --git a/lib/pages/video/video_controller.dart b/lib/pages/video/video_controller.dart
index 8efaca49..99966d16 100644
--- a/lib/pages/video/video_controller.dart
+++ b/lib/pages/video/video_controller.dart
@@ -296,9 +296,6 @@ abstract class _VideoPageController with Store {
} on VideoSourceTimeoutException {
loading = false;
errorMessage = '视频解析超时,请重试';
- } on VideoSourceCancelledException {
- KazumiLogger().i('VideoPageController: video URL resolution cancelled');
- // 不设置 loading = false,因为可能是切换到新的集数
} catch (e) {
loading = false;
errorMessage = '视频解析失败:${e.toString()}';
diff --git a/lib/providers/video_source_provider.dart b/lib/providers/video_source_provider.dart
index aea3c4a3..df613fca 100644
--- a/lib/providers/video_source_provider.dart
+++ b/lib/providers/video_source_provider.dart
@@ -47,14 +47,6 @@ class VideoSourceTimeoutException implements Exception {
String toString() => 'VideoSourceTimeoutException: Timed out after ${timeout.inSeconds}s';
}
-/// 视频源解析取消异常
-class VideoSourceCancelledException implements Exception {
- const VideoSourceCancelledException();
-
- @override
- String toString() => 'VideoSourceCancelledException: Resolution was cancelled';
-}
-
/// 视频源提供者接口
///
/// 抽象视频源的获取方式,支持多种实现:
@@ -74,7 +66,6 @@ abstract class IVideoSourceProvider {
/// 可能抛出:
/// - [VideoSourceNotFoundException] 未找到视频源
/// - [VideoSourceTimeoutException] 解析超时
- /// - [VideoSourceCancelledException] 解析被取消
Future<VideoSource> resolve(
String episodeUrl, {
required bool useLegacyParser,
@@ -83,8 +74,6 @@ abstract class IVideoSourceProvider {
});
/// 取消当前正在进行的解析
- ///
- /// 调用后,正在进行的 [resolve] 会抛出 [VideoSourceCancelledException]
void cancel();
/// 释放资源
diff --git a/lib/providers/webview_video_source_provider.dart b/lib/providers/webview_video_source_provider.dart
index 059aa8a5..51256802 100644
--- a/lib/providers/webview_video_source_provider.dart
+++ b/lib/providers/webview_video_source_provider.dart
@@ -32,9 +32,6 @@ class WebViewVideoSourceProvider implements IVideoSourceProvider {
}) async {
resolveId++;
final currentResolveId = resolveId;
- if (_completer != null && !_completer!.isCompleted) {
- _completer!.completeError(const VideoSourceCancelledException());
- }
await _subscription?.cancel();
_subscription = null;
@@ -80,11 +77,6 @@ class WebViewVideoSourceProvider implements IVideoSourceProvider {
);
return result;
- } catch (e) {
- if (currentResolveId != resolveId) {
- throw const VideoSourceCancelledException();
- }
- rethrow;
} finally {
if (currentResolveId == resolveId) {
await _subscription?.cancel();
@@ -97,9 +89,6 @@ class WebViewVideoSourceProvider implements IVideoSourceProvider {
@override
void cancel() {
- if (_completer != null && !_completer!.isCompleted) {
- _completer!.completeError(const VideoSourceCancelledException());
- }
_subscription?.cancel();
_subscription = null;
}