Package 'shinymedia'

Title: Multimedia Input/Output Controls for Shiny
Description: What the package does (one paragraph).
Authors: Joe Cheng [aut, cre]
Maintainer: Joe Cheng <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-05-12 06:59:05 UTC
Source: https://github.com/posit-dev/shinymedia

Help Index


Create an audio spinner

Description

Create an audio spinner

Usage

audio_spinner(
  ...,
  src = NULL,
  con = NULL,
  rpm = 10,
  gap = pi/5,
  stroke = 2.5,
  min_radius = 30,
  radius_compression = 0.8,
  radius_overscan = 1.1,
  steps = 2,
  blades = 3,
  width = "125px",
  height = "125px",
  autoplay = TRUE,
  autodismiss = FALSE,
  class = "mx-auto"
)

Arguments

...

Additional attributes for the spinner, to be added directly to the ⁠<audio-spinner>⁠ element.

src

The source URL or URI for the audio file. This should be used for remote resources or data URIs. If provided, this takes precedence over con.

con

An optional connection object or file path for local audio files. This is ignored if src is provided. Use this for reading local files securely.

rpm

The speed of the spinner, in clockwise revolutions per minute. Default is 10 RPM. Use 0 to disable rotation, or a negative value to rotate counter-clockwise.

gap

The gap between the blades of the spinner, in radians. Default is pi/5, or 36°.

stroke

The stroke thickness of the individual arcs that make up each blade of the spinner, in pixels. Default is 2.5.

min_radius

The radius of the spinner when there is only silence, in pixels. Default is 30.

radius_compression

The raw ⁠[-1, 1]⁠ amplitude of the audio is compressed using x^radius_compression to make the spinner more responsive to quiet sounds. Default is 0.8. Set to 1.0 to disable compression. (Note that this only affects the visualization, not the audio playback.)

radius_overscan

Use this parameter to set the maximum possible radius of the spinner, relative to the width/height of the container. Default is 1.1, meaning the spinner radius will be scaled such that at maximum amplitude, it will be 10% larger than the container (the spinner blades will be clipped). Use larger values if you're expecting generally quiet audio.

steps

The number of concentric arcs that make up each blade of the spinner, not including the central circle. Default is 2.

blades

The number of blades in the spinner. Default is 3. Set to 0 to use concentric circles instead of blades.

width

The width of the spinner in CSS units. Default is "125px".

height

The height of the spinner in CSS units. Default is "125px".

autoplay

Whether to autoplay the audio. Default is TRUE. Note that many browsers will not allow autoplaying audio without user interaction; if autoplay fails, the spinner will show a tooltip instructing the user to tap or click to start the audio.

autodismiss

Whether to remove the spinner after the audio finishes playing. Default is FALSE.

class

The class of the spinner. Default is "mx-auto" which horizontally centers the element inside its container (assuming Bootstrap is loaded).

Value

An HTML tag object representing the audio spinner.

Examples

# Using a URL
audio_spinner(src = "https://example.com/audio.mp3", rpm = 15, width = "200px", height = "200px")

# Using a local file
audio_spinner(con = "path/to/local/audio.mp3", rpm = 20, width = "150px", height = "150px")

A video clip input control that records short videos from webcam

Description

A video clip input control that records short videos from webcam

Usage

input_video_clip(
  inputId,
  reset_on_record = TRUE,
  mime_type = NULL,
  video_bits_per_second = NULL,
  audio_bits_per_second = NULL,
  ...
)

Arguments

inputId

The input slot that will be used to access the value.

reset_on_record

Whether to reset the video clip input value when recording starts. If TRUE, the video clip input value will become NULL at the moment the Record button is pressed; if FALSE, the value will not change until the user stops recording. Default is TRUE.

mime_type

The MIME type of the video clip to record. By default, this is NULL, which means the browser will choose a suitable MIME type for video recording. Common MIME types include 'video/webm' and 'video/x-matroska'.

video_bits_per_second

The target video bitrate in bits per second. By default, this is NULL, which means the browser will choose a suitable bitrate for video recording (according to the spec, 2,500,000). This is only a suggestion; the browser may choose a different bitrate.

audio_bits_per_second

The target audio bitrate in bits per second. By default, this is NULL, which means the browser will choose a suitable bitrate for audio recording. This is only a suggestion; the browser may choose a different bitrate.

...

Additional parameters to pass to the underlying HTML tag.

Value

A video clip input control that can be added to a UI definition.


Create HTML dependency for multimodal component

Description

Create HTML dependency for multimodal component

Usage

multimodal_dep()