Static Element: Video Template
This article will show you how to embed a video in your survey.
See the following articles if you have not already:
Add a Video
Follow the steps below to add a video:
- Program a Static Element
- See article:
- Standard Question: Static Elements
- Go to the 'Default Text' Card
- Click on 'Survey Settings' on the left
- Click on 'Default Text'
- Click on the edit icon tied to the 'Survey Header'
- Access the 'Source Code Editor'
- See article: Source Code Editor
- Add the following code
<script src="https://cdn2.cmix.com/surveyContent/thirdparty/jwplayer7_4_3/jwplayer.js"></script>
- Click on the source icon (</>) to close the code view
- Once you are out of the code view, click 'SAVE'
- You can now close the 'Default Text' Card
- Open your Static Element
- Click on 'ADD JAVASCRIPT' and add the following code below updating the options as needed. Areas to be updated have notes between the /* */
- Set your Next Page default
- Update your Video URL in the playlist. This is defaulted to show only one but you can add more videos to the playlist by making a comma delimited list of files.
- Example: One video:
{ file: "https://videocheck.mp4"} - Example: More than one video:
{ file: "https://videocheck1.mp4"},
{ file: "https://videocheck2.mp4"}
- Example: One video:
- Modify the height, if needed
- Modify the width, if needed
- Do you want to auto start the video when the page loads
- NOTE: If you are allowing mobile devices to take the survey you cannot use autostart
- Do you want to show the controls (play, pause, stop buttons)
- Do you want to mute the volume
- Set your Next Page settings after the playlist is done. Default is to disable the Next Page button until the video is done playing.
jwplayer.key="1b0vOLEKH9o78NHDYrVu8zqwA3ydA9hiZBqy85asUdQ="; /*NEXT PAGE - DEFAULT*/ /*a*/ cmSurvey.disableNextButton(true); /* Use 'true'to disable OR 'false' to enable */ /*PLAYLIST SETTINGS*/ jwplayer("cmix-video").setup({ /*b*/ /*if you have more than one video use this pattern: [{ file: "https://video1.mp4"}, { file: "https://video1.mp4"}, { file: "https://video1.mp4"}],*/ playlist: [ { file: "https://cdn2.cmix.com/surveyContent/client_13335/uploads/videocheck.mp4"} ], /*c*/ height: 300, /*d*/ width: 480, /*e*/ autostart: false, /* use 'true' or 'false' */ /*f*/ controls: true, /* use 'true' or 'false' */ /*g*/ mute: false /* use 'true' or 'false' */ }); /*NEXT PAGE - WHEN PLAYLIST IS DONE*/ jwplayer("cmix-video").onPlaylistComplete(function(){ /*h*/ cmSurvey.disableNextButton(false); /* NEXT PAGE when playlist is done. Use 'true' to enable OR 'false' to disable*/ }); /*ALLOWS PLAY BUTTON ON MOBILE AND HIDES CONTROL BAR*/ jwplayer("cmix-video").onPlay(function(){ jQuery(".jw-controlbar").css("visibility" , "hidden"); });
- Click on 'SAVE' when you are done
- Click on the 'ADD CSS'
- button and add the following code.
#cmix-video { margin: 0 auto; } /* UPDATED INFO FOR VIDEO WIDTH */ video.jw-video { transform: none !important; width: 100% !important; height: 100% !important; top: 0% !important; left: 0% !important; }
- Click on 'SAVE' when you are done
- button and add the following code.
- Click on the HTML Editor icon of your Static Element. This is normally where the text goes.
- Click on the source (</>)
- Add the following code into the source (</>)
<div id="cmix-video">video will show here</div>
- Click on the source (</>) to close the code view
- Click on 'SAVE' when you are done
- Close the Static Element Card
- Click on 'ADD JAVASCRIPT' and add the following code below updating the options as needed. Areas to be updated have notes between the /* */
- You are all done. Make sure to test to confirm everything is working as intended