Hi everyone,
I've been playing around with Twine for a little while, but I'm struggling with a couple of things. Namely, audio - I love to have audio in my scenes if possible, and about a year ago I had it working in Twine 1 via youtube links. This worked great, though it sort of required the viewer to have AdBlocker or ads would play before some sounds.
Basically, I'm after a way to have sound in my Twine game hosted online and played in-game, so I can share the Twine game (probably have it hosted somewhere) and not have to send a big bunch of sound files to whoever wants to play it.
I'm happy to use Harlowe, Snowman or Sugarcube for this, I'm just not sure on a method. I've spent quite a while searching online and there've been a few solutions, but I haven't been able to get any working. So;
* How do I play audio that's being hosted somewhere online?
* What's a good place to host my audio?
It seems like two questions in one, and it sort of is, but I'm essentially just trying to find out how I can add sounds to my Twine game and have them play without any reliance on local files.
Thanks for your time!
Comments
So that means I just add the links in the header or the css or the passage, and the audio plays the way it should. Since you have been here more than a year, I am going to assume that you know how to do that part already and this is more a question of hosting audio.
Assuming you don't have a website, you could always go to a place like http://www.theyoump3.com/ in order to convert the YouTube video into an mp3 and then once you have that you could base64 encode the resulting audio (not advocating piracy--except maybe Jack Sparrow, savvy?).
With the base64 code, you now use this:
Does that answer the question?
If you are using SugarCube then I suggest reading about the audio related macros (v2 and v1) but basically you use <<cacheaudio>> to cache your sound files, and then use <<audio>> to play them. Something like the following:
Your other choice (which should work for any story format) is to use a HTML audio element, which would look something like the following:
Beyond that, if you're going to use the <audio> element, then I'd suggest specifying the codec as well as the basic MIME-type. Based on the URL you specified (which, again, does not seem valid), that would be: Note: The semi-colon between the src and type attributes is a forum error and should not be there, the forums here do that for some reason, and it should be removed. The only semi-colon in the above example which should be there is the one within the type attribute.