Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Audio Files (Harlowe)

I'm coding a game using Twine 2 - Harlowe (latest version), and I'm having a hard time adding audio. I have an mp3 file that simply doesn't play when loading the page. I'm using the following model and neither one works. Please help!

<audio src="http://domainname/foldername/audioname.mp3"; autoplay>
Your browser does not support the <code>audio</code> element.
</audio>

<audio src="foldername/audioname.mp3" autoplay>
Your browser does not support the <code>audio</code> element.
</audio>

Comments

  • warning: Mobile web-browser can have restrictions on when you can auto-play a media file, they sometime require user interaction to do so.

    The syntax of both of your examples are correct (assuming the URL's are valid) but there are restrictions on when they will work.

    1. The hosted URL:

    This will work when using the Test and Play options of the web-browser based release of Twine 2 (both hosted and downloadable), it WON'T work for those same two options in the install-able release of Twine 2 because it's custom web-browser does not support the playing of media files.

    The audio element will also work when running a story HTML file created via the Publish to File option in either release of Twine 2.

    2. The local relative reference URL:

    This will only work within a story HTML file created via the Publish to File option and only if the HTML file is stored (saved) relative to the media file's location. It WON'T while using the Test and Play options because the HTML content created by those options only exists in memory so there is no physical HTML file for the media files to be relative to.
  • Greyefl,
    Thanks for the info and for your time. It helped a lot. I Published to File and it worked well (hosted URL).
    FJC
Sign In or Register to comment.