video autoplay

is there a way to make standard video block autoplay?
Cant' find anything online about this, and yet would seem obvious requirement.

View Replies:
mnakalay replied on at Permalink Reply

The standard video block just uses a normal HTML <video> element so to make it autoplay, you can simply copy the block's view.php file to create a template and in your template, around line 22, where it says
<video controls="controls" <?php echo $posterURL ? 'poster="' . $posterURL . '"' : '' ?>

Modify it to say
<video controls="controls" autoplay <?php echo $posterURL ? 'poster="' . $posterURL . '"' : '' ?>

But it is not necessarily a good idea because browsers are more and more blocking autoplay, especially on mobile.

You should read this to have a better idea of what browsers do and a possible strategy to deal with it:
mesuva replied on at Permalink Reply
One thing that has caught me out with this a few times is that some browsers will only autoplay a video if it doesn't have any audio track.

There is also another video attribute, muted, that can be added alongside autoplay, but I recall that that wasn't enough last time I tried (maybe because javascript could be used to toggle it once playing). The video itself had to have the audio stripped from it, even if the audio was just silence.

I use to re-encode videos smaller for the web, and you can also do a video only export.
mnakalay replied on at Permalink Reply
@mesuva is right and it is generally not a good idea anymore to autoplay videos