facebook

Stop / Start Buttons with sound help

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #349157 Reply

    Code_A
    Member

    This is my first attempt at a callback function but I think it works. Give this a try and see if it helps:

    playSound(findTIME);
    
    function playSound(callback) {
        AudioPlayerWidget.active.play();
        callback();
    }
    #349172 Reply

    falloffalot
    Member

    Sorry guys…still no go!
    It’s gonna be something really stupid I just know it!

    I’ve attached the template to see if anyone can help.

    ha ha so much for a simple build, this tiny thing is driving me crackers

    PS. the attached is the bare bones version and just the stopwatch, have removed all the things that don’t work to keep it simple.

    Thanks a million guys

    Attachments:
    You must be logged in to view attached files.
    #349181 Reply

    Code_A
    Member

    You can use this code to play the audio. I tested it in your file and the sound played and the findTIME() function worked. Be sure to add the audio file to your project before testing.

    var audioFile = new Audio();
    audioFile.src = "doorbell.mp3";  //audio file name
    audioFile.play();
    audioFile = null;  //cleanup
    #349182 Reply

    Attached is the modified MOBI file that plays a click sound when buttons are pressed.

    Place the mp3 file into the www\Stopwatch_Help\audio where your mobi program is located.

    Gen and Test.

    I have also included a ZIP file of the generated www\Stopwatch_Help directory.
    This one has everything included in the right places.
    You can unzip it and run the Stopwatch_Help.html in the browser.

    I tested it in the Chrome browser and Mobi Simulator. Both work.

    TG

    Attachments:
    You must be logged in to view attached files.
    #349184 Reply

    Code A,

    Sorry I did not notice your post below until after I posted my reply.
    I did not want to come across as having stolen your technique.
    It was pure coincidence.
    Cheers, Turgut

    @Code A wrote:

    You can use this code to play the audio. I tested it in your file and the sound played and the findTIME() function worked. Be sure to add the audio file to your project before testing.

    var audioFile = new Audio();
    audioFile.src = "doorbell.mp3";  //audio file name
    audioFile.play();
    audioFile = null;  //cleanup
    #349186 Reply

    falloffalot
    Member

    tguneysu & others
    Thank you guys so much for the help.
    I now have sound to go with the Stop / Start on my stopwatch.

    Can’t thank you guys enough.
    My skills are limited with MobiOne but if anyone who has helped needs any 3D models let me know.

    THE most helpful forum ever

    #349187 Reply

    falloffalot
    Member

    I am really appreciative of the help guys, but just published and tested on my iPad2 and there is no sound???
    Works perfectly using M1 sim but nothing on iPad?

    #349219 Reply

    Code_A
    Member

    I am guessing it is one of these issues, either:

    1. Your iPad is “soft” muted which can be remedied in this How To Fix No Sound in iPad Apps articled

    or

    2. You need to “enable” the sound through code after the initial app load due to Apple not allowing auto play on their devices. Here is an articled related to Audio Not Playing on iPad.

    Hope this helps!

Viewing 8 posts - 16 through 23 (of 23 total)
Reply To: Stop / Start Buttons with sound help

You must be logged in to post in the forum log in