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

[video_player, video_player_web] PlatformException fix #2483

Merged
merged 5 commits into from
Jan 27, 2020

Conversation

ditman
Copy link
Member

@ditman ditman commented Jan 24, 2020

Description

When videoElement.onError triggers, we create a PlatformException with data coming from the videoElement.error object, and add it as an error to the eventController Stream.

Before this change, the Event passed in to onError was passed directly to the Stream (but listeners at the other end are expecting a PlatformException.)

The PR also returns the Future coming from videoElement.play() up the stack, so it can be handled properly (especially when it errors). This was causing issues in tests, when that unhandled Future would error unexpectedly.

This also updates the documentation for both video_player and video_player_web with regards to installation and browser support.

Related Issues

Fixes: flutter/flutter#48884

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.

Note: there's a minor API change in the play() method of the private _VideoPlayer class. The change seems to be backwards-compatible.

* Bump version and update CHANGELOG.
…rror`.

* Return the `videoElement.play()` Future from the implementation of the
`play()` method, so we don't end up with unhandled Futures in tests or
otherwise.
* Update README
* Bump version and CHANGELOG
@ditman
Copy link
Member Author

ditman commented Jan 24, 2020

/cc @cbenhagen does this make sense to you?

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

LGTM with nit

@ditman
Copy link
Member Author

ditman commented Jan 25, 2020

(I'll merge and release this on monday, all is green now!)

@ditman ditman merged commit 0fa7230 into flutter:master Jan 27, 2020
@ditman ditman deleted the platform-exception-event-fix branch January 27, 2020 17:32
@ditman
Copy link
Member Author

ditman commented Jan 27, 2020

WoodyGuo pushed a commit to liuwei1130/plugins that referenced this pull request Feb 10, 2020
…convert them to PlatformExceptions (flutter#2483)

video_player_web:

* Add a `PlatformException` to the event Stream `onError`, instead of the Event coming straight from the DOM.
* Handle videoElement.play() rejection. Funnel that as a PlatformException to the event Stream as well.
* Update documentation about web-specific _quirks and features_.

video_player:

* Add documentation about the web platform.
WoodyGuo pushed a commit to liuwei1130/plugins that referenced this pull request Feb 10, 2020
…convert them to PlatformExceptions (flutter#2483)

video_player_web:

* Add a `PlatformException` to the event Stream `onError`, instead of the Event coming straight from the DOM.
* Handle videoElement.play() rejection. Funnel that as a PlatformException to the event Stream as well.
* Update documentation about web-specific _quirks and features_.

video_player:

* Add documentation about the web platform.
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
…convert them to PlatformExceptions (flutter#2483)

video_player_web:

* Add a `PlatformException` to the event Stream `onError`, instead of the Event coming straight from the DOM.
* Handle videoElement.play() rejection. Funnel that as a PlatformException to the event Stream as well.
* Update documentation about web-specific _quirks and features_.

video_player:

* Add documentation about the web platform.
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_web] Passing an Event as a PlatformException
3 participants