Testing if trial ends before video should #1776
Replies: 1 comment 1 reply
-
Hi @jackransomlovell, yes, I see what you mean. What I would do is switch to using one of the video-* plugins, and use the The catch with this solution is to get the trial to end automatically when the video is stopped. There's a parameter called if(trial.stop !== null){
video_element.addEventListener('timeupdate', function(e){
var currenttime = video_element.currentTime;
if(currenttime >= trial.stop){
video_element.pause();
end_trial(); // <---- add this to end trial after the video reaches the stop time
}
})
} By the way, I think you can get the video's duration using its duration property, but this will only work once the video has finished loading. |
Beta Was this translation helpful? Give feedback.
-
Hi, I have written an experiment that pauses a vid at a random point, asks for some rating, then resumes. I had to submit the trial durations by hand (couldn't figure out a way to just get the duration from a
<video>
object), so our concern is that if the video takes some time to load, this will cause the resume to start at the wrong point (i.e. the first video ends at the wrong time). Is there any way to control this? My code is below :)Beta Was this translation helpful? Give feedback.
All reactions