1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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

Discussion in 'Add-on Requests [Archive]' started by jacko, Oct 20, 2010.

  1. jacko

    jacko Active Member

    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:

    <!-- 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?
    Nolik likes this.
  2. jacko

    jacko Active Member

    could someone smart take a look at this?
    it is probably very simple :)
  3. jacko

    jacko Active Member

    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...
  4. ArnyVee

    ArnyVee Well-Known Member

    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.
  5. jacko

    jacko Active Member

    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...
  6. kkm323

    kkm323 Well-Known Member

    it would be great if we have this option
  7. DSF

    DSF Well-Known Member

    I think as [media] item it shall be possible.
  8. g0rn

    g0rn Well-Known Member

    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.
  9. jacko

    jacko Active Member

    Somehow XenForo detects that an attachment is a picture - I suspect by the file extension... Could that point us somewhere?
  10. jacko

    jacko Active Member

    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?
  11. jacko

    jacko Active Member

    well, I know it's incorrect but maybe I will point someone in the right direction:

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


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

    jacko Active Member

    Great news, there will be appropriate variable that will allow to write template modification that plays back MP3 attachments :)
    So as soon Beta 3 comes out I will post the attachment mp3 player template modification :)
    Darfuria and ArnyVee like this.
  13. jacko

    jacko Active Member

Share This Page