A+ A A-

How to Modify JomSocial to Support MP3 Audio Uploads

The open source stuff that JomSocial uses to convert and render video uploads (ffmpeg) also supports audio files.  I thought it would be cool to modify JomSocial to allow audio files to be used in its videos section.  It actually wasn't as hard to figure out as I thought it would be.  Please let me know if you have a better way to do this.  It would be cool if I could figure out how to customize the dull background ffmpeg puts on the "video," but at least it works.  Anyways, here's what I did...

* Find this file --> /components/com_community/helpers/videos.php
* Find the section that lists the MIME types that will be accepted
* Change / add MIME types as necessary

For example, I added this to videos.php:

$mimeType= array(

* You may also want to modify the language file so that audio files are listed as allowed uploads.  This just tells those uploading that they're allowed.

Something changed in a later version of ffmpeg, which broke JomSocial video uploads.  The wording on the ffmpeg version / copyright info changed, so some code modification was necessary to fix it.

* Go to a terminal on your server and type ffmpeg -version to see what the version / copyright info wording looks like.
* Edit this file --> /components/com_community/libraries/videos.php and look for the "hasFFmpegSupport" section.
* In my case I had to modify it to look like this:

function hasFFmpegSupport()
//return JFile::exists($this->ffmpeg);
$cmd= $this->ffmpeg . ' -version 2>&1';
$output= $this->_runCommand($cmd);
$hasVersion= JString::strpos( $output, 'ffmpeg version' );
$hasCopyright= JString::strpos( $output, 'the Libav developers' );

Newer versions of JomSocial have an additional file extension check upon upload, so 1 more change is necessary to get it working.

* Find the section below in file /components/com_community/helpers/videos.php, and add the file extensions you wish to support.  I added mp3 below as an example.

public function getValidExtensionType()
$extensionType= array(

Post comment as a guest

0 Character restriction
Your text should be more than 10 characters
  • Pending videos don't show up on your list of videos, so that looks fine. It's converting successfully. Click it and it should play.

  • I don't know either. I mentioned this in my article --> "It would be cool if I could figure out how to customize the dull background ffmpeg puts on the "video," but at least it works. " Please let me know if you figure it out.

  • I use a simple solution for this on my site. You can see it by clicking Media --> Music. I put all the music into a videos category called "Music," and set a menu item to display all videos in that category. If you want the music tab added to a user's profile, I recommend a plugin called MyPlayer by Nordmograph.

  • Guest - Adedoyin Kassem

    Thanks for the heads up, found the settings in the back-end. One more question though (this might be asking for way too much, but it is worth giving it a shot at least), do you know of any plugin that allows me create an additional tab beside the VIDEOS tab and call it say "MUSIC" (for audio files)?

    from Yaba, Lagos, Nigeria
  • JomSocial has that feature built-in. You just have to turn it on in the backend config.