Autoplay track on load of embedded player from URI/URL

5,902 views
Skip to first unread message

Mr. Magoo

unread,
Feb 7, 2012, 2:31:29 PM2/7/12
to SoundCloudAPI
It there a way to have an embedded set player autoplay a specified
track in the set?

For example:

The set player is embedded on mypage.html @ mydomain.com.

I can send people to http://mydomain.com/mypage.html and they will get
the default player loaded to the latest track in a set.

Can I pass a command to the embedded player from the url to autoplay a
track in the set?

Something like:

http://mydomain.com/mypage.html?command=trackid

I know I can send people to individual tracks at soundcloud.com; but
in this case it would be best to have people coming to my domain
instead of soundcloud.com, and I'm trying to avoid setting up a new
blog just for soundcloud postings.

Thanks for any help,

- Cory

Matas Petrikas

unread,
Feb 8, 2012, 6:00:15 AM2/8/12
to soundc...@googlegroups.com
hey,

yes you can! Pelase try combining two options - auto_play and
start_track, e.g. like

<iframe width="100%" height="450" scrolling="no" frameborder="no"
src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F1045510&show_artwork=true&auto_play=true&start_track=5"></iframe>

more info about the widget options can be found here:
http://developers.soundcloud.com/docs/widget

Greets,
Matas

> --
> You received this message because you are subscribed to the Google Groups "SoundCloudAPI" group.
> To post to this group, send email to soundc...@googlegroups.com.
> To unsubscribe from this group, send email to soundcloudap...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.
>

--
Matas Petrikas

http://soundcloud.com/matas

Mr. Magoo

unread,
Feb 8, 2012, 11:10:55 PM2/8/12
to SoundCloudAPI
I'm sorry I didn't clarify more in my original post.

I would like to pass the command to play a specific track from the url/
uri that a user enters so that an embedded player will play the track
that I specify.

For example I can share http://domain.com/page.html?command=1234 with
someone and the page will load the embedded player to track-id 1234.


On Feb 8, 3:00 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> hey,
>
> yes you can! Pelase try combining two options - auto_play and
> start_track, e.g. like
>
> <iframe width="100%" height="450" scrolling="no" frameborder="no"
> src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2..."></iframe>
>
> more info about the widget options can be found here:http://developers.soundcloud.com/docs/widget
>
> Greets,
> Matas
>
>
>
>
>
>
>
>
>
> On Tue, Feb 7, 2012 at 8:31 PM, Mr. Magoo <cory.kla...@gmail.com> wrote:
> > It there a way to have an embedded set player autoplay a specified
> > track in the set?
>
> > For example:
>
> > The set player is embedded on mypage.html @ mydomain.com.
>
> > I can send people tohttp://mydomain.com/mypage.htmland they will get
> > the default player loaded to the latest track in a set.
>
> > Can I pass a command to the embedded player from the url to autoplay a
> > track in the set?
>
> > Something like:
>
> >http://mydomain.com/mypage.html?command=trackid
>
> > I know I can send people to individual tracks at soundcloud.com; but
> > in this case it would be best to have people coming to my domain
> > instead of soundcloud.com, and I'm trying to avoid setting up a new
> > blog just for soundcloud postings.
>
> > Thanks for any help,
>
> > - Cory
>
> > --
> > You received this message because you are subscribed to the Google Groups "SoundCloudAPI" group.
> > To post to this group, send email to soundc...@googlegroups.com.
> > To unsubscribe from this group, send email to soundcloudap...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/soundcloudapi?hl=en.

Matas Petrikas

unread,
Feb 9, 2012, 5:36:03 AM2/9/12
to soundc...@googlegroups.com
hey,

here's a short jQuery script that I've written that wil generate an
auto-playing soundcloud widget based on the track_id value passed in
the url:
https://gist.github.com/1779157

Let me know if that works ok for you!

greets,
Matas

> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.

Mr. Magoo

unread,
Feb 13, 2012, 2:50:50 PM2/13/12
to SoundCloudAPI
Thanks for the help Matas.

Two quick questions though..

1) Where do I find my track IDs?

2) So I'll pass my track id from the url to the jquery function you've
created.. something like: mydomain.com/mypage.html?trackid=1234, and
your function will take "trackid" ?



On Feb 9, 2:36 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> hey,
>
> >> > I can send people tohttp://mydomain.com/mypage.htmlandthey will get

Matas Petrikas

unread,
Feb 14, 2012, 6:28:54 AM2/14/12
to soundc...@googlegroups.com
hey,


On Mon, Feb 13, 2012 at 8:50 PM, Mr. Magoo <cory....@gmail.com> wrote:
> Thanks for the help Matas.
>
> Two quick questions though..
>
> 1)  Where do  I find my track IDs?

what data about the sound do you have available? do you have their
SoundCloud url?
then, the script should be updated. This version would accept both
urls like http://example.com/mytracks?track_id=3223234 or
http://example.com/mytracks?track_url=http://soundcloud.com/matas/hobnotropic

https://gist.github.com/1779157

>
> 2) So I'll pass my track id from the url to the jquery function you've
> created.. something like: mydomain.com/mypage.html?trackid=1234, and
> your function will take "trackid" ?

yes, that's the idea - you pass the value in the url and the script
reads that out and generates a widget for that sound.

Greets,
Matas

> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.

Mr. Magoo

unread,
Feb 22, 2012, 12:41:56 AM2/22/12
to SoundCloudAPI
I feel a bit lame for asking this...

But, should I have the player widget code already present on the page
in div for the jquery code to modify?

Yes... Obviously I'm a bit new to jQuery...

Thanks for all of the assistance!

- Cory

On Feb 14, 3:28 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> hey,
>
> On Mon, Feb 13, 2012 at 8:50 PM, Mr. Magoo <cory.kla...@gmail.com> wrote:
> > Thanks for the help Matas.
>
> > Two quick questions though..
>
> > 1)  Where do  I find my track IDs?
>
> what data about the sound do you have available? do you have their
> SoundCloud url?
> then, the script should be updated. This version would accept both
> urls likehttp://example.com/mytracks?track_id=3223234orhttp://example.com/mytracks?track_url=http://soundcloud.com/matas/hob...
> >> >> > I can send people tohttp://mydomain.com/mypage.htmlandtheywill get

Matas Petrikas

unread,
Feb 22, 2012, 2:33:35 PM2/22/12
to soundc...@googlegroups.com
Hey Cory,

no, you only need an empty div where the embed code will be rendered
by the script:
<div id="player"></div>

so the 4 components that need to be there:

1. page has to be called with a track_id or track_url parameter
2. page code needs to contain the empty div with an id "player"
3. page code needs to have jQuery.js embedded somehow
4. page needs to contain the script I've written

If these all are fulfilled, you should see a playing widget on a page load.

In case you have a problem, please post a url of your page, so we
could have a look at it.

Greets,
Matas

> For more options, visit this group at http://groups.google.com/group/soundcloudapi?hl=en.

Mr. Magoo

unread,
Mar 26, 2012, 5:53:49 PM3/26/12
to SoundCloudAPI
Fantastic!

I got this all working.

I'll admit I wish I could have this kind of functionality on the Set
Player rather than having to load individual tracks. But I guess that
is a limitation of the Set vs. Individual track Players...

Thanks for all of the great help!

- Cory

On Feb 22, 12:33 pm, Matas Petrikas <matas.petri...@gmail.com> wrote:
> Hey Cory,
>
> no, you only need an empty div where the embed code will be rendered
> by the script:
> <div id="player"></div>
>
> so the 4 components that need to be there:
>
> 1. page has to be called with a track_id or track_url parameter
> 2. page code needs to contain the empty div with an id "player"
> 3. page code needs to have jQuery.js embedded somehow
> 4. page needs to contain the script I've written
>
> If these all are fulfilled, you should see a playing widget on a page load.
>
> In case you have a problem, please post a url of your page, so we
> could have a look at it.
>
> Greets,
> Matas
>
>
>
>
>
>
>
>
>
> On Wed, Feb 22, 2012 at 6:41 AM, Mr.Magoo<cory.kla...@gmail.com> wrote:
> > I feel a bit lame for asking this...
>
> > But, should I have the player widget code already present on the page
> > in div for the jquery code to modify?
>
> > Yes... Obviously I'm a bit new to jQuery...
>
> > Thanks for all of the assistance!
>
> > - Cory
>
> > On Feb 14, 3:28 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> >> hey,
>
> >> On Mon, Feb 13, 2012 at 8:50 PM, Mr.Magoo<cory.kla...@gmail.com> wrote:
> >> > Thanks for the help Matas.
>
> >> > Two quick questions though..
>
> >> > 1)  Where do  I find my track IDs?
>
> >> what data about the sound do you have available? do you have their
> >> SoundCloud url?
> >> then, the script should be updated. This version would accept both
> >> urls likehttp://example.com/mytracks?track_id=3223234orhttp://example.com/mytr......
>
> >>https://gist.github.com/1779157
>
> >> > 2) So I'll pass my track id from the url to the jquery function you've
> >> > created.. something like: mydomain.com/mypage.html?trackid=1234, and
> >> > your function will take "trackid" ?
>
> >> yes, that's the idea - you pass the value in the url and the script
> >> reads that out and generates a widget for that sound.
>
> >> Greets,
> >> Matas
>
> >> > On Feb 9, 2:36 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> >> >> hey,
>
> >> >> here's a short jQuery script that I've written that wil generate an
> >> >> auto-playing soundcloud widget based on the track_id value passed in
> >> >> the url:https://gist.github.com/1779157
>
> >> >> Let me know if that works ok for you!
>
> >> >> greets,
> >> >> Matas
>
> >> >> On Thu, Feb 9, 2012 at 5:10 AM, Mr.Magoo<cory.kla...@gmail.com> wrote:
> >> >> > I'm sorry I didn't clarify more in my original post.
>
> >> >> > I would like to pass the command to play a specific track from the url/
> >> >> > uri that a user enters so that an embedded player will play the track
> >> >> > that I specify.
>
> >> >> > For example I can sharehttp://domain.com/page.html?command=1234with
> >> >> > someone and the page will load the embedded player to track-id 1234.
>
> >> >> > On Feb 8, 3:00 am, Matas Petrikas <matas.petri...@gmail.com> wrote:
> >> >> >> hey,
>
> >> >> >> yes you can! Pelase try combining two options - auto_play and
> >> >> >> start_track, e.g. like
>
> >> >> >> <iframe width="100%" height="450" scrolling="no" frameborder="no"
> >> >> >> src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2..."></iframe>
>
> >> >> >> more info about the widget options can be found here:http://developers.soundcloud.com/docs/widget
>
> >> >> >> Greets,
> >> >> >> Matas
>
Reply all
Reply to author
Forward
0 new messages