Using this SO question, I put this html5 code into a typescript project to play a video automatically and to use a gif as a fallback if html5 video is not supported. However, the autoplay
and loop
and width
and height
controls create an error in typescript (see below). However, if I remove the autoplay
loop
width
and height
properties, then I can play the video by accessing the controls in the browser.
Question: How can I set the video to play and loop automatically in typescript?
<video autoplay="autoplay" loop="loop" width="400" height="300">
<source src={mymp4} type="video/mp4" />
<img src={fallback.gif} width="400" height="300" />
</video>
Type '{ autoplay: "autoplay"; loop: "loop"; width: "400"; height: "300"; children: Element[]; }' is not assignable to type 'DetailedHTMLProps, HTMLVideoElement>'