mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 08:38:18 +08:00
@@ -1991,4 +1991,50 @@ class VideoDetailController extends GetxController
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> onCast() async {
|
||||
SmartDialog.showLoading();
|
||||
final res = await VideoHttp.tvPlayUrl(
|
||||
cid: cid.value,
|
||||
objectId: epId ?? aid,
|
||||
playurlType: epId != null ? 2 : 1,
|
||||
qn: currentVideoQa.value?.code,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (res.isSuccess) {
|
||||
final PlayUrlModel data = res.data;
|
||||
final first = data.durl?.firstOrNull;
|
||||
final url = first?.backupUrl?.lastOrNull ?? first?.url;
|
||||
if (url == null || url.isEmpty) {
|
||||
SmartDialog.showToast('不支持投屏');
|
||||
return;
|
||||
}
|
||||
String? title;
|
||||
try {
|
||||
if (isUgc) {
|
||||
title = Get.find<UgcIntroController>(
|
||||
tag: heroTag,
|
||||
).videoDetail.value.title;
|
||||
} else {
|
||||
title = Get.find<PgcIntroController>(
|
||||
tag: heroTag,
|
||||
).videoDetail.value.title;
|
||||
}
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
if (kDebugMode) {
|
||||
debugPrint(title);
|
||||
}
|
||||
Get.toNamed(
|
||||
'/dlna',
|
||||
parameters: {
|
||||
'url': url,
|
||||
'title': ?title,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user