'React video not autoplaying, autoplay not working
I have a video component added like this
<video autoplay loop src="/vids/vid.mp4">
But it is not playing automatically.
What am I missing?
Solution 1:[1]
This worked
- Use
autoPlayinstead ofautoplayfor react. - Also add
muted
So, the code will be <video autoPlay muted loop src="/vids/vid.mp4">
if you want to use the autoplay with small letters, you should assign the value autoplay="true"
Solution 2:[2]
You need to add the muted attribute, like so:
<video muted autoplay loop src="/vids/vid.mp4">
For more, you can have a look: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Solution 3:[3]
This might help:
I was working with ReactFullpage and the video would not autoplay on mobile devices.
so I added data-autoplay="" and it got fixed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abraham |
| Solution 2 | danihazler |
| Solution 3 | Muhammad Arslan |

