Have you developed custom code to only allow audio response only and not video? | Experience Community
Skip to main content
Solved

Have you developed custom code to only allow audio response only and not video?

  • April 2, 2026
  • 5 replies
  • 33 views

Forum|alt.badge.img+6

I would only like my respondents to have the option to record audio responses (and no video) but cannot easily do this. Have you developed custom code to achieve this, and if so, would you please share it with me? Thanks in advance!!

Best answer by swholey

Whelp, I ran into a few errors, but a colleague helped me trouble shoot. This is what worked for us: 

Qualtrics.SurveyEngine.addOnReady(function()
{
//Qualtrics.SurveyEngine.addOnload(function () {
var questionId = this.questionId;

function hideVideoButton(scope) {
var btn = (scope || document).querySelector(".record-button.record-video");
if (btn) {
btn.style.display = 'none';
console.log("Hidden .record-button.record-video", btn);
return true;
}
return false;
}

// Classic layout: hide once on load, no observer needed
var btnClassic = document.querySelector("#" + questionId + " .video-recorder-device-button");
if (btnClassic) {
console.log("Layout: Classic — hiding", btnClassic);
btnClassic.style.display = 'none';
return;
}

// New survey taking experience: target div.video-container
var section = document.getElementById("question-" + questionId);
if (!section) {
console.warn("Section not found for:", questionId);
return;
}

// Initial hide on load
hideVideoButton(section);

var videoContainer = section.querySelector(".video-container");
if (!videoContainer) {
console.warn("video-container not found for:", questionId);
return;
}

var observer = new MutationObserver(function (mutations) {
var hasAdditions = mutations.some(function (m) {
return m.addedNodes.length > 0;
});
if (hasAdditions) {
hideVideoButton(section);
}
});

observer.observe(videoContainer, {
childList: true,
subtree: true
});

console.log("Observer active on:", videoContainer);
});

 

5 replies

vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+63
  • QPN Level 7 ●●●●●●●
  • April 3, 2026

Hi,

Qualtrics.SurveyEngine.addOnload(function () {
var questionId = this.questionId;

function hideVideoButton(scope) {
var btn = (scope || document).querySelector(".record-button.record-video");
if (btn) {
btn.style.display = 'none';
console.log("Hidden .record-button.record-video", btn);
return true;
}
return false;
}

// Classic layout: hide once on load, no observer needed
var btnClassic = document.querySelector("#" + questionId + " .video-recorder-device-button");
if (btnClassic) {
console.log("Layout: Classic — hiding", btnClassic);
btnClassic.style.display = 'none';
return;
}

// New survey taking experience: target div.video-container
var section = document.getElementById("question-" + questionId);
if (!section) {
console.warn("Section not found for:", questionId);
return;
}

// Initial hide on load
hideButton(section);

var videoContainer = section.querySelector(".video-container");
if (!videoContainer) {
console.warn("video-container not found for:", questionId);
return;
}

var observer = new MutationObserver(function (mutations) {
var hasAdditions = mutations.some(function (m) {
return m.addedNodes.length > 0;
});
if (hasAdditions) {
hideButton(section);
}
});

observer.observe(videoContainer, {
childList: true,
subtree: true
});

console.log("Observer active on:", videoContainer);
observeVideoContainer();

});

 


Forum|alt.badge.img+6
  • Author
  • Level 1 ●
  • April 3, 2026

Thank you, Vincent!


Forum|alt.badge.img+6
  • Author
  • Level 1 ●
  • Answer
  • April 7, 2026

Whelp, I ran into a few errors, but a colleague helped me trouble shoot. This is what worked for us: 

Qualtrics.SurveyEngine.addOnReady(function()
{
//Qualtrics.SurveyEngine.addOnload(function () {
var questionId = this.questionId;

function hideVideoButton(scope) {
var btn = (scope || document).querySelector(".record-button.record-video");
if (btn) {
btn.style.display = 'none';
console.log("Hidden .record-button.record-video", btn);
return true;
}
return false;
}

// Classic layout: hide once on load, no observer needed
var btnClassic = document.querySelector("#" + questionId + " .video-recorder-device-button");
if (btnClassic) {
console.log("Layout: Classic — hiding", btnClassic);
btnClassic.style.display = 'none';
return;
}

// New survey taking experience: target div.video-container
var section = document.getElementById("question-" + questionId);
if (!section) {
console.warn("Section not found for:", questionId);
return;
}

// Initial hide on load
hideVideoButton(section);

var videoContainer = section.querySelector(".video-container");
if (!videoContainer) {
console.warn("video-container not found for:", questionId);
return;
}

var observer = new MutationObserver(function (mutations) {
var hasAdditions = mutations.some(function (m) {
return m.addedNodes.length > 0;
});
if (hasAdditions) {
hideVideoButton(section);
}
});

observer.observe(videoContainer, {
childList: true,
subtree: true
});

console.log("Observer active on:", videoContainer);
});

 


vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+63
  • QPN Level 7 ●●●●●●●
  • April 7, 2026

Meh, I’m sorry… I somehow managed to post a mix of 2 scripts.


vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+63
  • QPN Level 7 ●●●●●●●
  • April 8, 2026

Here’s my correct version, with the disconnect on page submit.

Qualtrics.SurveyEngine.addOnload(function () {
var q = this;
var questionId = this.questionId;

function hideVideoButton(scope) {
var btn = (scope || document).querySelector(".record-button.record-video");
if (btn) {
btn.style.display = 'none';
console.log("Hidden .record-button.record-video", btn);
return true;
}
return false;
}

// Classic layout: hide once on load, no observer needed
var btnClassic = document.querySelector("#" + questionId + " .video-recorder-device-button");
if (btnClassic) {
console.log("Layout: Classic — hiding", btnClassic);
btnClassic.style.display = 'none';
return;
}

// New survey taking experience: target div.video-container
var section = document.getElementById("question-" + questionId);
if (!section) {
console.warn("Section not found for:", questionId);
return;
}

// Initial hide on load
hideVideoButton(section);

var videoContainer = section.querySelector(".video-container");
if (!videoContainer) {
console.warn("video-container not found for:", questionId);
return;
}

q.observer = new MutationObserver(function (mutations) {
var hasAdditions = mutations.some(function (m) {
return m.addedNodes.length > 0;
});
if (hasAdditions) {
hideVideoButton(section);
}
});

q.observer.observe(videoContainer, {
childList: true,
subtree: true
});

console.log("Observer active on:", videoContainer);
});

Qualtrics.SurveyEngine.addOnPageSubmit(function () {
if (this.observer) {
this.observer.disconnect();
console.log("Observer disconnected on page submit.");
} else {
console.log("No observer to disconnect.");
}
});