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 6663891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:32:58+00:00 2026-05-26T02:32:58+00:00

I feel like I’m taking crazy pills here because I can not figure out

  • 0

I feel like I’m taking crazy pills here because I can not figure out how to render the html 5 audio tag with custom controls.

I have this html so far, and it works no problem:

<audio controls preload='none'><source src='the url to the audio' type='audio/wav' /></audio>

How do I get it to display ONLY the play button, and perhaps when playing, show the pause button in it’s place.

From what I read,

By default, the element will not expose any sort of player controls.
You can create your own controls with plain old HTML, CSS, and
JavaScript. The element has methods like play() and pause() and a
read/write property called currentTime. There are also read/write
volume and muted properties. So you really have everything you need to
build your own interface.

If you don’t want to build your own interface, you can tell the
browser to display a built-in set of controls. To do this, just
include the controls attribute in your tag.

But I can not find any examples of using custom controls. How do you get just the play button?

  • 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-05-26T02:32:58+00:00Added an answer on May 26, 2026 at 2:32 am

    You create your elements like so…

    <audio id="yourAudio" preload='none'>
        <source src='the url to the audio' type='audio/wav' />
    </audio>
    <a href="#" id="audioControl">play!</a>
    

    And add some functionality:

    var yourAudio = document.getElementById('yourAudio'),
        ctrl = document.getElementById('audioControl');
    
    ctrl.onclick = function () {
    
        // Update the Button
        var pause = ctrl.innerHTML === 'pause!';
        ctrl.innerHTML = pause ? 'play!' : 'pause!';
    
        // Update the Audio
        var method = pause ? 'pause' : 'play';
        yourAudio[method]();
    
        // Prevent Default Action
        return false;
    };
    

    Right now, the button is just simple text (“play!” or “pause!”), but you could do just about anything you wanted with CSS. Instead of setting the innerHTML, set the className and you’re good to go!

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

Sidebar

Related Questions

I feel like this should be simple, but can't figure it out: What's the
I feel like I've only ever seen this here on SO, but I can't
I feel like I'm missing something obvious, but I can't work out why my
I feel like I'm missing something very obvious here, but I can't get a
I feel like this should be an easy thing to figure out, but I'm
I feel like i am completely missing something because I am not able to
I feel like a fool, couldn't figure out how to change case using jQuery.
I feel like I am not writing this correctly and this is my first
I feel like there's a pretty simple way to do this, but I'm not
I feel like this is something I should already know, but I'm just not

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.