An iframe added to the DOM with the 'allow="autoplay"' attribute and value in response to a user click event will not auto play video content with volume. *On iPad iOS 12.0.1 in Safari or Chrome* - Expected results: When the user clicks on the play button, the video plays with sound - Actual results: When the user clicks on the play button, the video is blocked from autoplaying The provided example below illustrates the issue. I've also provided the sample here: https://github.mlbam.net/pages/jcrosby/html-player-test/iframe-embed.html *simple-video.html* <video controls playsinline autoplay src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" width="480" height="270"></video> *iframe-embed.html* <button id="play-btn">PLAY</button> <div id="video-container"></div> <script> document.addEventListener('DOMContentLoaded', function() { var videoCntr = document.getElementById('video-container'); var playBtn = document.getElementById('play-btn'); var ifm = document.createElement('iframe'); ifm.setAttribute('src', '/simple-video.html'); ifm.setAttribute('allow', 'autoplay'); ifm.setAttribute('scrolling', 'no'); ifm.setAttribute('width', 480); ifm.setAttribute('height', 270); playBtn.addEventListener('click', function(event) { videoCntr.appendChild(ifm); }); }); </script>
Public sample page: https://www.jccrosby.com/playground/test-html-playback/iframe-embed.html
Thank you for the report! Could you please confirm whether this was happening in earlier iOS version, or new in iOS 12?
<rdar://problem/45467412>
Seems new in iOS 12.
I suspect that this has nothing to do with "allow=autoplay", since we do not honor that attribute. Instead, I suspect that the iframe does not actually load simple-video.html synchronously when added to the DOM, and thus the video element isn't created within an active user gesture. In other words, it's surprising that this ever worked, and I don't anticipate that we will fix this.