I’ve been podcasting and building my website for a couple of years now, and I thought it would be useful to some people if I talked about some of the things I’ve gone through in getting my site up and running that I couldn’t find anywhere else on the Internet. This one is all about podcasting efficiently with SoundCloud.
Now, I’m not a professional programmer by ANY stretch, but I like getting my feet wet with little bits of code from time to time. I also podcast a few times a week, and sometimes I’m lucky enough that these hobbies overlap! I recently moved my podcasts to SoundCloud, and they have a really nice web player (check out unwindmedia.com/feedback for a prime example). But I wanted to simplify my life and use one link for the RSS feed and for the web player embed.
Luckily, they use a unique ID number for each upload to SoundCloud, it’s just a matter of finding it. It is a 9-digit number smack in the middle of the enclosure URL that SoundCloud uses for RSS, something like this:
With a bit of Regex and replace magic (/.*/(d+)-.*/, “$1”) and some simple jQuery, I can extract that number, plunk it into the embed URL (see this page), and stick that into your container div.
Once you have that embed URL, you just have to put in all the embed options you want for your widget, and you’re good to go!
As SoundCloud opens up their platform to make it easier for podcasters, I hope this helps you simplify your life. I personally used this code on my Blogger site (unwindmedia.com) so I can have an audio player on my site that uses the enclosure link for the podcast episode, but in SoundCloud’s native player. It’s working incredibly well and I’m moving all my shows to this template in the coming weeks.
The code I used is below, and you can see it in action online at unwindmedia.com! If you have any questions please ask and I’ll give you all the details you could ever want!
EDIT (May 8): I made the code a lot simpler and got rid of redundant divs. Hopefully this is even simpler now.
var idVal = ‘POST-ID’;
var idTrack = ‘ENCLOSURE-URL’;
var encl = idTrack.replace(/.*/(d+)-.*/, “$1”);
var open = “<iframe frameborder=’no’ height=’160′ scrolling=’no’ src=’https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/”;
var close = “&color=1C4E94&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_artwork=false’ width=’100%’/>”;
$(‘.sound-container-‘ + idVal).append(open + encl + close);
|For those of you wondering, this is how I see myself.|
I’ve conducted experiments before, but the one I’m going to embark on for the next week will potentially be the most difficult I’ve ever challenged myself with. If you followed me online in December 2014, you’ll recall the Instagram Experiment I embarked upon in the last episode of +Attrell Update (at least the last so far). Basically, I wanted to try Instagram, because I had had an account for several years but had never used it. The experiment was what I would consider a success because I still post photos and video there, and I enjoy the tools Instagram provides to edit and share photos to Twitter and Facebook.
So, onto this new experiment I will be undertaking starting with the next 7 days. I am somebody who consumes a LOT of media. Podcasts, video, music, television, movies, books, blogs, long-reads, op-ed’s, reviews, etc. There is a lot of stuff on the internet and I take in quite a bit of it.
For the most part, this media is a one-way street. I slurp it up like a vacuum but rarely contribute to the conversation about it unless it is VERY compelling or I think I can make a particularly witty joke or comment. For the next week, I am going to do my very best to leave some kind of comment, observation or thought on every single thing I read. EVERY. Single. thing.
I have a feeling this will help me get to know people on the Internet, help me better understand subject matter and actually contribute to the Internet as one of its citizens, and it might help me reach people with my thoughts and ideas that otherwise might not get to them, and vice versa.
Some simple rules I will try to follow:
- I don’t HAVE to leave a comment if the content is offensive or overly negative. I will use my own discretion here.
- This will mainly apply to blogs, videos, podcast episodes, things with a home on the internet where you can leave a comment or discuss the media.
- I will do my very best to use the original source to comment on the material. For instance, if I read a story on a web page, I will leave a comment on the page directly, or on Twitter (like if I found the link there or on other social media).