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
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
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
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;
Hi Pavan,
Have you declared the required api in the control manifest?
<feature-usage> <uses-feature name="Device.captureAudio" required="true" />
WarrenBelz
89
Most Valuable Professional
Michael E. Gernaey
72
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1