Skip to content

Commit d2ffd9c

Browse files
committed
feat: background play
1 parent ea6bc2b commit d2ffd9c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

lib/views/widgets/video_widget.dart

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ Widget getVideo(BuildContext context, VideoController controller) {
3535
VideoSettingsWidget(),
3636
],
3737
),
38-
child: Scaffold(body: Video(controller: controller!)),
38+
child: Scaffold(
39+
body: Video(
40+
controller: controller!,
41+
resumeUponEnteringForegroundMode: true,
42+
pauseUponEnteringBackgroundMode: false,
43+
),
44+
),
3945
);
4046
case TargetPlatform.macOS:
4147
case TargetPlatform.windows:
@@ -61,9 +67,20 @@ Widget getVideo(BuildContext context, VideoController controller) {
6167
VideoSettingsWidget(),
6268
],
6369
),
64-
child: Scaffold(body: Video(controller: controller!)),
70+
child: Scaffold(
71+
body: Video(
72+
controller: controller!,
73+
resumeUponEnteringForegroundMode: true,
74+
pauseUponEnteringBackgroundMode: false,
75+
),
76+
),
6577
);
6678
default:
67-
return Video(controller: controller!, controls: NoVideoControls);
79+
return Video(
80+
controller: controller!,
81+
controls: NoVideoControls,
82+
resumeUponEnteringForegroundMode: true,
83+
pauseUponEnteringBackgroundMode: false,
84+
);
6885
}
6986
}

0 commit comments

Comments
 (0)