Commit f59dcfdd authored by Yang Wang's avatar Yang Wang

chatview: add audio widget button

- audio button is added to text area
- signal will be triggered by this button to record audio in native code

Change-Id: Id73b9a9cdc6b46bceb5a48f07d02810f3aa949a8
parent 86052314
......@@ -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" />
......
......@@ -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.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment