Has the Soundcloud web widget API become obsolete?

I am currently working with the SoundCloud widget API ().

My main goal is to retrieve information about the tracks within a set.

Unfortunately, it seems like I am only able to utilize the methods widget.getSounds() and widget.getCurrentSound successfully.

I am aware that these getter functions work asynchronously, and I am implementing a callback accordingly.

However, I have noticed that the sound object is not a simple array, which has led me to try other approaches without success.

If anyone can provide assistance or insight, it would be greatly appreciated.

widget
_ {}

widget.getVolume(function(ret){console.log(ret)});
_ {}
VM5139:1 50

widget.getDuration(function(ret){console.log(ret)});
_ {}
VM5164:1 255057

widget.getPosition(function(ret){console.log(ret)});
_ {}
VM5190:1 92164.92599999999

widget.getCurrentSound(function(ret){console.log(ret)});
_ {}
VM2993:3 Uncaught TypeError: currentSound.get is not a function
    at _.<anonymous> (<anonymous>:3:47)
    at m (sc.js:1)
    at w (sc.js:1)
(anonymous) @ VM2993:3
m @ sc.js:1
w @ sc.js:1

widget.getCurrentSound(function(ret){console.log(ret.title)});
_ {}
VM2993:3 Uncaught TypeError: currentSound.get is not a function
    at _.<anonymous> (<anonymous>:3:47)
    at m (sc.js:1)
    at w (sc.js:1)
(anonymous) @ VM2993:3
m @ sc.js:1
w @ sc.js:1

widget.getCurrentSound(function(ret){console.log(JSON.stringify(ret))});
_ {}
3VM2993:3 Uncaught TypeError: currentSound.get is not a function
    at _.<anonymous> (<anonymous>:3:47)
    at m (sc.js:1)
    at w (sc.js:1)
(anonymous) @ VM2993:3
m @ sc.js:1
w @ sc.js:1

widget.getCurrentSound(function(ret){console.dir(ret)});
_ {}
VM2993:3 Uncaught TypeError: currentSound.get is not a function
    at _.<anonymous> (<anonymous>:3:47)
    at m (sc.js:1)
    at w (sc.js:1)

Answer №1

It's a mystery how this issue resolved itself, but the code is now functioning as expected.

Perhaps the soundcloud server or API was experiencing some instability at that time.

The functions widget.getSounds() and widget.getCurrentSound() both return a JSON string (or array, which can be used interchangeably in JavaScript).

The formatting of the returned data is identical to what is shown on

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Should the request be sent to the parent or child component?

When a page is divided into various components, the data for each component is fetched asynchronously. Therefore, the parent component should trigger the request and pass it on to the child component, or alternatively, the request can be directly sent to ...

What is the method to execute a prototype function within another prototype?

I am facing an issue with my JavaScript class and need some help to resolve it. MyClass.prototype.foo = function() { return 0; } MyClass.prototype.bar = function() { return foo() + 1; } Unfortunately, when I try to run the program, it throws an ...

How to extract words from a dynamic router.pathname in NextJS when only the filename is displayed instead of the full path?

I'm keeping this example as straightforward as possible, but I can add more details if needed to solve the issue Currently, I am working with dynamic routes in nextJS. My application fetches data from Twitter based on the keywords entered into the dy ...

Executing a personalized function - settings.func does not exist as a valid function

I have developed a custom jQuery plugin where I intend to invoke a specific function like this... (function($) { $.fn.customPlugin= function(options) { var settings = { func: null }; if (options) { $. ...

Comparison of various approaches for invoking JavaScript/jQuery functions

Do the following examples have a performance variation? Example 1: $(window).on('resize', abc); function abc(){ //some abc code } Example 2: $(window).on('resize', function(){ //some abc code }); If so, what are the positives ...

Deciphering the LocalDate and nested object array in an AJAX response

Seeking assistance, looking for solutions to two problems. Firstly, how can I display LocalDate in an ajax response? And secondly, how do I iterate over a list of Custom objects received in the ajax response? I am passing a List of Custom Objects and Loca ...

Retrieving the chosen option from a dropdown menu using AngularJS

<tr (click)="onRowClick(myDropDownList.value)"> <td> <select #myDropDownList (click)="$event.stopPropagation()" (change)="onChange($event.target.value)"> <option *ngFor="let n of numbers" [value]="n">{{n}}</option> </se ...

Can JavaScript trigger an alert based on a CSS value?

Hello, I am facing an issue. I have created a blue box using HTML/CSS and now I want to use JavaScript to display an alert with the name of the color when the box is clicked. Below is my code: var clr = document.getElementById("box").style.background ...

Locate an array within a Multidimensional array and relocate it to the starting position

I've been attempting to figure out a solution for moving a specific array within another array to the beginning. The problem I'm encountering is that the code I was using, as suggested in a previous question, only removes the last value and plac ...

What is the method for determining the angle between two planes?

My question is about calculating the angle between two planes. Is it also possible to calculate the angle between two Object3D points like we do with planes? If you need a visual example, check out this fiddle: https://jsfiddle.net/rsu842v8/1/ const ...

What is the process of using AJAX, JavaScript, and HTML to submit data to a remote

I need help with sending data from an HTML page to a server. I have a JSON example below that illustrates what I want to achieve. On my HTML page, I have a question label and four options (A, B, C, D) as radio buttons. After clicking the send button, I ...

What is the most efficient method for transforming an index into a column number that resembles that of Excel using a functional approach?

Is there a way to write a function that can produce the correct column name for a given number, like A for 1 or AA for 127? I know this question has been addressed numerous times before, however, I am interested in approaching it from a functional perspect ...

AngularJS blank drop-down selection

I am currently working on an AngularJS select element with ng-options using the code below: <select ng-model="vm.selectedship" ng-change="vm.updateShip()" data-ng-options="ship as ('ship' + ' is ready (' + ship.currentlocation + & ...

Issue with dropdown element not triggering JavaScript onchange event

I am in the process of developing an application that involves searching a database and enabling users to compare the results. To achieve this, I require multiple dependent drop-down menus. While I have some understanding of HTML and PHP, my coding experti ...

Resizing a webpage to fit within an IFRAME

Having just started learning HTML, CSS, and JavaScript, I am attempting to incorporate a page as a submenu item on my website. Below is the code that I have so far: <!DOCTYPE html> <html> <meta name="viewport" content="width=1024"> ...

What are the steps to update content by referencing an id in the hash URL?

Currently, I am utilizing the following code snippet to extract an ID from the hash URL: var integer = window.location.hash.match(/\d+/) | 0; alert(integer); However, I have encountered an issue where upon using the back button after modifying the U ...

Mapping an object in ReactJS: The ultimate guide

When I fetch user information from an API, the data (object) that I receive looks something like this: { "id":"1111", "name":"abcd", "xyz":[ { "a":"a", "b":"b", "c":"c" ...

Retrieve the latest information and update the database with just one ajax request

I am attempting to update a row in the database and retrieve the updated row one at a time using an AJAX call. JavaScript inside the ready function $("button[name='teacher_lock_exam']").on(ace.click_event, function () { var current_exams_id ...

Having trouble running classes using Maven test with the Testng.xml file in the terminal, however, it runs smoothly in Eclipse

While I have been successful in running my solution through the testng suit in the Eclipse console, I am facing difficulties executing the testng.xml file via Maven integrated with Sauce Labs in the terminal. Output received on the terminal: ------------ ...

React JS - State values are not persisting and rendering properly upon clicking

Recently, I followed a step-by-step tutorial on creating a todo list using functional components. However, I encountered an issue when attempting to delete or mark items as complete in the list. In both the deleteHandler and completeHandler functions, I tr ...