Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

Sound play

An action block that plays a sound.

If the proceed option is set to Immediately, then the sound will be played without pausing the fiber. If set to When complete, then the fiber will pause until the playback has completed.

The playback will continue indefinitely if repeat is enabled, but can be stopped by an Sound stop block or by cancelling the notification.

A sound URI is most likely unique to your device. Either let the user pick a sound with the Ringtone pick or Content pick blocks, or use the Tone play block instead.

Playback speed and pitch may not work on all devices, audio formats.

An “setDataSource failed” error usually means the sound URI is inaccessible, or it’s not an supported audio formats. If it's a file then ensure to grant the appropriate file access privileges in settings.

Note! Few devices support playback in phone calls through the Voice call audio stream. Due to an Android bug playback of OGG files may loop even if repeat is disabled.

Options

  • Proceed — when the fiber should proceed.

Input arguments

  • Sound URI — content URI or sound file to play.
  • Audio stream — playback audio stream, default is Notification.
  • Volume — playback audio volume, default is 100%.
  • Speed — playback speed, default is 100%. (Android 6+)
  • Pitch — playback pitch, default is 100%. (Android 6+)
  • Start position — starting position, default to beginning of clip.
  • Repeat — whether the playback should repeat, loop.
  • Audio focus — audio focus to request, default is Normal for Music stream, otherwise Transient may duck.
  • Notification channelUUID of notification channel used for showing notification during playback, default is no notification.
Note! This documentation is also accessible within the app from Help & feedback menu.