0

HTML5 Audio Support

Hello.

I am trying to add a click sound to a touch presentation that is entirely made of HTML5, but can't make it quite work.

I use the code:

<body>
<
audio id="audio" src="audio/click.mp3"></audio>
...
<script>
$('body').click(function() {
document.getElementById('audio').play();
});
<script>
</body>

 

This should work, and it does - on a PC with Chrome. Works as wanted, when clicking anywhere on the html area the page emits a click. 

But can't make it work on an XD1032. I am using a video or image zone for the html page. The audio is output through HDMI and analog. Tired with mp3 and wav. So I am wondering if this is supported on a BS and if it should work?

1 comment

  • 0
    Avatar
    Romeo

    Hi Roni,

    Please try the below instead with FW 6.0.x

    <body>
     
     <div id="WhatsThatSound" name="WhatsThatSound" style="position:absolute;top:0;left:0;width:200px;height:50px;background-color:green">
        <audio id="BS_Audio_Player">
        <source src="notify.mp3" type="audio/mpeg" />     
        </audio>
     </div>

    </body>

     <script type="text/javascript">
      $('body').click(function() {
      //document.getElementById('audio').play();
      var BS_Player = document.getElementById("BS_Audio_Player") 
        
      BS_Player.load();
      BS_Player.play();
      
      });
     </script>

     

    for the sound to be outputted with that page you'll need to click on the green rectangle in the left top corner of your screen.

    Regards,

    Romeo

     

     

Please sign in to leave a comment.