opt: check cellular

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-26 20:08:09 +08:00
parent 45a965135e
commit e4f4a088ce
3 changed files with 18 additions and 22 deletions

View File

@@ -1013,18 +1013,18 @@ class VideoDetailController extends GetxController
// 视频链接
Future queryVideoUrl() async {
if (cacheVideoQa == null) {
await Utils.checkConnectivity().then((res) {
cacheVideoQa = res == ConnectivityResult.mobile
? setting.get(SettingBoxKey.defaultVideoQaCellular,
defaultValue: VideoQuality.high1080.code)
: setting.get(SettingBoxKey.defaultVideoQa,
defaultValue: VideoQuality.values.last.code);
await Connectivity().checkConnectivity().then((res) {
cacheVideoQa = res.contains(ConnectivityResult.wifi)
? setting.get(SettingBoxKey.defaultVideoQa,
defaultValue: VideoQuality.values.last.code)
: setting.get(SettingBoxKey.defaultVideoQaCellular,
defaultValue: VideoQuality.high1080.code);
cacheAudioQa = res == ConnectivityResult.mobile
? setting.get(SettingBoxKey.defaultAudioQaCellular,
defaultValue: AudioQuality.k192.code)
: setting.get(SettingBoxKey.defaultAudioQa,
defaultValue: AudioQuality.hiRes.code);
cacheAudioQa = res.contains(ConnectivityResult.wifi)
? setting.get(SettingBoxKey.defaultAudioQa,
defaultValue: AudioQuality.hiRes.code)
: setting.get(SettingBoxKey.defaultAudioQaCellular,
defaultValue: AudioQuality.k192.code);
});
}
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid);