mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 02:42:34 +01:00
chore: Play stories videos full
This commit is contained in:
parent
d49515011d
commit
ea19fa5f1a
@ -48,6 +48,8 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
bool replyLoading = false;
|
bool replyLoading = false;
|
||||||
bool _modalOpened = false;
|
bool _modalOpened = false;
|
||||||
|
|
||||||
|
VideoPlayerController? _videoPlayerController;
|
||||||
|
|
||||||
void replyEmojiAction() async {
|
void replyEmojiAction() async {
|
||||||
if (replyLoading) return;
|
if (replyLoading) return;
|
||||||
_modalOpened = true;
|
_modalOpened = true;
|
||||||
@ -160,9 +162,15 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
}
|
}
|
||||||
if (loadingMode) return;
|
if (loadingMode) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
progress = progress += _step;
|
final video = _videoPlayerController;
|
||||||
|
if (video == null) {
|
||||||
|
progress += _step;
|
||||||
|
} else {
|
||||||
|
progress = video.value.position;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (progress > maxProgress) {
|
final max = _videoPlayerController?.value.duration ?? maxProgress;
|
||||||
|
if (progress > max) {
|
||||||
skip();
|
skip();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -181,8 +189,7 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
final matrixFile = await event.downloadAndDecryptAttachment();
|
final matrixFile = await event.downloadAndDecryptAttachment();
|
||||||
final tmpDirectory = await getTemporaryDirectory();
|
final tmpDirectory = await getTemporaryDirectory();
|
||||||
final file = File(tmpDirectory.path + matrixFile.name);
|
final file = File(tmpDirectory.path + matrixFile.name);
|
||||||
final videoPlayerController = VideoPlayerController.file(file)
|
final videoPlayerController = VideoPlayerController.file(file);
|
||||||
..setLooping(true);
|
|
||||||
await videoPlayerController.initialize();
|
await videoPlayerController.initialize();
|
||||||
videoPlayerController.play();
|
videoPlayerController.play();
|
||||||
return videoPlayerController;
|
return videoPlayerController;
|
||||||
|
Loading…
Reference in New Issue
Block a user