Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Sing Me a Song

7 years ago

So I was stalking profiles and found out about certain profile pics like Sky's, which actually play music when you visit the page.
So I know that you can upload background images to storygame pages, much like on would do so on his/her profile. But I was wondering if loading music on storygame pages was possible. Is there some code for it? Assuming there is, would it restart each time a new page is visited?

@SkyTenshi You might know something about this.
@BradvinDvorak Seeing as you're an expert on code and all.

Sing Me a Song

7 years ago
Oh. I know this one x3

Excuse me. I have to turn on RTE

I've done this on other sites before...

Since RTE is being a bit buggy, I'll just PM you...

Sing Me a Song

7 years ago

(Meant to type in @BradinDvorak)

Sing Me a Song

7 years ago

Well, you already got your HTML5 method, but you can also do it the Tenshi way with any YouTube video. You just get the embed link, change width and height to 1 (or put style="display:none" after "iframe"), and add "?autoplay=1" to the end of the src attribute. e.g.:

<iframe style="display:none" width="1" height="1" src="https://www.youtube.com/embed/aOvTF2gBBAE?autoplay=1" frameborder="0" allowfullscreen></iframe>

With both of these methods, the music does stop every time a new page is loaded, and neither works with mobile devices since they won't autoplay anything.

Sing Me a Song

7 years ago

Is there any way to make it continuous? I've considered the alternative of just providing a link to YouTube or something, but if I can incorporate it into the game, that'd be even better.

Sing Me a Song

7 years ago

The closest I've come to that is by putting all the audio in the storygame's description and then controlling it within the storygame itself (example here), but there are issues and anyone can just close out the description, etc., so linking a YouTube video isn't really a bad alternative.

ENCORE!

7 years ago

Bump.

This is more for profile purposes. Is there anyway to make the song that plays randomly selected from a list of songs?

ENCORE!

7 years ago

Get a bunch of YouTube video embed sources and then use JavaScript to randomly pick one and add it to the page.

<script> var srcs = [ "https://www.youtube.com/embed/aOvTF2gBBAE", "https://www.youtube.com/embed/zaFN8J9j-W8", "https://www.youtube.com/embed/jdRCNM2k42o", "https://www.youtube.com/embed/QKiZJCFYAbg" ]; var iframe = document.createElement("iframe"); iframe.style.display = "none"; iframe.src = srcs[Math.floor(srcs.length*Math.random())] + "?autoplay=1"; document.body.appendChild(iframe); </script>

Sing Me a Song

7 years ago

Sing Me a Song

7 years ago

There's velcro out there that isn't that catchy.