PocketBrowser: Play beep sound through JavaScript

O Omar Candelaria 3 years 6 months ago
144 3 0

Hello,

I have a requirement to play a beep sound whenever I get an error response from the server. I'm handling the AJAX request through JavaScript and this beep sound would have to be played on the response.

On Internet Explorer I was able to implement this very easily by using either the embed or the bgsound HTML tags. I haven't been able to do the same on Pocket Browser.

I've tried using the PlayWave method on the RhoMobile library (Rhomobile | Generic Preexisting JavaScript Object) ) but it's not working as expected. The sound file is a WAV and is hosted on the web server. If I try entering the file's URL as the filename, I hear the default beep sound instead of the selected WAV file. I figured that the method would only support local files. But when I tried storing the WAV file on the device and specifying the filepath, I don't hear any sound played.

Do you have any examples on how to achieve this?

Thanks

Please Register or Login to post a reply

3 Replies

Y Yanis Dalabiras

What device and OS are you targeting? Some of the older CE devices do not have audio hardware,  they just have a beeper. 

If you just have a beeper,  you can use the code below to beep it.

   var Generic = new ActiveXObject("PocketBrowser.Generic");
   function beep()
   {
       Generic.InvokeMetaFunction("Notification", "SetBeeperFrequency:1500");
    Generic.InvokeMetaFunction("Notification", "SetBeeperDuration:200");
       Generic.InvokeMetaFunction("Notification", "SetBeeperVolume:3");
       Generic.InvokeMetaFunction("Notification", "StateCycle:2");
   }

O Omar Candelaria

Thanks for your quick reply.

It's Pocket Browser 3.1, running on Windows Mobile 6.5 on MC9200 and MC9090. These devices have an audio device since I can hear the alert beep whenever an alert window is triggered.

However, your suggestion is great for our requirement. I'm going to give it a try and let you know.

O Omar Candelaria

So... the device didn't beep with your code, but now we're hearing a different beep sound when scanning.

Any suggestions on how to fix this and how to play the beep sound after changing the beep tone?

CONTACT
Can’t find what you’re looking for?