Is there a way to play audio on a mobile browser with only a src url?

我的未来我决定 提交于 2019-12-13 14:21:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!