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 [26.04.2016 14:10] – [Embedding of an mp3 using HTML5] adminen:create:media [26.09.2025 09:33] (current) admin
Line 20: Line 20:
  
  
-===== Linking documents =====+===== 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. 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.
Line 34: Line 34:
 **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. **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.
  
 +===== Music, Audio Files and Videos =====
  
-===== Incorporating audio files =====+In many studies, embedding audio and video files needs to be customised. Read the following instructions to find out how this works:
  
-There are several file formats that are good for use online, particularly RealMedia (RMA) and Windows Media (WMA). However, both formats exclude a relevant proportion of participants. In contrast, virtually all internet users can now play Flash files. The open-source software [[http://emff.sourceforge.net/|EMFF]] is Flash-based and can play mp3 files. EMFF is a standard plug-in on the www.soscisurvey.de server.+  * [[:de:create:video]] 
 +  * [[:de:create:audio]] 
 +  * [[:de: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]]. 
  
  
-==== Simple embedding of an mp3 ====+===== Using HTML files =====
  
-If an audio file is saved in mp3 format and uploaded to the host serverit can simply be dragged into the questionnaire like a text element (**Compose Questionnaire**)With the display settings {{:button.settings.png?nolink|Einstellungen}}, the user can determine how the EMFF Player should appear.+SoSci Survey allows you to upload web pages (HTMLCSS and JS files) that can be used for information or as stimuliThe instructions [[:en:create:frameset]] describe a specific use case.
  
-**Note:** SoSci Survey embeds audio files with flash-based EMFF playerWhile this solution also works for outdated browsers, flash is not supported in iOS (iPhones/iPads). Further, Firefox now blocks flash content as a default, and requires for explicit content activation by clicking, even if autoplay is activated. We thus recommend audio file embedding using HTML5.+The following examples assume that you have uploaded file called ''stimulus.html'' (and any associated CSS and/or JS filesto the project directory.
  
 +**Important:** For security reasons, the server may block script content in HTML pages. Integrate the pages via ''index.php?html=<filename>'' (e.g. ''index.php?html=stimulus.html'') so that scripts work as expected. This workaround is not necessary for files from the protected file storage.
  
-====Embedding of an mp3 using HTML5====+HTML pages can be linked in the questionnaire so that they open in a new browser tab:
  
-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. +<code html
- +<href="stimulus.html" target="_blank">View page</a
-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 decent coverageThere is number of free tools available for conversion into compressed file formats, such as the Open Source Audio Editor [[http://sourceforge.net/projects/audacity/|Audacity]].+</code>
  
-To embed a file, create a new [[en:create:texts|Text element]] in **Text Elements and Labels** with //Formatting//HTML code”, and add the following content:+HTML pages can also be embedded directly into the questionnaire as ''<iframe>''.
  
 <code html> <code html>
-<audio id="audio_with_controls" preload="auto" controls autoplay> +<iframe src="stimulus.htmlwidth="100%height="400"></iframe>
-  <source src="audio.mp3type="audio/mpeg/> +
-  <source src="audio.oggtype="audio/ogg" /> +
-  Your browser is not able to play this audio file  +
-</audio>+
 </code> </code>
  
-The file name(sare entered in the ''<source>'' tags, while the options ''controls'' and ''autoplay'' enable controls and automatic playback. For more options, see [[http://www.w3schools.com/html/html5_audio.asp|w3schools: Audio]].+Please note that the width adapts to the screen (display on mobile devices), but the height is fixed. This can result in part of the content being cut off at the bottom or only being visible by scrolling.
  
-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).+The following HTML code embeds the page so that the aspect ratio remains constant and no frame is visible.
  
 <code html> <code html>
-<audio id="audio_with_controlscontrols style="width200pxheight80px"> +<iframe src="stimulus.html" width="100%" style="aspect-ratio1.7border:none;"></iframe>
-  <source src="audio.mp3" type="audio/mpeg" /> +
-</audio>+
 </code> </code>
  
-<code html> +It is more difficult to adjust the height so that the ''<iframe>'' becomes longer (higher) on narrow screens. This requires JavaScript ([[:en:create:javascript]]).
-<audio id="audio_with_controls" controls style="positionabsolute; left-9999px; top-9999px"> +
-  <source src="audio.mp3" type="audio/mpeg" /> +
-</audio> +
-</code>+
  
-**Note:** Due to technical limitations, as of this time it is not (!) possible to use the audio file embed code directly in an “HTML code” element from the **Compose Questionnaire** step. As described abovea text element containing the code must be created first, which can then be added in the **Compose Questionnaire** step.+**Tip:** If possible, save the HTML code of the stimulus directly as **Text**, setting //Display// to "HTML codein the **List of Questions**, and then drag the corresponding text into the questionnaire page.
  
  
-====Embedding of an mp3 using Flash==== 
  
-If additional functions are needed (such as playing the file automatically) or the file must be interchangeable (e.g. as a randomised stimulus), the [[http://emff.sourceforge.net/codegenerator/|EMFF code generator]] can be used to generate the appropriate HTML code to embed the file into the questionnaire. Subsequently, the path to the EMFF player must be adjusted twice (!) (''../plugins/emff/'', see code example below) and the HTML code must be saved as a text element (Text Elements and Labelling) and dragged into the questionnaire (**Compose Questionnaire**).+===== Problems with the Web Storage Space =====
  
-<code html> +At www.soscisurvey.de, 64 MB disk space per survey project is available by defaultThis is too little for longer videos in several formats.
-<object type="application/x-shockwave-flash" data="../plugins/emff/emff_standard.swf" width="110" height="34"> +
-  <param name="movie" value="../plugins/emff/emff_standard.swf"> +
-  <param name="FlashVars" value="src=audiofile.mp3&amp;autostart=yes"> +
-</object> +
-</code>+
  
-**Note:** If EMFF is not present on a host server, the necessary flash files (SWF) can be downloaded from the EMFF homepage and uploaded to the user's project. 
  
 +==== Survey server of the University ====
  
-===== Embedding videos =====+**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]]).
  
-**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!  
  
-==== The special case of YouTube videos ====+==== Online storage space of the university ====
  
-Users who upload videos to YouTube (and similar platforms) transfer a whole series of usage rights to the platformThis can be very useful in survey studies because YouTube offers the possibility of embedding videos directly into external websites (such as your online questionnaire).  +Ideally, you can access online storage at your own university or company and upload the video files thereIn the HTML codesimply enter the complete URL of the video filee.g
- +
-To do thisopen the video on YouTubeclick 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.+
  
 <code html> <code html>
-<iframe width="420" height="315" src="https://www.youtube.com/embed/WtR2m20C2YMframeborder="0allowfullscreen></iframe>+<video width="512" height="288controls controlsList="nodownload">  
 +  <source src="https://www.example.com/projectXYZ/filename.mp4type="video/mp4/> 
 +</video>
 </code> </code>
  
-With this HTML code, a (mostly invisibleYouTube website is opened within the questionnaire and the YouTube player is loadedThe user does not have to upload the filenor deal with copyright laws. In exchange, YouTube is permitted to blend their own advertisements into the video.+**Important:** The online memory must (!be accessible via HTTPSIf you try to include unencrypted HTTP content in a questionnaire page that was transmitted encrypted via HTTPSmost browsers block this.
  
-**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. 
  
-**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.+==== Cloud storage ====
  
 +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 "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:
  
-====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 ([[http://www.hongkiat.com/blog/html5-videos-things-you-need-to-know/|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 ([[http://caniuse.com/#feat=video|Can I use: Video element]]). 
- 
-To convert your video file into the file formats mp4, ogg, and webm, you can use a number of tools. It can be done quite conveniently using [[https://cloudconvert.com/|CloudConvert]] (online), and the 
-[[http://www.videolan.org/vlc/|VLC Media Player]] (offline) can also be used for this purpose. To  
-do so with VLC, do the following (instructions based on [[http://klaesimage.com/wordpress/?p=265|Using VLC Media Player to convert video]]): 
- 
-  * Open VLC Media Player 
-  * Menu: Media -> Convert/Save 
-  * File -> File Selection -> Add -> Choose video file 
-  * Convert/Save 
-  * Settings -> Profile: “Video - H.264 + MP3 (MP4)” 
-  * Destination -> Destination File -> Browse -> choose folder and file name, using .mp4 extension (e.g. video.mp4) 
-  * Start 
- 
-Possibly, the conversion parameters need to be adjusted to meet the needs of your project, e.g. concerning video bitrate. You can do so in the “Edit selected profile” dialog next to the profile selection. 
- 
-This procedure is repeated using the profiles “Video - VP80 + Vorbis (WebM)” -> file extension “.webm”, and “Video - Theora + Vorbis (OGG)” -> file extension “.ogg”. Once the files have been encoded, open the new video files in order to check video and audio quality. 
- 
-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" controls controlsList="nodownload"> 
-  <source src="filename.oggtype="video/ogg" /+    <source src="https://syncandshare.lrz.de/dl/fiR1vpLSm7zeDmYRoxRAiAQF/sample.mp4" type="video/mp4" />
-  <source src="filename.mp4" type="video/mp4" /+
-  <source src="filename.webm" type="video/webm" />+
 </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)).+**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.
  
-====Embedding videos using Flash====+  * 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%%'' 
  
-While video embedding using Flash has been the means of choice until just a few years ago, this solution now faces two major challenges: first, it does not work on iPhone/iPad, and second, the browser’s flash plug-in is frequently deactivated due to security concerns.  
  
-To convert your video into a flash video filea helpful tool is the [[http://www.dvdvideosoft.com/products/dvd/Free-Video-to-Flash-Converter.htm|Free Video to Flash Converter]]. +==== Google DriveDropbox and others ====
-When installing this tool, the suggested toolbars can be deactivated/not installed, and the same applies to the included add-on software (e.g. TuneUp Utilities). The programme helps the user turn videos into Flash videos and to play them via the Internet: +
  
-  - Start the application +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
-  //Add files// +
-    Select the desired file (the programme supports many common file formats) +
-    //Open// +
-  //Format// +
-    - "FLV" +
-    - The pre-set “high quality” with 1 MBit/sec is a good starting point -- yet, the image size and/or bit-rate may need adjusting. +
-  - Many more options can be selected under Player, such as which buttons to show, etc. +
-  - The box next to //Show HTML sample file// should be checked. +
-  - //Convert// – this will take a while+
  
-The converter will save the Flash video (FLV) and the actual player to play the video (SWF file) in the target directory. In some cases a control file (XML) is included as well. The two or three output files should be uploaded to the survey project – an eventual HTML or CSS file in the target directory does not need to be uploaded. The video file size (FLV) may not exceed 64 MB on the www.soscisurvey.de server. +If you store videos on Google Drive or Dropbox and share them from therethese services integrate their own video playersSo you don't get the video itselfbut only website that plays the video. Such an external website can be integrated into the questionnaire (as with YouTubeusing ''<iframe>''.
- +
-**Important:** In newer versions of the Free Video to Flash Converter, output may differ significantly from the results described in this manual. In this casesome adjustments need to be done (see the (German) support forum: [[http://forum.onlineforschung.org/viewtopic.php?p=25362#p25362|Support forum: Embedding flash video]]). +
- +
-After converting the video, a browser window with the necessary HTML code will open (if this window is closed by the user, it can be re-opened from the HTML file saved to the target directory by the programme). The relevant code is under //Copy the code from the box below to your web page//, and the ''<noscript>'' line can be adjusted as necessary -– it is displayed when JavaScript is deactivated and the video can’t be shown (see example below). +
- +
-This HTML code is best saved as a text element (**Text Elements and Labels**). For the text element's //Formatting//, select "HTML code". Finally, drag the text element into the questionnaire (**Compose Questionnaire**).+
  
 <code html> <code html>
-<object id="Object2" type="application/x-shockwave-flash" data="player_flv_classic.swf" width="480" height="360"+<iframe width="420" height="315src="https://drive.google.com/uc?export=preview&id=1Mu_zc...etcframeborder="0allowfullscreen allow="autoplay" style="display: block; border: 0 auto;"></iframe>
-  <noscript>You browser does not support Flash and/or JavaScript.</noscript> +
-  <param name="movie" value="player_flv_classic.swf" /+
-  <param name="wmode" value="opaque" /+
-  <param name="allowScriptAccess" value="sameDomain" /+
-  <param name="quality" value="high" /> +
-  <param name="menuvalue="true" /> +
-  <param name="autoplay" value="false/> +
-  <param name="autoload" value="false" /> +
-  <param name="FlashVars" value="configxml=FlickAnimation.xml" /> +
-</object>+
 </code> </code>
  
-**Tip:** This Flash application, playing the FLV filessupports lot of parameters[[http://www.dvdvideosoft.com/guides/new-multi-flash-player-settings.htm|DVD Video Soft: Multi Flash Player Settings]]+**Warning:** Whenever the data is loaded from a third-party serverthe respondent's IP address is transmitted to this server. Check with your organisation's data protection officer whether this is 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.gper 24 hours). Please ask the respective provider and/or the search engine you trust whether and what limits the selected cloud storage service uses.
  
  
Line 200: Line 137:
 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. 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. +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.
- +
-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). **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).
en/create/media.1461672652.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