html5 - How to fix jittery audio/video on firefox when playback rate set to .5x using javascript? -
i trying set experiment in playing .mp4 videos , changing playback rates using base javascript (no libraries) , html5 (mac osx 10.10.4). when change playback rate of video .5x, although audio-video slowed down, audio sounds jittery on firefox (version 39.0.3). problem not pronounced on chrome (version 44.0.2403.130, 64-bit), safari (version 8.0.7) or ie (version 11+). there way can make make audio video sound less noisy when using firefox?
<script type="text/javascript"> var videos = ['2.4.mp4', '3.2.mp4', '2.8.mp4'] var rates = [.5, 1, .5] function setupstim(){ stim = document.getelementbyid('movie'); stim.addeventlistener('loadeddata', function() { stim.defaultplaybackrate = rates[trialnum]; stim.playbackrate = rates[trialnum]; stim.play(); settimeout(enablebuttons,stim.duration*1000); }, false); } function stimulus(trialnum, moviename,rate,response, rt) { this.trialnum = trialnum; this.moviename = moviename; this.rate = rate; this.response = response; this.rt=rt; } function playvideo(){ hide('start'); stim.src = "https://s3.amazonaws.com/mcgurkstimuli/" + videos[trialnum]; document.getelementbyid('p3').innerhtml = (trialnum + 1)+ ' / '+ n; time0=performance.now(); return time0; } function choice(resp){ var time1 = performance.now(); stim.rt = math.round(time1-time0); stim.response = resp; videos[trialnum] = new stimulus(trialnum,stim.src,rate,resp,stim.rt); videos[trialnum].rt = stim.rt; videos[trialnum].response = stim.response; videos[trialnum].moviename = stim.src; videos[trialnum].rate = stim.playbackrate; videos[trialnum].trial=trialnum; data +=videos[trialnum]; document.getelementbyid("inputfields").innerhtml = data; trialnum++; if (trialnum<n){ playvideo(); } else { hideoptions(); hide('movie'); } } </script> <p><button class="startbutton" id="start" onclick="playvideo()" type="button">begin task</button> <video id="movie" onended="showoptions()"><source /></video> </p>
response
Comments
Post a Comment