I am developing a Chrome extension using soundcloud JavaScript sdk. All it does is when you click a button it plays a random track from soundcloud.
My get request works now but when I try to stream the. This is my code.
SC.initialize({
client_id: "2d2d0fb839111694b3877c008ea03a85",
});
$(document).ready(function(){
$("#loadTracks").on("click", function(){
SC.get('https://api.soundcloud.com/users/user486627426/tracks', {limit: 1}, function(tracks){
var track = tracks[0];
console.log(track.uri);
});
SC.stream('https://api.soundcloud.com/users/user486627426/tracks', function(sound){
sound.play();
});
});
});
I get a:
GET chrome-extension://connect.soundcloud.com/audiomanager/audiomanager.js net::ERR_FAILED
And here is my manifest.json
{
"manifest_version": 2,
"name": "Soundcloud",
"description": "This extension plays a random track using soundcloud",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"activeTab",
"https://connect.soundcloud.com/sdk-2.0.0.js",
"*://api.soundcloud.com/*"
],
"content_security_policy": "script-src 'self' https://connect.soundcloud.com/; object-src 'self' https://connect.soundcloud.com/"
}
How can I change the request to use https:// instead of Chrome-extension?
This probably isn't a legal url: chrome-extension://api.soundcloud.com/tracks
My guess is you want https://api.soundcloud.com/tracks.