« Web, HTML, Tech Forum

i give up. plz help

Posted by xSkyex

posted

Forum: Web, HTML, Tech

i seriously cant for the life of me get a fricken embedded youtube video to autoplay. ive tried like 40 websites and 30 different variations of an embed code. 


HELP ME PLZ


Report Topic

1 Reply

Reply by Tommy Panzram

posted
updated

Yeah it's a bit of  a pain because of how the code gets filtered on SpaceHey, but I have it working on my page (I also have the player hidden so it just plays in the background) so here's how I got it going:


Get your youtube embed code from the video you want to autoplay. Paste your code in to notepad (you can just paste it in your about me or whatever if you'd like, I'm just trying to keep it simple). Find the url inside of the embed code then add "?autoplay=1" to the end of the url while staying inside of the quotation marks. This should trigger the autoplay. However, if you test this on mobile it will not work. For some reason you can't get YouTube to autoplay on mobile (atleast, I can't get it figured out and I've never seen it work. If this has changed recently I'm not aware of it). You can do this with SoundCloud embeds though.

If you have any issues just let me know and I'll try to help you out.

I'm going to paste my actual working youtube embed code below this message. You can use it to reference with your own code. Remember that mine is set to be hidden from the user, so don't worry about what is in the style tag.

<iframe width="0" height="0" style="position: absolute; top: -999px;" src="https://www.youtube.com/embed/bctVAjI14YY?autoplay=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" class="ui-droppable"></iframe>


Report Reply