Important: Read the advice in Media Files in Questionnaires (Audio, Video, Documents) before this manual.
Important: Those who have not looked into copyright laws often think public and free-access videos (such as those on YouTube) may be used in questionnaires without further consideration. This is incorrect. Copyright laws apply to such videos as well!
Note: If a video does not play correctly, the instructions for solving audio/video problems will help.
Users who upload videos to YouTube (and similar platforms) transfer a whole series of usage rights to the platform. This can be very useful in survey studies because YouTube offers the possibility of embedding videos directly into external websites (such as your online questionnaire).
To do this, open the video on YouTube, click on the Share button, then Embed. MArk the option for “enhanced data protection” – otherwise the video might be blocked in firefox or other browsers. Copy the HTML code offered by YouTube into a text module (click Add text in a section of your choice) and drag this text into the questionnaire (Composing Questionnaire). Under certain circumstances the http:// must be replaced by https:// (see note below).
<iframe width="420" height="315" src="https://www.youtube.com/embed/WtR2m20C2YM" frameborder="0" allowfullscreen></iframe>
With this HTML code, a (mostly invisible) YouTube website is opened within the questionnaire and the YouTube player is loaded. The user does not have to upload the file, nor deal with copyright laws. In exchange, YouTube is permitted to blend their own advertisements into the video.
Warning: If YouTube is integrated into the questionnaire, then the call may transmit personal data to YouTube. This may require consent from the respondent. Please clarify this issue in advance (!) with the data protection officer at your university, institution or company.
Warning: YouTube allows itself in its own terms of use to include advertising in videos. The advertising spots shown previously to the video by youtube will vary for every respondent. Therefore, directly embedding the YouTube video may cause severe methodological trouble. The only solution to this case is to get the (written) consent of the copyright owner, to upload the video to the survey project, and to embed this file.
Note: Browser will access www.soscisurvey.de via secured (encrypted) HTTPS protocol. Some browsers deny including content from non-encrypted sources via iframe. When including external content, make sure, this content is available via HTTPS. Also use the HTTPS URL.
If you want to make sure that your video is played correctly for virtually all respondents, embed it in the questionnaire as an mp4 file with the <video> tag. In SoSci Survey, you now create a new text with the display “HTML code” and the following content:
<video playsinline controls controlsList="nodownload" style="max-width: 100%;"> <source src="filename.mp4" type="video/mp4" /> </video>
Note: Older browsers and, above all, older mobile devices may require the video in further formats besides mp4. If you want to be on the safe side, convert the video not only to mp4, but also to the formats webm and ogg.
To convert the video to the formats mp4, webm, and ogg, you can use different software. It works quite conveniently with CloudConvert (online, free for smaller files) and with the MiroVideoConverter.
<video width="512" height="288" playsinline controls controlsList="nodownload"> <source src="filename.mp4" type="video/mp4" /> <source src="filename.webm" type="video/webm" /> <source src="filename.ogg" type="video/ogg" /> </video>
With further options, you can have the video start automatically (autoplay, more on this below) or hide the control elements at the bottom (MDN: The Video Embed element).
The parameter playsinline ensures that the video does not automatically switch to full screen mode on mobile devices. However, this does not mean that this would happen automatically on all devices if it is omitted.
Most mobile devices (smartphones, some tablets) and sometimes also the desktop version of Safari block the autoplay function (autoplay) to start a media file (audio or video) automatically.
One option is to start the videosmuted. Many devices and browsers allow this.
<video width="max-width: 100%" playsinline autoplay muted controlsList="nodownload"> <source src="dateiname.mp4" type="video/mp4" /> <source src="dateiname.webm" type="video/webm" /> <source src="dateiname.ogg" type="video/ogg" /> </video>
Another option is to use JavaScript to try to start the video (possibly only after interaction with the page) and display the play button if this does not work.
HTML5 videos can be controlled in a very differentiated way using JavaScript and can react to events in the video. The following example of HTML code (for the video element) and JavaScript code ensures that (a) the next button is hidden as long as the video is playing and (b) the controls (pause, rewind, …) disappear once the participant has started the video.
Tip: Allow the controls even if you use autoplay – at least initially. Because browsers on mobile devices usually ignore the request for automatic playback in order to reduce mobile data consumption.
<video style="max-width: 100%" controls controlsList="nodownload" id="stimulus"> <source src="filename.mp4" type="video/mp4" /> <source src="filename.webm" type="video/webm" /> <source src="filename.ogg" type="video/ogg" /> </video> <script type="text/javascript"> <!-- var video = document.getElementById("stimulus"); // Hide controls once it plays SoSciTools.attachEvent(video, "play", function(evt) { video.removeAttribute("controls"); }); // Hide next button SoSciTools.attachEvent(window, "load", function(evt) { SoSciTools.submitButtonsHide(); }); // Show next button at the end of the video again SoSciTools.attachEvent(video, "ended", function(evt) { SoSciTools.submitButtonsDisplay(); }); // --> </script>
You can control the playback of the video with relatively little effort. The following JavaScript code writes the playback position to an internal variable every 0.1 seconds. This saves the position up to which the video was viewed in the data record.
<video> tag has an HTML ID, e.g. <video id="stimulus"><script> tag.window.setInterval(function() { var video = document.getElementById("stimulus"); var intVar = document.getElementById("IV01_01"); intVar.value = video.currentTime; }, 100);
The identifiers “stimulus” and “IV01_01” must be adapted to the HTML IDs of your video and the internal variable.