Translations of this page:

Media Files in Questionnaires (Audio, Video, Documents)

Online questionnaires distinguish themselves from printed questionnaires, according to the methodological literature, because, among other things, they can incorporate audiovisual material. Few research projects currently make the effort to produce media content, but if you would like to include a document (such as a PDF), an audio file or a video in your questionnaire, this chapter will help you do so.

Important: Most media files (images, music, sounds, videos, and texts) are subject to the copyright. That means, you must not publish (e.g., upload) or modify these files without a written consent by the copyright owners. This as well applies to materials, that can be consumed free of charge (e.g., YouTube videos) and to materials modified by you (e.g., cutted videos). In case of a copyright infringement you risk an expensive cease-and-desist order (costs a few hundret or some thousand Euros) and deletion of the uploaded files during data collection.

Note: Pictures in internet-appropriate formats (see Images) can be uploaded in the standard way at Due to frequently lacking awareness of copyright violations, the server administrator must first approve uploaded media files.

Important: If your questionnaire makes use of media files, inform your participants of this fact as early as possible. E.g., you could point it out in the questionnaire invitation or next to the questionnaire link, so participants won’t begin the questionnaire in an inappropriate environment, such as an open-space office or the subway, and then have to abort at the video. As a control, you can also include a short video or audio file on the first or second questionnaire page, so participants will prepare their headphones or speakers early.

Uploading media files

While questions and tests are saved directly to a database, images and media files must first be uploaded as separate files to a host server (Images and Media Files in the menu). There are two things to keep in mind when doing so:

  1. The files must be saved in an appropriate format. There are countless document formats (e.g. PDF, DOC, DOCX, ODT, TXT, RTF for text documents alone), but only very few are suitable for use in online questionnaires. Aside from the file size, a crucial factor is that all participants must be able to open the document – particularly with proprietary formats (e.g. Word DOC, Windows AVI, etc.), this is often not the case.
  2. By uploading, you are publishing the file on the internet, universally accessible to everyone. This is only permitted if you hold usage rights for the contents. This starts with text copyrights, extends to composition and performance in a piece of music, and extends well beyond the image rights for pictures and videos. If any persons are represented in the material, confidentiality rights must be respected as well. In short: Any time outside material (even as background music or only in excerpts) or representations of persons are used, written permission is required. Otherwise, a written reprimand may be issued. This can cost between several hundreds and multiple thousands or Euros.

Note: Capitalisation is critical in internet content. Uploading the file “Document.pdf” and then linking the file “document.pdf” will lead to errors.

Linking documents

Most text and image contents in a questionnaire are formatted as text elements with HTML and directly embedded. However, longer documents (such as multiple-page instructions) may need to be linked as a downloadable file. A widely-used file format is PDF.

PDF files can be created with Adobe Acrobat (if purchased) or with the freeware OpenOffice Writer or FreePDF.

Once a file is uploaded to the host server, it can be linked for download with the HTML tag <a>. Often (not always!) browsers will open PDF files in a new window rather than downloading them. The addition of target ensures that this occurs in a new browser window or tab.

<a href="document.pdf" target="_blank">Download file</a>

Note: Whether the PDF file is opened in the browser or downloaded depends on the browser, or rather, the participant’s settings, and can’t be controlled by the researcher.

Incorporating audio files

There are several file formats that are suitable for use online. Usually, mp3 is used because this is the format compatible with the most browsers (Mozilla: Browser Support).

Note: The solutions below will play the audio file on one specific questionnaire page. When clicking to the next page, it stops. If you need to bypass this restriction, please read Play music along several pages.

Simple embedding of an mp3

If an audio file is saved in mp3 format and uploaded to the host server, it can simply be dragged into the questionnaire like a text element (Compose Questionnaire). With the display settings Einstellungen, you may configure the audio element to start playing automatically.

Embedding of an mp3 using HTML5

Since the HTML5 tag <audio> has become quite common now, it is well suited for embedding audio files. Only very outdated browsers (e.g. Internet Explorer older than version 9) do not support this tag.

In order to make sure the audio file is played in all contemporary browsers, it should be present in mp3 and ogg format. However, mp3 alone already provides a decent coverage. There is a number of free tools available for conversion into compressed file formats, such as the Open Source Audio Editor Audacity when used together with LAME.

To embed a file, create a new Text element in Text Elements and Labels with Formatting “HTML code”, and add the following content:

<audio id="audio_with_controls" preload="auto" autoplay controls controlsList="​nodownload"​>
controls controlsList="​nodownload"​>
  <source src="audio.mp3" type="audio/mpeg" />
  <source src="audio.ogg" type="audio/ogg" />
  Your browser is not able to play this audio file 

The file name(s) are entered in the <source> tags, while the options controls and autoplay enable controls and automatic playback. For more options, see w3schools: Audio.

CSS formatting can be used to either adjust player size or to hide the player entirely. Please keep in mind that some browsers might ignore the autoplay setting, e.g. on mobile devices with limited data usage).

<audio id="audio02" controls ​ ​controlsList="​nodownload"style="​width:​ 200px; height: 80px"><source src="audio.mp3" type="audio/mpeg" />
<audio id="audio03" controls ​controlsList="​nodownload"style="​position:​ absolute; left: -9999px; top: -9999px"><source src="audio.mp3" type="audio/mpeg" />

Note: Most mobile devices (smartphones, some tablets) and sometimes the desktop version of Safari block the autoplay function to play a media file (audio or video) automatically. In this case, you should provide a JavaScript that displays the control elements after a short time if the media file does not start. For example:

<audio id="audio04" preload controlsList="nodownload" autoplay>
  <source src="someAudio.mp3">
<script type="text/javascript">
window.addEventListener("load", function() {
  window.setTimeout(function() {
    var audio = document.getElementById("audio04");
    if (audio.paused) {
      audio.setAttribute("controls", "yes");
  }, 250);
// -->

JavaScript can be used to further refine the control of the audio file. For example, you can use the JavaScript event ended to automatically forward to the next page after the audio file has been played.

<audio id="audio05" preload controlsList="nodownload" autoplay>
  <source src="someAudio.mp3">
<script type="text/javascript">
window.addEventListener("load", function() {
  window.setTimeout(function() {
    // Identify audio element by ID
    var audio = document.getElementById("audio05");
    // Show controls if the video does not start automatically
    if (audio.paused) {
      audio.setAttribute("controls", "yes");
    // Automatically continues to the next page after playback
    audio.addEventListener("ended", SoSciTools.submitPage);
  }, 250);
// -->

Tip: If the embedded video does not play correctly, take a look at your browser's error console.

Notes on listening studies

If the audio stimulus is not only intended to convey music or speech, but also the finest nuances, then lossy mp3 compression can become a problem. This is not optimised to compress the knocking of a woodpecker, for example.

However, lossless audio compression is not so trivial in the context of an online survey:

  • The uncompressed PCM format (WAV files) is not supported by the outdated Internet Explorer (which is nevertheless frequently used) (Can I Use: WAV), but above all the format requires a lot of storage space. SoSci Survey therefore does not allow uploads for WAV files.
  • A lossless compressed alternative to the WAV format is FLAC (Mozilla: Audio Codecs). Here, too, Internet Explorer is left out and may need an additional alternative offered – but at least the format does not waste unnecessary storage space and bandwidth for the respondents.
  • A third option is mp3 files that are compressed at a very high quality (e.g. 320kbps). These are played by all browsers and with a high bit rate, far fewer aspects of the audio signal are removed than with standard compression at 128kbps.

Please note that there are further limits to authentic reproduction in online surveys. As a rule, the work computer is not a recording studio.

  • Some respondents cannot hear any audio signal at all, e.g. because they are in an open-plan office or because no speakers or headphones are connected to the computer.
  • Other respondents can only hear the audio with relevant background noise, for example on public transport. And even at home, undisturbed listening enjoyment is often not guaranteed: Family members are present, the neighbour is mowing the lawn or the parcel carrier is ringing…
  • Most respondents will only have poor audio hardware at home that cannot reproduce low tones and does not deliver a straight frequency response.
  • If Bluetooth headphones are used, the signal between the computer and the headphones is potentially compressed again with a loss.

Embedding videos

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.

The special case of YouTube videos

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="" 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 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.

Embedding videos using HTML5

If you want to make sure your video can be displayed correctly for virtually all participants, you can embed it in your questionnaire using the HTML5 <video> tag. A disadvantage is that you first need to convert the video into 3 (!) different formats, and consequently also need to upload three files. Basically, you can also use just one of the file formats, but this way the video will only play in some browsers (HTML5 Videos: 10 Things Designers Need to Know).

Important: Very outdated versions of Internet Explorer (up to version 8) do not support the <video> tag. E.g. for Germany, this would affect about 3% of internet users (Can I use: Video element).

To convert the video to mp4, webm and ogg formats, you can use different software. It works quite comfortable with CloudConvert (online, free for smaller files) and with the MiroVideoConverter.

In SoSci Survey, you create a new Text element in Text Elements and Labels with Formatting “HTML code”, and add the following content:

<video width="512" height="288" playsinline controls controlList="nodownload">
  <source src="filename.mp4" type="video/mp4" />
  <source src="filename.webm" type="video/webm" />
  <source src="filename.ogg" type="video/ogg" />

Obviously, you can use the width and height parameters to adjust the video’s display size. This means that large videos can also be scaled to the available width.

<video style="max-width: 100%" playsinline controls controlsList="nodownload"> 
  <source src="dateiname.mp4" type="video/mp4" /> 
  <source src="dateiname.webm" type="video/webm" /> 
  <source src="dateiname.ogg" type="video/ogg" />   

Other options allow you to start the video automatically (autoplay, more on this below) or hide the control elements at the bottom.

The playsinline parameter 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.

Play automatically (mute)

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" />   

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.

Optimated Embedding

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" />
<script type="text/javascript">
var video = document.getElementById("stimulus");
// Hide controls once it plays
SoSciTools.attachEvent(video, "play", function(evt) {
// Hide next button
SoSciTools.attachEvent(window, "load", function(evt) {
// Show next button at the end of the video again
SoSciTools.attachEvent(video, "ended", function(evt) {
// -->

Control playback

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.

  • Create an internal variable (in the following example “IV01_01”),
  • Click on the variable in the navigation for editing and select that the data should be transmitted periodically in the background (this way, people who close the questionnaire window are also recorded).
  • Drag the question with the internal variable to the questionnaire page with the video.
  • Make sure that the <video> tag has an HTML ID, e.g. <video id="stimulus">
  • Insert the following JavaScript code under Video and internal variable within a <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.

Problems with the Web Storage Space

At, 64 MB disk space per survey project is available by default. This is too little for longer videos in several formats.

Survey server of the university

Tip: Check whether your university operates its own survey server (Availability of SoSci Survey at your university) – As a rule, significantly fewer surveys are run on local survey servers than on, so storage space can often be allocated less restrictively there. You can easily move existing projects (Copying a Survey).

Online storage space of the university

Ideally, you can access online storage at your own university or company and upload the video files there. In the HTML code, simply enter the complete URL of the video file, e.g.

<video width="512" height="288" controls controlsList="nodownload"> 
  <source src="" type="video/mp4" />

Important: The online memory must (!) be accessible via HTTPS. If you try to include unencrypted HTTP content in a questionnaire page that was transmitted encrypted via HTTPS, most browsers block this.

Cloud storage

If you have access to B2Drop, Sync&Share, Sciebo or another scientific cloud storage, you can also store videos there. After uploading the file to Sync&Share, select the icon next to the file to create a download link (chain icon). On the download page that opens, you will see “Download” and the name of the file in a box - this is a link. By right-clicking on the link, you can copy the link destination to the clipboard and then use it in the <video> tag:

<video width="512" height="288" controls controlsList="nodownload">
    <source src="" type="video/mp4" />

Important: Most cloud storage systems have different links. One link opens a website on which the video is displayed or offered for download. With Sync&Share, for example, this contains a getlink/. The other link leads directly to the download and contains, for example, a dl/ or a /download. Only the download link works in the <video> tag. Here is an example for Sync&Share.

  • Link to display the file
  • Link to download and integrate the file

Google Drive, Dropbox and others

If you do not need to access the video using JavaScript – e.g. to play or pause the video depending on certain events or to record timestamps – then you can also use external storage services that do not deliver the mp4 file directly. This can be YouTube (see above) or cloud storage services.

If you store videos on Google Drive or Dropbox and share them from there, these services integrate their own video players. So you don't get the video itself, but only a website that plays the video. Such an external website can be integrated into the questionnaire (as with YouTube) using <iframe>.

<iframe width="420" height="315" src="" frameborder="0" allowfullscreen allow="autoplay" style="display: block; border: 0 auto;"></iframe>

Warning: Whenever the data is loaded from a third-party server, the respondent's IP address is transmitted to this server. Check with your organisation's data protection officer whether this is a problem and whether you may need additional consent from respondents.

Warning: It cannot be ruled out that external cloud services may limit the number of accesses (e.g. per 24 hours). Please ask the respective provider and/or the search engine you trust whether and what limits the selected cloud storage service uses.

Technical hurdles

Regardless of whether audio files or videos are embedded following the directions above or directly from an external provider (e.g. YouTube), it can never guarantee that the participant can actually see the media file.

All options listed above (including YouTube) only work if the participant has a halfway up-to-date Flash Player. Flash is the most common media plug-in for browsers, but a relevant proportion of participants (depending on target population, 5-20%) will not have it installed. In addition, some participants use a Flash-Blocker to hide moving advertisements on some websites.

The solution to this problem is relatively simple: embed a short test video/audio clip on the first page of the questionnaire. The participants can then be asked to test the display in advance. I fit does not work properly, they should …

  • check if the speakers are turned on,
  • possibly install the up-to-date Flash Player (include a link to the download page) and/or
  • temporarily disable an Flash blocker.

Tip: Optionally, some information (such as a number) can be hidden in the media file by displaying or recording it. Only users who enter this information correctly into a text box can continue to the questionnaire (this is then checked via filter on the next page of the questionnaire).

Of course, a series of other problems can also prevent the display of media. This can start with the fact that the participant is using a hopelessly out-of-date browser (e.g. Internet Explorer 5) and extend well beyond difficulties playing the file (a frighteningly small proportion of internet users comprehends the term “play button”). It has to be accepted that under some circumstances, a portion of the participants in an online questionnaire simply cannot play the files. However, with the instructions above, this portion should be reduced to very few percent.

Finally, most of the time, it is impossible to control whether the participant has actually watched/listened to the complete file. This would require a special play-software to transmit this information to SoSci Survey (which does not currently exist). For those who do not wish to code their own software, the following options should work:

  • Ask the participant if he/she has watched/listened to the complete file,
  • check the time spent on each page during data analysis (Dwll Times) or
  • only display the Continue button after a short while (Timer: Display Next Button after Defined Time). If you allow a Back button, do not set this time interval too long.
en/create/media.txt · Last modified: 10.07.2024 12:41 by admin
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki