Compare commits
1 Commits
fix-issues
...
fix-videoC
| Author | SHA1 | Date | |
|---|---|---|---|
| c1008e0162 |
@ -229,9 +229,7 @@ class VideoContent extends StatelessWidget {
|
||||
),
|
||||
if (crossAxisCount > 1) ...[
|
||||
const SizedBox(height: 2),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
),
|
||||
VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
|
||||
],
|
||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||
Row(
|
||||
@ -292,10 +290,14 @@ class VideoContent extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: VideoStat(
|
||||
videoItem: videoItem,
|
||||
crossAxisCount: crossAxisCount,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
// const Spacer(),
|
||||
],
|
||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
||||
VideoPopupMenu(
|
||||
@ -317,10 +319,12 @@ class VideoContent extends StatelessWidget {
|
||||
|
||||
class VideoStat extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final int crossAxisCount;
|
||||
|
||||
const VideoStat({
|
||||
Key? key,
|
||||
required this.videoItem,
|
||||
required this.crossAxisCount,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -337,7 +341,7 @@ class VideoStat extends StatelessWidget {
|
||||
danmu: videoItem.stat.danmu,
|
||||
),
|
||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||
const Spacer(),
|
||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||
RichText(
|
||||
maxLines: 1,
|
||||
text: TextSpan(
|
||||
|
||||
@ -101,13 +101,10 @@ class MemberHttp {
|
||||
'data': MemberArchiveDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -126,13 +123,10 @@ class MemberHttp {
|
||||
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ class Stat {
|
||||
|
||||
Stat.fromJson(Map<String, dynamic> json) {
|
||||
view = json["play"];
|
||||
danmaku = json['video_review'];
|
||||
danmaku = json['comment'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@ class PlayUrlModel {
|
||||
String? seekParam;
|
||||
String? seekType;
|
||||
Dash? dash;
|
||||
List<Durl>? durl;
|
||||
List<FormatItem>? supportFormats;
|
||||
// String? highFormat;
|
||||
int? lastPlayTime;
|
||||
@ -53,8 +52,7 @@ class PlayUrlModel {
|
||||
videoCodecid = json['video_codecid'];
|
||||
seekParam = json['seek_param'];
|
||||
seekType = json['seek_type'];
|
||||
dash = json['dash'] != null ? Dash.fromJson(json['dash']) : null;
|
||||
durl = json['durl']?.map<Durl>((e) => Durl.fromJson(e)).toList();
|
||||
dash = Dash.fromJson(json['dash']);
|
||||
supportFormats = json['support_formats'] != null
|
||||
? json['support_formats']
|
||||
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||
@ -252,30 +250,3 @@ class Flac {
|
||||
audio = json['audio'] != null ? AudioItem.fromJson(json['audio']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
class Durl {
|
||||
Durl({
|
||||
this.order,
|
||||
this.length,
|
||||
this.size,
|
||||
this.ahead,
|
||||
this.vhead,
|
||||
this.url,
|
||||
});
|
||||
|
||||
int? order;
|
||||
int? length;
|
||||
int? size;
|
||||
String? ahead;
|
||||
String? vhead;
|
||||
String? url;
|
||||
|
||||
Durl.fromJson(Map<String, dynamic> json) {
|
||||
order = json['order'];
|
||||
length = json['length'];
|
||||
size = json['size'];
|
||||
ahead = json['ahead'];
|
||||
vhead = json['vhead'];
|
||||
url = json['url'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,12 +218,14 @@ class BangumiIntroController extends GetxController {
|
||||
addIds: addMediaIdsNew.join(','),
|
||||
delIds: delMediaIdsNew.join(','));
|
||||
if (result['status']) {
|
||||
addMediaIdsNew = [];
|
||||
delMediaIdsNew = [];
|
||||
// 重新获取收藏状态
|
||||
queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
Get.back();
|
||||
if (result['data']['prompt']) {
|
||||
addMediaIdsNew = [];
|
||||
delMediaIdsNew = [];
|
||||
Get.back();
|
||||
// 重新获取收藏状态
|
||||
queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,14 +60,16 @@ class FavDetailController extends GetxController {
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: id, addIds: '', delIds: mediaId.toString());
|
||||
if (result['status']) {
|
||||
List dataList = favList;
|
||||
for (var i in dataList) {
|
||||
if (i.id == id) {
|
||||
dataList.remove(i);
|
||||
break;
|
||||
if (result['data']['prompt']) {
|
||||
List dataList = favList;
|
||||
for (var i in dataList) {
|
||||
if (i.id == id) {
|
||||
dataList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SmartDialog.showToast('取消收藏');
|
||||
}
|
||||
SmartDialog.showToast('取消收藏');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,6 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
mediaId = Get.parameters['mediaId']!;
|
||||
_futureBuilderFuture = _favDetailController.queryUserFavFolderDetail();
|
||||
mediaId = Get.parameters['mediaId']!;
|
||||
titleStreamC = StreamController<bool>();
|
||||
|
||||
@ -80,14 +80,16 @@ class FavSearchController extends GetxController {
|
||||
var result = await VideoHttp.favVideo(
|
||||
aid: id, addIds: '', delIds: mediaId.toString());
|
||||
if (result['status']) {
|
||||
List dataList = favList;
|
||||
for (var i in dataList) {
|
||||
if (i.id == id) {
|
||||
dataList.remove(i);
|
||||
break;
|
||||
if (result['data']['prompt']) {
|
||||
List dataList = favList;
|
||||
for (var i in dataList) {
|
||||
if (i.id == id) {
|
||||
dataList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SmartDialog.showToast('取消收藏');
|
||||
}
|
||||
SmartDialog.showToast('取消收藏');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,6 @@ import 'package:pilipala/http/live.dart';
|
||||
import 'package:pilipala/models/live/room_info.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import '../../models/live/room_info_h5.dart';
|
||||
import '../../utils/storage.dart';
|
||||
import '../../utils/video_utils.dart';
|
||||
|
||||
class LiveRoomController extends GetxController {
|
||||
String cover = '';
|
||||
@ -18,7 +16,6 @@ class LiveRoomController extends GetxController {
|
||||
PlPlayerController plPlayerController =
|
||||
PlPlayerController.getInstance(videoType: 'live');
|
||||
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
|
||||
late bool enableCDN;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@ -34,8 +31,6 @@ class LiveRoomController extends GetxController {
|
||||
cover = liveItem.cover;
|
||||
}
|
||||
}
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
}
|
||||
|
||||
playerInit(source) async {
|
||||
@ -62,11 +57,9 @@ class LiveRoomController extends GetxController {
|
||||
List<CodecItem> codec =
|
||||
res['data'].playurlInfo.playurl.stream.first.format.first.codec;
|
||||
CodecItem item = codec.first;
|
||||
String videoUrl = enableCDN
|
||||
? VideoUtils.getCdnUrl(item)
|
||||
: (item.urlInfo?.first.host)! +
|
||||
item.baseUrl! +
|
||||
item.urlInfo!.first.extra!;
|
||||
String videoUrl = (item.urlInfo?.first.host)! +
|
||||
item.baseUrl! +
|
||||
item.urlInfo!.first.extra!;
|
||||
await playerInit(videoUrl);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../common/widgets/http_error.dart';
|
||||
import 'controller.dart';
|
||||
|
||||
class MemberArchivePage extends StatefulWidget {
|
||||
@ -87,16 +86,10 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||
: const SliverToBoxAdapter(),
|
||||
);
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
return const SliverToBoxAdapter();
|
||||
}
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
return const SliverToBoxAdapter();
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
|
||||
@ -4,7 +4,6 @@ import 'package:get/get.dart';
|
||||
import 'package:pilipala/pages/member_dynamics/index.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import '../../common/widgets/http_error.dart';
|
||||
import '../dynamics/widgets/dynamic_panel.dart';
|
||||
|
||||
class MemberDynamicsPage extends StatefulWidget {
|
||||
@ -81,16 +80,10 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
||||
: const SliverToBoxAdapter(),
|
||||
);
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
return const SliverToBoxAdapter();
|
||||
}
|
||||
} else {
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
return const SliverToBoxAdapter();
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
|
||||
@ -90,8 +90,6 @@ class VideoDetailController extends GetxController
|
||||
late String cacheDecode;
|
||||
late int cacheAudioQa;
|
||||
|
||||
PersistentBottomSheetController? replyReplyBottomSheetCtr;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@ -142,7 +140,7 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
|
||||
showReplyReplyPanel() {
|
||||
replyReplyBottomSheetCtr =
|
||||
PersistentBottomSheetController? ctr =
|
||||
scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
|
||||
return VideoReplyReplyPanel(
|
||||
oid: oid.value,
|
||||
@ -155,7 +153,7 @@ class VideoDetailController extends GetxController
|
||||
source: 'videoDetail',
|
||||
);
|
||||
});
|
||||
replyReplyBottomSheetCtr?.closed.then((value) {
|
||||
ctr?.closed.then((value) {
|
||||
fRpid = 0;
|
||||
});
|
||||
}
|
||||
@ -231,11 +229,9 @@ class VideoDetailController extends GetxController
|
||||
seekTo: seekToTime ?? defaultST,
|
||||
duration: duration ?? Duration(milliseconds: data.timeLength ?? 0),
|
||||
// 宽>高 水平 否则 垂直
|
||||
direction: firstVideo.width != null && firstVideo.height != null
|
||||
? ((firstVideo.width! - firstVideo.height!) > 0
|
||||
? 'horizontal'
|
||||
: 'vertical')
|
||||
: null,
|
||||
direction: (firstVideo.width! - firstVideo.height!) > 0
|
||||
? 'horizontal'
|
||||
: 'vertical',
|
||||
bvid: bvid,
|
||||
cid: cid.value,
|
||||
enableHeart: enableHeart,
|
||||
@ -252,21 +248,6 @@ class VideoDetailController extends GetxController
|
||||
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid);
|
||||
if (result['status']) {
|
||||
data = result['data'];
|
||||
if (data.acceptDesc!.isNotEmpty && data.acceptDesc!.contains('试看')) {
|
||||
SmartDialog.showToast(
|
||||
'该视频为专属视频,仅提供试看',
|
||||
displayTime: const Duration(seconds: 3),
|
||||
);
|
||||
videoUrl = data.durl!.first.url!;
|
||||
audioUrl = '';
|
||||
defaultST = Duration.zero;
|
||||
firstVideo = VideoItem();
|
||||
if (autoPlay.value) {
|
||||
await playerInit();
|
||||
isShowCover.value = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
final List<VideoItem> allVideosList = data.dash!.video!;
|
||||
try {
|
||||
// 当前可播放的最高质量视频
|
||||
@ -374,11 +355,4 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// mob端全屏状态关闭二级回复
|
||||
hiddenReplyReplyPanel() {
|
||||
replyReplyBottomSheetCtr != null
|
||||
? replyReplyBottomSheetCtr!.close()
|
||||
: print('replyReplyBottomSheetCtr is null');
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,9 +305,11 @@ class VideoIntroController extends GetxController {
|
||||
delIds: favStatus == 1 ? '$defaultFolderId' : '',
|
||||
);
|
||||
if (result['status']) {
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
if (result['data']['prompt']) {
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
@ -332,12 +334,14 @@ class VideoIntroController extends GetxController {
|
||||
delIds: delMediaIdsNew.join(','));
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
addMediaIdsNew = [];
|
||||
delMediaIdsNew = [];
|
||||
Get.back();
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
if (result['data']['prompt']) {
|
||||
addMediaIdsNew = [];
|
||||
delMediaIdsNew = [];
|
||||
Get.back();
|
||||
// 重新获取收藏状态
|
||||
await queryHasFavVideo();
|
||||
SmartDialog.showToast('✅ 操作成功');
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
@ -478,7 +482,7 @@ class VideoIntroController extends GetxController {
|
||||
final ReleatedController releatedCtr =
|
||||
Get.find<ReleatedController>(tag: heroTag);
|
||||
videoDetailCtr.bvid = bvid;
|
||||
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
|
||||
videoDetailCtr.oid.value = aid;
|
||||
videoDetailCtr.cid.value = cid;
|
||||
videoDetailCtr.danmakuCid.value = cid;
|
||||
videoDetailCtr.queryVideoUrl();
|
||||
|
||||
@ -12,7 +12,6 @@ import 'package:pilipala/pages/preview/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/index.dart';
|
||||
import 'package:pilipala/pages/video/detail/reply_new/index.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/url_utils.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
@ -621,34 +620,26 @@ InlineSpan buildContent(
|
||||
..onTap = () async {
|
||||
final String title = content.jumpUrl[matchStr]['title'];
|
||||
if (appUrlSchema == '') {
|
||||
if (matchStr.startsWith('BV')) {
|
||||
final String redirectUrl =
|
||||
await UrlUtils.parseRedirectUrl(matchStr);
|
||||
final String pathSegment = Uri.parse(redirectUrl).path;
|
||||
final String lastPathSegment =
|
||||
pathSegment.split('/').last;
|
||||
if (lastPathSegment.startsWith('BV')) {
|
||||
UrlUtils.matchUrlPush(
|
||||
matchStr,
|
||||
lastPathSegment,
|
||||
title,
|
||||
'',
|
||||
redirectUrl,
|
||||
);
|
||||
} else {
|
||||
final String redirectUrl =
|
||||
await UrlUtils.parseRedirectUrl(matchStr);
|
||||
final String pathSegment = Uri.parse(redirectUrl).path;
|
||||
final String lastPathSegment =
|
||||
pathSegment.split('/').last;
|
||||
if (lastPathSegment.startsWith('BV')) {
|
||||
UrlUtils.matchUrlPush(
|
||||
lastPathSegment,
|
||||
title,
|
||||
redirectUrl,
|
||||
);
|
||||
} else {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': redirectUrl,
|
||||
'type': 'url',
|
||||
'pageTitle': title
|
||||
},
|
||||
);
|
||||
}
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': redirectUrl,
|
||||
'type': 'url',
|
||||
'pageTitle': title
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (appUrlSchema.startsWith('bilibili://search')) {
|
||||
|
||||
@ -92,7 +92,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
videoSourceInit();
|
||||
appbarStreamListen();
|
||||
lifecycleListener();
|
||||
fullScreenStatusListener();
|
||||
}
|
||||
|
||||
// 获取视频资源,初始化播放器
|
||||
@ -189,14 +188,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
);
|
||||
}
|
||||
|
||||
void fullScreenStatusListener() {
|
||||
plPlayerController?.isFullScreen.listen((bool isFullScreen) {
|
||||
if (isFullScreen) {
|
||||
videoDetailController.hiddenReplyReplyPanel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
shutdownTimerService.handleWaitingFinished();
|
||||
@ -234,10 +225,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
@override
|
||||
// 返回当前页面时
|
||||
void didPopNext() async {
|
||||
if (plPlayerController != null &&
|
||||
plPlayerController!.videoPlayerController != null) {
|
||||
setState(() => isShowing = true);
|
||||
}
|
||||
setState(() => isShowing = true);
|
||||
videoDetailController.isFirstTime = false;
|
||||
final bool autoplay = autoPlayEnable;
|
||||
videoDetailController.playerInit(autoplay: autoplay);
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import 'package:pilipala/models/video/play/url.dart';
|
||||
|
||||
import '../models/live/room_info.dart';
|
||||
|
||||
class VideoUtils {
|
||||
static String getCdnUrl(dynamic item) {
|
||||
var backupUrl = "";
|
||||
@ -14,20 +12,13 @@ class VideoUtils {
|
||||
} else if (item is AudioItem) {
|
||||
backupUrl = item.backupUrl ?? "";
|
||||
videoUrl = backupUrl.contains("http") ? backupUrl : (item.baseUrl ?? "");
|
||||
} else if (item is CodecItem) {
|
||||
backupUrl = (item.urlInfo?.first.host)! +
|
||||
item.baseUrl! +
|
||||
item.urlInfo!.first.extra!;
|
||||
videoUrl = backupUrl.contains("http") ? backupUrl : (item.baseUrl ?? "");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
/// issues #70
|
||||
if (videoUrl.contains(".mcdn.bilivideo")) {
|
||||
videoUrl =
|
||||
'https://proxy-tf-all-ws.bilivideo.com/?url=${Uri.encodeComponent(videoUrl)}';
|
||||
} else if (videoUrl.contains("/upgcxcode/")) {
|
||||
if (videoUrl.contains(".mcdn.bilivideo") ||
|
||||
videoUrl.contains("/upgcxcode/")) {
|
||||
//CDN列表
|
||||
var cdnList = {
|
||||
'ali': 'upos-sz-mirrorali.bilivideo.com',
|
||||
|
||||
Reference in New Issue
Block a user