follow up
This commit is contained in:
parent
92b3097307
commit
a019ac5b92
|
|
@ -70,6 +70,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
await videoPlayerController.initialize();
|
||||
|
||||
// Create a ChewieController on top.
|
||||
setState(() {
|
||||
_chewieController = ChewieController(
|
||||
videoPlayerController: videoPlayerController,
|
||||
useRootNavigator: !kIsWeb,
|
||||
|
|
@ -77,6 +78,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
autoInitialize: true,
|
||||
looping: true,
|
||||
);
|
||||
});
|
||||
} on IOException catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
|
|
@ -117,32 +119,45 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
final blurHash = (widget.event.infoMap as Map<String, dynamic>)
|
||||
.tryGet<String>('xyz.amorgan.blurhash') ??
|
||||
fallbackBlurHash;
|
||||
|
||||
const width = 300.0;
|
||||
final infoMap = widget.event.content.tryGetMap<String, Object?>('info');
|
||||
final videoWidth = infoMap?.tryGet<int>('w') ?? 400;
|
||||
final videoHeight = infoMap?.tryGet<int>('h') ?? 300;
|
||||
final height = MediaQuery.of(context).size.height - 52;
|
||||
final width = videoWidth * (height / videoHeight);
|
||||
|
||||
final chewieController = _chewieController;
|
||||
return chewieController != null
|
||||
? Center(child: Chewie(controller: chewieController))
|
||||
? Center(
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
height: height,
|
||||
child: Chewie(controller: chewieController),
|
||||
),
|
||||
)
|
||||
: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: Hero(
|
||||
tag: widget.event.eventId,
|
||||
child: hasThumbnail
|
||||
? MxcImage(
|
||||
event: widget.event,
|
||||
isThumbnail: true,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context) => BlurHash(
|
||||
blurhash: blurHash,
|
||||
width: width,
|
||||
height: width,
|
||||
height: height,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
: BlurHash(
|
||||
blurhash: blurHash,
|
||||
width: width,
|
||||
height: width,
|
||||
height: height,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Center(child: CircularProgressIndicator.adaptive()),
|
||||
|
|
|
|||
Loading…
Reference in New Issue