feat: cdn speed test

Closes #105

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-07 10:08:39 +08:00
parent d9474a79c1
commit f5b50ffcb0
4 changed files with 111 additions and 18 deletions

View File

@@ -287,6 +287,9 @@ class GStorage {
static bool get continuePlayingPart =>
setting.get(SettingBoxKey.continuePlayingPart, defaultValue: true);
static bool get cdnSpeedTest =>
setting.get(SettingBoxKey.cdnSpeedTest, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -495,6 +498,7 @@ class SettingBoxKey {
subtitleBgOpaticy = 'subtitleBgOpaticy',
badCertificateCallback = 'badCertificateCallback',
continuePlayingPart = 'continuePlayingPart',
cdnSpeedTest = 'cdnSpeedTest',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',

View File

@@ -12,10 +12,10 @@ class VideoUtils {
RegExp(r'^https?://\d{1,3}\.\d{1,3}').hasMatch(url);
}
static String getCdnUrl(dynamic item) {
static String getCdnUrl(dynamic item, [defaultCDNService]) {
String? backupUrl;
String? videoUrl;
String defaultCDNService = GStorage.setting
defaultCDNService ??= GStorage.setting
.get(SettingBoxKey.CDNService, defaultValue: CDNService.backupUrl.code);
if (item is AudioItem) {
if (GStorage.setting