The web implementation of
This package is the endorsed implementation of
video_player for the web platform since version
0.10.5, so it gets automatically added to your application by depending on
No further modifications to your
pubspec.yaml should be required in a recent enough version of Flutter (
... dependencies: ... video_player: ^0.10.5 ...
Once you have the correct
video_player dependency in your pubspec, you should
be able to use
package:video_player as normal, even from your web code.
The Web platform does not suppport
dart:io, so attempts to create a
VideoPlayerController.file will throw an
Playing videos without prior interaction with the site might be prohibited by the browser and lead to runtime errors. See also: https://goo.gl/xX8pDD.
Supported Formats #
Different web browsers support different sets of video codecs.
Video codecs? #
Check MDN's Web video codec guide to learn more about the pros and cons of each video codec.
What codecs are supported? #
Visit caniuse.com: 'video format' for a breakdown of which browsers support what codecs. You can customize charts there for the users of your particular website(s).
Here's an abridged version of the data from caniuse, for a Global audience:
- Make the pedantic dev_dependency explicit.
- Add a
PlatformExceptionto the player's
eventControllerwhen there's a
videoElement.onError. Fixes https://github.com/flutter/flutter/issues/48884.
- Handle DomExceptions on videoElement.play() and turn them into
PlatformExceptionas well, so we don't end up with unhandled Futures.
- Update setup instructions in the README.
- Add an android/ folder with no-op implementation to workaround https://github.com/flutter/flutter/issues/46898.
- Support videos from assets.
- Remove the deprecated
author:field from pubspec.yaml
- Require Flutter SDK 1.10.0 or greater.
- Initial release
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: video_player_web: ^0.1.2+1
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Feb 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.5
- Flutter: 1.12.13+hotfix.7
The package description is too short. (-17 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
video_player_web.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.0.0-dev.28.0 <3.0.0|