Audio
Abandoned! Use zerosonesfun/flarum-ext-sm2 instead.
Once beta 8 was released I decided to do this extension differently and release it under a new name. This version will not work with beta 8+. The code will remain in GitHub should anyone want it.
(Images show extension with Sound Manager 2 included. Your audio player may look different.)
Description 💤
Originally created by Andrey Sobkanyuk, the Flarum Audio extension adds the ability to use an [audio] BBCode tag. This tag will allow you to play mp3, ogg, or wav URLs with your browser's default HTML audio player. Optionally, you may also add a couple scripts in your Custom Header, and add some CSS to your Custom CSS (both located in your admin appearance settings), and then you will be able to use an additional BBCode which I have added called [sound]. The difference is, the [sound] tag will use the popular Sound Manager 2 JavaScript library. There are multiple benefits to using Sound Manager 2, but you will need to research that on your own.
I will first show the standard installation instructions which do not require you to do anything extra, but you will only be able to use the [audio] tag. If you want to use the [sound] tag, see the Sound Manager 2 add-on instructions.
Installation âš¡
composer require zerosonesfun/flarum-ext-audio:*
Update 🌟
composer update zerosonesfun/flarum-ext-audio
Usage 🦄
[audio]https://example.com/boom.mp3[/audio]
Sound Manager 2 add-on
In addition to installing the main package with composer, go here and download soundmanager2.min.js
and inlineplayer.js
. 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.
However, the most proper way would be to add these scripts to the actual <head>
of your forum. One way to easily do this is to install this favicon extension. Why a favicon extension? Because this extension essentially just adds code to your <head>
. You could follow this other extension's instructions and keep the app icon and favicon code. I recommend this if you don't already have app icon code in your <head>
. But, whether you use this extra extension for icon purposes or not, go into the favicon extension's folder, and find assets/html/links.html
. In that file you could add the below script tags. Now, the scripts will be properly in the <head>
of your site.
If all of that feels like too much to go through, again, just pop the script code below into your custom header box which means the scripts will be included in your <body>
instead of the <head>
, but it should still work.
<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 my github repository linked above) to your custom CSS box in your admin appearance settings. Or, include it however you'd like (such as using the favicon extension mentioned above).
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]
Oh the places you'll go 🖇
Latest Release: https://github.com/zerosonesfun/flarum-ext-audio/releases/tag/1.2.2
Original author: https://github.com/chapay/flarum-ext-audio