Microphone control in Power Apps

A control that enables app users to record sounds from their device.

Description

Use the Microphone control to capture audio with a device's microphone. The device must have a microphone and the user must authorize the app to use the microphone.

The most recently recorded audio clip is available through the Audio property. With this property, recorded audio can be:

  • Played back with the Audio control. Use the Audio control to listen to the recording. For more information, see the examples.
  • Temporarily put in a variable or a collection. Use the Set or Collect functions to store audio clips in a variable or a collection. Use caution with multiple audio clips in a collection at the same time with device's limited memory. Use the SaveData and LoadData functions to move audio clips to the local storage on the device and for offline scenarios.
  • Stored in a database. Use the Patch function to store audio clips in a database.
  • Transmitted as a base64 encoded text string. Use the JSON function to base64 encode audio clips.

Format of the recorded audio:

  • 3gp format for Android.
  • AAC format for iOS.
  • OGG format for web browsers.

Captured media is referenced by a text string URI. For more information, read the data type documentation.

Note

The microphone control is supported only on Microsoft Edge based on Chromium, Chrome, and Firefox browsers; and Android and iOS devices. All other browsers and platforms will show a warning that some features of the app won't work.

Limitations

The microphone control has these limitations:

  • Power Apps Mobile runs on various types of devices, and some of them have limitations that are specific to that platform:
    • You can play videos in multiple Video controls at the same time on all platforms except iPhone devices.
    • You can record audio with multiple Microphone controls at the same time on all platforms except the web player.

Key properties

Audio – The audio clip captured when the user records with the device's microphone.

Mic – Numeric ID of the microphone on a device that has more than one microphone.

OnStop – Actions to perform when the user stops recording with a microphone control.

Additional properties

AccessibleLabel – Label for screen readers. Should describe the purpose of the microphone.

BorderColor – The color of a control's border.

BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.

BorderThickness – The thickness of a control's border.

Color – The color of text in a control.

DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).

DisabledBorderColor – The color of a control's border if the control's DisplayMode property is set to Disabled.

DisabledColor – The color of text in a control if its DisplayMode property is set to Disabled.

DisabledFill – The background color of a control if its DisplayMode property is set to Disabled.

Fill – The background color of a control.

FocusedBorderColor – The color of a control's border when the control is focused.

FocusedBorderThickness – The thickness of a control's border when the control is focused.

Height – The distance between a control's top and bottom edges.

HoverBorderColor – The color of a control's border when the user keeps the mouse pointer on that control.

HoverColor – The color of the text in a control when the user keeps the mouse pointer on it.

HoverFill – The background color of a control when the user keeps the mouse pointer on it.

Image – The name of the image that appears in an image, audio, or microphone control.

ImagePosition – The position (Fill, Fit, Stretch, Tile, or Center) of an image in a screen or a control if it isn't the same size as the image.

OnSelect – Actions to perform when the user selects a control.

OnStart – Actions to perform when the user starts to record with a microphone control.

PressedBorderColor – The color of a control's border when the user selects that control.

PressedColor – The color of text in a control when the user selects that control.

PressedFill – The background color of a control when the user selects that control.

Reset – Whether a control reverts to its default value.

TabIndex – Keyboard navigation order compared to other controls.

Tooltip – Explanatory text that appears when the user hovers over a control.

Visible – Whether a control appears or is hidden.

Width – The distance between a control's left and right edges.

X – The distance between the left edge of a control and the left edge of its parent container or screen.

Y – The distance between the top edge of a control and the top edge of the parent container or screen.

Examples

Simple direct playback

In this example, we'll directly connect a Microphone control with an Audio control for immediate playback:

  1. Add a Microphone control to your app.

  2. Authorize the app to use device's microphone if prompted.

  3. Add an Audio control to your app.

  4. Set the Audio control's Media property to the formula:

    Microphone1.Audio
    

    Note

    Replace microphone control name Microphone1 as appropriate.

  5. Preview the app.

  6. Select the Microphone control to begin recording.

  7. Speak to record audio.

  8. Select the Microphone control again to end the recording.

  9. Select the Audio control to hear the recording.

In this example, we'll create a gallery of audio clips stored in a collection that can be individually selected for playback:

  1. Add a Microphone control.

  2. Set its OnStop property to this formula using the Collect function:

    Collect( MySounds, MyMic.Audio )
    
  3. Add a Gallery control, move it below MyMic.

  4. Set the Items property for the gallery to this formula:

    MySounds
    
  5. In the template for the Custom gallery control, add an Audio control.

  6. Set the audio control's Media property to this formula:

    ThisItem.Url
    
  7. Press F5 to preview the app.

  8. Select MyMic to start recording, and then select it again to stop recording.

  9. In the Gallery control, select the play button in the Audio control to play back your recording.

  10. Add as many recordings as you want, and then return to the default workspace by pressing the Esc key.

  11. (optional) In the template for the Gallery control, add a Button control.

  12. Set its OnSelect property to the formula:

    Remove( MySounds, ThisItem )
    
  13. Press F5, and then remove a recording by selecting the corresponding Button control.

Use the SaveData function to save the recordings locally or the Patch function to update a data source.

Accessibility guidelines

The same guidelines for Button apply because Microphone is just a specialized button. Also, consider:

Audio alternatives

Consider adding an alternative form of input for users with speech disabilities or without a microphone. For example, Text input to allow users to enter text.

Color contrast

Screen reader support

See also

Limitations of controls in Power Apps