Power Apps Microphone Control – How to use

Microsoft Provides a list of controls to Power Apps to build business applications. This Microphone control enables users to interact with the application through voice commands or capture audio input.

In this tutorial, I will explain to you what Power Apps Microphone control is, the key properties of the Power Apps Microphone control, and how to use the PowerApps Microphone control in real-time scenarios like:

  • Use Microphone control to direct playback
  • Add Sounds to Power Apps Gallery Control
  • Upload Power Apps Audio to SharePoint Library

Power Apps Microphone Control

Power Apps Microphone control allows users to record any sounds or audio clips from their devices. Power Apps offers a control called “Audio Input” that allows users to capture audio using the device’s microphone.

Before using this Microphone control, a user must authorize the app to use the microphone, and also, the device should have a microphone that the user will use.

Access the most recent audio recording via the Audio property. This property allows for various actions with the recorded audio, such as:

  • Playback using the Audio control
  • Listen to the recording through the Audio control
  • Temporarily stored in a variable or collection

If you want to record audio using the Power Apps Microphone control, you must follow the format to record audio:

  • 3gp format for Android
  • AAC format for iOS
  • OGG format for web browsers
Note: Power Apps Microphone control has only supported Browsers like Chrome, Firefox, Microsoft Edge based on Chromium. Also, supports only with the Android and iOS Devices.

If you are using any other browser and platform, then maybe it will show a warning that some features of the app will not work.

Power Apps Microphone Control Properties

Let me explain what are the key properties available in the Power Apps Microphone control. For that, refer to the below table.

See also  Create a canvas app in PowerApps from a SharePoint list (Helpful tutorial)
PropertyDescription
AudioThe audio clip was obtained through user recordings using the device’s microphone
MicWhen a user stops the recording with a Microphone control, it specifies how the app responds.
OnStopThis property specifies the image name that is displayed in an image, audio, or Microphone control.
ImageWhen the user starts to record with a microphone control, it specifies how the app responds.
OnSelectWhen the user selects the control, it specifies how the app responds
OnStart When the user starts to record with a microphone control, it specifies how the app responds.
ResetThis property helps to determine whether a control reverts to its default value.
VisibleIt specifies whether the Microphone control displays or is hidden.

How to use Microphone Control in Power Apps

Here, I will show you how to add the Microphone control in Power Apps and how to use the Microphone control with different examples.

Use Microphone control to direct playback

In this example, we will discuss a direct connection between a Microphone and an Audio control to enable immediate playback. To do so, follow the below steps. Such as:

1. Open your Power Apps app -> Select the screen where you want to add the Microphone control -> Insert a Microphone control.

2. Whenever the user adds a Microphone control, it will give the control’s name as “Microphone1” and Its Mic property as “0” like below.

Power Apps Microphone Control

3. Now, to listen to your recently recorded audio clips, you need to insert an Audio control under the Microphone and set its Media property as:

Media = mic.Audio

Where,

  • mic = Power Apps Microphone name
PowerApps Microphone Control

4. Save, Publish, and Preview the app. Select or tap the Microphone control to start the recording and speak something to record your voice. Again, tap the Microphone control to stop the recording.

5. Finally, click on the start button of the Audio control to listen to the recorded audio clip.

How to use Power Apps Microphone Control

Add Sounds to Power Apps Gallery Control

Next, I will show you how to add sounds or audio to the Power Apps gallery control with a scenario.

See also  Container in Power Apps [With Examples]

Scenario:

Suppose there are some important Audio clips, and you want to collect all the recently recorded audio clips. In that case, you can store the Power Apps Collect() function in a Gallery control.

To achieve this, follow the below steps.

1. On the Power Apps Screen -> Insert a Microphone control and set its OnStop property as:

OnStop = Collect(colAudio, mic.Audio )

Where,

  • colAudio = Power Apps Collection
  • mic = Power Apps Microphone Name
powerapps play sound

2. Next, Insert a Gallery control (Insert -> Gallery -> Vertical) and Change the Layout to Title. Also, select the Gallery control and set its Items property

Items = colAudio
power apps play sound

3. Then, insert the Audio control inside the gallery control and set its Media property as:

Items = ThisItem.Value
How to use PowerApps Microphone Control

4. Now, Save, Publish, and Preview the app. Start and stop the recording by using the Microphone control. All the recorded audio clips have been stored in the gallery control.

How to use the Power Apps Microphone Control

5. If you want to listen to the audio clips, click on any Play button of the audio control.

This way, you can add Power Apps Microphone audio record to the gallery control.

How to use the PowerApps Microphone Control

How to Upload Power Apps Audio to SharePoint Library

Follow the steps below to upload a Power Apps Microphone Audio file into the Power Apps document library.

1. Create a SharePoint Online document library [Power Apps Audio Clips] where you want to store all the Powerapps microphone audio records.

How to upload Powerapps Audio into sharepoint

2. Go to the Power Apps Screen -> Insert a Microphone control and set its OnStop property:

OnStop = Set(
    varJson,
    JSON(
        mic_Clip.Audio,
        JSONFormat.IncludeBinaryData
    )
);
Set(
    strB64Audio,
    Mid(
        varJson,
        25,
        Len(varJson) - 25
    )
);

Where,

  • varJson = Power Apps variable name
  • mic_Clip = Microphone control name
How to upload Power apps Audio into sharepoint
Note: If you want to provide an Image to the Microphone control, you can use its Image property to add the imge

3. Next, insert an Audio control and set its Media property as:

Media = mic_Clip.Audio
Upload Power apps Audio into sharepoint

4. Insert a Text input control [To provide the Record file name], make its Default property as “Blank“, and set the Hint text as “Enter Audio Clip Name” as in the screenshot below.

Upload Powerapps Audio into sharepoint
Note: As we can not save the audio clip directly in SharePoint through Power Apps, So we need to convert the voice to a binary format and set it in a Variable.

5. Now, it’s time to create a Flow or Power Automate in Power Apps. For that, click on the Power Automate section -> Select the “Create new flow button” -> Select the + Create a flow button like below.

Upload the Powerapps Audio into sharepoint

6. Once you click on the “Create a flow” option, it will redirect you to the “Create your flow” page, where you will get, by default, a trigger as Power Apps (V2).

See also  Power Apps Dropdown Control - How to use

7. Next, click on the + New step to insert the Initialize variable action and provide the information below.

  • Name = Enter a name for the Initialize variable
  • Type = Select the Variable type as String
  • Value = Select the Value field and add “Ask in PowerApps” from the “Dynamic content”
Upload the Powerapps Audio into sharepoint Online

8. Now, add a Create file [In SharePoint] under the Initialize Variable action. Also, provide the below information.

  • Site Address = Provide the SharePoint Site address
  • Folder Path = Specify the Folder path or Library name (Power Apps Audio Clips) where you want to save the Power Apps recorded audio clips
  • File Name: Select the field -> Go to the Dynamic content tab -> Ask in Power Apps -> Set the property Createfile-FileName with an extension of “.webm
  • File Content: Select the field -> Go to Expression tab -> add base64ToBinary(variables(‘base64Audio’)) -> Click on OK
Saving Power Apps Microphone audio to SharePoint

9. Once your flow is done, save the flow, and you will get the created flow under the Power Automate section like below.

Saving PowerApps Microphone audio to SharePoint

10. Finally, insert a Button control and set its OnSelect property to the code below.

OnSelect = SaveAudioClipstoSharePointOnline.Run(strB64Audio,txt_Search.Text)

Where,

  • SaveAudioClipstoSharePointOnline = Power Apps Flow name
  • strB64Audio = Initialize Variable value
  • txt_Search = Power Apps text input name
Saving Power Apps Microphone audio files to SharePoint

11. Once your app is ready, Save, Publish, and Preview the app. Start and stop the recording by tapping on the Powerapps Microphone control. Click on the play button from the Audio control [You can listen to the voice recorder you have recently recorded].

12. Then, enter the Audio Clip Name in the text box control and click the button control to submit the audio file into the SharePoint document library. Have a look at the below screenshot for the output.

How to upload a Power apps Audio into sharepoint

This is how we can upload a Power Apps Microphone audio into the SharePoint document library.

Now, if you have any Power Apps Microphone control requirements, you can follow this Power Apps complete tutorial to do it. I explained information about the Power Apps Microphone control using different real-time scenarios.

Additionally, you may like some more Power Apps articles:

  • Thanks for this… successfully set up app to record sound and save to SP online… works find from my laptop BUT does save to SP from iPhone after I publish… it’ records find just doesn’t make it to SP… any tips??

  • >