Skip to main content

Music Control Overview

Music Control sends playback and playback-volume commands through a connected AIBuds device.

Available Features​

Getting Started​

  1. Connect to the Device - Wait until the device is connected and ready.
  2. Check Protocol Conformance - Verify support for DeviceMusicControlAPI.
  3. Choose a Command - Play, pause, select the next or previous track, or adjust playback volume.
  4. Handle Completion - Update application UI only after the command reports success.

Key Concepts​

Playback Commands​

  • playMusic starts or resumes playback.
  • pauseMusic pauses playback.
  • playNextMusic and playPreviousMusic navigate the playback queue.
  • The public protocol does not define a stop command.

Playback Volume Commands​

  • musicVolumeUp and musicVolumeDown move by one device-defined step.
  • mute and unmute control playback muting.
  • setMusicVolume accepts an explicit level from 0 through 100.

Protocol Reference​

Music Control is accessed through DeviceMusicControlAPI:

Swift
guard let device = device as? DeviceMusicControlAPI else {
    print("Device does not support DeviceMusicControlAPI")
    return
}

Best Practices​

  1. Check Protocol Conformance: The SDK exposes no separate Boolean support query.
  2. Handle Every Completion: Check success and report error when a command fails.
  3. Debounce Sliders: Avoid sending every intermediate explicit volume value.
  4. Observe Playback Changes: Use didMediaPlayStatusChanged when the UI must follow device notifications.

Notes​

  • The SDK does not expose the active player, track metadata, or playback queue through this protocol.
  • Command success confirms command execution, not a permanent playback state.
  • Volume Control and Music Control are separate protocols even though both include volume-related operations.