CAWI - How to Play Videos/Audios in Questions

Overview

This guide will describe how to play videos and audio files in questions running on CAWI

Steps

Video

To display videos in CAWI the video will need to be hosted outside STG, for example YouTube. 

Once the video is hosted outside the STG follow these steps:

  1. In the start script of the question you want to display the video in add this code -  SetTextFormat(CurrQues, "<iframe width=100% height='300' src='https://www.youtube.com/embed/2wuDMt4Zr2g?autoplay=1' frameborder='0' allow='autoplay; encrypted-media'></iframe>");
  2. In the src='' - paste the link where the video is located  
  3. In the Question text add the piping place holder {0}
  4. When running in the web the video will be displayed in the question

Audio

  1. Attach the audio file to your survey 
  2. in the start script of the question you would like to play the audio file add the below code: SetTextFormat(CurrQues, "<audio controls autoplay><source src='\dblstgatc://" + GetAttachmentID("SONG_1.mp3")+ "\' type='audio/mpeg'></audio>");

    Please Note: The auto-play attribute will make the audio start playing without the user pressing the play button BUT recently chrome changed it's auto-play policy as you can see in this link: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
    So, If the tag is placed in the first question in the survey the song does not auto play since chrome now lets you auto play only if the user interacted with the domain (click, tap, etc.) so you should notice that

That's It !

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.