javascript + loop&merge + embedded data | XM Community
Skip to main content

I’m using an outside app (Pipe) but my question is about JS and loop and merge and embedded data.

 

I want to save a value from JS (the app Pipe) called either streamName or filename as an embedded data field via JS (embedded data fields are populated as the content of the variable word which is "${lm://Field/1}"

 

Any advice at all appreciated!

 

 

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/



});

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/

var pipeParams = {
size: {
width: 640,
height: 390
},
qualityurl: "avq/360p.xml",
accountHash: "eb9885f030b885d97208a9279362237c",
eid: "kRSOkH",
mrt: 120,
ao:1
};


PipeSDK.insert("etym_self_a",pipeParams,function(recorderObject){
recorderObject.onSaveOk = function(recorderId, streamName, streamDuration, cameraName, micName, audioCodec, videoCodec, fileType, videoId, audioOnly, location){
//onSaveOK is part of the desktop recorder's JS events API (recording from camera or screen)
var args = Array.prototype.slice.call(arguments);
var word = parseInt("${lm://Field/1}");
Qualtrics.SurveyEngine.setEmbeddedData(word, streamName);
console.log("onSaveOk("+args.join(', ')+")");
Qualtrics.SurveyEngine.setEmbeddedData("etym_self_a_video_url", "https://"+location+"/eb9885f030b885d97208a9279362237c/"+streamName+".mp4");
};
recorderObject.onVideoUploadSuccess = function(recorderId, filename,filetype,videoId,audioOnly,location){
//onVideoUploadSuccess is part of the native mobile recorder's JS events API (upload new or existing recording)
var args = Array.prototype.slice.call(arguments);
var word = parseInt("${lm://Field/1}");
Qualtrics.SurveyEngine.setEmbeddedData(word, filename);
console.log("onVideoUploadSuccess("+args.join(', ')+")");
Qualtrics.SurveyEngine.setEmbeddedData("etym_self_a_video_url", "https://"+location+"/eb9885f030b885d97208a9279362237c/"+filename+".mp4");
};
recorderObject.onDesktopVideoUploadSuccess = function(recorderId, filename, filetype, videoId, audioOnly, location){
//onDesktopVideoUploadSuccess is part of the desktop recorder's JS events API (upload existing file from desktop)
var args = Array.prototype.slice.call(arguments);
var word = parseInt("${lm://Field/1}");
Qualtrics.SurveyEngine.setEmbeddedData(word, filename);
console.log("onDesktopVideoUploadSuccess("+args.join(', ')+")");
Qualtrics.SurveyEngine.setEmbeddedData("etym_self_a_video_url", "https://"+location+"/eb9885f030b885d97208a9279362237c/"+filename+".mp4");
};
});

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

 

 

Be the first to reply!

Leave a Reply