diff --git a/assets/images/video/danmu_close.svg b/assets/images/video/danmu_close.svg
new file mode 100644
index 000000000..9f48027b0
--- /dev/null
+++ b/assets/images/video/danmu_close.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/video/danmu_open.svg b/assets/images/video/danmu_open.svg
new file mode 100644
index 000000000..24e8d7a99
--- /dev/null
+++ b/assets/images/video/danmu_open.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/http/api.dart b/lib/http/api.dart
index 8aa62233b..445f61028 100644
--- a/lib/http/api.dart
+++ b/lib/http/api.dart
@@ -484,6 +484,9 @@ class Api {
/// 激活buvid3
static const activateBuvidApi = '/x/internal/gaia-gateway/ExClimbWuzhi';
+ /// 获取字幕配置
+ static const getSubtitleConfig = '/x/player/v2';
+
/// 我的订阅
static const userSubFolder = '/x/v3/fav/folder/collected/list';
diff --git a/lib/http/interceptor.dart b/lib/http/interceptor.dart
index 362ff17ad..a53592830 100644
--- a/lib/http/interceptor.dart
+++ b/lib/http/interceptor.dart
@@ -45,10 +45,13 @@ class ApiInterceptor extends Interceptor {
void onError(DioException err, ErrorInterceptorHandler handler) async {
// 处理网络请求错误
// handler.next(err);
- SmartDialog.showToast(
- await dioError(err),
- displayType: SmartToastType.onlyRefresh,
- );
+ String url = err.requestOptions.uri.toString();
+ if (!url.contains('heartBeat')) {
+ SmartDialog.showToast(
+ await dioError(err),
+ displayType: SmartToastType.onlyRefresh,
+ );
+ }
super.onError(err, handler);
}
@@ -75,23 +78,24 @@ class ApiInterceptor extends Interceptor {
}
static Future checkConnect() async {
- final ConnectivityResult connectivityResult =
+ final List connectivityResult =
await Connectivity().checkConnectivity();
- switch (connectivityResult) {
- case ConnectivityResult.mobile:
- return '正在使用移动流量';
- case ConnectivityResult.wifi:
- return '正在使用wifi';
- case ConnectivityResult.ethernet:
- return '正在使用局域网';
- case ConnectivityResult.vpn:
- return '正在使用代理网络';
- case ConnectivityResult.other:
- return '正在使用其他网络';
- case ConnectivityResult.none:
- return '未连接到任何网络';
- default:
- return '';
+ if (connectivityResult.contains(ConnectivityResult.mobile)) {
+ return '正在使用移动流量';
+ } else if (connectivityResult.contains(ConnectivityResult.wifi)) {
+ return '正在使用wifi';
+ } else if (connectivityResult.contains(ConnectivityResult.ethernet)) {
+ return '正在使用局域网';
+ } else if (connectivityResult.contains(ConnectivityResult.vpn)) {
+ return '正在使用代理网络';
+ } else if (connectivityResult.contains(ConnectivityResult.bluetooth)) {
+ return '正在使用蓝牙网络';
+ } else if (connectivityResult.contains(ConnectivityResult.other)) {
+ return '正在使用其他网络';
+ } else if (connectivityResult.contains(ConnectivityResult.none)) {
+ return '未连接到任何网络';
+ } else {
+ return '';
}
}
}
diff --git a/lib/http/video.dart b/lib/http/video.dart
index 73e8b6988..d43656b28 100644
--- a/lib/http/video.dart
+++ b/lib/http/video.dart
@@ -8,9 +8,11 @@ import '../models/model_rec_video_item.dart';
import '../models/user/fav_folder.dart';
import '../models/video/ai.dart';
import '../models/video/play/url.dart';
+import '../models/video/subTitile/result.dart';
import '../models/video_detail_res.dart';
import '../utils/recommend_filter.dart';
import '../utils/storage.dart';
+import '../utils/subtitle.dart';
import '../utils/wbi_sign.dart';
import 'api.dart';
import 'init.dart';
@@ -476,6 +478,25 @@ class VideoHttp {
}
}
+ static Future getSubtitle({int? cid, String? bvid}) async {
+ var res = await Request().get(Api.getSubtitleConfig, data: {
+ 'cid': cid,
+ 'bvid': bvid,
+ });
+ try {
+ if (res.data['code'] == 0) {
+ return {
+ 'status': true,
+ 'data': SubTitlteModel.fromJson(res.data['data']),
+ };
+ } else {
+ return {'status': false, 'data': [], 'msg': res.data['msg']};
+ }
+ } catch (err) {
+ print(err);
+ }
+ }
+
// 视频排行
static Future getRankVideoList(int rid) async {
try {
@@ -498,4 +519,12 @@ class VideoHttp {
return {'status': false, 'data': [], 'msg': err};
}
}
+
+ // 获取字幕内容
+ static Future