diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index 63d950c21eb8..38bfe90f7b1e 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -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`. diff --git a/packages/video_player/video_player_web/lib/video_player_web.dart b/packages/video_player/video_player_web/lib/video_player_web.dart index 560c4afc0869..f9e27d16725a 100644 --- a/packages/video_player/video_player_web/lib/video_player_web.dart +++ b/packages/video_player/video_player_web/lib/video_player_web.dart @@ -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);