Widgets

Audio

Audio

Audio control. Build it with the audio helper.

Example

audio(
  src: "https://example.com/image.png",
  on_duration_change: ->(event) {}
)

Properties

  • autoplay — Sets the autoplay property.
  • balance — Sets the balance property.
  • playback_rate — Sets the playback rate property.
  • release_mode — Sets the release mode property.
  • src — Source URL or asset path of the image.
  • src_base64 — Sets the src base64 property.
  • volume — Sets the volume property.

Common layout and animation properties

  • data — Arbitrary value you can attach to the control and read back in handlers.
  • key — Stable identity used to preserve state across rebuilds.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • rtl — Renders right-to-left when true.
  • tooltip — Text shown on hover/long-press.
  • visible — Hides the control when false.

Events

  • on_duration_change — Fired on duration change.
  • on_error — Fired when an error occurs.
  • on_loaded — Fired when the control has loaded.
  • on_position_change — Fired on position change.
  • on_seek_complete — Fired on seek complete.
  • on_state_change — Fired when the control's state changes.

Methods

  • get_current_position(timeout: ..., on_result: ...)
  • get_duration(timeout: ..., on_result: ...)
  • pause(timeout: ..., on_result: ...)
  • play(position: ..., timeout: ..., on_result: ...)
  • release(timeout: ..., on_result: ...)
  • resume(timeout: ..., on_result: ...)
  • seek(position_milliseconds, timeout: ..., on_result: ...)

Reference

  • Family: materials
  • Widget type: audio
  • Helpers: audio