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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:55:10+00:00 2026-05-24T00:55:10+00:00

I have made a simple play/pause button that works in conjunction with the audio

  • 0

I have made a simple play/pause button that works in conjunction with the audio html5 tag and jquery:

$(document).ready(function() {
   $("#stop-bt").hide();

 $("#play-bt").click(function() {
   $("#play-bt").hide();
   $("#audio-player")[0].play();
   $("#stop-bt").show();
 });

 $("#stop-bt").click(function() {
    $("#stop-bt").hide();
    $("#audio-player")[0].pause();
    $("#audio-player")[0].currentTime = 0;
    $("#play-bt").show();
 });
});

I want to add a spinner to indicate the stream is loading. How would I show a div containing my spinner (#spin) when the stream is loading and hide it when the stream starts playing?

I thought I might be on the right track using something like: .bind(‘progress’, function() {..} but I couldn’t figure it out.

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-05-24T00:55:11+00:00Added an answer on May 24, 2026 at 12:55 am

    Thanks for the answers. I’m sure there are many ways to solve this problem. This is what ended up working for me:

    $(document).ready(function() {
     $("#stop-bt").hide();
     $("#spin").hide();
    
     $("#play-bt").click(function() {
       $("#play-bt").hide();
       $("#spin").show();
       $("#audio-player")[0].play();
      });
    
     $("#audio-player").bind('playing', function() {
       $("#spin").hide();
       $("#stop-bt").show();
     });
    
    
     $("#stop-bt").click(function() {
      $("#stop-bt").hide();
      $("#play-bt").show();
      $("#audio-player")[0].pause();
      $("#audio-player")[0].currentTime = 0;
     });
    
    });
    

    This is a pretty easy solution and might be elementary to some, but in the hopes of helping someone else I want to explain it. This answer assumes you have the corresponding html divs somewhere on the page.

    Essentially, how it works is to start by hiding the div containing the stop button, and the div containing the spinner. Next, if the div containing the play button is clicked, it then hides the play button, shows the spinner div and attempts to play the audio.

    There is an event in conjunction with the html audio tag called ‘playing’ (among others) that reveals when the audio begins playing. When the playing event begins, it hides the div containing the spinner and shows the div containing the stop button.

    Finally, if the stop button is clicked, it hides the stop div container, shows the play button div container, and pauses the audio.

    • 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 a simple software that is made in Delphi 7, and it crashes
Currently, I have some basic code to play a simple tone whenever a button
I just made a simple HTML5 game for mobile webkit. I have made a
I have made a simple test applet that has a red background and a
Heavy emphasis on simple. I've never made an installer and I'd rather not have
I have made a new windows service which works fine using barebone code (just
So I have made a webservice that interfaces with a set of data contained
I've made a simple app, where I have a list of songs. The user
My question involves a simple game that 2-4 people can play. This is a

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.