SoundCloud Embed

Acelondoner

Member
I have a forum which uses phpbb currently. I plan on switching to xenforo using the phpbb importer. My phpbb board currently has 100's of soundcloud embeds as people like to show their music.

Does the importer convert over bbcodes? I would like all the soundcloud embeds to get transfered over to the new forum. If the importer doesn't do this then can it be achieved another way?

This is the only thing that is holding me back from buying this forum software right now so if it's possible, you have a sale.

Cheers, Ace.
 
Here is the code I used in phpbb:

BBCode Usage:

[soundcloud]{URL}[/soundcloud]


HTML replacement:

<object height="81" width="100%"><param name="movie" value="http://player.soundcloud.com/player.swf?url={URL}&amp;g=bb"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url={URL}&amp;g=bb" type="application/x-shockwave-flash" width="100%"></embed></object> <a href="{URL}">{URL}</a>


Help Line:

Embed the tracks from SoundCloud into your post. Use the track URL in your browser: [soundcloud]http://soundcloud.com/forss/speech-craft-no-sleep-til-dawn-remix-by-forss[/soundcloud]

Cheers, Ace.
 
Here are instructions to convert your BB codes after the import:

1) Install this addon:

http://xenforo.com/community/threads/post-content-find-replace.6548/

2) Use these settings:

Quick Find: [soundcloud

Regular expression: #\[soundcloud\]http://soundcloud\.com/([\-a-z0-9_]+/[\-a-z0-9_]+)\[/soundcloud\]#siU

Replacement String: [media=soundcloud]\1[/media]

I tested it on my forum and it works.

Screen shot 2012-04-08 at 5.52.46 AM.webp
 
The regular SoundCloud embed mentioned above is working fine for me, however the method above doesn't work for playlists / sets. Is there any way to include this, or would that mean a new expression?

here's an example of a playlist / set.
http://soundcloud.com/adrielm5/sets/maroon-5-overexposed-preview/

That requires a new media site.

I looked at the embed code for the set. This one is difficult because the id used in the embed code is not contained in the URL. It requires page scraping to enable automatic embedding based on the URL (page scraping is yucky). Or you can manually type the BB code and manually enter the id which makes for a much simpler media site (to create) but it's less usable as it requires the user to find the id.
 
Sorry, i'm not particularly good with BB code, but how would I manually add the id?

Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: soundcloudset

Site Title: SoundCloud Set

Site URL: http://soundcloud.com/

Match URLs: <leave it empty>

Embed HTML:

Code:
<iframe width="100%" height="450" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F{$id}&show_artwork=true"></iframe>

URLs tested:
http://soundcloud.com/adrielm5/sets/maroon-5-overexposed-preview/ (you need to manually get the id from the source code, which is 2092643 in this example)

Then you need to manually type in the BB code into your post which is:

Code:
[media=soundcloudset]2092643[/media]
 
I've been following this thread since I'd like to do the same thing. Your description works, Jake, but I don't see where you got the 2092643 ID from; I don't see it anywhere in the page source.
 
From the page source:

Code:
<div class="set large" data-sc-playlist-id="2092643">

Or if you click the Share button in the player it will give you embed code which contains the id.
 
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: soundcloudset

Site Title: SoundCloud Set

Site URL: http://soundcloud.com/

Match URLs: <leave it empty>

Embed HTML:

Code:
<iframe width="100%" height="450" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F{$id}&show_artwork=true"></iframe>

URLs tested:
http://soundcloud.com/adrielm5/sets/maroon-5-overexposed-preview/ (you need to manually get the id from the source code, which is 2092643 in this example)

Then you need to manually type in the BB code into your post which is:

Code:
[media=soundcloudset]2092643[/media]


Whenever I try embedding it says "The specified URL cannot be embedded as media."
 
if you want to embed a song in your forum, i.e. if you have a forum that's about music, you might want to embed the song in the post, rather than people having to download the MP3.
 
Top Bottom