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

Conversation

@cbenhagen
Copy link
Contributor

@cbenhagen cbenhagen commented Dec 20, 2019

Description

This seemed to have no effect. Was it optimized away because _ was not used?

final VideoPlayerPlatform _ = VideoPlayerPlatform.instance..init();

Related Issues

Fixes flutter/flutter#47524

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@cbenhagen
Copy link
Contributor Author

@cyanglaz can I ask you for a review and a tip on how to properly test this?

@cbenhagen cbenhagen changed the title Make sure the plugin is correctly initialized [video_player] Make sure the plugin is correctly initialized Dec 20, 2019
@cbenhagen
Copy link
Contributor Author

Added a test to check if init has been called.

@cbenhagen
Copy link
Contributor Author

@mklim do you have an idea why the test works locally but fails on Cirrus CI? Is there maybe a better way to test this?

@cbenhagen
Copy link
Contributor Author

@amirh people keep running into issues with the released video_player plugin which already have PRs with simple fixes pending (this and #2397). Can you help me get the plugin into a good state again or do you know someone else I could ping for a quick review?

@amirh
Copy link
Contributor

amirh commented Jan 10, 2020

This seemed to have no effect. Was it optimized away because _ was not used?

Yes, static initializers are lazily evaluated when the field is first used.

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

LGTM

final VideoPlayerPlatform _videoPlayerPlatform = VideoPlayerPlatform.instance
// This will clear all open videos on the platform when a full restart is
// performed.
..init();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this hack in general, but we don't have a better alternative right now. I filed flutter/flutter#48586 to expose an engine restart hook to the plugin's platform code.

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

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

We need to fix the unit test before landing

@cbenhagen cbenhagen force-pushed the fix_silenced_audio branch 2 times, most recently from f6067c5 to 5937282 Compare January 10, 2020 23:04
@cbenhagen cbenhagen requested a review from amirh January 10, 2020 23:08
@cbenhagen
Copy link
Contributor Author

@amirh does this need to be reviewed by another person?

@amirh
Copy link
Contributor

amirh commented Jan 16, 2020

I was just waiting for the tree to become green before landing (was red for multiple days until now 😞 )

@amirh amirh merged commit ddf17ee into flutter:master Jan 16, 2020
@cbenhagen cbenhagen deleted the fix_silenced_audio branch January 16, 2020 18:42
@cbenhagen
Copy link
Contributor Author

Oh ok. Thanks for merging!

WoodyGuo pushed a commit to liuwei1130/plugins that referenced this pull request Feb 10, 2020
…#2434)

The initialization was done through a static initialization of an unused field, and since static initialization is invoked lazily it was never initialized.
WoodyGuo pushed a commit to liuwei1130/plugins that referenced this pull request Feb 10, 2020
…#2434)

The initialization was done through a static initialization of an unused field, and since static initialization is invoked lazily it was never initialized.
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
…#2434)

The initialization was done through a static initialization of an unused field, and since static initialization is invoked lazily it was never initialized.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

video_player: no audio when iPhone ringer is silenced

3 participants