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

[video_player_web] fix: set autoplay to false during initialization #3985

Merged
merged 3 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/video_player/video_player_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 2.0.1

* Fix videos not playing in Safari/Chrome on iOS by setting autoplay to false
* Change sizing code of `Video` widget's `HtmlElementView` so it works well when slotted.
* Move tests to `example` directory, so they run as integration_tests with `flutter drive`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ class _VideoPlayer {
// Allows Safari iOS to play the video inline
videoElement.setAttribute('playsinline', 'true');

// Set autoplay to false since most browsers won't autoplay a video unless it is muted
videoElement.setAttribute('autoplay', 'false');

// TODO(hterkelsen): Use initialization parameters once they are available
ui.platformViewRegistry.registerViewFactory(
'videoPlayer-$textureId', (int viewId) => videoElement);
Expand Down