Disable iframe autoplay

*

8120 visibility 0 arrow_circle_up 0 arrow_circle_down

I have tried the following code:

I have tried many things but not getting any solution. I want to disable the autoplay on the video and don't want to use tag so its possible without tag?

Answer - 1

0 arrow_circle_up 0 arrow_circle_down

I think this is what you want.

function a[] { var iframe = document.getElementById["iframe"]; iframe.src = "video.mp4" } Play
Answer - 2

0 arrow_circle_up 0 arrow_circle_down

According to this article the syntax should go like this:

This is fairly new [at least to me] and I don't see explicit directions as to how autoplay is shut off. Try either the second or third example. This is part of the new feature policy called iframe delegation which will go into full effect on april 2018. I will add onto this answer if I find more concrete info.

Answer - 3

0 arrow_circle_up 0 arrow_circle_down

iframe does not support this by default. Why do you not want to use video tag? The only thing I can think of to make it look like an iframe without autoplay is with help of javascript.

First set the iframe src to empty or leave the src out. Set a picture as iframe background to make it look like the video.

Then create an title event for that iframe and change the iframe src

function loadVideo[] { var frame = document.getElementById["frame"]; frame.src = "video.mp4"; }

I would consider using video tag or a plugin that works on every browser.

Video liên quan

Chủ Đề