[SOLVED] Why does using the ".play" action not play this video?


I’m trying to make an image that, when clicked, will play a video, but when I click it the video doesn’t play. I’m using a chromium browser.

<img src="overlay.png" onclick="playit();">
<video id="video" loop>
     <source src="wheel.mp4" type="video/mp4">

     function playit() {

I’ve put a console.log() message in the same script, and it executes succesfully, but nothing occurs with the .play action


You need to call the play() method like so:

function playit() {

More on play()

Answered By – Rico Hancock

Answer Checked By – Marilyn (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *