Riproduzione automatica file mp4 caricato

Hi team,

Is it possible to put this forum page automatically playing that video whenever anyone just open the page?

Thanks in advance.

1 Mi Piace

Instead of just having the video link handled by Discourse when it bakes the post, you can insert the video HTML element and add the autoplay attribute:

<video width="100%" height="100%" preload="metadata" controls="" autoplay>
      <source src="https://www.simscale.com/forum/uploads/default/original/3X/d/6/d6fab77fb56eeb98ef660d682f344dba4bbb66ce.mp4">
      <a href="https://www.simscale.com/forum/uploads/default/original/3X/d/6/d6fab77fb56eeb98ef660d682f344dba4bbb66ce.mp4">/forum/uploads/default/original/3X/d/6/d6fab77fb56eeb98ef660d682f344dba4bbb66ce.mp4</a>
</video>

Since the video has no sound, it will autoplay. If it had sound, you would have to add the muted attribute as well.

More info:

You can see what HTML tags are allowed in posts here: https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115

4 Mi Piace

Hi @Canapin,

That’s really helpful, and I feel really appreciated for your answer.
BTW, is there any HTML attribute to insert loop for such video? Or you think by inserting this autoplay HTML string it will be automatically in loop?

Thanks once again,

You can add the loop attribute :slight_smile:

1 Mi Piace

Nice @Canapin :slightly_smiling_face: I think it would be a great addition to Insert Video theme component as it has other option like nodownload too. It can probably appear on modal to each video upload. :thinking:

3 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.