In <audio > or <video > element if we don't give controls attribute, its not working.Why is it so? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In <audio > or <video > element if we don't give controls attribute, its not working.Why is it so?

Instead only controls (like play, pause, download) shouldn't be available but video or audio should work.

10th Jun 2017, 3:07 PM
Utkarsh Hemrajani
Utkarsh Hemrajani - avatar
15 Answers
+ 4
On a desktop, IE 11, FF, Chrome and Safari all play with just 'autoplay'. It appears that it is probably intentional that mobile browsers will not allow 'autoplay' to work without the 'controls', because it would be very annoying not to be able to turn of a video or an audio. With neither present, logically the player should not work. Btw, for some reason there are two versions of this topic.
11th Jun 2017, 4:22 AM
Victor
Victor - avatar
+ 3
Another piece of information:. The autoplay attribute does not work in mobile devices like iPad and iPhone. I will check several desktop browsers later today.
11th Jun 2017, 2:04 AM
Victor
Victor - avatar
+ 3
a jquery/any other js plugin might help, what do you guys think???
11th Jun 2017, 3:19 PM
Rinmawia
Rinmawia - avatar
+ 2
you cannot play without controls, you have to make it auto play i think
10th Jun 2017, 3:26 PM
Rinmawia
Rinmawia - avatar
+ 2
I will. check further tomorrow.
10th Jun 2017, 6:02 PM
Victor
Victor - avatar
+ 1
You can use autoplay, but cannot control the playing.
10th Jun 2017, 4:04 PM
Victor
Victor - avatar
+ 1
@Rinmawia I checked using only autoplay also but still it's not working in the code playground: https://code.sololearn.com/WQHjT54jxOHv/?ref=app
10th Jun 2017, 5:09 PM
Utkarsh Hemrajani
Utkarsh Hemrajani - avatar
+ 1
try adding 'autoplay' attribute
10th Jun 2017, 5:27 PM
erez
erez - avatar
+ 1
On computer or mobile? echo browser
10th Jun 2017, 5:27 PM
Victor
Victor - avatar
+ 1
which browser
10th Jun 2017, 5:27 PM
Victor
Victor - avatar
+ 1
@victor code playground Android app (Mobile)
10th Jun 2017, 5:53 PM
Utkarsh Hemrajani
Utkarsh Hemrajani - avatar
+ 1
ok
10th Jun 2017, 6:04 PM
Utkarsh Hemrajani
Utkarsh Hemrajani - avatar
+ 1
thanks a lot victor
11th Jun 2017, 1:08 PM
Utkarsh Hemrajani
Utkarsh Hemrajani - avatar
+ 1
its working but visitor can not control the audio&video.
12th Jun 2017, 9:16 PM
A.RAHMAN
A.RAHMAN - avatar
+ 1
@Rinmawia. The beauty of HTML5 audio/video is it's simplicity​. The HTML5 DOM has methods, properties, and events for the <audio> and <video> elements. These methods, properties, and events allow you to manipulate <audio> and <video> elements using JavaScript. See: https://www.w3schools.com/tags/ref_av_dom.asp
13th Jun 2017, 2:26 AM
Victor
Victor - avatar