Skip to content Skip to sidebar Skip to footer

Playing Sound In Hidden Tag

I am trying to set sound on web page. I found this code. It is working code when the div is visible but I want to be hidden and working. In this case it is not working because it i

Solution 1:

I agree with the sentiment in the comments above — this can be pretty annoying. We can only hope you give the user the option to turn the music off.

However...

audio { display:none;}
<audioautoplay="true"src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg">

The css hides the audio element, and the autoplay="true" plays it automatically.

Solution 2:

I have been trying to attach an audio which should autoplay and will be hidden. It's very simple. Just a few lines of HTML and CSS. Check this out!! Here is the piece of code I used within the body.

<div id="player">
    <audio controls autoplay hidden>
     <source src="file.mp3"type="audio/mpeg">
                unsupported !! 
    </audio>
</div>

Solution 3:

<audio autoplay> <source src="file.mp3" type="audio/mpeg"> </audio>

It removes the auto play bar but still plays the music. Invisible sounds!

Solution 4:

That's how I achieved it, which is not visible (HORRIBLE SOUND....)

<!-- horrible is your mp3 file name any other supported format.--><audiocontrolsautoplayhidden=""src="horrible.mp3"type ="audio/mp3"">your browser does not support Html5</audio>

Solution 5:

audio { display:none;}
<audioautoplay="true"src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg">

Post a Comment for "Playing Sound In Hidden Tag"