0

How can I make my html page represent local audio without uploading.
I have code like but the audio is not playing it just represent audio style:

<audio controls preload="none" id="audio"> 
    <source id="first-audio" src="/home/linux/Desktop/Mega/upload/Audio Files/file.wav" type="audio/wav">
 </audio>
Rana
  • 2,500
  • 2
  • 7
  • 28
Sara
  • 11
  • 3
  • FYI: Your code is blank. – kanine Nov 30 '21 at 13:44
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio – user1063287 Nov 30 '21 at 13:47
  • 1
    Does this answer your question? [Using local file as – Liam Nov 30 '21 at 13:47
  • You should try to remove the first slash `/` before `home` from `src`, most of the time it creates a problem. See if it works – Rana Nov 30 '21 at 13:59
  • Hi @sara : There can only be two reasons that it is not working. 1. Wrong Relative path of the audio file means `src={}` is not pointing to correct audio path. 2. Or wrong `type` or the type of audio not supported. Can can please show me the file structure. Take a screenshot and add to the question. – Imran Rafiq Rather Nov 30 '21 at 14:05

1 Answers1

0

<html>
    <head>
        <title> Audio Play </title>
    </head>
    <body>
         <audio controls autoplay>
            <source src="https://www.computerhope.com/jargon/m/example.mp3">
        </audio> 
    </body>
</html>

Try this, remember to place your audio file in same directory that your html file or use relative path :

 <html>
        <head>
            <title> Audio Play </title>
        </head>
        <body>
             <audio controls autoplay>
                <source src="frere_jacques.mp3" type="audio/mpeg">
            </audio> 
        </body>
    </html>

more infos, to help you : www.w3schools

Romylussone
  • 773
  • 1
  • 8
  • 19