forked from Nexus/nexus
don't open media if context not mounted
This commit is contained in:
parent
44a1ec667e
commit
3e1552f246
2 changed files with 2 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ class const AudioPlayer(
|
||||||
final audio = await ref
|
final audio = await ref
|
||||||
.read(ClientController.provider.notifier)
|
.read(ClientController.provider.notifier)
|
||||||
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
|
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
|
||||||
|
if (!context.mounted) return;
|
||||||
await player.open(Media(audio.path), play: false);
|
await player.open(Media(audio.path), play: false);
|
||||||
if (context.mounted) loaded.value = true;
|
if (context.mounted) loaded.value = true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class const VideoPlayer(
|
||||||
final video = await ref
|
final video = await ref
|
||||||
.read(ClientController.provider.notifier)
|
.read(ClientController.provider.notifier)
|
||||||
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
|
.downloadMedia(.new(mxc: uri, encrypted: encrypted));
|
||||||
|
if (!context.mounted) return;
|
||||||
await player.open(Media(video.path), play: false);
|
await player.open(Media(video.path), play: false);
|
||||||
if (context.mounted) loaded.value = true;
|
if (context.mounted) loaded.value = true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue