HTML - attributes - autoplay

revision:


Content

"autoplay" attribute : a boolean attribute, that allows audio/video playing syntax some examples


"autoplay" attribute : a boolean attribute, that allows audio/video playing

top

When present, the audio/video will automatically start playing as soon as it can do so without stopping.
The autoplay attribute can be used on the following elements:<audio >, <video>.


syntax

top

<element autoplay>


some examples

top

Click on the play button to play a sound:

codes:
                    <audio style="margin-left:5vw;" controls autoplay>
                        <source src="../../pics/horse.wav" type="audio/wav">
                        <source src="../../pics/horse.mp3" type="audio/mpeg">
                        Your browser does not support the audio element.
                    </audio>
                

Click on the play button to play a video

codes
                    <video style="margin-left:5vw;" width="400" height="200" controls autoplay> 
                    <source src="../../pics/Wuzhen-20-10_02.mp4" type="video/mp4"> 
                    </video>