<span class="mediaBBCode">
- <video src="{$attachment->getLink()}" controls></video>
+ <video src="{$attachment->getLink()}" style="display: none;" id="attachmentVideo_{$attachmentIdentifier}" controls></video>
<span class="mediaBBCodeCaption">
<a href="{$attachment->getLink()}">{$attachment->filename}</a>
</span>
</span>
+
+<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);
+ }
+</script>
else if (substr($attachment->fileType, 0, 6) === 'video/' && $parser->getOutputType() == 'text/html') {
return WCF::getTPL()->fetch('__videoAttachmentBBCode', 'wcf', [
'attachment' => $attachment,
+ 'attachmentIdentifier' => StringUtil::getRandomID(),
]);
}
else {