zerosonesfun/flarum-ext-audio

Adds an [audio] and a [sound] BBCode tag to Flarum.

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 2

Watchers: 1

Forks: 3

Open Issues: 0

Language:JavaScript

Type:flarum-extension

1.2.2 2018-10-27 16:54 UTC

README

An extension for Flarum which adds two BBCodes. One is [audio] and it will turn a mp3, ogg, or wav URL into your browser's default audio player. The other is [sound] and it will turn your mp3, mp4, ogg, opus, wav, or flac URL into a simple CSS/JavaScript audio player thanks to Soundmanager2. However, the second BBcode ([sound]) will only work if you also manually add some JavaScript and CSS. Below the main install instructions are the instructions you may follow if you want the Soundmanager2 player to work. Otherwise, the default HTML audio player will work fine if you don't want to mess with the additional steps.

Usage (standard HTML audio player)

[audio]URL to audio file[/audio]

Installation

composer require zerosonesfun/flarum-ext-audio:*

Soundmanager2 add-on (optional)

In addition to installing the main package with composer, download soundmanager2.min.js and inlineplayer.js from the assets folder of this repository. Upload those where ever you'd like. Then include the following script tags in your Flarum header. There is a custom header code area in your admin dashboard in the appearance section. You may add this in there. Or, if you're a Flarum expert, add them to your head (different from the header).

<script src="https://yoursite.com/path/to/soundmanager2.min.js"></script>
<script src="https://yoursite.com/path/to/inlineplayer.js"></script>

Finally, add the inlineplayer.css (also located in the repository folder linked above) to your custom CSS box in your admin appearance settings.

Clear your cache.

Now you can use both the [audio] tag and the [sound] tag if you'd like. Or, just use one of them. The power is yours! If you use the [sound] tag you will include the audio URL a little differently, like this:

SM2 Usage 🦄

[sound="https://example.com/boom.mp3"]Title Goes Here[/sound]

Namaste.