feat:进页面seekTo
This commit is contained in:
parent
bcdce80889
commit
74976ae83a
@ -359,6 +359,7 @@ class VideoInfo {
|
|||||||
num? isVip,
|
num? isVip,
|
||||||
Revolution? revolution,
|
Revolution? revolution,
|
||||||
String? imageUrl,
|
String? imageUrl,
|
||||||
|
String? playSeconds,
|
||||||
}) {
|
}) {
|
||||||
_id = id;
|
_id = id;
|
||||||
_shortPlayVideoId = shortPlayVideoId;
|
_shortPlayVideoId = shortPlayVideoId;
|
||||||
@ -372,6 +373,7 @@ class VideoInfo {
|
|||||||
_isVip = isVip;
|
_isVip = isVip;
|
||||||
_revolution = revolution;
|
_revolution = revolution;
|
||||||
_imageUrl = imageUrl;
|
_imageUrl = imageUrl;
|
||||||
|
_playSeconds = playSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoInfo.fromJson(dynamic json) {
|
VideoInfo.fromJson(dynamic json) {
|
||||||
@ -389,6 +391,7 @@ class VideoInfo {
|
|||||||
? Revolution.fromJson(json['revolution'])
|
? Revolution.fromJson(json['revolution'])
|
||||||
: null;
|
: null;
|
||||||
_imageUrl = json['image_url'];
|
_imageUrl = json['image_url'];
|
||||||
|
_playSeconds = json['play_seconds'];
|
||||||
}
|
}
|
||||||
|
|
||||||
num? _id;
|
num? _id;
|
||||||
@ -403,7 +406,7 @@ class VideoInfo {
|
|||||||
num? _isVip;
|
num? _isVip;
|
||||||
Revolution? _revolution;
|
Revolution? _revolution;
|
||||||
String? _imageUrl;
|
String? _imageUrl;
|
||||||
|
String? _playSeconds;
|
||||||
VideoInfo copyWith({
|
VideoInfo copyWith({
|
||||||
num? id,
|
num? id,
|
||||||
num? shortPlayVideoId,
|
num? shortPlayVideoId,
|
||||||
@ -417,6 +420,7 @@ class VideoInfo {
|
|||||||
num? isVip,
|
num? isVip,
|
||||||
Revolution? revolution,
|
Revolution? revolution,
|
||||||
String? imageUrl,
|
String? imageUrl,
|
||||||
|
String? playSeconds,
|
||||||
}) => VideoInfo(
|
}) => VideoInfo(
|
||||||
id: id ?? _id,
|
id: id ?? _id,
|
||||||
shortPlayVideoId: shortPlayVideoId ?? _shortPlayVideoId,
|
shortPlayVideoId: shortPlayVideoId ?? _shortPlayVideoId,
|
||||||
@ -430,6 +434,7 @@ class VideoInfo {
|
|||||||
isVip: isVip ?? _isVip,
|
isVip: isVip ?? _isVip,
|
||||||
revolution: revolution ?? _revolution,
|
revolution: revolution ?? _revolution,
|
||||||
imageUrl: imageUrl ?? _imageUrl,
|
imageUrl: imageUrl ?? _imageUrl,
|
||||||
|
playSeconds: playSeconds ?? _playSeconds,
|
||||||
);
|
);
|
||||||
|
|
||||||
num? get id => _id;
|
num? get id => _id;
|
||||||
@ -456,6 +461,8 @@ class VideoInfo {
|
|||||||
|
|
||||||
String? get imageUrl => _imageUrl;
|
String? get imageUrl => _imageUrl;
|
||||||
|
|
||||||
|
String? get playSeconds => _playSeconds;
|
||||||
|
|
||||||
set id(num? value) => _id = value;
|
set id(num? value) => _id = value;
|
||||||
|
|
||||||
set shortPlayVideoId(num? value) => _shortPlayVideoId = value;
|
set shortPlayVideoId(num? value) => _shortPlayVideoId = value;
|
||||||
@ -480,6 +487,8 @@ class VideoInfo {
|
|||||||
|
|
||||||
set imageUrl(String? value) => _imageUrl = value;
|
set imageUrl(String? value) => _imageUrl = value;
|
||||||
|
|
||||||
|
set playSeconds(String? value) => _playSeconds = value;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
map['id'] = _id;
|
map['id'] = _id;
|
||||||
@ -496,6 +505,7 @@ class VideoInfo {
|
|||||||
map['revolution'] = _revolution?.toJson();
|
map['revolution'] = _revolution?.toJson();
|
||||||
}
|
}
|
||||||
map['image_url'] = _imageUrl;
|
map['image_url'] = _imageUrl;
|
||||||
|
map['play_seconds'] = _playSeconds;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,6 +125,8 @@ class VideoPlayLogic extends GetxController {
|
|||||||
state.videoId = state.video?.videoInfo?.shortPlayVideoId ?? 0;
|
state.videoId = state.video?.videoInfo?.shortPlayVideoId ?? 0;
|
||||||
}
|
}
|
||||||
state.episodeList = state.video?.episodeList ?? [];
|
state.episodeList = state.video?.episodeList ?? [];
|
||||||
|
state.videoFirstTime =
|
||||||
|
int.tryParse(state.video?.videoInfo?.playSeconds ?? '0') ?? 0;
|
||||||
if (toPage) currentIndex = (state.video?.videoInfo?.episode ?? 1) - 1;
|
if (toPage) currentIndex = (state.video?.videoInfo?.episode ?? 1) - 1;
|
||||||
for (var video in state.episodeList) {
|
for (var video in state.episodeList) {
|
||||||
if (video.isLock == true) {
|
if (video.isLock == true) {
|
||||||
@ -142,6 +144,7 @@ class VideoPlayLogic extends GetxController {
|
|||||||
currentIndex,
|
currentIndex,
|
||||||
isToggle: true,
|
isToggle: true,
|
||||||
isUploadHistorySeconds: false,
|
isUploadHistorySeconds: false,
|
||||||
|
type: 1,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
_initializeController(currentIndex);
|
_initializeController(currentIndex);
|
||||||
@ -258,6 +261,9 @@ class VideoPlayLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
|
if (type == 1) {
|
||||||
|
controllers[index]?.seekTo(Duration(milliseconds: state.videoFirstTime));
|
||||||
|
}
|
||||||
if (state.episodeList[index].isLock == true) {
|
if (state.episodeList[index].isLock == true) {
|
||||||
controllers[index]?.seekTo(Duration(seconds: 0));
|
controllers[index]?.seekTo(Duration(seconds: 0));
|
||||||
controllers[index]?.pause();
|
controllers[index]?.pause();
|
||||||
@ -280,6 +286,7 @@ class VideoPlayLogic extends GetxController {
|
|||||||
controllers[index]?.play();
|
controllers[index]?.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers[index]?.setPlaybackSpeed(state.currentSpeed);
|
controllers[index]?.setPlaybackSpeed(state.currentSpeed);
|
||||||
updateHomeVideo();
|
updateHomeVideo();
|
||||||
// print('----curIndex:$currentIndex');
|
// print('----curIndex:$currentIndex');
|
||||||
|
|||||||
@ -8,6 +8,7 @@ class VideoPlayState {
|
|||||||
String imageUrl = '';
|
String imageUrl = '';
|
||||||
num shortPlayId = -1;
|
num shortPlayId = -1;
|
||||||
num videoId = -1;
|
num videoId = -1;
|
||||||
|
int videoFirstTime = 0;
|
||||||
int curUnlock = 999;
|
int curUnlock = 999;
|
||||||
int? activityId;
|
int? activityId;
|
||||||
bool isFromDiscover = false;
|
bool isFromDiscover = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user