Inline Audio

License Latest Stable Version Total Downloads

A Flarum extension. Automatically convert audio URLs into minimal inline audio players (makes link play audio on click instead of opening in a new tab). To use, paste in an audio URL, or create a markdown link to a standard audio file. To see player immediately, refresh page. But, do not worry, no one else will need to refresh the page and you don't need to either, unless you want to play the audio for yourself immediately.

Bonus: Use with fof/upload. Allow uploading audio files. For the template choose the URL only option. Now users can upload an audio file, and that url will turn into the minimal player.

Install

composer require zerosonesfun/flarum-inline-audio:"*"

Update

composer update zerosonesfun/flarum-inline-audio:"*"

Uninstall

composer remove zerosonesfun/flarum-inline-audio

Screenshot

Screenshot

Links

I am using Flarum 0.1.0-beta.15

the error received

Your requirements could not be resolved to an installable set of packages.

Problem 1
- zerosonesfun/flarum-inline-audio[1.0, ..., 1.0.1] require flarum/core 0.1.0-beta.16 -> found flarum/core[v0.1.0-beta.16] but the package is fixed to v0.1.0-beta.15 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires zerosonesfun/flarum-inline-audio 1.0 -> satisfiable by zerosonesfun/flarum-inline-audio[1.0, 1.0.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

    Braden use * version to install extensions on older Flarum versions, like:

    composer require zerosonesfun/flarum-inline-audio:*

    (I have not actually tested it, but that's how it should work with all extensions)

    Otherwise it will try to install the latest version of the extension without regard for your Flarum version.

      clarkwinkelmann you taught me that bro, i tried it already v1.0 and v0.1.0

      it looks like some days i will just have to update to beta 16. Am afraid to do so now, the site is working superfine 👍

        Braden Maybe since you already tried once beta 16 is stuck in your composer.json for this extension and you’ll have to manually change the beta 16 version constraint to *. I’m not sure to be honest just making a guess. Sometimes I feel like composer stuff gets cached or something? Because it can simply act odd from time to time.

          010101 Don't worry bill you have done a great job airing the audio implementation. Am sure soon something will come up, that's why we are still using beta, cheer up!

          Version 1.2

          • Added [player] BBCode (see first post)

          You now have a choice. Insert a regular link to an audio file. It will automatically turn into an unobtrusive player which is a link with an icon. Click it and audio plays. Or, use [player]url[/player] (optional artist and title attributes available) and you’ll get a modern, clean audio player with volume control, seek, progress bar, and it will be your forum’s primary color.

            20 days later
            3 months later

            I've almost got this working with the FOF Upload extension. However, after I added Amazon S3 support for the file uploads, the inline link/icon no longer appears to play the file.

            Any thoughts?

              whisperwow I would guess that maybe the Amazon URL doesn’t end in an audio file extension. For this to work, the URL has to end in .mp3, .mp4, .wav, .flac, etc.

                010101 Both the local server and Amazon S3 files end in the .mp3 extension but the inline player does not seem to be working.

                  whisperwow I’d have to see the post and inspect the code. If you want to share a link I’ll take a look. Otherwise, it could have to do with caching. Is the little headphones icon showing?

                  It’s pretty hard to troubleshoot these things without seeing.

                    whisperwow Ok, I see. Looks like this extension can't handle forums installed in a directory (i.e. your site.com/forum). I thought it could, but I guess not. The JavaScript included isn't pointing to the exact right spot. If your forum was installed at forum.yoursite.com or yoursite.com, it would work.

                    Maybe one day a developer here will contribute to this extension and help fix that. 😸 Or, it's always possible that I'll find the energy one day to figure it out. It's just not a priority for me at the moment.

                    Instead, because it's faster and easier for me personally, just like I did with the audio bbcode for you, I made a version for your forum. Hard to explain, but doing this is much faster for me than re-doing the existing extension. So, remove the existing one, and install this instead:

                    composer require 2nrwls/flarum-inline-audio:"*"
                    also run:
                    php flarum cache:clear

                    This worked great as well. Thank you very much for taking the time to do the version for my forum.

                    Since I plan on officially launching my SongSport site in October, I'd be happy to maybe sponsor further development of this or the BB Code player extension that you developed. Since the "FOF Upload" extension already uploads a file to a local server or Amazon S3 and creates a valid .MP3 extension, is there a way to build or "extend" on that so that your Audio URL or BB Code player automatically takes that file name that is uploaded and put it into BB Code to display the player?

                    Just food for thought.

                    Thanks again and let me know if you're interested in discussing further.

                    a month later

                    Version 2.0

                    • No new features
                    • Code clean up
                    • Had to remove the more complex BBCode audio player. It had a major bug. Sorry if anyone uses it. Just don't update if you really like it that much. But, the bug is that the code would repeat itself over and over sometimes. Might not be visible, but it was rather dirty behind the scenes. And so, this version is back to only being the original inline minimal player which is bug free. If you need a player with a progress bar try Essential Audio, or Audio BBCode.

                    So I should remove this file via composer?

                    composer remove 2nrwls/flarum-inline-audio:"*"

                    I tried it but it says it doesn't exist.

                    Also, will the 2.0 version work on "Forum" subdirectories?

                      whisperwow I cleaned up that version as well. You may simply use the following command to update it:

                      composer update 2nrwls/flarum-inline-audio:"*"

                      For anyone else, the above is a custom version for whisperwow’s forum. It is only for forums installed at /forum.

                      4 months later

                      When I installed this extension, the FoF Upload stuff disappeared (no "My Media", no buttons available, etc.)