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