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

  • Home
  • SEARCH
  • 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 9212349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:30:20+00:00 2026-06-18T01:30:20+00:00

I have an HTML5 audio player that should play when an element has been

  • 0

I have an HTML5 audio player that should play when an element has been clicked. It works fine in all desktop browsers. It’s just not working on the iPad.

I’ve read that ios doesn’t support auto play and that a user must initiate the play…which as far as I’m aware is exactly what I’m doing by having my code within a click function?

    var item = $('.type-aud'),
        path = item.attr('file'),
        html = '<audio controls><source src="'+path+'" type="audio/mpeg" class="audio"></audio><span class="play"></span>',
        playerClass = item.find('.audio');

        if (!playerClass.hasClass('audio')) {
            item.append(html);          
        } 

        item.click(function() { 
            var player = item.find('audio');

            if (!player.hasClass('playing')) {
                $(player).addClass('playing').trigger("play").next().addClass('pause').removeClass('play');
            } else {
                $(player).removeClass('playing').trigger("pause").next().removeClass('pause').addClass('play');
            }
        });

I’ve enabled the controls for debugging, and if I press ‘Play’ on the native controls, It then starts working…

Thanks

  • 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-18T01:30:21+00:00Added an answer on June 18, 2026 at 1:30 am

    I was working on something similar recently and found that you are unable to get the audio to play using a trigger event.

    e.g. I was trying

    $('#btn').click(function(){
        myAudioControl.play();
    });
    
    $('#btn').trigger('click');
    

    This code will never work on iOS5 as it requires a physical click of an element.

    There is a good solution here Play a sound via javascript event in iOS 5 HTML5 app Which I worked with to find a solution to the problem.

    I basically had the audio play a silent mp3 file when the user clicked a button, then updated the audio src. Then I could dynamically play the audio file through any trigger or event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a jquery plugin that uses a HTML5 audio player
I have made a simple play/pause button that works in conjunction with the audio
Okay so I have an html5 audio player that i built with jquery however
Possible Duplicate: HTML5 audio element with dynamic source I'm trying to get the player
I'm creating my own HTML5 audio player capable of handling playlists. I have created
I have a simple html5 mp3 player that I found online. The player is
Using HTML5 I have 2 Audio elements and 1 video element on a page.
I used the html5 audio tag to have an player and I'm trying to
I have been working on an audio player applet, and I am having a
I have an instance of Jplayer (HTML5 audio player for jQuery) and an instance

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.