Compare commits
6 Commits
feature-ch
...
fix-videoC
| Author | SHA1 | Date | |
|---|---|---|---|
| c1008e0162 | |||
| d1e8068e51 | |||
| 6de9b1977c | |||
| 3c0f54bfd7 | |||
| 8950658f08 | |||
| fb32388536 |
@ -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(
|
||||
|
||||
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -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