Overview

The Entreluma Audio Viewer adds a compact player for an audio file — an oral-history interview, a reading, a piece of music — with an optional title and caption. It follows the site’s light and dark modes, and, like the video viewers, it supports timed playback and action links, so the text of a story can play a particular passage.

The player handles any format the reader’s browser can play. MP3 and M4A (AAC) work everywhere; Ogg and WAV work in most browsers.

Attributes

Required Attributes

src

The audio file. A plain filename is resolved against the post’s media_subpath, exactly as images are; a full URL is used as is.

1
2
src="interview.m4a"
src="https://upload.wikimedia.org/wikipedia/commons/2/2a/Gymnopedie_No._1_%28ISRC_USUAN1100787%29.mp3"

Optional Attributes

title

A short title shown above the controls. It also labels the player for screen readers.

1
title="Interview with Mary Wynne"

caption

Text shown below the controls, typically a credit or licence. Markdown links and HTML are allowed.

1
caption="Recorded 1978. Courtesy of the Kent Archives."

start

The initial playback position, expressed as seconds, m:ss, or h:mm:ss.

1
start="1:30"

end

The position at which playback pauses. It uses the same formats as start and must be later than the start time.

1
end="2:15"

autoplay

Starts playback when the page loads. Browsers usually block audio autoplay until the reader has interacted with the page, so use this sparingly.

1
autoplay="true"

loop

Repeats the recording when it reaches the end.

1
loop="true"

id

A unique viewer identifier, required when an action link targets the player.

1
id="audio1"

class

Size and position words such as medium right float; see Formatting Tips.

1
class="medium right"

Examples

Basic Player

1
2
3
4
5
{% include embed/audio.html
    src="https://upload.wikimedia.org/wikipedia/commons/2/2a/Gymnopedie_No._1_%28ISRC_USUAN1100787%29.mp3"
    title="Gymnopédie No. 1 — Erik Satie"
    caption="Performed by Kevin MacLeod. [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/), via Wikimedia Commons."
%}

A Local File

Place the file alongside the post’s other media and refer to it by name:

1
2
3
4
{% include embed/audio.html
    src="interview.m4a"
    title="Interview, 1978"
%}

Give the player an id, then target it from ordinary Markdown text:

1
[Hear the opening phrase](audio1/playat/0,0:20)

Try it on the example above: hear the opening phrase, continue from 1:00, or pause.

Unlike the video viewers, playat plays in place rather than opening an expanded dialog. The play action takes an optional start time; pause takes none. See the Action Links reference.

In a Tab Group

Adjacent viewers are combined into a tab group, and the audio player’s tab shows a headphones icon. This is a convenient way to pair a recording with a portrait or a transcript image.

1
2
3
4
5
6
7
{% include embed/image.html
    src="wc:Erik_Satie_by_Henri_Manuel.jpg"
%}
{% include embed/audio.html
    src="https://upload.wikimedia.org/wikipedia/commons/2/2a/Gymnopedie_No._1_%28ISRC_USUAN1100787%29.mp3"
    title="Gymnopédie No. 1 — Erik Satie"
%}

Troubleshooting

  • “Unable to load audio file.” Check the filename and media_subpath, and that the file is published with the site. A full URL must allow embedding by other sites.
  • Nothing plays in Safari. Safari does not play Ogg; supply MP3 or M4A instead.
  • Autoplay doesn’t start. Browsers block autoplaying sound until the reader interacts with the page. This is expected.
  • Older posts using {% include audio.html %} continue to work; that tag is an alias for embed/audio.html.