mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-23 02:26:52 +08:00
@@ -111,17 +111,6 @@ class LiveRoomController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void setVolume(value) {
|
||||
if (value == 0) {
|
||||
// 设置音量
|
||||
volumeOff.value = false;
|
||||
} else {
|
||||
// 取消音量
|
||||
volume = value;
|
||||
volumeOff.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> queryLiveInfoH5() async {
|
||||
var res = await LiveHttp.liveRoomInfoH5(roomId: roomId);
|
||||
if (res['status']) {
|
||||
@@ -152,20 +141,22 @@ class LiveRoomController extends GetxController {
|
||||
if (messages.isEmpty) {
|
||||
LiveHttp.liveRoomDanmaPrefetch(roomId: roomId).then((v) {
|
||||
if (v['status']) {
|
||||
messages.addAll((v['data'] as List)
|
||||
.map((obj) => {
|
||||
'name': obj['user']['base']['name'],
|
||||
'uid': obj['user']['uid'],
|
||||
'text': obj['text'],
|
||||
'emots': obj['emots'],
|
||||
'uemote': obj['emoticon']['emoticon_unique'] != ""
|
||||
? obj['emoticon']
|
||||
: null,
|
||||
})
|
||||
.toList());
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scrollToBottom(),
|
||||
);
|
||||
if ((v['data'] as List?)?.isNotEmpty == true) {
|
||||
messages.addAll((v['data'] as List)
|
||||
.map((obj) => {
|
||||
'name': obj['user']['base']['name'],
|
||||
'uid': obj['user']['uid'],
|
||||
'text': obj['text'],
|
||||
'emots': obj['emots'],
|
||||
'uemote': obj['emoticon']['emoticon_unique'] != ""
|
||||
? obj['emoticon']
|
||||
: null,
|
||||
})
|
||||
.toList());
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scrollToBottom(),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -186,25 +177,28 @@ class LiveRoomController extends GetxController {
|
||||
msgStream?.addEventListener((obj) {
|
||||
if (obj['cmd'] == 'DANMU_MSG') {
|
||||
// logger.i(' 原始弹幕消息 ======> ${jsonEncode(obj)}');
|
||||
final info = obj['info'];
|
||||
final first = info[0];
|
||||
final content = first[15];
|
||||
final extra = jsonDecode(content['extra']);
|
||||
final user = content['user'];
|
||||
messages.add({
|
||||
'name': obj['info'][0][15]['user']['base']['name'],
|
||||
'uid': obj['info'][0][15]['user']['uid'],
|
||||
'text': obj['info'][1],
|
||||
'emots': jsonDecode(obj['info'][0][15]['extra'])['emots'],
|
||||
'uemote': obj['info'][0][13],
|
||||
'name': user['base']['name'],
|
||||
'uid': user['uid'],
|
||||
'text': info[1],
|
||||
'emots': extra['emots'],
|
||||
'uemote': first[13],
|
||||
});
|
||||
Map json = jsonDecode(obj['info'][0][15]['extra']);
|
||||
if (showDanmaku) {
|
||||
controller?.addDanmaku(
|
||||
DanmakuContentItem(
|
||||
json['content'],
|
||||
color: DmUtils.decimalToColor(json['color']),
|
||||
type: DmUtils.getPosition(json['mode']),
|
||||
extra['content'],
|
||||
color: DmUtils.decimalToColor(extra['color']),
|
||||
type: DmUtils.getPosition(extra['mode']),
|
||||
),
|
||||
);
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => scrollToBottom(),
|
||||
);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => scrollToBottom());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user