diff --git a/src/web-chatview/chatview.html b/src/web-chatview/chatview.html index d592f32cfb6890ab37208e707c21e71eec3a46e3..1701e130792f869870a43d07900b6fdf7a2bbf52 100644 --- a/src/web-chatview/chatview.html +++ b/src/web-chatview/chatview.html @@ -97,6 +97,12 @@ <path d="M0 0h24v24H0z" fill="none" /> </svg> </div> + <div id="audioRecordButton" class="action-button nav-button" onclick="audioRecord()"> + <svg class="svgicon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> + <path d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z" /> + <path d="M0 0h24v24H0z" fill="none" /> + </svg> + </div> <div id="videoRecordButton" class="nav-button action-button nav-right" onclick="videoRecord()"> <svg class="svgicon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> <path fill="none" d="M0 0h24v24H0V0z" /> diff --git a/src/web-chatview/chatview.js b/src/web-chatview/chatview.js index e8deb8c7e81c4b769aa0ec4b1126ebe0799e0558..5b696ab2170a56aa5a22995c58abc1e9ef39b7b4 100644 --- a/src/web-chatview/chatview.js +++ b/src/web-chatview/chatview.js @@ -45,6 +45,7 @@ const backToBottomBtn = document.getElementById("back_to_bottom_button") const backToBottomBtnContainer = document.getElementById("back_to_bottom_button_container") const sendFileButton = document.getElementById("sendFileButton") const videoRecordButton = document.getElementById("videoRecordButton") +const audioRecordButton = document.getElementById("audioRecordButton") const aliasField = document.getElementById("nav-contactid-alias") const bestIdField = document.getElementById("nav-contactid-bestId") const idField = document.getElementById("nav-contactid") @@ -359,8 +360,10 @@ function displayNavbar(isVisible) { /* exported displayRecordControls */ function displayRecordControls(isVisible) { if (isVisible) { + audioRecordButton.classList.remove("hiddenState") videoRecordButton.classList.remove("hiddenState") } else { + audioRecordButton.classList.add("hiddenState") videoRecordButton.classList.add("hiddenState") } } @@ -647,13 +650,24 @@ function selectFileToSend() { /* exported sendFile */ function videoRecord() { if (use_qt) { - window.jsbridge.videoRecord() + var rect = videoRecordButton.getBoundingClientRect() + window.jsbridge.openVideoRecorder(rect.left + rect.width / 2, rect.top) } else { var rect = videoRecordButton.getBoundingClientRect() window.prompt(`VIDEO_RECORD:${rect.left + rect.width / 2}x${rect.top}`) } } +function audioRecord() { + if (use_qt) { + var rect = audioRecordButton.getBoundingClientRect() + window.jsbridge.openAudioRecorder(rect.left + rect.width / 2, rect.top) + } else { + var rect = audioRecordButton.getBoundingClientRect() + window.prompt(`AUDIO_RECORD:${rect.left + rect.width / 2}x${rect.top}`) + } +} + /** * Clear all messages. */