Change the state of the howler player from the server.

playHowl, pauseHowl, togglePlayHowl and stopHowl will all be applied to the current track.

changeTrack will update the track to the file specified.

addTrack will add a new track to the specified player.

changeTrack(id, track, session = getDefaultReactiveDomain())

addTrack(id, track, play_track = FALSE, session = getDefaultReactiveDomain())

playHowl(id, session = getDefaultReactiveDomain())

pauseHowl(id, session = getDefaultReactiveDomain())

togglePlayHowl(id, session = getDefaultReactiveDomain())

stopHowl(id, session = getDefaultReactiveDomain())

seekHowl(id, seek, session = getDefaultReactiveDomain())

Arguments

id

ID of the howler to update

track

Either the track name of the file to change to, or the index of the file to play. If the file is not included in the player nothing will happen.

session

Shiny session

play_track

Logical, should the new track be played on addition?

seek

Time (in seconds) to set the position of the track

Value

Updates the the state of the specified howler in the shiny application.

Examples

if (interactive()) {
  library(shiny)

  tracks <- c("audio/track1.mp3", "audio/track2.mp3")

  ui <- fluidPage(
    title = "howler.js Player",
    selectInput("track", "Select Track", basename(tracks)),
    howler(elementId = "howler", tracks),
    howlerPlayPauseButton("howler")
  )

  server <- function(input, output) {
    observeEvent(input$track, changeHowlerTrack("howler", input$track))
  }

  runShiny(ui, server)
}