0 votes
by (120 points)

Massive beginner here. I cannot for the life of me figure out how to make sound effects play. I tried pasting

<audio src="https://www.dropbox.com/s/gdvznlmh20e9ion/the-hum-for-5-minutes.mp3?dl=1" autoplay>

into my intended passage, but to no avail. Furthermore having it at the top of my passage completely removes all the text beneath it from displaying, although variables defined beneath it are still defined in debug mode. I genuinely have no idea what I'm doing wrong.

1 Answer

0 votes
by (61.5k points)
The <audio> tag needs to be closed.
by (120 points)

I'm not sure what you mean. Like this?

<audio> src="https://www.dropbox.com/s/gdvznlmh20e9ion/the-hum-for-5-minutes.mp3?dl=1"autoplay>

I tried that as well as closing autoplay and removing the spaces between things. Nothing so far has helped, the same initial problem is still there.

by (23.6k points)

Closing means you need to put a </audio> at the end:

<audio src="https://www.dropbox.com/s/gdvznlmh20e9ion/the-hum-for-5-minutes.mp3?dl=1" autoplay></audio>

 

by (63.7k points)

You already have the correct answer, but to expand on it a bit:  In HTML there are elements that generally have a start and an end tag, which are called normal elements, and elements that only have a start tag, which are called void elements.

  • Examples of normal elements: <p>…</p> and <a>…</a>.
  • Examples of void elements: <img> and <br>.

The <audio> element is a normal element, so it should have a start and an end tag—e.g. <audio>…</audio>.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...