--- /dev/null
+<div id="attachmentVideo_{@$attachmentIdentifier}" class="videoContainer" style="display: none;">
+ <video src="{link controller='Attachment' object=$attachment}{/link}" controls></video>
+</div>
+
+<a id="attachmentVideoLink_{@$attachmentIdentifier}" href="{link controller='Attachment' object=$attachment}{/link}">{$attachment->filename}</a>
+
+<script data-relocate="true">
+ {* try to determine if browser might be able to play video *}
+ var video = elById('attachmentVideo_{@$attachmentIdentifier}');
+ var canPlayType = elCreate('video').canPlayType('{$attachment->fileType}');
+
+ if (canPlayType === '') {
+ elRemove(video);
+ }
+ else {
+ elShow(video);
+ elRemove(elById('attachmentVideoLink_{@$attachmentIdentifier}'));
+ }
+</script>
use wcf\data\attachment\GroupedAttachmentList;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\request\LinkHandler;
+use wcf\system\WCF;
use wcf\util\StringUtil;
/**
return $result;
}
+ else if (substr($attachment->fileType, 0, 6) === 'video/') {
+ return WCF::getTPL()->fetch('__videoAttachmentBBCode', 'wcf', [
+ 'attachment' => $attachment,
+ 'attachmentIdentifier' => StringUtil::getRandomID()
+ ]);
+ }
else {
// file
return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', [