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":"2cec0e67-0b8f-425c-b0eb-b099d07acf7a","pane":"main","current":true,"path":"C:\\Users\\Quentin\\Documents\\camera_adc\\config.xml","type":"projectSettings","mode":"form"},{"id":"2de4cf48-434e-4f38-9c33-b980bdf9ae44","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\open.html","type":"file"},{"id":"fc889f10-19af-4cca-91e7-e5e9779ff811","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\static\\adc_camera.js","type":"file"},{"id":"bd8fe99e-e996-4240-9fdb-8ce80db2e80c","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\default.css","type":"file"},{"id":"a1efba25-fcc9-4c66-9c29-20846d24d6b1","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\fallback_mobiles_open.html","type":"file"},{"id":"c5657dce-d817-45a9-9127-43cdb8c3a144","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\static\\adc_camera_mobiles.js","type":"file"},{"id":"bfafd1f8-3c81-4b4b-bcbc-2ab1b53ee6cc","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\fallback_open.html","type":"file"},{"id":"b44a24b3-877b-44fe-9f0a-9e5fe2c1078b","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\readme.md","type":"file"},{"id":"7d784d4f-60ed-4d60-ba28-4852c27acb4e","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\static\\adc_camera_mobiles.js","type":"file"},{"id":"6ada7478-961e-4ce5-8c41-168b343e2e71","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\static\\adc_camera.js","type":"file"},{"id":"8a2c5a0f-2da2-4ae0-a5ea-7861d627d220","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\dynamic\\open.html","type":"file"},{"id":"2adb3c8c-0f19-4157-be72-7399cf6f3505","pane":"main","path":"C:\\Users\\Quentin\\Documents\\GitHub\\MyADCs\\Camera\\config.xml","type":"projectSettings","mode":"form","adxVersion":"2.0.0","adxType":"adc"}]}
{"tabs":[{"id":"0a91f9a4-ecba-4b24-a030-bd894ab800ef","pane":"main","current":true,"path":"C:\\Users\\Quentin\\Documents\\camera_adc\\config.xml","type":"projectSettings","mode":"form"},{"id":"d51b30dc-05ae-428e-a441-da1bacc7b447","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\open.html","type":"file"},{"id":"e7cc8a9a-09f2-4e3f-875c-19d6cf1d076f","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\static\\adc_camera.js","type":"file"},{"id":"b7cfe526-9936-4062-a526-9cfdb6d4fd31","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\default.css","type":"file"},{"id":"1028798b-1e9f-4a5a-827a-02f29bf0dcf9","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\fallback_mobiles_open.html","type":"file"},{"id":"1c67e3d3-c4f3-4454-bf5c-aa43f6e300e5","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\static\\adc_camera_mobiles.js","type":"file"},{"id":"ecdb6429-8330-4770-aaa8-aac6a2edf996","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\resources\\dynamic\\fallback_open.html","type":"file"},{"id":"59181ece-2c88-456a-a684-a6fdd0c429bb","pane":"main","path":"C:\\Users\\Quentin\\Documents\\camera_adc\\readme.md","type":"file"},{"id":"e58c731f-a216-46ad-9b4d-fb8e2d982294","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\static\\adc_camera_mobiles.js","type":"file"},{"id":"b20b5873-15ba-40c3-94f6-ca6adad1b3f0","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\static\\adc_camera.js","type":"file"},{"id":"5881a8d2-453f-4a09-b6c7-1580b51b5c1a","pane":"main","path":"C:\\Users\\Quentin\\Documents\\ADC_Camera\\resources\\dynamic\\open.html","type":"file"},{"id":"e17bc251-9b5a-4cfb-be56-3576e58ea01e","pane":"main","path":"C:\\Users\\Quentin\\Documents\\GitHub\\MyADCs\\Camera\\config.xml","type":"projectSettings","mode":"form"},{"id":"c89f74ed-7c49-435e-8e68-57ff07caf5b4","pane":"main","path":"C:\\Users\\JordanGrindle\\Documents\\GitHub\\Camera\\config.xml","type":"projectSettings","mode":"code","adxVersion":"2.0.0","adxType":"adc"}]}
Binary file modified bin/Camera.adc
Binary file not shown.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

v1.0.1 - change the `stopRecordingVideo` func code to get the promise instead of a blob
v1.0.2 - image capture issue when uploading - fixed
v1.0.3 -
v1.0.4 - photo button caption disappears when mobile - fixed
v1.1.0 - WebRTC,RecordRTC library update
- Fixed - DOF runtime errors
v2.0.0 - RecordRTC & WebRTC library update
v2.0.1 - fixed/modernized buttons with button instead of input, removed onclick listeners with addeventhandler
v2.0.2 - fixed issue where desktop recording wouldn't function properly
10 changes: 2 additions & 8 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
<info>
<name>Camera</name>
<guid>d7c94a7c-10f9-4d31-8e51-82dc9c96c089</guid>
<version>1.1.0</version>
<version>2.0.2</version>
<date>2022-09-29</date>
<description><![CDATA[Video or image capture via the webcam,
v1.0.1 - change the `stopRecordingVideo` func code to get the promise instead of a blob
v1.0.2 - image capture issue when uploading - fixed
v1.0.3 -
v1.0.4 - photo button caption disappears when mobile - fixed
v1.1.0 - WebRTC,RecordRTC library update
- Fixed - DOF runtime errors]]></description>
<description><![CDATA[]]></description>
<company>Askia</company>
<author><![CDATA[Quentin Legrand <[email protected]>]]></author>
<site>http://www.askia.com</site>
Expand Down
Binary file modified example/Camera.qex
Binary file not shown.
181 changes: 128 additions & 53 deletions resources/dynamic/open.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
Dim loop = (CurrentADC.PropValue("loop") = "1")

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

%}

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

{%if enabledNextAfterUpload then%}
<script>
// Hide the button Next
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%}

{%if typeOfCapture = "image" Then%}
<script>
// Displays the webcam stream on screen
window.addEventListener("load", function () {
var video = document.getElementById('preview')
navigator.mediaDevices.getUserMedia({video: true}).then(function(stream) {
setSrcObject(stream, video);
}).catch(function(error) {
displayErrorMessage(uploadConfig({%=CurrentADC.InstanceId%}).ErrMsgUserMediaAccess, {%=CurrentADC.InstanceId%});
console.error("Cannot access media devices: ", error);
});
}, false);
window.addEventListener("load", function () {
startImagePreview({%=CurrentADC.InstanceId%});
}, false);
</script>
{%EndIf%}

{% if typeOfCapture = "video" then %}
<script>
window.addEventListener("load", function () {
if (navigator.userAgent.split("Edge").length > 1) { // Edge
displayErrorMessage(uploadConfig({%=CurrentADC.InstanceId%}).ErrMsgUserMediaAccess, {%=CurrentADC.InstanceId%});
document.getElementsByClassName("video_{%=CurrentADC.InstanceId%}")[0].style.display = "none";
document.getElementById("btnUpload_{%=CurrentADC.InstanceID%}").style.display = "none";
document.getElementById("btnSave_{%=CurrentADC.InstanceID%}").style.display = "none";
}
}, false);
window.addEventListener("load", function () {
if (navigator.userAgent.split("Edge").length > 1) {
displayErrorMessage(uploadConfig({%=CurrentADC.InstanceId%}).ErrMsgUserMediaAccess, {%=CurrentADC.InstanceId%});

var videoContainer = document.getElementsByClassName("video_{%=CurrentADC.InstanceId%}")[0];
var uploadButton = document.getElementById("btnUpload_{%=CurrentADC.InstanceID%}");
var saveButton = document.getElementById("btnSave_{%=CurrentADC.InstanceID%}");

if (videoContainer) {
videoContainer.style.display = "none";
}

if (uploadButton) {
uploadButton.style.display = "none";
}

if (saveButton) {
saveButton.style.display = "none";
}
}
}, false);
</script>
{%EndIf%}

<!-- <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>

{% if typeOfCapture = "video" Then %}

<div class="video_{%=CurrentADC.InstanceId%}">
<label for="btn-start-recording" class="label-start btn primary">
<input type="button" id="btn-start-recording" onclick="startRecordingVideo({%=CurrentADC.InstanceId%});" hidden/>
{%=CurrentADC.PropValue("startBtnText")%}
</label>
<label for="btn-stop-recording" class="label-stop btn">
<input type="button" id="btn-stop-recording" onclick="stopRecordingVideo({%=CurrentADC.InstanceId%});" disabled="disabled" hidden/>
{%=CurrentADC.PropValue("stopBtnText")%}
</label>
<br/>
<video id="player" {% if showControls Then %}controls{% Endif %} {% if autoplay Then %}autoplay{% Endif %} {% if loop Then %}loop{% Endif %}></video>
<button
type="button"
id="btn-start-recording_{%=CurrentADC.InstanceId%}"
class="btn primary"
onclick="startRecordingVideo({%=CurrentADC.InstanceId%});">
{%=CurrentADC.PropValue("startBtnText")%}
</button>

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

<br/>

<video
id="player_{%=CurrentADC.InstanceId%}"
{% if showControls Then %}controls{% Endif %}
{% if autoplay Then %}autoplay{% Endif %}
{% if loop Then %}loop{% Endif %}></video>
</div>

<br />

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

<button
type="button"
id="btnUpload_{%=CurrentADC.InstanceID%}"
class="btn"
onclick="uploadVideo({%=CurrentADC.InstanceID%});">
{%=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>

{% Endif %}

{% if typeOfCapture = "image" Then %}

<div class="video_{%=CurrentADC.InstanceId%}">
<label for="btn-capture-image" class="btn primary">
<input type="button" id="btn-capture-image" class="btn primary" onclick="captureImage({%=CurrentADC.InstanceId%});" hidden/>
{%=CurrentADC.PropValue("captureBtnText")%}
</label>
<br/>
<video id="preview" autoplay></video>
<img id="capturedImage" src="" hidden/>
<canvas id="canvas" hidden></canvas>
<button
type="button"
id="btn-capture-image_{%=CurrentADC.InstanceId%}"
class="btn primary"
onclick="captureImage({%=CurrentADC.InstanceId%});">
{%=CurrentADC.PropValue("captureBtnText")%}
</button>

<br/>

<video id="preview_{%=CurrentADC.InstanceId%}" autoplay></video>
<img id="capturedImage_{%=CurrentADC.InstanceId%}" src="" hidden/>
<canvas id="canvas_{%=CurrentADC.InstanceId%}" hidden></canvas>
</div>

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

<button
type="button"
id="btnUpload_{%=CurrentADC.InstanceID%}"
class="btn"
onclick="uploadImage({%=CurrentADC.InstanceID%});">
{%=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>
{% EndIf %}

{% EndIf %}
Loading
Loading