我用SoundCloud API創建了自己的音樂播放器,並且桌面上的一切都正常工作。但是,由於某種原因,在音樂播放器實際啓動之前,手機上的播放按鈕至少需要點擊三次。任何想法我做錯了什麼?爲什麼SoundCloud API不會響應,直到我在手機上點擊三次?
下面是我的jQuery代碼。我的音樂播放器是一個JS對象,這是該劇方法:
//<-- PLAY TRACK -->
this.playTrack = function(track, number) {
var that = this;
SC.stream("/tracks/" + track, {onfinish: function() {
that.onFinish(number);
}},
function (sound) {
that.stream = sound;
that.currentTrack = track;
var trackName = $(that.track_links[number]).html();
trackName = trackName.replace(/\d.\s/, "");
that.player.find(".current-track").css("display", "block");
that.player.find(".current-track").children("p").html(trackName);
sound.play({
whileplaying: function() {
that.player.find(".progress").css('width', ((sound.position/sound.duration) * 100) + '%');
that.player.find(".playtime").html(that.minutesAndSeconds(sound.position));
},
});
that.updateProgress(sound);
that.playing = true;
});
}
任何人遇到同樣的問題?這很奇怪...... –