← Back to Docs
  • index.html
  • Clayground
  • Clayground.Sound
  • Music
  • Clayground 2026.2
  • Music QML Type

    Play background music with play/pause/stop/loop controls. More...

    Import Statement: import Clayground.Sound

    Detailed Description

    Music provides an interface for playing longer audio tracks like background music. Supports play, pause, stop, seek, and looping.

    Properties

    The audio file URL to load (local or remote).

    Volume level from 0.0 (silent) to 1.0 (full). Default: 1.0

    If true, audio loads on first play() call. If false (default), loads immediately.

    Read-only. True when audio data is fully loaded and ready to play.

    Read-only. True when audio is currently playing.

    Read-only. True when audio is paused.

    If true, audio loops continuously. Default: false

    Read-only. Current playback position in milliseconds.

    Read-only. Total duration in milliseconds.

    Read-only. Current loading status:

    Methods

    Starts or resumes playback. If paused, resumes from paused position. If not loaded, triggers lazy loading then plays.

    Pauses playback. Position is preserved for later resume.

    Stops playback and resets position to beginning.

    Seeks to the specified position in milliseconds.

    Explicitly preloads the audio (useful with lazyLoading enabled).

    Signals

    Emitted when playback completes (not emitted when looping).

    Emitted when loading or playback fails.

    See also Sound.