I'm building a Shiny app where users will be able to play snippets of an audio file. The time stamps are from a JSON file to mark each sentence in the audio file. To play the audio I was originally using runjs() like so:
in my input function:
tags$audio(id = "audio", controls = NA, autoplay = NA, src = "")
and in the server function:
observeEvent(input$select.file, {
runjs(sprintf("document.getElementById('audio').src = '%s';", input$select.file))
})
but I think this will not work for playing a certain segment of the audio. I have been looking at RStudio resources like this one on playing audio, but I haven't found anything showing how to play a section of the audio that doesn't necessarily start at the beginning.