Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:58:27+00:00 2026-06-08T17:58:27+00:00

In my small HTML5 web-app, I want to play sounds in response to user

  • 0

In my small HTML5 web-app, I want to play sounds in response to user actions. When the user clicks a button, in the onclick handler I play a sound like this:

    url = "assets/sounds/buzz" + (this.canPlayMP3 ? ".mp3" : ".ogg");
    sound = new Audio(url);
    sound.load();
    sound.play();

This works great on Firefox. Unfortunately, on an iPad (iPad 2 running iOS 5.1.1), I get a 2-second delay before the sound is played. This happens every time I play the sound sample, not just the first time.

The MP3 file is 9KB long. The iPad is connected to the network using exactly the same Wifi connection as the computer running Firefox.

How can I figure out what’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:58:28+00:00Added an answer on June 8, 2026 at 5:58 pm

    You might want to create a single instance of the audio element for each sound:

    var Sounds = {
        cat: new Audio('/sounds/meow.ogg'),
        bird: new Audio('/sounds/tweet.ogg')
    };
    

    Then you can play the same element over and over again:

    function playSound(name) {
        Sounds[name].currentTime = 0;
        Sounds[name].play();
    }
    
    playSound('cat');
    

    If iOS destroys your Audio objects, you could cache sound files in the cache manifest:

    CACHE MANIFEST
    # 2012-08-09:v1.3
    
    NETWORK:
    *
    
    CACHE:
    /sounds/meow.ogg
    /sounds/tweet.ogg
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a small web app, which plays really short sound bits on the
I'm building a small html5 web-app to hone my html5 skills. I've built the
We are small web app development company. We are planning to upgrade to HTML5/CSS3
I want to dvp a small web app which would ideally be used worldwide.
I did a small web application for using PHP, HTML, and JavaScript. I want
I'm building a small web app that allows users to list their goals. I
I'm trying to create a small web app that is used to remove items
I'm teaching myself web development, and am working on a small and free web-app
I have a small web app that is nothing more than a few HTML
I have developed a small demo web app which is hosted on tomcat. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.