feat: 直播间播放
This commit is contained in:
@ -190,4 +190,10 @@ class Api {
|
||||
// ?page=1&page_size=30&platform=web
|
||||
static const String liveList =
|
||||
'https://api.live.bilibili.com/xlive/web-interface/v1/second/getUserRecommend';
|
||||
|
||||
// 直播间详情
|
||||
// cid roomId
|
||||
// qn 80:流畅,150:高清,400:蓝光,10000:原画,20000:4K, 30000:杜比
|
||||
static const String liveRoomInfo =
|
||||
'https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo';
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/models/live/room_info.dart';
|
||||
|
||||
class LiveHttp {
|
||||
static Future liveList(
|
||||
@ -22,4 +23,27 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future liveRoomInfo({roomId, qn}) async {
|
||||
var res = await Request().get(Api.liveRoomInfo, data: {
|
||||
'room_id': roomId,
|
||||
'protocol': '0, 1',
|
||||
'format': '0, 1, 2',
|
||||
'codec': '0, 1',
|
||||
'qn': qn,
|
||||
'platform': 'web',
|
||||
'ptype': 8,
|
||||
'dolby': 5,
|
||||
'panorama': 1,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': RoomInfoModel.fromJson(res.data['data'])};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user