I wanted my forum users to be able to upload mp3's and have a little flash player show up so that other users could stream them directly from the site (see screenshot).
After a few hours of scouring forums and googling, it seemed that nobody had the solution I wanted (just a bunch of less appealing alternatives). So, even though I don't know javascript or php, I managed to put together this little hack and to my surprise it gets the job done! When it's finished, you'll be able to upload an mp3, and when you click the "place inline" button, it will embed mp3's in our flash player BBCode tag.Note: If you are using something other than the default prosilver style, you will need to edit the files that are in those style folders.
Part 1: Install Flash Player
I use the Dewplayer Multi BBCode. If you want to install a different flash player, you just need to make sure you install that one and replace all appropriate references to the BBCode. Get the files and original instructions here.
1. First thing is to download the attachment in the link, unzip it, and upload the contents to your forum root (ie: /home/yourusername/public_html/phpBB3/ on a default install on a linux server running apache).
2. Next go to the Admin Control Panel >> Select "Posting" Tab >> Select "BBCodes" from left menu
3. Select "Add a new BBCode"
4. Enter the following into the boxes:
BBCode Usage
HTML Replacement
Helpline
Then select the box that says "Display on Posting Page" if you want it there for convenience to your forum users.
Part 2: The Coding Hack
There are three files that each need one small edit. I highly recommend making a backup copy of each file, something like filename_backup, in case something goes wrong and your forum becomes dysfunctional.
First file: "forum_root/cache/tpl_prosilver_posting_editor.html.php"
Edit line 121
Change from this:
To this (Ctrl+A to select All):
Second file: "forum_root/styles/prosilver/template/posting_editor.html"
Line in file: 168
Replace:
With this:
Last file: "forum_root/styles/prosilver/template/editor.js"
Function starting on line: 189
Replace this:
With this:
That should do it, you're all done! Now when you upload an mp3 file and click "Place Inline," it should wrap the appropriate URL in the dewplayer tag. Hope you find this helpful!
Tuesday, January 13, 2009
Easy MP3 Streaming with Attachments in phpBB3
Posted by Alec Koumjian at 11:35 AM
Labels: attachment, attachments, flash, inline, mp3, phpbb3, player, streaming
Subscribe to:
Post Comments (Atom)

3 comments:
Hi, sounds great!! Thanks for the tutorial.
However, editing the file in the cache folder is not possible at least in my case. I always get an Error 550 using ftp even if I want to adjust the file attributes. cache folder is 777 as required. How did you manage to edit this file? Thanks, Joe
Hi,
sounds like what I have been looking for hours!
However, once I upload an mp3 file, I get the button empti with the text written as plain text and not php code:
In the generated HTML code it looks like
input type="button" value="">_rootref['L_PLACE_INLINE'])) ? $this->_rootref['L_PLACE_INLINE'] : ((isset($user->lang['PLACE_INLINE'])) ? $user->lang['PLACE_INLINE'] : '{ PLACE_INLINE }')); ?>" onclick="attach_inline(0, 'under_pressure_mobile.mp3', '4');" class="button2" />
So maybe there is an error in the code for the tcl_edit php hack??
Thanks, Matthew
hi i tried to use your code to get .flv files playing from attachments rather than mp3 files.
could you help me get my flash files working?
i did everything you did but used a different player and changed the flags to [flv][/flv]
im not sure the attach_id bit is working correctly. i seem to be albe to get the player there and but it errors on playing. cant find file or access denied. when i edit the code that i get from the inline button thingy so the attach_id bit is an actual name of a file that i placed in my attachment folder manually it works fine.
any ideas. you have msn or anything that you can use to help me?
Post a Comment