BBCode for mp4 video attachement issue

Get help developing custom BBCodes or request one.
Vabalistas
Registered User
Posts: 9
Joined: Wed Jun 26, 2024 10:06 am

BBCode for mp4 video attachement issue

Post by Vabalistas »

Hi,

I have this BBCode for playing mp4 videos:

<video src="{URL}" style="max-width:720px;max-height:600px" controls> Your browser does not support the video tag. </video>

Works fine if I upload the file directly to my server and use the original filename. However, if the user attaches the video to a post, phpbb would change real_filename to physical_filename and then this BBCode no longer works. How do I modify it to call for a physical_filename by using real_filename?

Thanks.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6613
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: BBCode for mp4 video attachement issue

Post by thecoalman »

For compatibility the video needs to be .webm or an .mp4 encoded with h.264. mp4's using other encoding methods have very little browser support and will never work.

Generally speaking you should specify the mime type:

Code: Select all

 <video width="320" height="240" controls>
  <source src="{URL}" type="video/mp4">
</video> 
Lastly phpBB serves all files except images using mime type application/octet-stream which is just generic, the default behavior for a browser is to download and save the file. Video files embedded in page using <video> tag are going to give sporadic results based on the browser. I would imagine most of them are going to reject playing it.

There is topic about making modification so it''s being served with correct mime type here:

viewtopic.php?f=496&t=2319361
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

Return to “Custom BBCode Development and Requests”