Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .adxstudio/workspace.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tabs":[{"id":"38de036d-07f0-462b-be8f-63dc5c14ae61","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\open.html","type":"file"},{"id":"3c6b6cc6-b5cb-407e-8788-f42094e28da4","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\static\\adc_microphone.js","type":"file"},{"id":"8ff54ff3-2c8f-47ea-9f07-17bd7bcc8e34","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\default.css","type":"file"},{"id":"08794c7f-866e-46aa-9171-21b10a3e3d9a","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\fallback_mobile_open.html","type":"file"},{"id":"a426712c-6257-4fff-9f5a-7e4e243a28f9","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\fallback_open.html","type":"file"},{"id":"a1fd4492-942a-497e-903c-0e043331ef9b","pane":"main","path":"C:\\Users\\Quentin\\Documents\\GitHub\\MyADCs\\Microphone\\config.xml","type":"projectSettings","mode":"form","adxVersion":"2.0.0","adxType":"adc"}]}
{"tabs":[{"id":"f075c78e-4988-496a-ae35-ca41cf102dc3","pane":"main","current":true,"path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\open.html","type":"file"},{"id":"09b0e1f8-ba00-440b-ade1-b65bb5e99fad","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\static\\adc_microphone.js","type":"file"},{"id":"8554908c-c63f-4ed4-a6b7-a084fe998987","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\default.css","type":"file"},{"id":"69f00b3d-6329-45b7-b0a3-d19cb827a7e8","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\fallback_mobile_open.html","type":"file"},{"id":"21fa85ae-28eb-4a50-b098-54cec0da577a","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Microphone\\resources\\dynamic\\fallback_open.html","type":"file"},{"id":"f1d8a70b-814a-41c6-b8e0-9df0f4b03601","pane":"main","path":"C:\\Users\\Quentin\\Documents\\GitHub\\MyADCs\\Microphone\\config.xml","type":"projectSettings","mode":"form"},{"id":"ea4b64b6-317e-4aa4-9f7c-48d14d49515c","pane":"main","path":"C:\\Users\\JordanGrindle\\Documents\\GitHub\\Microphone\\resources\\static\\RecordRTC.js","type":"file"},{"id":"e588e8f7-564f-468a-976e-93b1bddcf540","pane":"main","path":"C:\\Users\\JordanGrindle\\Documents\\GitHub\\Microphone\\config.xml","type":"projectSettings","mode":"code","adxVersion":"2.0.0","adxType":"adc"}]}
Binary file modified bin/Microphone.adc
Binary file not shown.
15 changes: 11 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
Version 1.0.0

- Feature 1
- Feature 2
Audio capture via the microphone
v1.0.1 - change the `stopRecordingAudio` func code to get the promise instead of a blob
v1.0.2 -
v1.0.3 -
v1.0.4 - Fixed, dof runtime errors
v2.0.0 - Fixed issues of the control not running correctly on mobile devices. MIME types not supported.
v2.0.1 - changed button behavior to not be a hidden label. updated RecordRTC library to v5.6.3
v2.0.2 - changed .catch() error message to a more robust feedback instead of "cannot record"
v2.0.3 - updated WebRTC lib
v2.0.4 - updated missing libraries in config.xml for mobile browser fallback
v2.0.5 - changed to button type instead of input type, changed to addeventhandler instead of onclick listeners
19 changes: 9 additions & 10 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
<info>
<name>Microphone</name>
<guid>d7c94a7c-10f9-4d31-8e51-82dc9c96c089</guid>
<version>1.0.4</version>
<date>2022-10-04</date>
<description><![CDATA[Audio capture via the microphone
v1.0.1 - change the `stopRecordingAudio` func code to get the promise instead of a blob
v1.0.2 -
v1.0.3 -
v1.0.4 - Fixed, dof runtime errors]]></description>
<version>2.0.5</version>
<date>2026-04-20</date>
<description><![CDATA[Audio capture via the microphone]]></description>
<company>Askia</company>
<author><![CDATA[Quentin Legrand <quentin@askia.com>]]></author>
<author><![CDATA[Jordan Grindle <jordan@askia.com>]]></author>
<site>http://www.askia.com</site>
<helpURL></helpURL>
<categories>
Expand Down Expand Up @@ -60,6 +56,9 @@
<content fileName="overlay.css" type="css" mode="static" position="head" />
<content fileName="open.html" type="html" mode="dynamic" position="none" />
<content fileName="default.html" type="html" mode="dynamic" position="placeholder" />
<content fileName="adc_microphone.js" type="javascript" mode="static" position="head" />
<content fileName="RecordRTC.js" type="javascript" mode="static" position="head" />
<content fileName="adapter-latest.js" type="javascript" mode="static" position="head" />
</output>
</outputs>
<properties>
Expand Down Expand Up @@ -140,7 +139,7 @@
</property>
<property xsi:type="standardProperty" id="start_recording_error" name="Start recording error" type="string" require="false" visible="true">
<description><![CDATA[]]></description>
<value><![CDATA[Cannot start video recording.]]></value>
<value><![CDATA[Cannot start recording.]]></value>
</property>
<property xsi:type="standardProperty" id="user_media_access_error" name="User media access" type="string" require="false" visible="true">
<description><![CDATA[]]></description>
Expand Down Expand Up @@ -203,4 +202,4 @@
</property>
</category>
</properties>
</control>
</control>
Binary file modified example/Microphone.qex
Binary file not shown.
134 changes: 115 additions & 19 deletions resources/dynamic/open.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

Dim enabledNextAfterUpload = (CurrentADC.PropValue("nextAfterUpload") = "1")
%}

<script>
var uploadConfig_{%=CurrentADC.InstanceID%} = {
authenticationUrl : '{%=CurrentADC.PropValue("AusUrl")%}' + "/Authenticate",
Expand Down Expand Up @@ -45,41 +46,136 @@
EnabledNextAfterUpload : '{%=CurrentADC.PropValue("nextAfterUpload")%}',
AutoSubmitAfterUpload : '{%=CurrentADC.PropValue("autoSubmitUpload")%}'
};

var audioRecorder;
</script>

{%if enabledNextAfterUpload then%}
<script>
window.addEventListener('load', function () {
document.getElementsByName("Next")[0].hidden = true;
window.addEventListener("load", function () {
var nextButton = document.getElementsByName("Next")[0];

if (nextButton) {
nextButton.hidden = true;
}
}, false);
</script>
{%EndIf%}

<!-- <script src="https://www.webrtc-experiment.com/RecordRTC.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script> -->
<!--
<script src="https://www.webrtc-experiment.com/RecordRTC.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
-->

<div id="adc-errdiv_{%=CurrentADC.InstanceId%}">
<ul id="ulErrorMessages_{%=CurrentADC.InstanceID%}">
</ul>
<ul id="ulErrorMessages_{%=CurrentADC.InstanceID%}"></ul>
</div>

<div id="adc-succdiv_{%=CurrentADC.InstanceId%}">
<span id="spanSuccessMessage_{%=CurrentADC.InstanceID%}"></span>
</div>

<div class="audio_{%=CurrentADC.InstanceId%}">
<label for="btn-start-recording" id="label-start" class="btn primary">
<input type="button" id="btn-start-recording" onclick="startRecordingAudio({%=CurrentADC.InstanceId%});" hidden/>
{%=CurrentADC.PropValue("startBtnText")%}
</label>
<label for="btn-stop-recording" id="label-stop" class="btn">
<input type="button" id="btn-stop-recording" onclick="stopRecordingAudio({%=CurrentADC.InstanceId%});" disabled="disabled" hidden/>
{%=CurrentADC.PropValue("stopBtnText")%}
</label>
<br/>
<audio id="player" {% if showControls Then %}controls{% Endif %} {%if notIOS then%} {% if autoplay Then %}autoplay{% Endif %} {% if loop Then %}loop{% Endif %}{%EndIf%} controlsList="nodownload"></audio>
<button
type="button"
id="btn-start-recording_{%=CurrentADC.InstanceId%}"
class="btn primary">
{%=CurrentADC.PropValue("startBtnText")%}
</button>

<button
type="button"
id="btn-stop-recording_{%=CurrentADC.InstanceId%}"
class="btn"
disabled="disabled">
{%=CurrentADC.PropValue("stopBtnText")%}
</button>

<br/>

<audio
id="player_{%=CurrentADC.InstanceId%}"
{% if showControls Then %}controls{% Endif %}
{%if notIOS then%}
{% if autoplay Then %}autoplay{% Endif %}
{% if loop Then %}loop{% Endif %}
{%EndIf%}
controlsList="nodownload"></audio>
</div>

{%if allowSaveFile then%}
<input type="button" id="btnSave_{%=CurrentADC.InstanceId%}" class="btn" value="{%=CurrentADC.PropValue("btnSaveFileText")%}" onclick="saveAudio({%=CurrentADC.InstanceId%})"/>
<button
type="button"
id="btnSave_{%=CurrentADC.InstanceId%}"
class="btn">
{%=CurrentADC.PropValue("btnSaveFileText")%}
</button>
{%EndIf%}
<input type="button" id="btnUpload_{%=CurrentADC.InstanceID%}" class="btn" value="{%=CurrentADC.PropValue("UploadButtonText")%}" onclick="uploadAudio({%=CurrentADC.InstanceID%});" />
<input type="hidden" id="HidResult_{%=CurrentADC.InstanceID%}" name="{%= inputName %}" value="" {%:= attrMax %} {%:= attrRequired %}/>

<button
type="button"
id="btnUpload_{%=CurrentADC.InstanceID%}"
class="btn">
{%=CurrentADC.PropValue("UploadButtonText")%}
</button>

<input
type="hidden"
id="HidResult_{%=CurrentADC.InstanceID%}"
name="{%= inputName %}"
value=""
{%:= attrMax %}
{%:= attrRequired %}/>

<div id="overlay_loader_{%=CurrentADC.InstanceID%}" class="loading hidden">Loading&#8230;</div>

<script>
(function () {
var instanceId = "{%=CurrentADC.InstanceID%}";

function bindAudioControlEvents() {
var btnStart = document.getElementById("btn-start-recording_" + instanceId);
var btnStop = document.getElementById("btn-stop-recording_" + instanceId);
var btnSave = document.getElementById("btnSave_" + instanceId);
var btnUpload = document.getElementById("btnUpload_" + instanceId);

if (btnStart && !btnStart.dataset.audioEventBound) {
btnStart.addEventListener("click", function () {
startRecordingAudio(instanceId);
});

btnStart.dataset.audioEventBound = "true";
}

if (btnStop && !btnStop.dataset.audioEventBound) {
btnStop.addEventListener("click", function () {
stopRecordingAudio(instanceId);
});

btnStop.dataset.audioEventBound = "true";
}

if (btnSave && !btnSave.dataset.audioEventBound) {
btnSave.addEventListener("click", function () {
saveAudio(instanceId);
});

btnSave.dataset.audioEventBound = "true";
}

if (btnUpload && !btnUpload.dataset.audioEventBound) {
btnUpload.addEventListener("click", function () {
uploadAudio(instanceId);
});

btnUpload.dataset.audioEventBound = "true";
}
}

if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", bindAudioControlEvents);
} else {
bindAudioControlEvents();
}
})();
</script>
Loading
Loading