Repository navigation
[video_player_platform_interface] Add preventsDisplaySleepDuringVideoPlayback option #11546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
c52b4b6
35405e9
7b62ee0
0459c0f
2f2ff36
06de736
e1a828f
f290b07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,6 +122,16 @@ abstract class VideoPlayerPlatform extends PlatformInterface { | |
| throw UnimplementedError('setAllowBackgroundPlayback() has not been implemented.'); | ||
| } | ||
|
|
||
| /// Sets whether the screen is prevented from sleeping during video playback. | ||
| Future<void> setPreventsDisplaySleepDuringVideoPlayback( | ||
| int playerId, | ||
| bool preventsDisplaySleepDuringVideoPlayback, | ||
| ) { | ||
| throw UnimplementedError( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed this in the previous review. It looks like the main PR plans to only implement this for some platforms. A feature cannot both throw an error when not implemented, and not have a support query, because otherwise there is no way for a client to know whether or not it is safe to call the method. Is the desired behavior for this feature that it silently no-ops if not implemented, or do clients need to know whether it is going to work? /cc @tarrinneal
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. switched the default to a silent no-op. |
||
| 'setPreventsDisplaySleepDuringVideoPlayback() has not been implemented.', | ||
| ); | ||
| } | ||
|
|
||
| /// Sets additional options on web. | ||
| Future<void> setWebOptions(int playerId, VideoPlayerWebOptions options) { | ||
| throw UnimplementedError('setWebOptions() has not been implemented.'); | ||
|
|
@@ -461,6 +471,7 @@ class VideoPlayerOptions { | |
| VideoPlayerOptions({ | ||
| this.mixWithOthers = false, | ||
| this.allowBackgroundPlayback = false, | ||
| this.preventsDisplaySleepDuringVideoPlayback = true, | ||
| this.webOptions, | ||
| }); | ||
|
|
||
|
|
@@ -475,6 +486,13 @@ class VideoPlayerOptions { | |
| /// currently no way to implement this feature in this platform). | ||
| final bool mixWithOthers; | ||
|
|
||
| /// Whether the screen is prevented from sleeping during video playback. | ||
| /// | ||
| /// Defaults to `true`. | ||
| /// | ||
| /// This option may not be supported on all platforms. | ||
| final bool preventsDisplaySleepDuringVideoPlayback; | ||
|
|
||
| /// Additional web controls | ||
| final VideoPlayerWebOptions? webOptions; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.