cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PavanKumar
Level 8

Capture Audio is not working

HI Guys,

 

Am using CaptureAudio feature of the PCF as below but its throwing an error - Required method not supported on device

any help is appreciated.

var self = this;

            var promise1 = new Promise<File>(function (resolve, reject) {
                setTimeout(function () {
                    debugger;
                    
                    self._context.device.captureAudio()
                }, 300);
            });

            promise1.then(function (value) {
                debugger;
                console.log(value);
                // expected output: "foo"
            });

 

Regards,

Pavan Kumar Garlapati

4 REPLIES 4
ScottDurow
Level 8

Re: Capture Audio is not working

Hi Pavan,

Have you declared the required api in the control manifest?

 

 <feature-usage>
      <uses-feature name="Device.captureAudio" required="true" />
Power Apps Staff jopursle
Power Apps Staff

Re: Capture Audio is not working

Hi Pavan,

 

The device.captureAudio call will the current device to see if there is support for it and if that check returns false, the method will return that error.  By default the tooling harness will return false for these checks, so when running in the harness this is an expected message.

 

While you can't test captureAudio in the harness, you can specify in the manifest required="false" and manually check in the method is available by checking if captureAudio is null or not.

 

If required="false" for captureAudio in the ControlManifest.xml file:

 

self._context.device.captureAudio !== null ? self._context.device.captureAudio() : null;

 

 

PavanKumar
Level 8

Re: Capture Audio is not working

Hi @jopursle  @ScottDurow ,

 

No luck I have deployed it in Model driven app and still am getting same error ""Required method not supported on device"" Any help on this please?

 

Regards, Pavan Kumar Garlapati

Power Apps Staff jopursle
Power Apps Staff

Re: Capture Audio is not working

Hi Pavan,

 

Device's captureAudio method currently isn't supported on browsers and will work on mobile only.  You can add the null check I mentioned earlier to make sure you don't hit any exceptions and limit your code to only run captureAudio on mobile.

 

Joseph

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (5,030)