使用taphold API:
context = new (window.AudioContext || window.webkitAudioContext)()
曲を再生します。
$(function(){
$("your element").bind("taphold", tapholdHandler);
function tapholdHandler(event){
/*write your code here for seek forward */
}
});
使用jQueryのタイマー
var mousedowntime;
var presstime;
$("button[id$='" + buttonID + "']").mousedown(function() {
var d = new Date();
mousedowntime = d.getTime();
});
$("button[id$='" + buttonID + "']").mouseup(function() {
var d = new Date();
presstime = d.getTime() - mousedowntime;
if (presstime > 999/*You can decide the time*/) {
//Do_Action_Long_Press_Event();
}
else {
//Do_Action_Click_Event();
}
});
はゼロに
function beginAudio(){
audio.trigger('pause');
audio.prop("currentTime",audio.prop("currentTime")-audio.prop("currentTime"));
audio.trigger('play');
}
または設定された現在の時間を最初から再生して、再生します。前方と後方の使用のために
この
audio.prop("currentTime",audio.prop("currentTime")-5);// 5 secs backward
audio.prop("currentTime",audio.prop("currentTime")+5);// 5 secs forward
質問の第2部分にもお答えください。私たちはどれくらいの歌をしていますか?パーセントまたは何かで... – Akxe
「AudiBufferNode」には 'duration'プロパティがあります。あなたはそれを使用しようとすることができます。 また、これは少し役に立ちます。http://stackoverflow.com/questions/11203773/how-can-i-get-the-html5-audios-duration-time –
これは間違っています。「AudioBufferSourceNode」は検索できません'start'を複数回呼び出すことはできません)。 – ffxsam