I've embedded a video using
<code><iframe src="HS Website Video Final 8-01-12.mp4" style="height: 232px; width: 534px" class="auto-style15" /></iframe></code>
How do I keep it from starting automatically?
I've embedded a video using
<code><iframe src="HS Website Video Final 8-01-12.mp4" style="height: 232px; width: 534px" class="auto-style15" /></iframe></code>
How do I keep it from starting automatically?
Short answer: stop embedding the raw .mp4 inside an <iframe> and use the HTML5 <video> element without an autoplay attribute — the <video> element will not auto-start unless autoplay is present or a script calls play(). Modern browsers additionally block autoplay of audible media by default (muted autoplay is allowed more often). (developer.mozilla.org)
As already moved to <video> and suggested a workaround, the remaining problem (Firefox not playing) is almost always caused by one of three things: codec/platform support, server headers or byte-range support, or the file being loaded from the wrong location. Firefox’s MP4/H.264 playback depends on the operating system’s codecs; on some systems a WebM/OGG fallback is required. Servers must send the correct Content-Type (e.g. video/mp4, video/webm) and support HTTP range requests (206 / Accept-Ranges) for progressive playback and seeking. Inspect the file URL directly in the browser and the Network/Console tabs to see 404s, MIME mismatches or missing 206 responses. (devdoc.net)
Quick, practical checklist (apply before considering a player workaround):
Content-Type: video/mp4 and Accept-Ranges: bytes / 206 Partial Content.ffmpeg -i input.mov -c:v libx264 -c:a aac -movflags +faststart output.mp4
ffmpeg -i input.mov -c:v libvpx-vp9 -c:a libopus output.webm A minimal, defensive HTML example:
<video controls preload="metadata" playsinline width="640" height="360">
<source src="/videos/clip.webm" type="video/webm">
<source src="/videos/clip.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
<script>
// defensive: stop any unexpected autoplay
window.addEventListener('DOMContentLoaded', ()=>{ const v=document.querySelector('video'); if(v) v.pause(); });
</script> If autoplay still appears with an iframe, it’s because the browser is loading the raw media document or a player is forcing play() — migrating fully to <video> plus the checks above is the correct fix. (developer.mozilla.org)
Jump to Post— JameB 66First link from Google when typing out your entire question as is: http://stackoverflow.com/questions/5349716/how-to-make-youtube-embed-code-video-auto-start
First link from Google when typing out your entire question as is: http://stackoverflow.com/questions/5349716/how-to-make-youtube-embed-code-video-auto-start
Thanks for the response however, it does not work. I'm not linking to YouYube.
A quick search tells me that it's not possible... http://www.blackhatworld.com/blackhat-seo/youtube/171955-truth-about-iframes-autoplay.html
.
.
I suggest you work around it (if no one else knows how to do this...) by opening a video in a new window/tab when the user presses a button (idn, call it "watch this video" button)...
I got rid of the iframe tag and replaced it with the video tag. Like so...
<video width="320" height="240" controls="controls">
<source src="movie.mp4" type="video/mp4" ></source>
<source src="movie.ogg" type="video/ogg" ></source>
<source src="movie.webm" type="video/webm" ></source>
<object data="movie.mp4" width="320" height="240">
<embed src="movie.swf" width="320" height="240" />
</object>
</video>
However, it does not work in Firefox.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.