Click sound delay on Android

  • Hi,

    I have very small WAV (2kB or so) file which is triggered to play after user tap the button. For some reason it is delayed about 1 second.

    Some sort description of my project:

    1. I have "preload sounds" enabled in C2, but it is delayed everytime not only the first time it is triggered.

    2. Also tried with preload sound in "On layout start".

    3. I'm exporting as Cordova app

    4. Then wrapping to APK using Intel XDK to Android Crosswalk

    5. In C2 preview (HTML) it works fine, but once it is installed on android device it delays (tested on Samsung Galaxy S4 and Sony Xpreria Z1)

    Should I import some plugin in XDK? I'm realy lost here... what am I missing?

  • Over 40 views and no replies. Does this mean that nobody has same problem or nobody knows how to fix it or maybe my post is not clear enough?

  • I do not have the problem, look at the plugins you have selected in intel XDK new version.

  • Thank you for the reply Should I include some audio plugin in Intel XDK? At the moment I use only cranberrygame plugin for adMob - nothing else.

  • In theory the plugin Cranberries can cause problems with the sound, screen, etc to interact with advertising.

  • Problem is not in any plugin. I've created completely new blank project to test Audio. What I've added to the project:

    1. On tap gesture on: spriteObject -> play sound "Click".

    2. On touched: spriteObject2 -> play sound "Click".

    3. Every 1 second substact 1 from counter -> if counter == 0 then play sound "Click". (I wanted to test here if TAP event was delaying or play sound)

    RESULTS:

    a) In C2 preview mode it works good.

    b) In Intel XDK emulate mode it works good.

    c) In Intel XDK Debug mode (run app via USB on my mobile) sound delays about 0,5s for every above mentioned step 1, 2 and 3.

    d) Same delay as above for app installed on mobile with APK.

    I have the newest C2 version and newest Intel XDK version. There is absolutely no other plugin involved in this test. It is really hard to believe that only I have this problem because I am not doing anything fancy - everything is out of the box.

    Tested on Samsung Galaxy S4, Sony Xperia Z1, and some old LG (I don't know what is it exactly).

    Can someone confirm that he is using Audio object with Cordova + Intel XDK and it works fine without any delay? Any clue what can be done? How to debug the problem? I'm out of ideas already.

  • Small update. It works fine on Samsung Galaxy S6. So it looks like it depends on mobile.

  • I have similar problem with Nexus 5 and Nexus 4 - the sound that I play on the start of my app doesn't play on the phone, but works good in preview. All other sounds works good

  • Long shot try putting the sound in the music folder or the sound folder under files and export.

    I had a problem with delay and moved it from the music folder to the sound folder which seemed to fix it.

    Not sure why it worked though.

    Worth a punt.

    P.S. I am using Intel XDK and admob plugin

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It works fine on Samsung Galaxy S6, Samsung Galaxy 5, Samsung Galaxy Tab, Sony M2, Samsung Galaxy Note 3 . So it looks like it depends on mobile

  • Have you tried preloading the audio when the Layout loads?

    I had the delayed sound problem and found that to help.

    It still did depend on device and the amount of memory my game was using. Between preloading and shrinking the game down in Events and the size of images it ended up running well, including audio, on all devices.

  • I have the same problem and here Ashley's anwser

  • It works fine on Samsung Galaxy S6, Samsung Galaxy 5, Samsung Galaxy Tab, Sony M2, Samsung Galaxy Note 3 . So it looks like it depends on mobile

    I have the delay on my Note 3 :/

  • What kinda worked for me:

    1. move sound from Sounds directory (in C2) to Music directory

    2. prelod that sound in event sheet on start of the project

    After that my delay on SGS4 decreased from 0.5s to 0.1s which is pretty acceptable.

  • I fixed my delay issue in Android devices by javascript :

    I added following code in index.html

    <script>
         function playAudio(){     
                var myAudio = new Audio("click.m4a"); 
                myAudio.play();
         }
    </script>
    [/code:cvvb6eth]
    Then Call : Browers-> Execute Javascript("playAudio();");  in C2 everytime user click
    P/S: Can't use .ogg , I'm using .m4a instead.
    
    Hopefully someone can make it become a plugin in C2. It worked very great, even on slow Android devices.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)