Insert Autoplay Video

// Not guaranted to be autoplayed because of various browser policies... const insertVideo = (url,el) => { const newVid = document.createElement("video"); newVid.setAttribute("src", url); newVid.setAttribute("autoplay", true); newVid.setAttribute("playsinline", true); newVid.setAttribute("loop", true); newVid.setAttribute("style", "width: 100%"); document.querySelector(el).appendChild(newVid); }; insertVideo("", "body");

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.