Home > Software design >  How to autoplay local video with iframe?
How to autoplay local video with iframe?

Time:11-14

There are many solutions out there on how to make youtube/vimeo autoplay a video but they don't seem to work on a local video:

<template>
  <section id="vision" class="vision">
    <iframe src="videos/cgi_neutral.mp4?autoplay=1" allow="autoplay" allowfullscreen="true"></iframe>
  </section>
</template>

This does not autoplay.

CodePudding user response:

First, instead of using an iframe, use a <video> tag. (Because its self-hosted on your website, no need to use an iframe) To make it autoplay, just add the "autoplay" attribute.

For Example:

<video width="320" height="240" controls autoplay>
 <source src="movie.mp4" type="video/mp4">
</video>
  • Related