You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/video_player/video_player_web/README.md
+55-12Lines changed: 55 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -5,49 +5,92 @@ The web implementation of [`video_player`][1].
5
5
## Usage
6
6
7
7
This package is [endorsed](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin),
8
-
which means you can simply use `video_player`
9
-
normally. This package will be automatically included in your app when you do.
8
+
which means you can simply use `video_player` normally. This package will be
9
+
automatically included in your app when you do.
10
10
11
-
## dart:io
11
+
## Limitations on the Web platform
12
12
13
-
The Web platform does **not** suppport `dart:io`, so attempts to create a `VideoPlayerController.file` will throw an `UnimplementedError`.
13
+
Video playback on the Web platform has some limitations that might surprise developers
14
+
more familiar with mobile/desktop targets.
14
15
15
-
## Autoplay
16
-
Playing videos without prior interaction with the site might be prohibited
17
-
by the browser and lead to runtime errors. See also: https://goo.gl/xX8pDD.
16
+
In no particular order:
18
17
19
-
##Mixing audio with other audio sources
18
+
### dart:io
20
19
21
-
The `VideoPlayerOptions.mixWithOthers` option can't be implemented in web, at least at the moment. If you use this option it will be silently ignored.
20
+
The web platform does **not** suppport `dart:io`, so attempts to create a `VideoPlayerController.file`
21
+
will throw an `UnimplementedError`.
22
+
23
+
### Autoplay
24
+
25
+
Attempts to start playing videos with an audio track (or not muted) without user
26
+
interaction with the site ("user activation") will be prohibited by the browser
27
+
and cause runtime errors in JS.
28
+
29
+
See also:
30
+
31
+
*[Autoplay policy in Chrome](https://developer.chrome.com/blog/autoplay/)
32
+
* MDN > [Autoplay guide for media and Web Audio APIs](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide)
33
+
* Delivering Video Content for Safari > [Enable Video Autoplay](https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari#3030251)
34
+
* More info about "user activation", in general:
35
+
*[Making user activation consistent across APIs](https://developer.chrome.com/blog/user-activation)
36
+
* HTML Spec: [Tracking user activation](https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation)
37
+
38
+
### Some videos restart when using the seek bar/progress bar/scrubber
39
+
40
+
Certain videos will rewind to the beginning when users attempt to `seekTo` (change
41
+
the progress/scrub to) another position, instead of jumping to the desired position.
42
+
Once the video is fully stored in the browser cache, seeking will work fine after
43
+
a full page reload.
44
+
45
+
The most common explanation for this issue is that the server where the video is
46
+
stored doesn't support [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).
47
+
48
+
> **NOTE:** Flutter web's local server (the one that powers `flutter run`) **DOES NOT** support
49
+
> range requests, so all video **assets** in `debug` mode will exhibit this behavior.
50
+
51
+
See [Issue #49360](https://github.com/flutter/flutter/issues/49360) for more information
52
+
on how to diagnose if a server supports range requests or not.
53
+
54
+
### Mixing audio with other audio sources
55
+
56
+
The `VideoPlayerOptions.mixWithOthers` option can't be implemented in web, at least
57
+
at the moment. If you use this option it will be silently ignored.
22
58
23
59
## Supported Formats
24
60
25
61
**Different web browsers support different sets of video codecs.**
26
62
27
63
### Video codecs?
28
64
29
-
Check MDN's [**Web video codec guide**](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs) to learn more about the pros and cons of each video codec.
65
+
Check MDN's [**Web video codec guide**](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_codecs)
66
+
to learn more about the pros and cons of each video codec.
30
67
31
68
### What codecs are supported?
32
69
33
-
Visit [**caniuse.com: 'video format'**](https://caniuse.com/#search=video%20format) for a breakdown of which browsers support what codecs. You can customize charts there for the users of your particular website(s).
0 commit comments