when displaying videos, is there a way to move forward immediately after each video? | XM Community
Solved

when displaying videos, is there a way to move forward immediately after each video?

  • 13 August 2018
  • 6 replies
  • 569 views

Hi all,

I am showing some videos from youtube to my participants though a survey using the Merge & Loop option. Importantly, each video has a different duration.
After each video I would like to display immediately a multiple choice question. However, to move automatically forward.. the timing option only allows to choose one specific time (i.e., auto-advance). Is there a way to customise this? Otherwise, sometimes my participants have to wait long for the multiple choice whereas other times they videos are cut without finishing..

any thoughts, code, and so on are more than welcome!
thanks in advance.
best wishes,
Alex
icon

Best answer by Anonymous 13 August 2018, 20:35

View original

6 replies

Hello @Alex_GP ,

Please see this post
Hello @Alex_GP ,

If your video is not embedded from youtube then just paste the following code in the js(on ready) of question:

var video = jQuery("#vidid");
var preview = false;
if(/^\\/jfe[0-9]?\\/preview/.test(window.location.pathname)) preview = true;

if(preview) {
if(jQuery('.MobilePreviewFrame:first').length > 0) {
var vidEl = video.get(0);
vidEl.muted = true;
vidEl.width = "300";
}
}

$('NextButton').hide();
video.on('ended', function(event) {


$('NextButton').click();

});

Note: var video = jQuery("#vidid"); // vidid is the id of video tag

You question will be something like this in html
!
Hi Shashi,

I have tried putting your code in but I kept getting the message about "unexpected identifier". Would you happen to know where have I gone wrong?
Thanks.
This is what I have done:

var video = jQuery("#vidid");//<video id="vidid" controls="controls" autoplay="autoplay" height="500" src="https://www.youtube.com/embed/YLYIVOcsH2U?rel=0&XXX;autoplay=1" width="889"></iframe>
var preview = false;
if(/^\\/jfe[0-9]?\\/preview/.test(window.location.pathname)) preview = true;

if(preview) {
if(jQuery('.MobilePreviewFrame:first').length > 0) {
var vidEl = video.get(0);
vidEl.muted = true;
vidEl.width = "300";
}

}

$('NextButton').hide();
video.on('ended', function(event)


$('NextButton').click();
Userlevel 3
Badge +1
> @Shashi said:
> Hello @Alex_GP ,
>
> Please see this post

Hello @Alex_GP , You can use this Post ,if you are embedding your Youtube videos
Userlevel 3
Badge +1
> @Shashi said:
> Hello @Alex_GP ,
>
> If your video is not embedded from youtube then just paste the following code in the js(on ready) of question:
>
> var video = jQuery("#vidid");
> var preview = false;
> if(/^\\/jfe[0-9]?\\/preview/.test(window.location.pathname)) preview = true;
>
> if(preview) {
> if(jQuery('.MobilePreviewFrame:first').length > 0) {
> var vidEl = video.get(0);
> vidEl.muted = true;
> vidEl.width = "300";
> }
> }
>
> $('NextButton').hide();
> video.on('ended', function(event) {
>
>
> $('NextButton').click();
>
> });
>
> Note: var video = jQuery("#vidid"); // vidid is the id of video tag
>
> You question will be something like this in html
> !
>
>
>

Hello @Alex_GP , You can go with this post if your video is uploaded in qualtrics library or video is hosted somewhere else.

@sankeshkumar

I'm trying to use this code, and am successfully getting the next button to hide, but button doesn't get clicked (no advance) when the video ends. Is this code outdated, or do you have any advice?

Leave a Reply