HAH, THERE'S A BETTER WAY!
OK, make a public or unlisted playlist on YouTube and load it with the music you want, then use this code. It is working! Ignore what's below, but I'll leave it for posterity. Thanks to subfuse for figuring this out! Your playlist can be as long as you'd like, and each song can be as long as you'd like, as far as I can tell.
Caveats: Ad blockers need to be completely off, or at least passing though YouTube and SpaceHey. (But we should be allowing ads on SpaceHey anyway just in case, to support An) In my testing, it works in Safari only when a user clicks on the browser anywhere within like the first second of the page loading. (I'm mulling over how to fix that.) Chrome it works better, Edge it works great. Firefox it may not work at all. It will definitely not work on mobile.
<iframe style="opacity:0;position:absolute;pointer-events:none;" frameborder="no" src="https://www.youtube.com/embed/videoseries?list=[YOUR YOUTUBE PLAYLIST ID HERE];&autoplay=1" allowfullscreen=""></iframe></p>
BIG HUGE HONKIN' CAVEAT: This only reliably works with YouTube clips that are 10 seconds or less in duration. Also this will not work on mobile, at least not on iPhone.
<iframe src="https://www.youtube.com/embed/[YOUTUBE ID GOES HERE]?&;autoplay=1" frameborder="0" class="hideobj"></iframe>
Then somewhere in your style code, put this to hide it:
.hideobj{ visibility: hidden; height: 20px; width: 0%; }
And then your audio sound effect that's 10 seconds or less will automatically play!
Comments
Displaying 11 of 11 comments ( View all | Add Comment )
LunaKniteWolfe13
Will this work with spotify as well?
I can’t guarantee it’ll work with Spotify.
by Cory
;
;
Report
sakon
thxxxx
Kathleen
have no idea what I'm doing incorrectly, I understand this concept with a singular video...
PhillySoHostile
This does not work for me
.
I'm on Chrome v88 - 64bit - Win 10 latest update
THIS IS WHAT I HAVE SO FAR:
iframe style="opacity:0;position:absolute;pointer-events:none;" frameborder="no" src="https://www.youtube.com/embed/videoseries?list=https://youtube.com/playlist?list=PL1CBvYw0kxXY5uD2AclKXFi4GGdvLAZEi;&autoplay=1" allowfullscreen="">
by PhillySoHostile; ; Report
you are missing the
by DropDeadNola; ; Report
It doesn't show me what you said.
All your comment says is "You're missing the...." If it was code, it automatically gets deleted from comments.
by PhillySoHostile; ; Report
Josefina
Oh my god, this works!!!
I've spent too many (embarrassing) hours trying to figure this out, before I found this code. Bless.
Thank you!
Tyybot
Is it possible to have the playlist shuffle?
So to say, every time someone visits your profile, a different song plays?
Rainstorm Moonbow
Thanks for this. I find if I add a live music youtube stream it plays different songs all day. Found a nice lo-fi live feed.
Makes my profile take longer to load though, but it's all for the aesthetic. xD
Everything we do is for the aEsThEtIc
by Cory
;
;
Report
David Freitag
Thank you so much I've almost recreated the profile from when I was 13.
Rainstorm Moonbow
& Keeps changing to & a m p ;
FiendOcular
Does it still have to be 10 seconds?
ufish
heck yeah, im glad you thought this was cool. it should technically work for any embed/iframe supported on spacehey that also has an autoplay function. it's a lil weird tho, like if say you have youtube/soundcloud muted on another tab it won't have sound on your page. also adblockers and mobile aren't always a fan.