How to play a sound

To play a sound you need to add your wav files to your project with Build Action -> Content

In this example, we have added them in a Resources folder on our project. After that, you need to call from your Javascript the next function:

window.external.Notify("PlayAudio(Resources/yourfile.wav, false)");
You can set the second parameter to true to play your file in a loop

Last edited May 12, 2011 at 11:57 AM by onir, version 2


Moli Jun 19, 2011 at 2:29 PM 
Hi, I use the function and it throws "InvalidOperationException" at following code:

manageWidget = ManageWidget.Manage(e.Value, widget);

with message "Loop must be set before the first Play call"

(But I can hear the sound before the exception)