Set start and end time for an embedded audio clip in Quarto HTML presentation

I am creating a Quarto HTML presentation, and I want to embed an audio file but set the start and end time for each slide. Is there an easy way to do this? There seems to be for videos, but not audio. For videos you could use the shortcode:

{{< video https://www.youtube.com/embed/wo9vZccmqwc
    title="What is the CERN?"
    start="116"
    aspect-ratio="21x9" 
>}}

Source: Videos – Quarto

But if I try this with my audio file I get an error about the media (note the audio file is local, so not sure if that is also an issue, but I think the local video issue was resolved, and I have the most up-to-date Quarto installation, so it shouldn't be that?).

This audio html tag solution works to embed video, but does not support start and end times, as it would in a standard website:

<audio controls=1 src="audio/audiofile.mp3#t=3" preload="auto"></audio>

Any help to move forward on this would be greatly appreciated!

I can replicate this if I'm only using quarto preview, but when I quarto render it into an HTML, it seems that the audio controls load up on the correct time stamp.
I'm not sure why there would be a different in the preview and rendered versions.

this is the reprex quarto file I used:

---
title: Audio start example
format: html
---


<audio controls src="https://download.samplelib.com/mp3/sample-3s.mp3#t=00:00:01"></audio>
1 Like

Thanks Dan for looking at this, it's helpful!

1 Like

This is also a Quarto Extension to help with this