修复直播状态

This commit is contained in:
Yutousama 2022-04-11 19:13:56 +08:00
parent 9d72939d95
commit addda76eaa

View File

@ -350,7 +350,9 @@ public class LiveUtils {
public static JSONObject getLiveInfo(int roomId) {
return http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + roomId + "&protocol=0,1&format=0,1,2&codec=0,1&qn=10000&platform=web&ptype=8");
}
public static JSONObject getLiveRoomInfo(int roomId){
return http_get("https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo?room_id"+ roomId + "&protocol=0,1&format=0,1,2&codec=0,1&qn=10000&platform=web&ptype=8");
}
public static boolean getLiveState(int roomId) {
@ -358,12 +360,12 @@ public class LiveUtils {
}
public static void reloadLiveState(int roomId) {
JSONObject json = getLiveInfo(roomId);
JSONObject json = getLiveRoomInfo(roomId);
if (json != null) {
try {
liveStateMap.put(roomId, json.getJSONObject("data").getInteger("live_status") == 1);
} catch (Exception e) {
Log.i("live state = "+json.toString());
Log.i("live state = "+json);
}
}
}