0

audio or video doesn't autoplay in Html5

So I'm doing HTML5 course and was learning about adding audio and video elements in a webpage. When I insert an audio or a video and use 'autoplay' attribute along with them. for eg: <audio controls autoplay> <source src="path.mp3" type="audio/mp3"> </audio> Here audio should play automatically as we open the webpage but it doesn't happen. It doesn't work on sololearn app on android and also on windows chrome. I've checked on both platforms. Now for video element similar thing happens. When I simply use video element along with autoplay attribute as : <video controls autoplay> Then video doesn't autoplay. But when I use muted attribute in video element. Then video plays automatically as when I use: <video controls autoplay muted> Now can someone please tell me why audio doesn't autoplay and video autoplay only in muted form but not with volume.

5th Sep 2020, 7:43 AM
Gursimranjit Singh
Gursimranjit Singh - avatar
1 Antwort
0
<!-- First, please do never use autoplay. But i will help you. The simple solution to use autoplay. Copy and run it! <object data="path.mp3"> <param name="autoplay" value="true" /> <param name="controls" value="true" /> </object>
5th Sep 2020, 8:13 AM
Web-Learner