0

I have developed a web app that I want to package as desktop application using a framework. I tried doing so in appJS and tideSDK. Everything is working fine except for one function that plays a sound.

Here is the audio element and the button for playing the sound.

<audio id="audioElem" src="clap.mp3"></audio>
<input type="submit" value="Play" onclick="playSound();" />

This is the function for playing sounds

function playSound(){
    document.getElementById('audioElem').play();
    return false;
}

Everything is working fine when I test the stuff in the browsers, but the sound is not playing when I publish the app using these frameworks. The audio file is in MP3 format, and I think this format is supported in the frameworks since they are based on webkit.

Please help me.

Ankur
  • 48
  • 7

3 Answers3

3

You are using html5 to play the sound but that is not an automatic part of chromium which is what appjs uses.

Quick fix is to use soundmanager2 to play your audio instead, this detects what is available and uses various fallbacks, so with appjs it will select a flash fallback.

Longer fix is to distribute an extra binary with appjs that enables the audio, I cannot remember what exactly it was called now. At some time in the future the html5 standard will be supported out of the box.

sihorton
  • 416
  • 2
  • 3
1

Are you trying to use TideSDK on windows ? If yes currently audio and video tags are not supported because underlying webkit implementation (wincairo) does not support the same.

In other operating systems the above code should work fine. Current version of TideSDK includes slightly older version of webkit so the HTML5 CSS3 score would be little less.

Mital Vora
  • 2,199
  • 16
  • 19
0

I have found that chromium browser, on which both tideSDK and appJS work does not support MP3 unlike chrome browser.

Video and audio tags in the two browsers.

chrome : AAC, MP3, Vorbis and Theora

chromium : Vorbis and Theora by default

It is because of the format support issue that the audio is not playing.

Community
  • 1
  • 1
Ankur
  • 48
  • 7