0

I currently have a jQuery plugin I am working with that is setup to use songs / tracks like this:

//Using an audio object
var a = new Audio();
a.src = 'somesong.mp3';
customPlayer.load( a );

It also supports these options:

//Using an audio element on the page
customPlayer.load( document.getElementsByTagName('audio')[0] );

//Using a config object and you only have one encoding
customPlayer.load({ src: 'somesong.mp3' });

//Using a config object, and you have an ogg and mp3 version
customPlayer.load({ src: 'somesong', codecs: [ 'ogg', 'mp3' ]});

I am trying to figure a way to use it with a Spotify track!... Any thoughts / suggestions would be appreciated.

4

1 回答 1

0

Spotify 的 API 不以任何方式支持 HTML5 音频,包括播放 mp3 文件或类似文件的外部音频以及使用 HTML5 音频元素来控制播放器。Spotify 播放器 API 只是指示客户端播放您想要的曲目,而不是将其托管在 HTML5 音频元素中。

做你想做的唯一方法是创建一个与 jQuery Audio 类具有相同接口的包装类,但调用 Spotify API。

于 2013-03-07T18:00:58.220 回答