Skip to Content
Author's profile photo Sanjoy Saha

Give an error/warning sound to the user when an error occurs in Application

Here we go. It is a very helpful example for make user friendly application by using HTML5 audio tag. When an error occurs, users can be notified by a sound.


In index.html write this:


<body class="sapUiBody">
  <div id="content"></div>
  <audio id="idErrorSound">
  <source src="audio/ErrorSound.mp3"></source>
  </audio>
</body>

Now write a small javascript which can be called from your application when you found an error/mistake done from user end:


function playErrorSound() {
  var audio = document.getElementById("idErrorSound");
  audio.play();
}

Now here we can see a small code snippet where we are calling this js written above:


if (error) {
        playErrorSound();
        // open a dialog to give user a message
        } 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Laurent DUBOIS
      Laurent DUBOIS

      Hi,

      I'm trying to implement this solution. It's working when I execute the application from my local WebIde, but when I deploy the application on the gateway it doesn't work... It seems that the mp3/wav is not published correctly into the BSP... Any ideas how to fix this?

       

      Cheers

      LAurent.