Skip to content

[video_player] Added fullscreen functionality (for web). #3577

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

Closed
wants to merge 5 commits into from

Conversation

rsegecin
Copy link

@rsegecin rsegecin commented Mar 29, 2023

Adds a feature on the video_player package to enable a video to go fullscreen on web platform.

flutter/flutter#64397

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@camsim99 camsim99 removed their request for review March 29, 2023 15:38
@rsegecin rsegecin changed the title [video_player] Added fullscreen functionality, only works for web. [video_player] Added fullscreen functionality (only works for web). Mar 30, 2023
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! This will need tests, per the comment above, before moving forward. See also my comment below about the feature design, as it doesn't seem like this is a complete feature as presented.

@rsegecin rsegecin requested a review from stuartmorgan-g April 2, 2023 09:25
@rsegecin rsegecin changed the title [video_player] Added fullscreen functionality (only works for web). [video_player] Added fullscreen functionality (for web). Apr 3, 2023
await tester.pumpAndSettle(_playDuration);

expect(controller.value.isFullScreen, true);
expect(controller.value.position,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this expectation related to the functionality you are testing?

await tester.pumpAndSettle(_playDuration);

expect(controller.value.isFullScreen, false);
expect(controller.value.position,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.


await controller.play();
await controller.toggleFullScreen();
await tester.pumpAndSettle(_playDuration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to play a second of video for full screen changes to take effect?

expect(controller.value.position,
(Duration position) => position > Duration.zero);
},
skip: !kIsWeb,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than making this platform-gated, there should be a supportsFullScreen API at both the app-facing and platform interface levels so that it's runtime-checkable.

Future<void> toggleFullScreen() async {
if (kIsWeb) {
if (!value.isFullScreen) {
await _applyFullScreen();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are only used in one place, they don't need to be separated out into helpers.

value = value.copyWith(isFullScreen: true);
} else {
await _applyExitFullScreen();
value = value.copyWith(isFullScreen: false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't the user exit full screen directly? It seems like we would need a state listener for this, rather than managing the state from Dart.

@@ -125,6 +125,16 @@ void main() {
expect(VideoPlayerPlatform.instance.pause(await textureId), completes);
});

testWidgets('can enter fullscreen', (WidgetTester tester) async {
expect(VideoPlayerPlatform.instance.enterFullScreen(await textureId),
completes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only testing that the future completes, not that it does anything. Wouldn't at empty implementation of enterFullScreen pass this test?

@stuartmorgan-g
Copy link
Contributor

@rsegecin Are you still planning on updating this PR based on the feedback above?

@rsegecin
Copy link
Author

@rsegecin Are you still planning on updating this PR based on the feedback above?

Yes, I do want to continue but I think it'll take some time for me to understand, learn and make the appropriate corrections you mentioned. I've been busy with other projects and I don't know when I'll work in this PR so if you rather close it I'll understand may be we can reopen in the future right?

Btw thank you very much for your review @stuartmorgan.

@stuartmorgan-g
Copy link
Contributor

I'll mark it as a draft for now so that it doesn't show up in our regular PR triage; please feel free to mark it as ready for review again once you've updated it.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft June 14, 2023 15:32
@ditman
Copy link
Member

ditman commented Jul 11, 2023

This PR is adding support to enable the native full-screen support on web, without needing to add a controller-owned method:

(The difference that I see is that apps cannot know/trigger the full-screen mode, it needs to be user-triggered from the native UI)

@rsegecin what do you think about 3259, would it fulfill your needs?

@rsegecin
Copy link
Author

This PR is adding support to enable the native full-screen support on web, without needing to add a controller-owned method:

(The difference that I see is that apps cannot know/trigger the full-screen mode, it needs to be user-triggered from the native UI)

@rsegecin what do you think about 3259, would it fulfill your needs?

Yes, definitely, thank you for notifying me @ditman. Kudos to @defuncart coming up with this nice way to set web options for video_player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants