Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:create:media [20.12.2019 17:37] adminen:create:media [10.07.2024 12:41] (current) – [Optimated Embedding] admin
Line 37: Line 37:
 ===== Incorporating audio files ===== ===== 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.+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 ([[https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Cross-browser_audio_basics#audio_codec_support|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 [[:en:create:frameset]]. **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 [[:en:create:frameset]].
Line 124: Line 124:
 </code> </code>
  
 +**Tip:** If the embedded video does not play correctly, take a look at your [[en:general:browser-tools|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) ([[https://caniuse.com/?search=wav|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 ([[https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_codecs|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 ===== ===== Embedding videos =====
Line 129: Line 147:
 **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!  **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 [[en:general:browser-tools|solving audio/video problems]] will help.
 ==== The special case of YouTube videos ==== ==== 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).  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//Copy the HTML code into a text element (**Text Elements and Labels**) and drag it into the questionnaire (**Compose Questionnaire**). If necessary, replace ''%%http://%%'' by ''%%https://%%'' in the HTML code.+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).
  
 <code html> <code html>
Line 141: Line 160:
 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. 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:** 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.+**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. **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.
Line 152: Line 173:
 **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 ([[http://caniuse.com/#feat=video|Can I use: Video element]]). **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 ([[http://caniuse.com/#feat=video|Can I use: Video element]]).
  
-To convert the video to mp4, ogg and webm formats, you can use different software. It works quite comfortable with [[https://cloudconvert.com/|CloudConvert]] (online, free for smaller files) and with the [[MiroVideoConverter|http://www.mirovideoconverter.com/]].+To convert the video to mp4, webm and ogg formats, you can use different software. It works quite comfortable with [[https://cloudconvert.com/|CloudConvert]] (online, free for smaller files) and with the [[http://www.mirovideoconverter.com/|MiroVideoConverter]].
  
 In SoSci Survey, you create a new [[:en:create:texts|Text element]] in **Text Elements and Labels** with //Formatting// “HTML code”, and add the following content: In SoSci Survey, you create a new [[:en:create:texts|Text element]] in **Text Elements and Labels** with //Formatting// “HTML code”, and add the following content:
  
 <code html> <code html>
-<video width="512" height="288" controls+<video width="512" height="288" playsinline controls controlList="nodownload">
-  <source src="filename.oggtype="video/ogg" />+
   <source src="filename.mp4" type="video/mp4" />   <source src="filename.mp4" type="video/mp4" />
   <source src="filename.webm" type="video/webm" />   <source src="filename.webm" type="video/webm" />
 +  <source src="filename.ogg" type="video/ogg" />
 </video> </video>
 </code> </code>
  
-Obviously, you can use the ''width'' and ''height'' parameters to adjust the video’s display size. Additional options are available to enable autoplay or hide the player controls ([[http://wiki.selfhtml.org/wiki/HTML/Multimedia_und_Grafiken/Video|SelfHTML: HTML/Multimedia und Grafiken/video]] (German only)).+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.
  
 +<code html> 
 +<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" />   
 +</video> 
 +</code> 
  
-==== Optimierte Einbindung ====+Other options allow you to start the video automatically (''autoplay'', more on this below) or hide the control elements at the bottom. 
  
-HTML5-Videos kann man mittels JavaScript sehr differenziert ansteuern bzwauf Ereignisse im Video reagieren. Das folgende Beispiel aus HTML-Code (für das Video-Element) und JavaScript-Code sorgt dafür, dass (a) der Weiter-Knopf ausgeblendet wird, solange das Video spielt und (b) die Bedienelemente (Pause, Spulen, ...) verschwindensobald der Teilnehmer das Video gestartet hat.+The ''playsinline'' parameter ensures that the video does not automatically switch to full screen mode on mobile devicesHoweverthis does not mean that this would happen automatically on all devices if it is omitted
  
-**Tipp:** Erlauben Sie die Bedienelemente auch dann, wenn Sie ''autoplay'' verwenden -- zumindest zu BeginnDenn Browser auf Mobilgeräten ignorieren die Aufforderung zum automatischen Abspielen in aller Regel, um den mobilen Datenverbrauch zu reduzieren.+==== 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 videos''muted''. Many devices and browsers allow this.  
 + 
 +<code html>  
 +<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>  
 +</code>  
 + 
 +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 initiallyBecause browsers on mobile devices usually ignore the request for automatic playback in order to reduce mobile data consumption.
  
 <code html> <code html>
-<video width="512" height="288" controls controlsList="nodownload" id="stimulus"> +<video style="max-width: 100%" controls controlsList="nodownload" id="stimulus"> 
-  <source src="dateiname.ogg" type="video/ogg" /> +  <source src="filename.mp4" type="video/mp4" /> 
-  <source src="dateiname.mp4" type="video/mp4" /> +  <source src="filename.webm" type="video/webm" /> 
-  <source src="dateiname.webm" type="video/webm" />+  <source src="filename.ogg" type="video/ogg" />
 </video> </video>
  
Line 186: Line 233:
 var video = document.getElementById("stimulus"); var video = document.getElementById("stimulus");
  
-// Bedienelemente ausblenden, sobald es abspielt+// Hide controls once it plays
 SoSciTools.attachEvent(video, "play", function(evt) { SoSciTools.attachEvent(video, "play", function(evt) {
-  stimulus.removeAttribute("controls");+  video.removeAttribute("controls");
 }); });
-// Weiter-Knopf ausblenden+// Hide next button
 SoSciTools.attachEvent(window, "load", function(evt) { SoSciTools.attachEvent(window, "load", function(evt) {
   SoSciTools.submitButtonsHide();   SoSciTools.submitButtonsHide();
 }); });
-// Weiter-Knopf am Ende des Videos wieder anzeigen +// Show next button at the end of the video again 
-SoSciTools.attachEvent(stimulus, "ended", function(evt) {+SoSciTools.attachEvent(video, "ended", function(evt) {
   SoSciTools.submitButtonsDisplay();   SoSciTools.submitButtonsDisplay();
 }); });
Line 203: Line 250:
 </code> </code>
  
 +==== Control playback ====
  
 +You can control the playback of the video with relatively little effort. The following [[:en:create:javascript|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 [[:en:create:questions:internal|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.
 +
 +<code javascript>
 +window.setInterval(function() {
 +  var video = document.getElementById("stimulus"); 
 +  var intVar = document.getElementById("IV01_01");  
 +  intVar.value = video.currentTime;
 +}, 100);
 +</code>
 +
 +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 ==== ==== Problems with the Web Storage Space ====
  
 At www.soscisurvey.de, 64 MB disk space per survey project is available by default. This is too little for longer videos in several formats. At www.soscisurvey.de, 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 ([[https://www.soscisurvey.de/de/campus|Availability of SoSci Survey at your university]]) -- As a rule, significantly fewer surveys are run on local survey servers than on www.soscisurvey.de, so storage space can often be allocated less restrictively there. You can easily move existing projects ([[:en:general:copy-project]]).
 +
 +=== 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.  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. 
  
 <code html> <code html>
-<source src="https://www.example.com/projectXYZ/filename.mp4" type="video/mp4" />+<video width="512" height="288" controls controlsList="nodownload">  
 +  <source src="https://www.example.com/projectXYZ/filename.mp4" type="video/mp4" /
 +</video>
 </code> </code>
  
 **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. **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.
  
-If you have access to Sync&Share, you can also store videos there. After uploading the file to Sync&Share, select the icon for creating a download link (chain icon) next to the file. On the download page that opens, a box will say "download" and the name of the file -- 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:+=== Cloud storage === 
  
-<code html> +If you have access to [[https://b2drop.eudat.eu|B2Drop]], [[https://syncandshare.lrz.de/login|Sync&Share]], [[https://www.hochschulcloud.nrw/|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 "Downloadand 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:
-<source src="https://syncandshare.lrz.de/dl/fiR1vpLSm7zeDmYRoxRAiAQF/sample.mp4type="video/mp4" /> +
-</code>+
  
-If you do not have access to your own online storage, you can use the provider [[https://www.dropbox.com/|Dropbox]]. There you can create links to share the files. But in order to use them in the questionnaire, you have to make sure that Dropbox delivers the media file directly and not a download page. Therefore you have to set or change the parameter ''dl=1'' in the URL. 
  
 <code html> <code html>
-<source src="https://www.dropbox.com/s/eccvtg69sxl8ume/video001.mp3?dl=1" type="video/mp4" />+<video width="512" height="288" controls controlsList="nodownload"> 
 +    <source src="https://syncandshare.lrz.de/dl/fiR1vpLSm7zeDmYRoxRAiAQF/sample.mp4" type="video/mp4" /
 +</video>
 </code> </code>
  
-**Warning:** In Safari (Apple/MacOS) problems with the integration of Dropbox have been reportedApparently Dropbox does not deliver the media file to the Safari browserbut an HTML fileThis results in Mac users not being able to view the video.+**Important:** Most cloud storage systems have different linksOne 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 containsfor example, a ''dl/'' or a ''/download''Only the download link works in the ''<video>'' tag. Here is an example for Sync&Share.
  
-**Warning:** Dropbox may restrict the possibility of direct download at any time.+  Link to display the file\\ ''%%https://syncandshare.lrz.de/getlink/QKpc3cSZlxs4MSwziVRyCk/StimulusB1.mp4%%'' 
 +  Link to download and integrate the file\\ ''%%https://syncandshare.lrz.de/dl/QKpc3cSZlxs4MSwziVRyCk/StimulusB1.mp4%%'' 
  
-**Warning:** There is no information yet on whether Dropbox will restrict direct download even if many users access 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 directlyThis 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>''
 + 
 +<code html> 
 +<iframe width="420" height="315" src="https://drive.google.com/uc?export=preview&id=1Mu_zc...etc" frameborder="0" allowfullscreen allow="autoplay" style="display: block; border: 0 auto;"></iframe> 
 +</code>
  
 +**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 ===== ===== Technical hurdles =====
  
en/create/media.1576859833.txt.gz · Last modified: 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