mod
This commit is contained in:
@ -562,4 +562,37 @@ class Api {
|
|||||||
/// 系统通知标记已读
|
/// 系统通知标记已读
|
||||||
static const String systemMarkRead =
|
static const String systemMarkRead =
|
||||||
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||||
|
|
||||||
|
/// 编辑收藏夹
|
||||||
|
static const String editFavFolder = '/x/v3/fav/folder/edit';
|
||||||
|
|
||||||
|
/// 新建收藏夹
|
||||||
|
static const String addFavFolder = '/x/v3/fav/folder/add';
|
||||||
|
|
||||||
|
/// 直播间弹幕信息
|
||||||
|
static const String getDanmuInfo =
|
||||||
|
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';
|
||||||
|
|
||||||
|
/// 直播间发送弹幕
|
||||||
|
static const String sendLiveMsg = '${HttpString.liveBaseUrl}/msg/send';
|
||||||
|
|
||||||
|
/// 我的关注 - 正在直播
|
||||||
|
static const String getFollowingLive =
|
||||||
|
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
|
||||||
|
|
||||||
|
/// 稍后再看&收藏夹视频列表
|
||||||
|
static const String mediaList = '/x/v2/medialist/resource/list';
|
||||||
|
|
||||||
|
/// 用户专栏
|
||||||
|
static const String opusList = '/x/polymer/web-dynamic/v1/opus/feed/space';
|
||||||
|
|
||||||
|
///
|
||||||
|
static const String getViewInfo = '/x/article/viewinfo';
|
||||||
|
|
||||||
|
/// 直播间记录
|
||||||
|
static const String liveRoomEntry =
|
||||||
|
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
||||||
|
|
||||||
|
/// 删除评论
|
||||||
|
static const String replyDel = '/x/v2/reply/del';
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ class HttpString {
|
|||||||
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
||||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||||
|
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
||||||
static const List<int> validateStatusCodes = [
|
static const List<int> validateStatusCodes = [
|
||||||
302,
|
302,
|
||||||
304,
|
304,
|
||||||
|
@ -70,7 +70,7 @@ class HtmlHttp {
|
|||||||
static Future reqReadHtml(id, dynamicType) async {
|
static Future reqReadHtml(id, dynamicType) async {
|
||||||
var response = await Request().get(
|
var response = await Request().get(
|
||||||
"https://www.bilibili.com/$dynamicType/$id/",
|
"https://www.bilibili.com/$dynamicType/$id/",
|
||||||
extra: {'ua': 'pc', 'opus-goback': '1'},
|
extra: {'ua': 'pc'},
|
||||||
);
|
);
|
||||||
Document rootTree = parse(response.data);
|
Document rootTree = parse(response.data);
|
||||||
Element body = rootTree.body!;
|
Element body = rootTree.body!;
|
||||||
|
@ -226,15 +226,6 @@ class Request {
|
|||||||
if (extra['ua'] != null) {
|
if (extra['ua'] != null) {
|
||||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||||
}
|
}
|
||||||
if (extra['opus-goback'] != null) {
|
|
||||||
List<Cookie> cookies = await cookieManager.cookieJar
|
|
||||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
|
||||||
String cookieHeader = cookies
|
|
||||||
.map((cookie) => '${cookie.name}=${cookie.value}')
|
|
||||||
.join('; ');
|
|
||||||
options.headers!['cookie'] =
|
|
||||||
'$cookieHeader; opus-goback = ${extra['opus-goback']}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
options.responseType = resType;
|
options.responseType = resType;
|
||||||
|
|
||||||
|
@ -145,4 +145,18 @@ class LiveHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 直播历史记录
|
||||||
|
static Future liveRoomEntry({required int roomId}) async {
|
||||||
|
await Request().post(
|
||||||
|
Api.liveRoomEntry,
|
||||||
|
data: {
|
||||||
|
'room_id': roomId,
|
||||||
|
'platform': 'pc',
|
||||||
|
'csrf_token': await Request.getCsrf(),
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
'visit_id': '',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -703,43 +703,3 @@ class Vip {
|
|||||||
status = json['status'];
|
status = json['status'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Staff {
|
|
||||||
Staff({
|
|
||||||
this.mid,
|
|
||||||
this.title,
|
|
||||||
this.name,
|
|
||||||
this.face,
|
|
||||||
this.vip,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? mid;
|
|
||||||
String? title;
|
|
||||||
String? name;
|
|
||||||
String? face;
|
|
||||||
int? status;
|
|
||||||
Vip? vip;
|
|
||||||
|
|
||||||
Staff.fromJson(Map<String, dynamic> json) {
|
|
||||||
mid = json['mid'];
|
|
||||||
title = json['title'];
|
|
||||||
name = json['name'];
|
|
||||||
face = json['face'];
|
|
||||||
vip = Vip.fromJson(json['vip']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Vip {
|
|
||||||
Vip({
|
|
||||||
this.type,
|
|
||||||
this.status,
|
|
||||||
});
|
|
||||||
|
|
||||||
int? type;
|
|
||||||
int? status;
|
|
||||||
|
|
||||||
Vip.fromJson(Map<String, dynamic> json) {
|
|
||||||
type = json['type'];
|
|
||||||
status = json['status'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -132,4 +132,22 @@ class FavDetailController extends GetxController {
|
|||||||
title.value = res['title'];
|
title.value = res['title'];
|
||||||
print(title);
|
print(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future toViewPlayAll() async {
|
||||||
|
final FavDetailItemData firstItem = favList.first;
|
||||||
|
final String heroTag = Utils.makeHeroTag(firstItem.bvid);
|
||||||
|
Get.toNamed(
|
||||||
|
'/video?bvid=${firstItem.bvid}&cid=${firstItem.cid}',
|
||||||
|
arguments: {
|
||||||
|
'videoItem': firstItem,
|
||||||
|
'heroTag': heroTag,
|
||||||
|
'sourceType': 'fav',
|
||||||
|
'mediaId': favInfo['id'],
|
||||||
|
'oid': firstItem.id,
|
||||||
|
'favTitle': favInfo['title'],
|
||||||
|
'favInfo': favInfo,
|
||||||
|
'count': favInfo['media_count'],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,10 +668,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
tag: heroTag,
|
tag: heroTag,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (isShowing)
|
Obx(
|
||||||
Padding(
|
() => isShowing.value
|
||||||
padding: EdgeInsets.only(top: 0),
|
? buildVideoPlayerPanel()
|
||||||
child: videoPlayerPanel,
|
: const SizedBox(),
|
||||||
),
|
),
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
/// 关闭自动播放时 手动播放
|
||||||
|
@ -366,13 +366,7 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
// 配置Player 音轨、字幕等等
|
// 配置Player 音轨、字幕等等
|
||||||
_videoPlayerController = await _createVideoController(
|
_videoPlayerController = await _createVideoController(
|
||||||
dataSource,
|
dataSource, _looping, enableHA, width, height, seekTo);
|
||||||
_looping,
|
|
||||||
enableHA,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
seekTo,
|
|
||||||
);
|
|
||||||
// 获取视频时长 00:00
|
// 获取视频时长 00:00
|
||||||
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
||||||
updateDurationSecond();
|
updateDurationSecond();
|
||||||
@ -403,7 +397,7 @@ class PlPlayerController {
|
|||||||
bool enableHA,
|
bool enableHA,
|
||||||
double? width,
|
double? width,
|
||||||
double? height,
|
double? height,
|
||||||
Duration? seekTo,
|
Duration seekTo,
|
||||||
) async {
|
) async {
|
||||||
// 每次配置时先移除监听
|
// 每次配置时先移除监听
|
||||||
removeListeners();
|
removeListeners();
|
||||||
@ -491,12 +485,9 @@ class PlPlayerController {
|
|||||||
play: false,
|
play: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
player.open(
|
await player.open(
|
||||||
Media(
|
Media(dataSource.videoSource!,
|
||||||
dataSource.videoSource!,
|
httpHeaders: dataSource.httpHeaders, start: seekTo),
|
||||||
httpHeaders: dataSource.httpHeaders,
|
|
||||||
start: seekTo ?? Duration.zero,
|
|
||||||
),
|
|
||||||
play: false,
|
play: false,
|
||||||
);
|
);
|
||||||
// 音轨
|
// 音轨
|
||||||
@ -536,15 +527,6 @@ class PlPlayerController {
|
|||||||
await setPlaybackSpeed(1.0);
|
await setPlaybackSpeed(1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getVideoFit();
|
|
||||||
// if (_looping) {
|
|
||||||
// await setLooping(_looping);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 自动播放
|
|
||||||
if (_autoPlay) {
|
|
||||||
await play(duration: duration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<StreamSubscription> subscriptions = [];
|
List<StreamSubscription> subscriptions = [];
|
||||||
|
@ -193,6 +193,9 @@ class Routes {
|
|||||||
// 专栏
|
// 专栏
|
||||||
CustomGetPage(name: '/opus', page: () => const OpusPage()),
|
CustomGetPage(name: '/opus', page: () => const OpusPage()),
|
||||||
CustomGetPage(name: '/read', page: () => const ReadPage()),
|
CustomGetPage(name: '/read', page: () => const ReadPage()),
|
||||||
|
// 用户专栏
|
||||||
|
CustomGetPage(
|
||||||
|
name: '/memberArticle', page: () => const MemberArticlePage()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,21 +226,6 @@ class Utils {
|
|||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
||||||
// 向上查找
|
|
||||||
if (closestNumber == 0) {
|
|
||||||
try {
|
|
||||||
for (int number in numbers) {
|
|
||||||
int diff = (number - target).abs();
|
|
||||||
|
|
||||||
if (diff < minDiff) {
|
|
||||||
minDiff = diff;
|
|
||||||
closestNumber = number;
|
|
||||||
return closestNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 向上查找
|
// 向上查找
|
||||||
if (closestNumber == 0) {
|
if (closestNumber == 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -129,6 +129,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.4"
|
version: "4.0.4"
|
||||||
|
brotli:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: brotli
|
||||||
|
sha256: "7f891558ed779aab2bed874f0a36b8123f9ff3f19cf6efbee89e18ed294945ae"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.0"
|
||||||
build:
|
build:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
18
pubspec.yaml
18
pubspec.yaml
@ -147,6 +147,10 @@ dependencies:
|
|||||||
# 二维码
|
# 二维码
|
||||||
qr_flutter: ^4.1.0
|
qr_flutter: ^4.1.0
|
||||||
bottom_sheet: ^4.0.4
|
bottom_sheet: ^4.0.4
|
||||||
|
web_socket_channel: ^2.4.5
|
||||||
|
brotli: ^0.6.0
|
||||||
|
# 文本语法高亮
|
||||||
|
re_highlight: ^0.0.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@ -180,20 +184,6 @@ dependency_overrides:
|
|||||||
url: https://github.com/media-kit/media-kit
|
url: https://github.com/media-kit/media-kit
|
||||||
path: libs/universal/media_kit_libs_video
|
path: libs/universal/media_kit_libs_video
|
||||||
|
|
||||||
dependency_overrides:
|
|
||||||
media_kit:
|
|
||||||
git:
|
|
||||||
url: https://github.com/media-kit/media-kit.git
|
|
||||||
path: media_kit
|
|
||||||
media_kit_video:
|
|
||||||
git:
|
|
||||||
url: https://github.com/media-kit/media-kit.git
|
|
||||||
path: media_kit_video
|
|
||||||
media_kit_libs_video:
|
|
||||||
git:
|
|
||||||
url: https://github.com/media-kit/media-kit.git
|
|
||||||
path: libs/universal/media_kit_libs_video
|
|
||||||
|
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
android: true
|
android: true
|
||||||
ios: true
|
ios: true
|
||||||
|
Reference in New Issue
Block a user