Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 16a7dae

Browse files
authored
[video_player] add allowBackgroundPlayback option platform interface changes (#4807)
1 parent 10a59af commit 16a7dae

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

packages/video_player/video_player_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.1.0
2+
3+
* Adds `allowBackgroundPlayback` to `VideoPlayerOptions`.
4+
15
## 5.0.2
26

37
* Adds the Pigeon definitions used to create the method channel implementation.

packages/video_player/video_player_platform_interface/lib/video_player_platform_interface.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,14 @@ class VideoPlayerOptions {
346346
// in all of the other video player packages, fix this, and then update
347347
// the other packages to use const.
348348
// ignore: prefer_const_constructors_in_immutables
349-
VideoPlayerOptions({this.mixWithOthers = false});
349+
VideoPlayerOptions({
350+
this.mixWithOthers = false,
351+
this.allowBackgroundPlayback = false,
352+
});
353+
354+
/// Set this to true to keep playing video in background, when app goes in background.
355+
/// The default value is false.
356+
final bool allowBackgroundPlayback;
350357

351358
/// Set this to true to mix the video players audio with other audio sources.
352359
/// The default value is false

packages/video_player/video_player_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/main/packages/video_player/v
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 5.0.2
7+
version: 5.1.0
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:flutter_test/flutter_test.dart';
2+
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
3+
4+
void main() {
5+
test(
6+
'VideoPlayerOptions allowBackgroundPlayback defaults to false',
7+
() {
8+
final VideoPlayerOptions options = VideoPlayerOptions();
9+
expect(options.allowBackgroundPlayback, false);
10+
},
11+
);
12+
test(
13+
'VideoPlayerOptions mixWithOthers defaults to false',
14+
() {
15+
final VideoPlayerOptions options = VideoPlayerOptions();
16+
expect(options.mixWithOthers, false);
17+
},
18+
);
19+
}

0 commit comments

Comments
 (0)