0 votes
by (2k points)
This is what I'm trying to use:

(live: 4s)[<audio src="https://www.dropbox.com/s/tzhqrnqheccr7cm/Metal%20Hit%20Sound%20Effects%20All%20Sounds.mp3?dl=1" autoplay>]

1 Answer

+2 votes
by (154k points)
selected by
Best answer

note: You don't state this in your question but based on your example it appears that you are trying to play an audio file after a 4 second delay.

The (live:) macro is a type of loop, it executes the contents of it's associated hook every X milliseconds until either:

a. A Passage Transition occurs.
b. A (stop:) macro is used to end the loop.

To use the (live:) macro as a form of delay you need to call the (stop:) macro so that the contents of associated hook is only executed a single time.

(live: 4s)[{
	<audio src="https://www.dropbox.com/s/tzhqrnqheccr7cm/Metal%20Hit%20Sound%20Effects%20All%20Sounds.mp3?dl=1" autoplay>

a. The above code is untested because I don't have access to your audio file.

b. Folder & File names are case sensitive in most Operating Systems (excluding Windows), because of this web-developers generally only use single case letters (lower-case) when naming them. Space characters can also cause issues when used in folder & file names, because of this web-developers generally replace them with either a standard dash / minus sign character (-) or a standard underscore character (_)


c. Many modern web-browsers (especially those used on mobile devices) don't allow the autoplaying of media files until after the end-user has interated with the web-page. (eg. clicked on a link, etc...) Because of this autoplaying a media file within the first Passage of a story may not work.

by (2k points)
Thank you ver much.
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.