Issue with SoundCloud API - Ionic 2

Hi everybody!!

I want to stream audios from SoundCloud’s API but have a problem.

I did it:

  • $ionic g provider SoundCloud

  • $npm install soundcloud --save

Then in my new providers/sound-cloud.ts, i imported SC:

import { SC } from 'soundcloud';

I registered this provider in my app.module.ts:

import { SoundCloud } from '../providers/sound-cloud';
.
.
.
providers: [
    SoundCloud
]

Well… if i refresh changes, i have no problems in console, but i have a white screen instead of the content of the page that should be viewed.

If i remove the import from sound-cloud.ts the page refresh normally. But i need to use SoundCloud’s API, i already have the client_id and it’s properly configured in sound-cloud.ts but did not include it to not be so extensive…

Thanks!!!

I solved this.

  • In sound-cloud.ts i replaced:

import { SC } from 'soundcloud';

for this:

declare var SC;

  • I included SoundCloud script in the index.html file instead using npm package:

<script src="https://connect.soundcloud.com/sdk/sdk-3.1.2.js"></script>


  • So, in the player page, i imported:

import { SoundCloud } from '../../providers/sound-cloud';

  • and inyected in constructor:

constructor(public soundCloud: SoundCloud)

NOTE: This is a good tutorial: https://www.joshmorony.com/streaming-music-from-soundcloud-in-ionic-2-part-1/ but there are some changes in app.ts because now there is a new version than in the post.

1 Like

You can use SoundCloud API to download soundcloud into mp3. However, the public access to soundcloud API is currently unavailable but maybe you can get help from this site https://scdownloader.online

yeah, if you like, you can try use app soundcloud mod apk