video can now loop

This commit is contained in:
ALEZ-DEV 2024-05-14 21:18:54 +02:00
parent 08740a4988
commit 6d4087539e
2 changed files with 16 additions and 5 deletions

View File

@ -12,10 +12,13 @@ class HomeScreen extends StatelessWidget {
const Background(),
SizedBox(
child: Align(
alignment: Alignment.bottomCenter,
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(bottom: 50),
child: FilledButton(
padding: const EdgeInsets.only(right: 50, bottom: 50),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue[500],
),
onPressed: () {},
child: const SizedBox(
width: 300,

View File

@ -10,7 +10,9 @@ class Background extends StatefulWidget {
}
class _BackgroundState extends State<Background> {
late final player = Player();
late final player = Player(
configuration: PlayerConfiguration(),
);
late final controller = VideoController(player);
@override
@ -21,6 +23,7 @@ class _BackgroundState extends State<Background> {
'https://media-cdn-zspms.kurogame.net/pnswebsite/website2.0/video/1715184000000/1l5uvj9eqpjjcazt4p-1715219648481.mp4',
),
);
player.setPlaylistMode(PlaylistMode.loop);
}
@override
@ -32,6 +35,11 @@ class _BackgroundState extends State<Background> {
@override
Widget build(BuildContext context) {
player.play();
return Video(controller: controller);
return Video(
controller: controller,
controls: NoVideoControls,
wakelock: false,
fit: BoxFit.cover,
);
}
}