howlerServer | R Documentation |
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())
deleteTrack(id, track, session = getDefaultReactiveDomain())
playHowl(id, session = getDefaultReactiveDomain())
pauseHowl(id, session = getDefaultReactiveDomain())
togglePlayHowl(id, session = getDefaultReactiveDomain())
stopHowl(id, session = getDefaultReactiveDomain())
seekHowl(id, seek, session = getDefaultReactiveDomain())
changeHowlSpeed(id, rate = 1, session = getDefaultReactiveDomain())
id |
ID of the |
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 |
rate |
Rate (from 0.5 to 4.0) of the audio playback speed |
For 'deleteTrack', make sure that the name is used of the track rather than the file name.
Updates the the state of the specified howler
in the shiny application.
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.