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: [

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…



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=""></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: but there are some changes in app.ts because now there is a new version than in the post.

Modals not showing when I use soundcloud api with typings in my Ionic2 project