Home > Blockchain >  Local Audio in HTML
Local Audio in HTML

Time:12-01

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>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

<html>
    <head>
        <title> Audio Play </title>
    </head>
    <body>
         <audio controls autoplay>
            <source src="https://www.computerhope.com/jargon/m/example.mp3">
        </audio> 
    </body>
</html>
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

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

CodePudding user response:

You can try by typing the src attribute inside the audio tag.

<audio src="/audio/audio.mp3" controls></audio>
  • Related