# Automatically playing mp4 uploaded file

**URL:** https://meta.discourse.org/t/automatically-playing-mp4-uploaded-file/281040
**Category:** Support
**Created:** [October 4, 2023, 1:46pm UTC](https://meta.discourse.org/t/automatically-playing-mp4-uploaded-file/281040 "2023-10-04T13:46:20Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 4, 2023, 3:45pm UTC](https://meta.discourse.org/t/automatically-playing-mp4-uploaded-file/281040/3 "2023-10-04T15:45:34Z")

</div>

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:

```html
<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>

```

[/forum/uploads/default/original/3X/d/6/d6fab77fb56eeb98ef660d682f344dba4bbb66ce.mp4](https://www.simscale.com/forum/uploads/default/original/3X/d/6/d6fab77fb56eeb98ef660d682f344dba4bbb66ce.mp4)

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:

> **[Autoplay guide for media and Web Audio APIs - Media | MDN](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Autoplay)**
>
> Automatically starting the playback of audio (or videos with audio tracks) immediately upon page load can be an unwelcome surprise to users. While autoplay of media serves a useful purpose, it should be used carefully and only when needed. In order...

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](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115)

---

_[View the full topic](https://meta.discourse.org/t/automatically-playing-mp4-uploaded-file/281040)._
