--- /dev/null
+<span class="mediaBBCode">
+ <audio src="{$attachment->getLink()}" style="display: none;" id="attachmentAudio_{$attachmentIdentifier}" controls></audio>
+
+ <span class="mediaBBCodeCaption">
+ <a href="{$attachment->getLink()}">{$attachment->filename}</a>
+ </span>
+</span>
+
+<script data-relocate="true">
+ (function () {
+ {* try to determine if browser might be able to play audio *}
+ var audio = elById('attachmentAudio_{@$attachmentIdentifier}');
+ var canPlayType = audio.canPlayType('{$attachment->fileType}');
+
+ if (canPlayType === '') {
+ elRemove(audio);
+ }
+ else {
+ elShow(audio);
+ }
+ })();
+</script>
'attachmentIdentifier' => StringUtil::getRandomID(),
]);
}
+ else if (substr($attachment->fileType, 0, 6) === 'audio/' && $parser->getOutputType() == 'text/html') {
+ return WCF::getTPL()->fetch('__audioAttachmentBBCode', 'wcf', [
+ 'attachment' => $attachment,
+ 'attachmentIdentifier' => StringUtil::getRandomID(),
+ ]);
+ }
else {
// file
return StringUtil::getAnchorTag($attachment->getLink(), $attachment->filename);