Getting music to play in the background of specific pages in a Twine game is relatively simple as long as the music comes from a YouTube video.
Open the YouTube video where the music you want to autoplay is sourced. Under the actual video, second from the left you will see a tab labeled “share”, click it.
After you click on it, the first tab that will appear will be a general share URL. Instead of using that link, click the link next to “share” labeled “embed”.
A new link will appear that’s formatted with html coding. Highlight and copy the embed link.
Open twine and click on the page box where you want the music the play.
Copy and paste the embed link into the dialogue box for the page where you want the music to autoplay.
Within the embed link is the URL for the YouTube video. Locate the URL and at the end, right before the quotation mark. Type in the following: ?autoplay=1
This will cause the video to automatically play.
Locate where it says “width=” and “height=” within the embed link. Change the following number in quotation marks to zero. This will cause the video player to not appear which will make the music seem as if it’s playing in the background.
Close the dialogue box and save your game. The music should now play in the background.