betterplayer
betterplayer copied to clipboard
[BUG] fit property is ignored
History check Please confirm that you've checked issues history and you didn't find anything which may solve your issue. ✅
Describe the bug ' BetterPlayerConfiguration' 's fit property does not affect the video's fit.
To Reproduce Steps to reproduce the behavior:
- Copy the following code
- Run the app
- See the error :
*Example code
import 'package:better_player/better_player.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const Scaffold(
body: Center(
child: AspectRatio(
aspectRatio: 1,
child: ColoredBox(
color: Colors.red,
child: VideoWidget(),
),
),
),
),
);
}
}
class VideoWidget extends StatelessWidget {
const VideoWidget({super.key});
@override
Widget build(BuildContext context) {
return BetterPlayer.network(
'https://static.apidae-tourisme.com/filestore/objets-touristiques/videos/237/148/18060525/Mountain+Cart+LP.mp4',
betterPlayerConfiguration: const BetterPlayerConfiguration(
fit: BoxFit.cover,
looping: true,
fullScreenByDefault: false,
autoPlay: true,
controlsConfiguration: BetterPlayerControlsConfiguration(
showControls: false,
),
),
);
}
}
Expected behavior The video has an aspect ratio of 1.
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F82 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.79.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
Better Player version
- Version: 0.0.83
Smartphone (please complete the following information):
- Device: iPhone 14 Pro
- OS: 16.5.1
Additional context The video provided is a 16/9 format
Ok it seems that with the property expandToFill: false
, the 'bug' is fixed :
But in this case @jhomlala, I'm not sure to understand the doc on this prop, shouldn't it be the opposite ?