feat: dlna

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-12 19:02:40 +08:00
parent 0acd9ca767
commit 37b1228552
11 changed files with 257 additions and 41 deletions

View File

@@ -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();
}
}
}