0


i am trying to play a mp3-file in the SAP Web IDE but can't get it working.

    var audio = new Audio("sound/beep.mp3");
    audio.play();

It does not seem that the IDE is even loading the soundfile.
Do i have to add something in the preload config?

CalvT
  • 3,123
  • 6
  • 37
  • 54
www40
  • 285
  • 1
  • 7
  • 19

1 Answers1

1

I found a solution on SCN

They add the audio tag in the index.html:

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

and then load it by the given id like this:

function playErrorSound() {  
    var audio = document.getElementById("idErrorSound");  
    audio.play();  
}  
www40
  • 285
  • 1
  • 7
  • 19