Compare commits
6 Commits
feature-ch
...
fix-upArch
Author | SHA1 | Date | |
---|---|---|---|
e8f63f6114 | |||
d1e8068e51 | |||
6de9b1977c | |||
3c0f54bfd7 | |||
8950658f08 | |||
fb32388536 |
@ -101,10 +101,13 @@ class MemberHttp {
|
||||
'data': MemberArchiveDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -123,10 +126,13 @@ class MemberHttp {
|
||||
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
|
||||
class RecVideoItemAppModel {
|
||||
RecVideoItemAppModel({
|
||||
this.id,
|
||||
@ -50,14 +52,15 @@ class RecVideoItemAppModel {
|
||||
? json['player_args']['aid']
|
||||
: int.parse(json['param'] ?? '-1');
|
||||
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
|
||||
bvid = null;
|
||||
bvid = json['player_args'] != null
|
||||
? IdUtils.av2bv(json['player_args']['aid'])
|
||||
: '';
|
||||
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
|
||||
pic = json['cover'];
|
||||
stat = RcmdStat.fromJson(json);
|
||||
// 改用player_args中的duration作为原始数据(秒数)
|
||||
duration = json['player_args'] != null
|
||||
? json['player_args']['duration']
|
||||
: -1;
|
||||
duration =
|
||||
json['player_args'] != null ? json['player_args']['duration'] : -1;
|
||||
//duration = json['cover_right_text'];
|
||||
title = json['title'];
|
||||
owner = RcmdOwner.fromJson(json);
|
||||
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ 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 {
|
||||
@ -86,10 +87,16 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
||||
: const SliverToBoxAdapter(),
|
||||
);
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
|
@ -4,6 +4,7 @@ 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 {
|
||||
@ -80,10 +81,16 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
|
||||
: const SliverToBoxAdapter(),
|
||||
);
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
return HttpError(
|
||||
errMsg: snapshot.data['msg'],
|
||||
fn: () {},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return const SliverToBoxAdapter();
|
||||
|
@ -102,15 +102,12 @@ class _ImagePreviewState extends State<ImagePreview>
|
||||
);
|
||||
}
|
||||
|
||||
// 设置状态栏图标透明
|
||||
// 隐藏状态栏,避免遮挡图片内容
|
||||
setStatusBar() async {
|
||||
if (Platform.isIOS) {
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
await StatusBarControl.setHidden(true,
|
||||
animation: StatusBarAnimation.SLIDE);
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
await StatusBarControl.setColor(Colors.transparent);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -229,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,
|
||||
@ -250,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 {
|
||||
// 当前可播放的最高质量视频
|
||||
|
@ -20,11 +20,15 @@ class AudioSessionHandler {
|
||||
session.interruptionEventStream.listen((event) {
|
||||
final player = PlPlayerController.getInstance();
|
||||
if (event.begin) {
|
||||
if (player.playerStatus != PlayerStatus.playing) return;
|
||||
switch (event.type) {
|
||||
case AudioInterruptionType.duck:
|
||||
player.setVolume(player.volume.value * 0.5);
|
||||
break;
|
||||
case AudioInterruptionType.pause:
|
||||
player.pause(isInterrupt: true);
|
||||
_playInterrupted = true;
|
||||
break;
|
||||
case AudioInterruptionType.unknown:
|
||||
player.pause(isInterrupt: true);
|
||||
_playInterrupted = true;
|
||||
@ -36,7 +40,7 @@ class AudioSessionHandler {
|
||||
player.setVolume(player.volume.value * 2);
|
||||
break;
|
||||
case AudioInterruptionType.pause:
|
||||
if (_playInterrupted) PlPlayerController.getInstance().play();
|
||||
if (_playInterrupted) player.play();
|
||||
break;
|
||||
case AudioInterruptionType.unknown:
|
||||
break;
|
||||
@ -47,7 +51,10 @@ class AudioSessionHandler {
|
||||
|
||||
// 耳机拔出暂停
|
||||
session.becomingNoisyEventStream.listen((_) {
|
||||
PlPlayerController.getInstance().pause();
|
||||
final player = PlPlayerController.getInstance();
|
||||
if (player.playerStatus == PlayerStatus.playing) {
|
||||
player.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user