fix: get correct aspect ratio from VideoPlayerController
This commit is contained in:
parent
dd1e2f34d3
commit
0c7c8f8d5a
1 changed files with 1 additions and 5 deletions
|
|
@ -82,10 +82,6 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
|
|
||||||
await videoPlayerController.initialize();
|
await videoPlayerController.initialize();
|
||||||
|
|
||||||
final infoMap = widget.event.content.tryGetMap<String, Object?>('info');
|
|
||||||
final videoWidth = infoMap?.tryGet<int>('w') ?? 400;
|
|
||||||
final videoHeight = infoMap?.tryGet<int>('h') ?? 300;
|
|
||||||
|
|
||||||
// Create a ChewieController on top.
|
// Create a ChewieController on top.
|
||||||
setState(() {
|
setState(() {
|
||||||
_chewieController = ChewieController(
|
_chewieController = ChewieController(
|
||||||
|
|
@ -94,7 +90,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
autoPlay: true,
|
autoPlay: true,
|
||||||
autoInitialize: true,
|
autoInitialize: true,
|
||||||
looping: true,
|
looping: true,
|
||||||
aspectRatio: videoHeight == 0 ? null : videoWidth / videoHeight,
|
aspectRatio: _videoPlayerController?.value.aspectRatio,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} on IOException catch (e) {
|
} on IOException catch (e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue