| howlerButton {howler} | R Documentation |
Audio Buttons
Description
Buttons that can be used to interact with the howler.
howlerPlayButton, howlerPauseButton, howlerPlayPauseButton and
howlerStopButton will all be applied to the current track.
howlerBackButton and howlerForwardButton will
change the track position by a specified amount of time.
howlerPreviousButton and howlerNextButton will
play the previous/following track supplied to the player.
howlerVolumeDownButton and howlerVolumeUpButton will
change the volume of the player by a specified percentage.
howlerButton is a customisable version of any of the above individual button.
Usage
howlerButton(howler_id, button_type = HOWLER_BUTTON_TYPES, ...)
howlerPlayButton(howler_id)
howlerPauseButton(howler_id)
howlerPlayPauseButton(howler_id)
howlerStopButton(howler_id)
howlerBackButton(howler_id, seek_change = 10L)
howlerForwardButton(howler_id, seek_change = 10L)
howlerPreviousButton(howler_id)
howlerNextButton(howler_id)
howlerVolumeUpButton(howler_id, volume_change = 0.1)
howlerVolumeDownButton(howler_id, volume_change = 0.1)
howlerVolumeToggleButton(howler_id)
Arguments
howler_id |
ID given to the |
button_type |
Type of button to create. Available buttons are in the details, default set to |
... |
Attributes/Inner tags added to the button |
seek_change |
Time (in seconds) to move forward/backward the track when clicked. Default is 10 seconds |
volume_change |
How much to change the volume by. Default is 10%. |
Details
The following button_type are available to create:
play_pause(default) Switch between playing and pausing the track
playResumes the current track
pausePauses the current track
stopStops current track, when played will start from beginning
previous,nextSwitches to the previous/following track
volumedown,volumeupDecreases/Increases the volume by 10% (If using
howlerButtoninclude the attribute`data-volume-change`)back,forwardSeek forward/backwards 10s (If using
howlerButtoninclude the attribute`data-seek-change`with negative values to go backwards)
When using a play_pause button, the icon will toggle between the play and pause button
depending on whether or not the track is playing.
Value
An HTML tag containing the audio button.
An additional input will be available in the server side in the form {id}_{button_type}. For example
howlerBackButton("howler") will create an input element of input$howler_back. All of these will work in
the same way as actionButton
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
tile = "howler.js Player",
howler(elementId = "howler", "audio/sound.mp3"),
howlerPreviousButton("howler"),
howlerBackButton("howler"),
howlerPlayPauseButton("howler"),
howlerForwardButton("howler"),
howlerNextButton("howler"),
howlerVolumeDownButton("howler"),
howlerVolumeUpButton("howler")
)
server <- function(input, output) {
}
shinyApp(ui, server)
}