mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 06:52:35 +01:00
Merge branch 'krille/fix-video-stories' into 'main'
chore: Fix video stories See merge request famedly/fluffychat!649
This commit is contained in:
commit
9f040acee0
@ -196,16 +196,18 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
|
|
||||||
String get roomId => VRouter.of(context).pathParameters['roomid'] ?? '';
|
String get roomId => VRouter.of(context).pathParameters['roomid'] ?? '';
|
||||||
|
|
||||||
Future<VideoPlayerController>? loadVideoControllerFuture;
|
Future<VideoPlayerController?>? loadVideoControllerFuture;
|
||||||
|
|
||||||
Future<VideoPlayerController> loadVideoController(Event event) async {
|
Future<VideoPlayerController?> loadVideoController(Event event) async {
|
||||||
try {
|
try {
|
||||||
final matrixFile = await event.downloadAndDecryptAttachment();
|
final matrixFile = await event.downloadAndDecryptAttachment();
|
||||||
|
if (!mounted) return null;
|
||||||
final tmpDirectory = await getTemporaryDirectory();
|
final tmpDirectory = await getTemporaryDirectory();
|
||||||
final fileName =
|
final fileName =
|
||||||
event.content.tryGet<String>('filename') ?? 'unknown_story_video.mp4';
|
event.content.tryGet<String>('filename') ?? 'unknown_story_video.mp4';
|
||||||
final file = File(tmpDirectory.path + '/' + fileName);
|
final file = File(tmpDirectory.path + '/' + fileName);
|
||||||
await file.writeAsBytes(matrixFile.bytes);
|
await file.writeAsBytes(matrixFile.bytes);
|
||||||
|
if (!mounted) return null;
|
||||||
final videoPlayerController =
|
final videoPlayerController =
|
||||||
_videoPlayerController = VideoPlayerController.file(file);
|
_videoPlayerController = VideoPlayerController.file(file);
|
||||||
await videoPlayerController.initialize();
|
await videoPlayerController.initialize();
|
||||||
|
@ -72,7 +72,7 @@ class StoryView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
if (!controller.isOwnStory)
|
if (!controller.isOwnStory && currentEvent != null)
|
||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
duration: const Duration(seconds: 1),
|
duration: const Duration(seconds: 1),
|
||||||
opacity: controller.isHold ? 0 : 1,
|
opacity: controller.isHold ? 0 : 1,
|
||||||
@ -159,7 +159,7 @@ class StoryView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (event.messageType == MessageTypes.Video &&
|
if (event.messageType == MessageTypes.Video &&
|
||||||
PlatformInfos.isMobile)
|
PlatformInfos.isMobile)
|
||||||
FutureBuilder<VideoPlayerController>(
|
FutureBuilder<VideoPlayerController?>(
|
||||||
future: controller.loadVideoControllerFuture ??=
|
future: controller.loadVideoControllerFuture ??=
|
||||||
controller.loadVideoController(event),
|
controller.loadVideoController(event),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user