Hi!
We have a mobile app run on a browser on a scanner. And we want to run a beep when there is an error. When I do "Send Bell" then the sound is on the server but not on the scanner. Any idea what I can do?
Regards
Peter
Hi!
We have a mobile app run on a browser on a scanner. And we want to run a beep when there is an error. When I do "Send Bell" then the sound is on the server but not on the scanner. Any idea what I can do?
Regards
Peter
you will need to send a javascript message to cause the bell on the client
as far as i know JS doesnt have a bell or similar so you need to create an audio object and play an mp3 file
Michael Salzlechner
StarZen Technologies, Inc
http.://www.starzen.com
IT Director at Balloons Everywhere
Development Blog
http://www.salzlechner.com/dev
DataFlex Package Manager (aka Nuget for DataFlex)
http://windowsdeveloper.com/dfPackage
You could make a simple small script in your index.html like so:
Then call "playAudio" using "psClientClientOnClick" or something similar. I'd probably just drop the mp3 file in the AppHtml folder.Code:<script> const playAudio = () => { const audio = new Audio('relative/path/to/your/audio_file.mp3'); audio.play(); } </script>
Thank you, I will try it.
Regards
Peter
Hi Henri!
I added this in the index.html in the AppHtml folder in the <head> section (where all the other scripts are)
The sample.mp3 file I also added to the AppHtml folder<script> const playAudio = () => {
const audio = new Audio('sample.mp3');
audio.play();
}
</script>
In my app I added Send ClientAction "playAudio" in the OnBlur procedure of a field
Then I get the error msg: Action method not found "playAudio"
What I am doing wrong?
Best regards
Peter
Cache ?
Make sure the index.html loaded is the "changed" one using f12, source-code.
Samuel Pizarro
I don't think "Send ClientAction 'playAudio' " will work as the method is not part of the invoking control but rather a generic piece of script. You can call this piece of script by setting psClientOnBlur to the name of the method (playAudio).
I tried to keep the example as simple as possible to avoid having to write your own control logic in JS. If you want to go the "Send ClientAction" route, thats what you'll have to do but i'd advise against it in this case.
Change the JavaScript into:
And you can call it using Send ClientAction "playAudio" or Send ClientAction "window.playAudio" just fine...Code:<script> function playAudio(){ const audio = new Audio('sample.mp3'); audio.play(); } </script>
Note that for both ClientAction and psClient.. you can use the 'window.' to specify global functions. To explicitly call local functions (of the object only) you can use 'this.' and if nothing is specified it will first look for a local function and then for a global function.
That´s a great explanation.
Thanks Harm.
--
Wil
Thank you, Harm, that works fine!
Regards
Peter