mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -800,6 +800,10 @@ class PlPlayerController {
|
||||
videoPlayerController!.stream.error.listen((String event) {
|
||||
// 直播的错误提示没有参考价值,均不予显示
|
||||
if (videoType.value == 'live') return;
|
||||
if (event.startsWith("Failed to open .") ||
|
||||
event.startsWith("Cannot open file ''")) {
|
||||
SmartDialog.showToast('视频源为空');
|
||||
}
|
||||
if (event.startsWith("Failed to open https://") ||
|
||||
event.startsWith("Can not open external file https://") ||
|
||||
//tcp: ffurl_read returned 0xdfb9b0bb
|
||||
@@ -807,13 +811,15 @@ class PlPlayerController {
|
||||
event.startsWith('tcp: ffurl_read returned ')) {
|
||||
EasyThrottle.throttle('videoPlayerController!.stream.error.listen',
|
||||
const Duration(milliseconds: 10000), () {
|
||||
Future.delayed(const Duration(milliseconds: 3000), () {
|
||||
Future.delayed(const Duration(milliseconds: 3000), () async {
|
||||
debugPrint("isBuffering.value: ${isBuffering.value}");
|
||||
debugPrint("_buffered.value: ${_buffered.value}");
|
||||
if (isBuffering.value && _buffered.value == Duration.zero) {
|
||||
refreshPlayer();
|
||||
SmartDialog.showToast('视频链接打开失败,重试中',
|
||||
displayTime: const Duration(milliseconds: 500));
|
||||
if (!await refreshPlayer()) {
|
||||
debugPrint("failed");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/models/video/play/CDN.dart';
|
||||
import 'package:PiliPlus/models/video/play/url.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -20,11 +21,15 @@ class VideoUtils {
|
||||
if (item is AudioItem) {
|
||||
if (GStorage.setting
|
||||
.get(SettingBoxKey.disableAudioCDN, defaultValue: true)) {
|
||||
return item.backupUrl ?? item.baseUrl ?? "";
|
||||
return item.backupUrl.isNullOrEmpty.not
|
||||
? item.backupUrl!
|
||||
: item.baseUrl ?? "";
|
||||
}
|
||||
}
|
||||
if (defaultCDNService == CDNService.baseUrl.code) {
|
||||
return item.baseUrl ?? "";
|
||||
return item.baseUrl.isNullOrEmpty.not
|
||||
? item.baseUrl
|
||||
: item.backupUrl ?? "";
|
||||
}
|
||||
if (item is CodecItem) {
|
||||
backupUrl = (item.urlInfo?.first.host)! +
|
||||
@@ -34,20 +39,20 @@ class VideoUtils {
|
||||
backupUrl = item.backupUrl;
|
||||
}
|
||||
if (defaultCDNService == CDNService.backupUrl.code) {
|
||||
return backupUrl ?? item.baseUrl ?? "";
|
||||
return backupUrl.isNullOrEmpty.not ? backupUrl : item.baseUrl ?? "";
|
||||
}
|
||||
videoUrl = (backupUrl == null || isMCDNorPCDN(backupUrl))
|
||||
videoUrl = (backupUrl.isNullOrEmpty || isMCDNorPCDN(backupUrl!))
|
||||
? item.baseUrl
|
||||
: backupUrl;
|
||||
|
||||
if (videoUrl == null) {
|
||||
if (videoUrl.isNullOrEmpty) {
|
||||
return "";
|
||||
}
|
||||
debugPrint("videoUrl:$videoUrl");
|
||||
|
||||
String defaultCDNHost = CDNServiceCode.fromCode(defaultCDNService)!.host;
|
||||
debugPrint("defaultCDNHost:$defaultCDNHost");
|
||||
if (videoUrl.contains("szbdyd.com")) {
|
||||
if (videoUrl!.contains("szbdyd.com")) {
|
||||
String hostname =
|
||||
Uri.parse(videoUrl).queryParameters['xy_usource'] ?? defaultCDNHost;
|
||||
videoUrl =
|
||||
|
||||
Reference in New Issue
Block a user