diff --git a/lib/pages/home/home_controller.dart b/lib/pages/home/home_controller.dart index f22854a..1428131 100644 --- a/lib/pages/home/home_controller.dart +++ b/lib/pages/home/home_controller.dart @@ -197,9 +197,9 @@ class HomeController extends GetxController with WindowListener { return; } tip = '正在打开 ${item.name ?? ''}'; - update(); - playerConfig(); + playerConfig(); + update(); player.media = url; player.state = PlaybackState.playing; player.updateTexture(); @@ -241,7 +241,6 @@ class HomeController extends GetxController with WindowListener { switch (e.category) { case 'reader.buffering': tip = value < 100 ? '缓冲 $value%' : ''; - break; case 'render.video': if (value > 0) { diff --git a/lib/utils/playlist/playlist_check_req.dart b/lib/utils/playlist/playlist_check_req.dart index 41a3dc5..8349eb2 100644 --- a/lib/utils/playlist/playlist_check_req.dart +++ b/lib/utils/playlist/playlist_check_req.dart @@ -84,6 +84,10 @@ class PlaylistCheckReq { final res = {}; try { + if (!url.startsWith('http')) { + res['status'] = 400; + return res; + } final uri = Uri.parse(url); final pingRes = await Ping(uri.host, count: 1, forceCodepage: true).stream.first; diff --git a/lib/utils/playlist/playlist_util.dart b/lib/utils/playlist/playlist_util.dart index 7821f11..315751c 100644 --- a/lib/utils/playlist/playlist_util.dart +++ b/lib/utils/playlist/playlist_util.dart @@ -368,9 +368,27 @@ class PlaylistUtil { return groupBy(list, (e) => e.group ?? "未分组"); } +// realtime url + bool isRtUrl(String url) { + const protols = [ + 'rtmp', + 'rtsp', + 'rtp', + 'rtmpt', + 'rtmpt', + 'rtmps', + 'gopher', + 'mms' + ]; + if (protols.contains(url.split('://')[0])) { + return true; + } + return false; + } + //检查是否为真实有效的url bool validateUrl(String url) { - return Uri.tryParse(url)?.origin.isNotEmpty ?? false; + return Uri.tryParse(url)?.origin.isNotEmpty ?? isRtUrl(url); } Future checkUrlAccessible(String url, CancelToken cancelToken) async { diff --git a/pubspec.yaml b/pubspec.yaml index f250cac..0426e2e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.8.3 +version: 0.8.4 environment: sdk: ">=2.17.0 <3.0.0"