For a client though having this was important, so I thought I'd share my hack. I don't think this can be done as an extension because it requires a new version of
attachment.html
. You have to overwrite some of the template. Unfortunately, template events won't do the trick. You could create a custom style and inherit your default style and do it that way, but that's pretty advanced. You also have to mess with phpBB's attachment groups.Web-ready video formats are played natively in the browser without a browser add on or extension and use the HTML 5
<video>
tag. The web-ready formats are MP4, WebM and OGG. As with most things, browsers are not entirely consistent and really old non-HTML 5 browsers will ignore the tag. This may be a deal killer if you have to support really old browsers. As a practical matter MP4 is the format that is typically uploaded.Changes to
attachment.html
. Find:Code: Select all
<!-- IF _file.S_FLASH_FILE -->
Code: Select all
<video controls>
<source src="{_file.U_VIEW_LINK}" type="video/mp4">
<source src="{_file.U_VIEW_LINK}" type="video/ogg">
<source src="{_file.U_VIEW_LINK}" type="video/webm">
Your browser does not support the video tag.
</video>
<object>
tag code as follows:Code: Select all
<!--object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{_file.WIDTH}" height="{_file.HEIGHT}">
<param name="movie" value="{_file.U_VIEW_LINK}" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="quality" value="high" />
<param name="allowScriptAccess" value="never" />
<param name="allowNetworking" value="internal" />
<embed src="{_file.U_VIEW_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
</object-->
Style changes are also needed. The approach used depends on the style and how it is written. Usually you just append this code at the bottom of
stylesheet.css
. This will shrink the video proportionately to accommodate lots of devices, principally mobile:Code: Select all
video {
width: 100%;
height: auto;
}
- Changed swf extension to Unassigned
- Added mp4 to Flash group
- Added m4v to Flash group. This is actually a mp4 format that some phones like an iPhone will use by default, so it's important to allow it.
- Added webm to Flash group
- Added ogg to Flash group
Of course, if you don't allow attachments at all, this won't work. ACP > Posting > Attachment settings. Make sure the first radio button is checked to allow post attachments, and possibly the second to allow them in private messages.
With quite a bit of testing, I found some mobile browsers problematic. In general where there are issues it is best to use Chrome. Most browsers are fine since HTML 5 is everywhere now. Safari seems the most problematic.
You may need to clear your browser's cache to see the changes.
I think this is it. Obviously, as phpBB gets updated or upgraded, the
attachment.html
template may get overwritten so these changes may need to be reapplied.This is a bit hackish, so YMMV. If you have suggestions on how to do this better, please post them.