Seems worth noting the following here...
Chatbot output from Kagi follows.
-----
XenForo doesn't allow raw HTML in posts for security reasons. Create a custom BB Code that the system replaces with an <audio> tag
3.
Step 1: Go to the Custom BB Code manager
In your
Admin Control Panel, navigate to:
>
Content →
BB Code →
Custom BB Codes → click
Add custom BB code
Step 2: Fill in the BB Code settings
Configure the fields as follows
2:
| Field | Value |
|---|
| BB code tag | AUDIO |
| Title | HTML5 Audio Player |
| Description | Embeds a native HTML5 audio player for FLAC, MP3, OGG, WAV, etc. |
| Replacement mode | Simple replacement |
| Supports option parameter | No |
Step 3: Set the HTML replacement
In the
HTML replacement box, enter
3:
Code:
<audio controls preload="none" style="width:100%; max-width:400px;">
<source src="{text}" type="audio/flac">
Your browser does not support the audio element.
</audio>
{text} will be replaced by whatever the user puts between the [AUDIO] tags (i.e., the file URL).
type="audio/flac" tells the browser it's a FLAC file. If you want to support multiple formats, you can omit the type attribute or add multiple <source> lines.
preload="none" prevents auto-loading (saves bandwidth). Remove it if you want auto-loading.
controls displays the native play/pause/seek bar.
Step 4: Optional — Add a button to the editor
In the
Editor icon field, enter a Font Awesome icon class (e.g.,
fa fa-music) so users get a clickable button in the message editor instead of having to type the BB Code manually
3.
Step 5: Save and test
Save the BB Code. Now in any post, a user can write:
Code:
[AUDIO]https://example.com/files/song.flac[/AUDIO]
This will render a native HTML5 audio player in the post.
Supporting multiple audio formats
If you want the player to handle FLAC
and other formats, you can make a more flexible version. Set
Supports option parameter to
Yes, and use this HTML replacement:
Code:
<audio controls preload="none" style="width:100%; max-width:400px;">
<source src="{text}" type="audio/{option}">
Your browser does not support the audio element.
</audio>
Then usage would be:
Code:
[AUDIO=flac]https://example.com/files/song.flac[/AUDIO]
[AUDIO=mp3]https://example.com/files/song.mp3[/AUDIO]
[AUDIO=ogg]https://example.com/files/song.ogg[/AUDIO]
The
{option} token captures the format type after the = sign
3.
Important notes
- Browser support for FLAC: The native HTML5 <audio> player supports FLAC in Chrome, Firefox, Edge, and Opera (desktop and mobile). Safari does not support FLAC — it will show "Your browser does not support the audio element" for Safari users.
- File hosting: The audio file must be hosted somewhere accessible via a direct URL (your own server, a CDN, etc.). The BB Code doesn't handle file uploads — it just plays a URL.
- Attachment files: If you want to play attached files (files uploaded directly to the post) rather than external URLs, you'd need a template modification instead. There are existing add-ons like the Simple HTML5 video and audio attachment player that handle this, though they may not list FLAC explicitly 3.
References