feat: 充电视频试看
This commit is contained in:
@ -34,6 +34,7 @@ class PlayUrlModel {
|
|||||||
String? seekParam;
|
String? seekParam;
|
||||||
String? seekType;
|
String? seekType;
|
||||||
Dash? dash;
|
Dash? dash;
|
||||||
|
List<Durl>? durl;
|
||||||
List<FormatItem>? supportFormats;
|
List<FormatItem>? supportFormats;
|
||||||
// String? highFormat;
|
// String? highFormat;
|
||||||
int? lastPlayTime;
|
int? lastPlayTime;
|
||||||
@ -52,7 +53,8 @@ class PlayUrlModel {
|
|||||||
videoCodecid = json['video_codecid'];
|
videoCodecid = json['video_codecid'];
|
||||||
seekParam = json['seek_param'];
|
seekParam = json['seek_param'];
|
||||||
seekType = json['seek_type'];
|
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
|
supportFormats = json['support_formats'] != null
|
||||||
? json['support_formats']
|
? json['support_formats']
|
||||||
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
.map<FormatItem>((e) => FormatItem.fromJson(e))
|
||||||
@ -250,3 +252,30 @@ class Flac {
|
|||||||
audio = json['audio'] != null ? AudioItem.fromJson(json['audio']) : null;
|
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,
|
seekTo: seekToTime ?? defaultST,
|
||||||
duration: duration ?? Duration(milliseconds: data.timeLength ?? 0),
|
duration: duration ?? Duration(milliseconds: data.timeLength ?? 0),
|
||||||
// 宽>高 水平 否则 垂直
|
// 宽>高 水平 否则 垂直
|
||||||
direction: (firstVideo.width! - firstVideo.height!) > 0
|
direction: firstVideo.width != null && firstVideo.height != null
|
||||||
? 'horizontal'
|
? ((firstVideo.width! - firstVideo.height!) > 0
|
||||||
: 'vertical',
|
? 'horizontal'
|
||||||
|
: 'vertical')
|
||||||
|
: null,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid.value,
|
cid: cid.value,
|
||||||
enableHeart: enableHeart,
|
enableHeart: enableHeart,
|
||||||
@ -248,6 +250,21 @@ class VideoDetailController extends GetxController
|
|||||||
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid);
|
var result = await VideoHttp.videoUrl(cid: cid.value, bvid: bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
data = result['data'];
|
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!;
|
final List<VideoItem> allVideosList = data.dash!.video!;
|
||||||
try {
|
try {
|
||||||
// 当前可播放的最高质量视频
|
// 当前可播放的最高质量视频
|
||||||
|
Reference in New Issue
Block a user