问题
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?
来源:https://stackoverflow.com/questions/42829572/is-there-a-way-to-play-audio-on-a-mobile-browser-with-only-a-src-url