How to automatically present a video in Full Screen mode | XM Community
Question

How to automatically present a video in Full Screen mode

  • 6 November 2019
  • 7 replies
  • 234 views

Hi there, I am putting together an experiment that requires participants to watch a video that must be viewed in Full Screen mode. I Have tried inserting some of the java/HTML code that has been previously posted on this subject but to no avail. I am not sure if I am inserting it in the correct place or whether the code does not work! Can anyone help??? Thanks a million in advance... Luke

7 replies

Userlevel 2
Badge +1
hi @Luke_may001 - Can you paste the JS code you are using? you would need to paste the JS code within the "addOnload" function. Also have you provided your iFrame with an id?
Hi Igee, thanks a lot for getting back to me,

this is one of the scripts i tried:

function goFullscreen(id) {
var element = document.getElementById(id);

if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}

<img class="video_player" src="image.jpg" id="player"></img>
<button onclick="goFullscreen('player'); return false">Fullscreen</button>

This the screen I have entered it into, but i was not sure where to enter it or whether to delete what was already there...
!
I just tried adding the javascript to within the "addonload" section and it came up with:!
Userlevel 2
Badge +1
hey @Luke_may001 - You get the error cause you are trying to use a "<" however, in order to use a "<" tag you would need to use jQuery. I see you are using something along the lines of <img class, (not able to see more of the code due to the Alert pop-up so I am unsure what is that for?

Are you using an iFrame to embed your video into Qualtrics or have you uploaded the video from your local machine?
Userlevel 2
Badge +1
@Luke_may001 - If you are using an iFrame this is possible by giving your iframe a particular id eg: "iframe1" as highlighted below under Iframe Properties > Advanced

!

Once you have assigned an id, you can then use the below JS code for that question, under the "addonload" function.

!
Hi Igee, thanks for getting back to me again! I uploaded the video directly from my drive so not iframe, do you have any script for that situation?
Hi Igee, are you able to help with this or should i try reposting the question?
thanks,
Luke

Leave a Reply