ekumanov/flarum-ext-inline-audio

Automatically converts audio file links into inline players in posts, with optional [player] BBCode tag

Maintainers

Package info

github.com/ekumanov/flarum-ext-inline-audio

Language:JavaScript

Type:flarum-extension

pkg:composer/ekumanov/flarum-ext-inline-audio

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.2.0 2026-03-17 23:27 UTC

This package is auto-updated.

Last update: 2026-03-17 23:55:20 UTC


README

ℹ️ If you've been using Inline Audio (aka Audio URL to Player), that extension has been abandoned. This is a fresh, actively maintained replacement built for Flarum 2.0+ (and 1.8 via the 1.x branch).

Inline Audio Player

License Latest Stable Version Total Downloads

A Flarum extension that automatically converts audio file links in posts into clickable filenames backed by a shared overlay player bar, with an optional [player] BBCode tag.

Audio links are replaced with a compact filename button. Clicking it loads the track into a fixed player bar at the bottom of the page — keeping posts clean while giving you a persistent, always-visible player.

No player open

Player open

Features

  • Auto-detects links to audio files and replaces them with a clickable filename — no BBCode required
  • Clicking a filename loads it into a shared overlay player bar fixed at the bottom of the page
  • Clicking the same filename again toggles play/pause
  • Clicking the track name in the bar scrolls back to the source post
  • A circle-play icon precedes each filename in the post; it switches to a pulsating circle-pause while that track is playing
  • When a new track starts, any currently playing audio is stopped automatically — one track at a time
  • Download button in the player bar; works correctly in all browsers including Safari
  • [player]URL[/player] BBCode for explicit embedding — identical behavior to auto-detected links
  • The player bar follows the Flarum theme (light/dark) rather than the OS theme
  • On narrow screens the filename expands to fill available width; audio controls shrink to their natural size
  • The bar has a close button that stops playback and dismisses the bar
  • Bar rises above the Flarum composer when it is open
  • Accessible: keyboard navigation, screen reader labels, respects prefers-reduced-motion
  • Works seamlessly with FoF Upload when using a filename-link upload template (see below)

Supported formats: mp3 · wav · ogg · flac · m4a · aac · webm · mp4 · mpeg · mpg · wave

Installation

composer require ekumanov/flarum-ext-inline-audio

Update

composer update ekumanov/flarum-ext-inline-audio
php flarum cache:clear

Uninstall

composer remove ekumanov/flarum-ext-inline-audio

BBCode

[player]https://example.com/audio/track.mp3[/player]

FoF Upload Integration

If you use FoF Upload and want audio files to automatically render as inline players after uploading — without requiring users to manually wrap links in [player] tags — you can register a filename-link upload template in your forum's extend.php.

FoF Upload does not ship with this template; add it yourself as follows:

use FoF\Upload\Contracts\Template;
use FoF\Upload\File;
use Flarum\Foundation\AbstractServiceProvider;
use FoF\Upload\Helpers\Util;

class FilenameLink implements Template
{
    public function tag(): string   { return 'filenamelink'; }
    public function name(): string  { return 'Filename link'; }
    public function description(): string { return 'Generates a link with the filename as text'; }

    public function preview(File $file): string
    {
        return '[' . $file->base_name . '](' . $file->url . ')';
    }
}

class FilenameLinkServiceProvider extends AbstractServiceProvider
{
    public function register()
    {
        $this->container->make(Util::class)
            ->addRenderTemplate($this->container->make(FilenameLink::class));
    }
}

// In your return array:
(new Extend\ServiceProvider())->register(FilenameLinkServiceProvider::class),

Once registered, select Filename link as the upload template in the FoF Upload admin settings.

To restrict the template to audio files only, set a MIME type filter in FoF Upload using this regex:

^audio\/(flac|x-flac|mp3|x-mp3|mpg|mpeg|mpeg3|x-mpeg|x-mpeg3|x-mpg|x-mp4a|x-mpegaudio|mp4|vnd.wave|wav|wave|x-wav|x-pn-wav|ogg|x-ogg|x-ogg-flac)

Compatibility

Branch Flarum version
main (this) Flarum 2.0+
1.x Flarum 1.8

Links