Java Script for audio suddenly stopped working only in desktop-layer

Hello,

something strange happened. I made a Javascript for stopping external audio when hitting a button, like in the description on this link: Controlling Audio & Advanced Techniques (Play, Pause, Rewind, Volume control).
It worked fine, I had no problems but suddenly the button didn’t work on the desktop-layer. iPhone, iPad layers are still working. I made a new button with the same settings, the same JavaScript (it’s really exactly the same that worked before) but it won’t happen. Is this a known issue?

Thanks!
Richard

Can you share a Tumult Hype document (as a zip file) so we can check it out? Also sharing a URL will be helpful as well. You can drop a zip file into your reply here.

blahasblog_podcast_js.zip (1.3 MB)

Thanks very much for the fast response. Here’s the .zip file. And heres the URL: http://www.blahasblog.de/#podcast1 As it is in German, it is the button named “STOP und zum HAUPTMENÜ”. When you click it, the audio should stop and the first scene should load - which it does, but the audio does not stop. But the audio stops in the smaller mobile layouts, although it’s the same button.

Thank you!
Best, Richard

have you tried loading and manipulating audio using the hypeDocument.extensions?

Here’s more: Extend Tumult Hype with JavaScript: hypeDocument.extensions

We had trouble with audio and solved it using this method.

If you do attempt to implement this, place your extension in HeadHTML and make sure that, before it, you had the hypeDocument.getPrivateContainer function which you’ll also find on that page as it’s required by the first script I linked to.

2 Likes

Thanks! What exactly does this? (sorry for my noob question).
As my issue is with external audio only, playing from a server, I don’t know if this could be a solution? I’d like to keep the audio file on the server.

The element ID of your audio element is the same in multiple layouts. When you run a Javascript function targeting the element, the browser doesn’t know which one you mean so isn’t able to stop each of them.

The function @hyperthetical is mentioning is LoadSound & StopSound which can help you get multiple audio objects playing (and stopped) much more easily.

1 Like

Thank you very much for this quick help! Now it works!
My mistake was that I thought that there can be only one audio element for all layouts.

Thanks to you too, @hyperthetical I’ll try that for the other sounds on the website

Cheers! :smile:

1 Like