I have created a custom styled component for a video tag.
const Video = styled.video`
...
`
When I use this component like below:
<Video width='200px' height='200px' autoplay='autoplay' muted loop>
<source src={img.src} type='video/mp4' />
</Video>
The issue is that the autoplay
attribute does not seem to work and isn't visible in Devtools. However, other attributes like width, height, and loop are functioning correctly.
Interestingly, if I replace the custom styled component with a regular video tag as shown below, the autoplay feature works as expected:
<video width='200px' height='200px' autoplay='autoplay' muted loop>
<source src={img.src} type='video/mp4' />
</video>
Can anyone explain why the styled-component does not recognize the autoplay attribute?