-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[video_player] Fixes video initialization future stall. #2134
Conversation
25d83d4 to
432f4e3
Compare
907ccaa to
4530941
Compare
|
@amirh Added tests as requested on discord sometime ago. I also have another fix to go into release on top of this. I'll link the PR to this one and update the CHANGELOG and pubspec in that PR. |
…ing to load source data and does not throw error. Fix formatting. Add tests for errors during init.
4530941 to
45836b2
Compare
mklim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
The code itself LG, but the pubspec.yaml and CHANGELOG.md also need to be updated here.
| try { | ||
| dynamic error; | ||
| fakeVideoPlayerPlatform.forceInitError = true; | ||
| await controller.initialize().catchError((dynamic e) => error = e); | ||
| final PlatformException platformEx = error; | ||
| expect(platformEx.code, equals('VideoError')); | ||
| } finally { | ||
| fakeVideoPlayerPlatform.forceInitError = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why the try/finally here? Is the catchError not really catching the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just used to reset the forceInitError flag to ensure if any other error is thrown during testing the flag is reset so other tests can complete without issue.
|
@mklim do you want me to update the CHANGELOG and pubspec in this PR or do you want to handle that yourself? My other work that depends on this needs test cases and other things that I do not have time to complete on. slightfoot@599b6b0 So you might want to merge this ASAP before it gets out of date. |
|
@slightfoot ideally this patch would be ready to land as-is. :) Since you don't have the bandwidth to work on this though I'll get it up to date. |
|
Thanks again for the contribution! |
…acheing-01-08 * flutterPlugin/master: (30 commits) Update Gradle version (flutter#2448) [image_picker] support android V2 embedding (flutter#2430) [webview_flutter] Setup XCTests (flutter#2445) [video_player] Fixes video initialization future stall. (flutter#2134) [ci] Upgrade to Xcode 11.3 (flutter#2435) [In_app_purchases] migrate to Play Billing Library 2.0. (flutter#2287) Migrate away from deprecated `BinaryMessages` (flutter#2444) [google_sign_in]Update google_sign_in_example name in pubspec.yaml (flutter#2335) [ios_platform_images] Removed android support from the pubspec. (flutter#2432) [google_sign_in] Expose network error (flutter#2398) [battery] cleanup for Android embedding post 1.12 (flutter#2400) [flutter_webview] Raise min Flutter SDK to stable (flutter#2425) re-enable stable CI (flutter#2402) [in_app_purchase]Change a comment. (flutter#2329) [google_sign_in] Pass the client id to the platform interface. (flutter#2427) [ios_platform_images] Made ios_platform_images set the correct image scale. (flutter#2414) [url_launcher_platform_interface] use non static token for platform interface (flutter#2418) [plugin_platform_interface] Don't use const Object as a token (flutter#2417) Update endorsed macos plugins readme and update others (flutter#2407) [webview_flutter] add gesture navigation for iOS (flutter#2339) ... # Conflicts: # packages/video_player/video_player/CHANGELOG.md # packages/video_player/video_player/pubspec.yaml
Fixes issue where `initialize()` `Future` stalls when failing to load source data and does not throw error. For example if the network is offline and you try to load a video. The video will attempt to load the source on Android through ExoPlayer. This error of failing to load is reported through the event stream to the client. However, this does not complete the initialization `Completer` leaving the `Future stalled waiting for the completer to complete which it never will.
Fixes issue where `initialize()` `Future` stalls when failing to load source data and does not throw error. For example if the network is offline and you try to load a video. The video will attempt to load the source on Android through ExoPlayer. This error of failing to load is reported through the event stream to the client. However, this does not complete the initialization `Completer` leaving the `Future stalled waiting for the completer to complete which it never will.
Fixes issue where `initialize()` `Future` stalls when failing to load source data and does not throw error. For example if the network is offline and you try to load a video. The video will attempt to load the source on Android through ExoPlayer. This error of failing to load is reported through the event stream to the client. However, this does not complete the initialization `Completer` leaving the `Future stalled waiting for the completer to complete which it never will.
Description
Fixes issue where
initialize()Futurestalls when failing to load source data and does not throw error.For example if the network is offline and you try to load a video. The video will attempt to load the source on Android through ExoPlayer. This error of failing to load is reported through the event stream to the client. However, this does not complete the initialization
Completerleaving the `Future stalled waiting for the completer to complete which it never will.