Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

Playing Audio in the Store Commerce App

Posted on by 5

I’m trying to extend the POS so that when the user scans a barcode if the barcode does not correspond to a product, the POS with play an audio file to alert the user that the barcode they just scanned is invalid.

audio-in-pos-code.png

I have added a Sounds folder under the Resources folder in my POS project in the CommerceSDK. When we build the CommerceSDK locally it is replicating this audio resource folder to C:\Program Files\Microsoft Dynamics 365\10.0\Store Commerce\Extensions\BHS.Commerce\POS\Resources\Sounds\alarm.mp3.

CommerceSDK-files.png

At runtime audio.src is set to local.storecommerce.dynamics.com/.../alarm.mp3, and it doesn’t give me an error, but the audio doesn’t play. I have confirmed the SCA's ability to play audio with this code by replacing the local call with a URL to an MP3 (https://www.soundjay.com/misc/sounds/bell-ringing-01c.mp3) which is played.

However, we need to support this functionality in offline mode, so we are hoping to have it available as a local resource. I have tried to make a reference to the audio on the POS project manifest file in the resources section, but it never compiles.

I have also tried creating an audio.d.ts file under Pos/Libraries that contained the following code:

declare module "*.mp3";

declare module "*.wav";

 

Then in my RequestHandler I added the import statement:

import note from '../../Resources/Sounds/alarm.mp3';

 

And then I created the Audio object with this code:

let audio = new Audio(note);

 

My extension failed to load on the SCA when I did this though.

Ultimately, I've confirmed that the code playing the audio is working so the issue has to do with the location of the audio file in my resources and/or how the CommerceSDK is making that resource available at the SCA. Any advice on how to link the resource up with my codebase would be greatly appreciated.

  • huijij Profile Picture
    huijij 19,811 on at
    RE: Playing Audio in the Store Commerce App

    Hi Cgarvey,

    Please wait patiently for others on the forum who have such experience.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans