1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can BBCode media ID contain "/" (forward slash)?

Discussion in 'XenForo Questions and Support' started by jacko, Nov 11, 2010.

  1. jacko

    jacko Active Member

  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The forward slash is a problem, but it isn't the problem. It appears that with soundcloud.com you can't build the embed code from the URL.

    Here is the embed code for that composition:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F6928510&secret_url=false"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F6928510&secret_url=false" type="application/x-shockwave-flash" width="100%"></embed>
    </object>
    <span>
    <a href="http://soundcloud.com/chimpstudio/tes-27-apr">Tes 27 apr</a> by <a href="http://soundcloud.com/chimpstudio">chimpstudio</a>
    </span>
    
    And here is the URL for the page:

    http://soundcloud.com/chimpstudio/tes-27-apr

    Nowhere within the embed code is any identifying portion of the URL. The id of the video (for use in the embed code) appears to be 6928510, but that isn't in the URL.

    I don't see any easy way to use soundcloud.com as a BB Code Media Site in xenForo.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Of course you could skip the editor shortcut and manually type the BB code into your post. Like this:

    [media=soundcloud]6928510[/media]

    Then your embed code would be:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{$id}&secret_url=false"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{$id}&secret_url=false" type="application/x-shockwave-flash" width="100%"></embed>
    </object>
    
    The problem is that there is no easy way to see the id number of the composition. It is not apparent in the URL or on the page. You would have to look at the embed code of the composition, pick out the id, then manually type it into the BB code in your post.
     
    gib likes this.
  4. jacko

    jacko Active Member

    Well, there is an easy way and it is described here: http://blog.soundcloud.com/2009/07/...n-forums-5-step-guide-for-soundcloud-bb-code/

    In this case forward slash is the problem, isn't it?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Interesting. They have different embed code for use in BB codes than is used on their own site. That threw me off.

    I tested this and I still can't get it working. This was my best attempt using the new embed code:

    Media Site ID: soundcloud
    Site Title: Sound Cloud
    Site URL: http://soundcloud.com/
    Match URLs: {$id}
    Embed HTML:

    Code:
    <object height="81" width="100%">
    <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2F{$id}&amp;g=bb"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2F{$id}&amp;g=bb" type="application/x-shockwave-flash" width="100%"></embed>
    </object>
    <a href="http://soundcloud.com/{$id}">http://soundcloud.com/{$id}</a>
    
    Code to be used in post:

    Code:
    [media=soundcloud]chimpstudio%2Ftes-27-apr[/media]
    
    Ignoring the editor shortcut for the moment... I still can't get it working.

    Using the full URL for the param kept activating the link parser. Using [plain] to prevent hyperlinking didn't work.

    So then I moved the base URL into the replacement code so I could just specify chimpstudio/tes-27-apr as the param. It apparently didn't like the "/" so that didn't work.

    Then I tried changing "/" in the param to %2F (url encoded "/"). For some reason the post parser converts %2F to %252F which messes it up.


    I am out of ideas. This might require a xenForo fix. Maybe Kier / Mike can offer their insight.
     
  6. jacko

    jacko Active Member

    It would be great if they could take a look at this.
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  9. gib

    gib Active Member

    Thanks for the tip about viewing the soundcloud source page to get the data-sc-track id and embedding it as a single value, it's not ideal, but it works :)
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

Share This Page