3

Using the spotify API I'm able to retrieve and play various songs after creating an audio element with the appropriate src.

'<audio preload="auto" src="https://p.scdn.co/mp3-preview/43e7efa8214783c2af2cb32edbb94b7c836fc4b2?cid=null"></audio>'

http://codepen.io/niko8888/pen/jyyKLZ

var fetchTracks = function (albumId, callback) {
    $.ajax({
        url: 'https://api.spotify.com/v1/albums/' + albumId,
        success: function (response) {
          console.log(response)
            callback(response);
        }
    });
};

The problem is that it refuses to play on a mobile browser. Is there a way to do this?

Squirrl
  • 4,909
  • 9
  • 47
  • 85
  • I've had a look at some of the usual issues related to this (audio can only be started in the mobile web in response to a user interaction event such as onclick, but I see you've taken that into account), but I can't find what the issue is. Have you tried remote debugging your app to see if any errors are being printed to the console? [Here](https://docs.brightcove.com/en/perform/concepts/mobile-debugging/mobile-debugging.html) is an article explaining how to do it. – Hugh Rawlinson Mar 19 '17 at 19:46
  • Maybe help you start from here http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page – b2ok Mar 29 '17 at 18:28

0 Answers0