Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
/// Attempts to open the given [dataSource] and load metadata about the video.
Future<void> initialize() async {
_lifeCycleObserver = _VideoAppLifeCycleObserver(this);
_lifeCycleObserver.initialize();
if (videoPlayerOptions?.observeAppLifecycle)
_lifeCycleObserver.initialize();
_creatingCompleter = Completer<void>();

DataSource dataSourceDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ class VideoPlayerOptions {
/// The default value is false
final bool mixWithOthers;

/// Set this to true to let plugin manage play/pause with app lifecycle changes,
/// Set this to fase to keep playing video in background, when app goes in background
/// The default value is true
final bool observeAppLifecycle;

/// set additional optional player settings
VideoPlayerOptions({this.mixWithOthers = false});
VideoPlayerOptions(
{this.mixWithOthers = false, this.observeAppLifecycle = true});
}