After the little thread on Uralic Languages, I went looking (randomly) for information on Nganasan. (Hey, it starts with a velar nasal. Who can resist?)
I found this page:
At the end of the page there are two texts, with audio recordings (mp3s) and transcriptions. Awesome.
However, the audio files are only linked to, rather than made playable within the page itself. That’s kind of a bummer, since the web fully supports inline audio players.
So I thought I’d share a little Javascript what I do in such situations. I just threw it together, but I think it’s worth while in that it helps to lift the veil a little bit on what is actually going on inside a browser.
(Hosted at the internet archive)
Here’s the outline I worked from:
CSS
- Select links
- Select links to mp3s
Javascript
-
Get the link to the audio
- Select links to mp3s
- Access each link’s href attribute
-
Create an audio player to play that link
- How to create an audio player
- How to set the audio player’s src attribute
-
Step through all the links and create an audio player for each one
- Iterate through each link
- Carry out steps 1 and 2 to create an audio player for that link
- Place the audio player after the link in the DOM
If anyone actually finds this interesting, I’d be happy to go through what’s going on in more detail.