mrl
mrl

Reputation: 1536

Android MediaPlayer with Soundcloud Stream Redirect

I am currently using Android MediaPlayer to stream music in an Android app. I have gotten the Redirect URL from the Soundcloud stream_url, which works by itself in a browser.

However, when I use this redirect_url as the source for SetDataSource, mediaplayer won't work.

mediaplayer.setDataSource(redirect_url);
mediaplayer.prepareAsync();

When using an ordinary mp3 url, this works fine. Something about Soundcloud's redirected URL is giving my app problems, even though the redirect url works fine if placed in a browser. Any ideas of what my problem is?

Upvotes: 1

Views: 1191

Answers (2)

Tekmology
Tekmology

Reputation: 51

you should add your client id to the 'stream_url' provided by soundcloud. You can obtain a client id by registering a developer account at soundcloud.

stream_url = stream_url+"?client_id=123456567889997"

Upvotes: 0

cucko
cucko

Reputation: 1436

i've had the same problem with soundclud url.

at the end, it turns out that changing the https with http in your stream_url will solve the problem.

Upvotes: 4

Related Questions