• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Automatic MP3 Attachment Player

jacko

Well-known member
#1
It was already suggested as a core feature of Xenforo here: http://xenforo.com/community/threads/attachment-mp3-player.354/ , but it could also be a modification.

In vBulletin it was quite simple. There was a code that had to be inserted in postbit attachment template:

Code:
<!-- Embed Player -->  <vb:if condition="$attachment[attachmentextension] == mp3">  <embed type="application/x-shockwave-flash" src="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=attachment.php?{vb:raw session.sessionurl}attachmentid={vb:raw attachment.attachmentid}&amp;d={vb:raw attachment.dateline}" width="400" height="27" allowscriptaccess="never" quality="best" bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded" />
</vb:if>  <!-- /Embed Player -->
perhaps it is similar in Xenforo?
 

jacko

Well-known member
#3
I just need this sctructure in xenforo attachment template:

if attachment.extension = mp3
than embed the attachment in the player

I don't know how to do it though...
 

ArnyVee

Well-known member
#4
Wish I knew how to do this because it is very cool to have an embedded mp3 player in posts :)

Good luck on getting this done or finding someone to help with it.
 

jacko

Well-known member
#5
Please, could someone check what is the variable for attachment extensions?
I am sure there is a way of rewriting this simple code from vBulletin to Xenforo... I am not knowledgeable enough to do that...
 

g0rn

Well-known member
#8
Please, could someone check what is the variable for attachment extensions?
I am sure there is a way of rewriting this simple code from vBulletin to Xenforo... I am not knowledgeable enough to do that...
There is actually no such variable, you have to check if extension is mp3 somewhere in an add-on and write a result to the corresponding $posts['attachments'] array's element, and only after that you can use that variable in your attached_files template.
 

jacko

Well-known member
#9
There is actually no such variable, you have to check if extension is mp3 somewhere in an add-on and write a result to the corresponding $posts['attachments'] array's element, and only after that you can use that variable in your attached_files template.
Somehow XenForo detects that an attachment is a picture - I suspect by the file extension... Could that point us somewhere?
 

jacko

Well-known member
#10
ok, this is the line that needs to be added to make the attachment player working:

<embed type="application/x-shockwave-flash" src="audio-player.swf?audioUrl={xen:link attachments, $attachment}" width="400" height="27" allowscriptaccess="never" quality="best" bgcolor="#ffffff" wmode="window" flashvars="playerMode=embedded">

the next step would be to write a condition
if {$attachment.filename} contains *.mp3

could someone help out with that?
 

jacko

Well-known member
#11
well, I know it's incorrect but maybe I will point someone in the right direction:

<xen:if is="{$attachment.filename} == *.mp3 ">

or

<xen:if is="{$attachment.extension} == mp3 ">