开发者

Is it possible to play an HTML5 audio element for a very specific duration (less than total duration of the sound bite)

I have a sound element that is actually a composition of several differ开发者_StackOverflowent sounds. My approach had been to only have to load a single source for sound, and play different segments based on the desired sound bite.

I can seek to the start point just fine by setting the 'currentTime' property. However, setting the 'duration' property does not seem to have any affect what-so-ever.

I've tried to use a setTimeout, but, as expected, the timer resolution is not sufficient to get consistent behavior in the audio (sometimes it does not play at all, and when it does play it's 'stop' point is inconsistent).

Is this possible? Or will I be stuck loading each sound bite in it's own individual element?


Remy Sharp has posted about this as Audio Sprites (and fixes for iOS). Does that implementation work for you?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜