Compare commits
1 Commits
fix-relate
...
feature-ch
Author | SHA1 | Date | |
---|---|---|---|
3d2c6a122a |
@ -34,6 +34,7 @@ class PlayUrlModel {
|
||||
String? seekParam;
|
||||
String? seekType;
|
||||
Dash? dash;
|
||||
List<Durl>? durl;
|
||||
List<FormatItem>? supportFormats;
|
||||
// String? highFormat;
|
||||
int? lastPlayTime;
|
||||
@ -52,7 +53,8 @@ class PlayUrlModel {
|
||||
videoCodecid = json['video_codecid'];
|
||||
seekParam = json['seek_param'];
|
||||
seekType = json['seek_type'];
|
||||
dash = Dash.fromJson(json['dash']);
|
||||
dash = json['dash'] != null ? Dash.fromJson(json['dash']) : null;
|
||||
durl = json['durl']?.map<Durl>((e) => Durl.fromJson(e)).toList();
|
||||
supportFormats = json['support_formats'] != null
|
||||
? json['support_formats']
|
||||
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||
@ -250,3 +252,30 @@ 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'];
|
||||
}
|
||||
}
|
||||
|
@ -229,9 +229,11 @@ class VideoDetailController extends GetxController
|
||||
seekTo: seekToTime ?? defaultST,
|
||||
duration: duration ?? Duration(milliseconds: data.timeLength ?? 0),
|
||||
// 宽>高 水平 否则 垂直
|
||||
direction: (firstVideo.width! - firstVideo.height!) > 0
|
||||
? 'horizontal'
|
||||
: 'vertical',
|
||||
direction: firstVideo.width != null && firstVideo.height != null
|
||||
? ((firstVideo.width! - firstVideo.height!) > 0
|
||||
? 'horizontal'
|
||||
: 'vertical')
|
||||
: null,
|
||||
bvid: bvid,
|
||||
cid: cid.value,
|
||||
enableHeart: enableHeart,
|
||||
@ -248,6 +250,21 @@ 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 {
|
||||
// 当前可播放的最高质量视频
|
||||
|
Reference in New Issue
Block a user