- Include CDN Hosted version of MeMo Embed in your page including CSS and Javascript resources
- jQuery 1.9.1+: https://code.jquery.com/jquery-1.9.1.min.js
- MeMo Embed code: https://cdn.crowdemotion.co.uk/playcorder/v3/vrtk-v3.all.js
- MeMo Embed CSS: https://cdn.crowdemotion.co.uk/playcorder/v3/vrtk-v3.min.css
- See the code: https://github.com/CrowdEmotion/respondent-video-capture-kit/blob/master/examples/demo1.html#L6-L9
- Add the following markup elements to your HTML structure:
- minimal markup https://github.com/CrowdEmotion/respondent-video-capture-kit/blob/master/examples/demo1.html#L549
- option markup with example buttons https://github.com/CrowdEmotion/respondent-video-capture-kit/blob/master/examples/demo1.html#L540-L550
- Use the following Javascript code to configure and activate the MeMo Embed:
- Be sure to substitute appToken and projectKey with the ones you collected in the previous steps
- Check carefully how event handlers are attached to the MeMo Embed and to the DOM elements because that is where most of your customization takes place to change the user workflow
- During tests it is very important to leave apiSandbox parameter to true in order to avoid wasting paid viewers during development
- The proposed Javascript code should be executed when the markup elements are already in place (in the DOM of the page)
- See the code: https://github.com/CrowdEmotion/respondent-video-capture-kit/blob/master/examples/demo1.html#L56-L280
- If you are going to use MeMo Embed default configuration for video recording and not your servers, write to to us at [email protected] about which domains you wish whitelisted else MeMo Embed will not work.
- MeMo Embed runs only on pages that implement a secure transport (HTTPS protocol) - this is a requirement of browsers/web standards, not of MeMo Embed.
Include the following code in the tag head of your page:
<SCRIPT>
$(document).ready(function(){
//Create Playcorder instance
var vrt = new Vrt(<<OPTIONS>>);
//Implement event listeners
$(vrt).on('vrt_event_XXXXXX',function(){ // code here});
$(vrt).on('vrt_event_YYYYYY',function(){ // code here});
//Complete initilization
vrt.init();
});
</SCRIPT>
the <<OPTIONS>>
object attributes are the same of previous paragraph, just add these values:
researchToken
: astring
value that load the media listappToken
: an authstring
valuestreamName
: astring
value to prepend before each stringapiSandbox
: aboolean
value, set to false for facevideo analysis
vrt_event_preview_loaded
: all objects are loadedvrt_event_producer_camera_ok
: the user camera is okvrt_event_api_login_fail
: login to api is failedvrt_event_producer_camera_muted
: webcam is waiting for user permissionvrt_event_producer_camera_blocked
: user block webcamvrt_event_start_video_session
: the first video stimuli is played and producer is recordingvrt_event_video_step_completed
: one video stimuli is ended and facevideos is uplodead, aresponseId
is receivedvrt_event_user_next_video
: user is ready for next videovrt_event_skip_or_end_video
: video stimuli reach the end or skipped by uservrt_event_video_session_complete
: all video stimuli are playedvrt_event_user_session_complete
: user finish his sessionvrt_event_flash_old
: the Flash version included is too old (Flash 11.1.0 is required)vrt_event_flash_no
: there is no Flash includedvrt_event_producer_no_camera_found
: no camera foundvrt_event_frame_open
: use this event to open a frame OR user theopenFrame()
methodvrt_event_frame_close
: triggere by thecloseFrame()
methodvrt_event_create_response
: if the optionresponseAtStart
istrue
, this event will send you the response id before the video playvrt_event_browser_old
: this error is trigger when the browser is IE 9 or older
Example:
$(window.vrt).on('vrt_event_producer_camera_blocked', function () {
alert('The webcam is blocked');
});
recorderHide()
: hide the recorderrecorderShow()
: show the recorderopenFrame
(src
,options
) : open a frame with thesrc
parameter, useoptions.width
andoptions.height
to set the frame dimension. include a close button withoptions.showBtnClose
set totrue
. Customize button withoptions.cssClass
,options.btnStyle
andoptions.btnText
. set the position of the button withoptions.btnPosition
set totop
orbottom
.closeFrame()
: close the frame opened with theopenFrame
method
(document).ready(function(){
//create PlayCorder object
var vrt = new Vrt({
researchToken: ‘XXXXXX’,
appToken: ‘YYYYYY’,
streamName: ‘ce-demo1_’,
apiSandbox: true,
debug: true,
respondentCustomData: {user_video_behavior: vb},
playerCentered: false,
recorderCentered: false,
playerHorizontallyCentered: true,
recorderHorizontallyCentered: true,
fullscreen: false,
randomOrder: false,
savePlatform: true,
recordingAudio: false //temporary fix
});
//Implement event and method related to PlayCorder
$(vrt).on("vrt_event_producer_camera_ok",function() { alert("Your webcam is ok") });
//...insert code here
//PlayCorder start
vrt.init();
});
PlayCorder has 2 type of custom data:
- custom data for every
response
, saved before or after every video - custom data for every
respondent
, saved once during the session (respondent
is a group of responses tied to one user, one project and its related media)
Custom data could be added in two ways:
- using the method apiClientSaveCustomData()
- setting the option customData inside vrt object
apiClientSaveCustomData()
can be used every time a face video is uploaded through the API:
window.vrt.apiClientSaveCustomData( api_response_id , data_object, callback_function)
api_response_id
is an integer value provided by CrowdEmotion API after a video uploaddata_object
is a js script object with custom values, like{user_id:333;user_name:"john"}
callback_function
is the function called at end of apiClientSaveCustomData()
To implement respondent
custom data just add the options respondentName
, respondentCustomDataString
, respondentCustomData
to PlayCorder initialization.
Every research could integrate and outgoing url. To use this option
- Go to Maker
- Insert a valid URL inside the “outgoing url” option in your research
- Add to your javascript code this snippet
$(window.vrt).on(‘vrt_event_preview_loaded’, function () {
var url = vrt.researchOutUrl;
var urlOriginal = vrt.researchOutUrlOriginal;
//insert you code here for redirect
});
Also, it's possible for an outgoing url to change dynamically according to url parameters of your PlayCorder page. This could be useful if you integrate an external page as surveys.
How to: If your entry page include any query parameters, and your outgoing url include the same query parameters inside curly brackets, The values between curly brackets will be changed with query values from entry url.
Example:
Entry page: http://yousite.com/index.html?**id=100**&**value=AAA** Outgoing Url: http://newsite.com/index.htm?user={**id**}&number={**value**}
The values for outgoing Url will be:
- vrt.researchOutUrl: http://newsite.com/index.htm?**user=100&number=AAA**
- vrt.researchOutUrlOriginal: http://newsite.com/index.htm?user={id}&number={value} - no changes