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( var res = await Request().get(
Api.liveRoomInfo, Api.liveRoomInfo,
queryParameters: { queryParameters: {
@@ -77,6 +77,7 @@ class LiveHttp {
'ptype': 8, 'ptype': 8,
'dolby': 5, 'dolby': 5,
'panorama': 1, 'panorama': 1,
if (onlyAudio) 'only_audio': 1,
}, },
); );
if (res.data['code'] == 0) { if (res.data['code'] == 0) {

View File

@@ -93,7 +93,11 @@ class LiveRoomController extends GetxController {
: Pref.liveQualityCellular; : 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']) { if (res['status']) {
RoomPlayInfoData data = res['data']; RoomPlayInfoData data = res['data'];
if (data.liveStatus != 1) { if (data.liveStatus != 1) {

View File

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

View File

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