Stopping / resetting all audio


#1

If I wanted to pause audio but wasn’t sure which audio file was playing at any given time, usually I’d use getElementsByTagName to loop through all audio elements to pause any that are playing and reset their currentTime to 0.

However, in Hype, I’ve created the audio elements as global variables in Head HTML. As a result, getElementsByTagName returns an empty array. I assume this is because they aren’t being embedded in the DOM.

Is there an elegant way to do this without throwing them into the innerHTML of elements to make this work?


(Hans-Gerd Claßen) #2

search them within the head¿

var headContent = document.getElementsByTagName('head').thenyourquery(...)

but it’s just a guess as your setup is not clearly explained and no sample attached …


(Hans-Gerd Claßen) #3

btw did you know of those audio-extensions:


#4

thanks Hans-Gerd. Obviously, I explained it clearly enough for you to help me! Pretty efficient, no?

that second post with the audio-extensions does what I need. I thought it would be something Hype-ish that I was unaware of.

Cheers.


(Hans-Gerd Claßen) #5

good, though … this thread is not of any help if someone may have a simular problem.
I’d keep in mind that a forum should be a place of help and exchange too. :slight_smile:


#6

sigh…

I’d keep in mind that if you police the forums too strictly and tell people what they’ve posted is “not of any help” even if it quite likely does describe an issue in enough detail, you’re likely to put people off posting at all.

Feel free to check back through my posts to see where I’ve described in minute detail other issues I’ve faced as well as added projects to my requests on multiple threads.

Unfortunately, when I’m faced with tight deadlines at work, I don’t always have the luxury of going into as much detail as I’d like.


(Hans-Gerd Claßen) #7

there’ll be plenty of possibilities to do such implementation

so what in detail¿

//////////////////////
i may have been to strict indeed … and it’s not my duty :wink:
but i’d say that pointing out that forum means exchange is not that bad :slight_smile:
have a sunny day!


(Mark Hunte) #8

I will be honest, it was one of the reasons why I did not try and help on this as I would have been guessing.

It would be of interest to me though if you could post the code setup you used, when you do have a moment @hyperthetical

Cheers.