Question T15516
Visible to All Users

Inquiry on Implementing Play and Pause Functionality for Audio Questions in SurveyJS

created a year ago

Dear SurveyJS Support Team,

I hope this message finds you well. I am currently working on a project that involves using SurveyJS for conducting surveys, and I am seeking guidance on implementing a play and pause functionality for audio questions.

Thank you for your time and assistance. I look forward to your prompt response.

Answers approved by surveyjs Support

created a year ago

Hello,
Thank you for reaching out to us. To embed an audio element within a SurveyJS Form Library, you can consider either option.

HTML Question with the <audio> HTML element

Create an HTML question with the audio HTML element.

JSON
... "type": "html", "name": "question1", "html": "<audio controls><source src=\"https://www.w3schools.com/html/horse.mp3\" type='audio/mp3'></audio>" ...

View Plunker Demo

A Custom Widget / A Custom Component

You can implement a custom audio widget to render HTML with the audio element. An example is available here.

Note that custom widgets are applicable for those who want to integrate jQuery third-party components within a Knockout/jQuery app. If you're developing a React or Angular application, consider implementing a custom component.

Should you have any questions or require further assistance, please feel free to contact us at any time.