opt live onlyPlayAudio

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-16 17:44:06 +08:00
parent e0243461bb
commit f223befad6
4 changed files with 16 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ class LiveHttp {
}
}
static Future liveRoomInfo({roomId, qn}) async {
static Future liveRoomInfo({roomId, qn, bool onlyAudio = false}) async {
var res = await Request().get(
Api.liveRoomInfo,
queryParameters: {
@@ -77,6 +77,7 @@ class LiveHttp {
'ptype': 8,
'dolby': 5,
'panorama': 1,
if (onlyAudio) 'only_audio': 1,
},
);
if (res.data['code'] == 0) {

View File

@@ -93,7 +93,11 @@ class LiveRoomController extends GetxController {
: Pref.liveQualityCellular;
});
}
var res = await LiveHttp.liveRoomInfo(roomId: roomId, qn: currentQn);
var res = await LiveHttp.liveRoomInfo(
roomId: roomId,
qn: currentQn,
onlyAudio: plPlayerController.onlyPlayAudio.value,
);
if (res['status']) {
RoomPlayInfoData data = res['data'];
if (data.liveStatus != 1) {

View File

@@ -171,6 +171,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
upName: roomInfoH5?.anchorInfo?.baseInfo?.uname,
plPlayerController: plPlayerController,
onSendDanmaku: onSendDanmaku,
onPlayAudio: _liveRoomController.queryLiveInfo,
),
bottomControl: BottomControl(
plPlayerController: plPlayerController,

View File

@@ -10,17 +10,19 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
class LiveHeaderControl extends StatelessWidget {
const LiveHeaderControl({
super.key,
required this.title,
required this.upName,
required this.plPlayerController,
required this.onSendDanmaku,
super.key,
required this.onPlayAudio,
});
final String? title;
final String? upName;
final PlPlayerController plPlayerController;
final VoidCallback onSendDanmaku;
final VoidCallback onPlayAudio;
@override
Widget build(BuildContext context) {
@@ -95,7 +97,11 @@ class LiveHeaderControl extends StatelessWidget {
width: 35,
height: 35,
child: IconButton(
onPressed: plPlayerController.setOnlyPlayAudio,
onPressed: () {
plPlayerController.onlyPlayAudio.value =
!plPlayerController.onlyPlayAudio.value;
onPlayAudio();
},
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
),