HTML5 web audio seekTo for buffered source -
i have web application(similar karaoke) user can record voice on instrumental. after recording user plays recording. here play instrumental in <audio>
tag , voice using web audio api. sync both audios on play/pause calculate time this
pausedat = date.now() - startedat; startedat = date.now() - pausedat;
this works fine. issue when user uses slider on audio tag move forward/backward. thinking of solution this
- use
ontimeupdate
event, stop voice , usestartat(currenttime)
currenttime of instrumental playing in audio tag.
since there no seekto function in api, have stop , start audio. there better solution this?
second issue face seeking on audio tag not smooth. if arbitrarily clicks on progress bar doesn't work. when saw network tab in developer tool window saw shown in image. sends out 600 requests , 86 mb data downloaded whereas file size less 10 mb.
you should use web audio api this. never give precise synchronization, , rely on streaming seek - going result in downloading, saw. load song via xhr , decodeaudiodata, , provide own playback controls.
Comments
Post a Comment