Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
[#979585] fixes for soundcloud urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDowne committed Mar 5, 2014
1 parent 7c78a00 commit 7b31e72
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions public/src/util/mediatypes.js
Expand Up @@ -194,24 +194,22 @@ define( [ "localized", "util/uri", "util/xhr", "json!/api/butterconfig", "jquery
id = splitUriDirectory[ splitUriDirectory.length - 1 ];
userId = splitUriDirectory[ splitUriDirectory.length - 2 ];

xhrURL = "https://api.soundcloud.com/tracks.json?callback=?&client_id=PRaNFlda6Bhf5utPjUsptg&title=" + id + "&user_id=" + userId;
xhrURL = "https://api.soundcloud.com/tracks/" + id + ".json?callback=?&client_id=PRaNFlda6Bhf5utPjUsptg&user_id=" + userId;
// If an embed iframe source is used, which looks like this:
// https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/11921587
} else if ( parsedUri.host === "w.soundcloud.com" ) {
id = parsedUri.queryKey.url.split( "api.soundcloud.com/tracks/" )[ 1 ];
xhrURL = "https://api.soundcloud.com/tracks/" + id + ".json?callback=?&client_id=PRaNFlda6Bhf5utPjUsptg";
}
Popcorn.getJSONP( xhrURL, function( respData ) {
if ( !respData || !respData[ 0 ] ) {
if ( !respData ) {
return;
}

if ( respData.error ) {
return errorCallback( SOUNDCLOUD_EMBED_UNPLAYABLE );
}

respData = respData[ 0 ];

if ( respData.sharing === "private" || respData.embeddable_by === "none" ) {
errorCallback( SOUNDCLOUD_EMBED_DISABLED );
return;
Expand Down

0 comments on commit 7b31e72

Please sign in to comment.