Reputation: 5025
<audio src="file.ogg" type="audio/ogg" controls="controls"></audio>
Why is it that this jQuery/JavaScript works:
var audio = $('audio').get(0);
audio.play();
But this doesn't?:
var audio = $('audio').get(0);
audio.currentTime = 20;
audio.play();
Upvotes: 3
Views: 3882
Reputation: 1969
Try
var audio = $('audio');
audio.bind('canplay', function() {
this.currentTime = 20;
});
audio.get(0).play();
Upvotes: 4