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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:25:14+00:00 2026-06-16T11:25:14+00:00

i have written some simple html and javascript that should play a sound file.

  • 0

i have written some simple html and javascript that should play a sound file. The page displays the two buttons but when i click the play button it does nothing . I know that my browser can play my mp3 file because it works with just the audio tag ex:

<audio src="soundtest.mp3" ></audio>

If anyone could tell me what i am doing wrong i would greatly appreciate it.

<!DOCTYPE html>
<html>
<body>

<button onclick="playSong()" type="button">play</button>
<button onclick="pauseSong()" type="button">pause</button>
<br>

<audio id="audio1">
<source src="soundtest.mp3" type="audio/mp3" >
  Your browser does not support the audio tag!
</audio>

<script> 
var mySong=document.getElementById("audio1"); 

function playSong()
  { 
  mySong.play();

  } 

function pauseSong()
  { 
  mySong.pause();

  } 


</script>


</body>
</html>
  • 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-16T11:25:19+00:00Added an answer on June 16, 2026 at 11:25 am

    There are a few things to try. First and foremost, check mySong.canPlayType("audio/mpeg"). It should return “maybe”. If it does not, your browser doesn’t support MP3 and you should try a different one.

    Then, the <audio> tag’s type attribute should be audio/mpeg, not audio/mp3. MIME type is important.

    So important, in fact, that if it still doesn’t work you should check to ensure that the server is configured to serve .mp3 files with the audio/mpeg MIME type header.

    If this still doesn’t work… try turning the speakers on :p I’m kidding, if you still have problems after these steps, let me know.

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

Sidebar

Related Questions

I have a simple html page that sources a javascript file. The javascript file's
I'have written a simple code, that gets accelerometer&orientation meter and display some graphics based
I noticed that many websites, even Google and some banking sites, have poorly-written HTML
I have written a simple javascript searcher for a page and am running into
I have written some JavaScript code that will read from the Google Maps API
I have written some relatively simple jQuery plug-ins, but I am contemplating writing something
I have written very very simple console application which supports some command line options.
i have some WinForms app (Framework to develop some simple apps), written in C#.
i have some WinForms app (Framework to develop some simple apps), written in C#.
I have written some code that loads an XML document using an XmlDocument object

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.