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?
精彩评论