It generally helps if you state which story format you are using because the answer can be different for each one but in this case the answer is the same for both Harlowe and Snowman 2.
These story formats do not have they own built-in way of playing sound so you will need to use one of the standard HTML5 ways of doing it, for example the <audio> HTML tag. Something like the following.
<audio src="sounds/soundeffect.ogg" autoplay> Your browser does not support the <code>audio element.
[quote]I have tried a similar format to the method for images: There is currently no built-in way to display images either, so again you have to use standard HTML, the <img> tag in this case:
In Harlowe, I am using the html5 code to play a sound in a passage, but it only plays for 1 second:
<audio controls autoplay loop> <source src="sounds/soundeffect.ogg" type="audio/ogg"> Your browser does not support the <code>audio element.
Any idea what could be happening? If I play the sound with the controls, I can hear the entire file so it's not that the file is missing or just one second long.
In Harlowe, I am using the html5 code to play a sound in a passage, but it only plays for 1 second:
<audio controls autoplay loop> <source src="sounds/soundeffect.ogg" type="audio/ogg"> Your browser does not support the <code>audio element.
Any idea what could be happening? If I play the sound with the controls, I can hear the entire file so it's not that the file is missing or just one second long.
Same here. And the passage where my audio loop starts has only a few words. The loop works when inserted via javascript.
This is just the problem I mentioned in the recent post about problems with raw HTML5 audio. If you do an audio-heavy story you need to look into some use of javascript, such as Leon's sound macros at the least.
The code worked perfectly for me. (thank you!)
Is there a way to make it keep playing through despite different passages, like a soundtrack?
It loops only if I stay on that passage.
Comments
These story formats do not have they own built-in way of playing sound so you will need to use one of the standard HTML5 ways of doing it, for example the <audio> HTML tag. Something like the following. [quote]I have tried a similar format to the method for images:
There is currently no built-in way to display images either, so again you have to use standard HTML, the <img> tag in this case:
You could use (if:) macros to set a variable $sound and then something like the following may work:
(note: im not at my machine to test atm)
Don't know how you'd get it to carry across the whole game though :-\
-
Wait - figured out a tasty hack to call any javascript from Harlowe, so I was able to jQuery this iframe on to the <body> and it stayed when moving passages: http://twinery.org/forum/index.php/topic,2260.msg6635.html#msg6635
Thank you!
Did you fix the problem? How did you get around it? Do you mean the passage has too much text?
Thanks,
Same here. And the passage where my audio loop starts has only a few words. The loop works when inserted via javascript.
Is there a way to make it keep playing through despite different passages, like a soundtrack?
It loops only if I stay on that passage.
http://twinery.org/forum/discussion/2260#msg6635
How?