[mirotalksfu] - improve transcription UI, add persistent mode

هذا الالتزام موجود في:
Miroslav Pejic
2023-12-22 14:52:09 +01:00
الأصل c85c7fce69
التزام 9f823ac60a
7 ملفات معدلة مع 99 إضافات و30 حذوفات

عرض الملف

@@ -18,7 +18,8 @@ class LocalStorage {
this.SFU_SETTINGS = {
share_on_join: true, // popup message on join
show_chat_on_msg: true, // show chat on new message
show_transcript_on_msg: true, // show transcript on new message
transcript_persistent_mode: false, // Prevent stop transcript in case of no-speech
transcript_show_on_msg: true, // show transcript on new message
speech_in_msg: false, // speech incoming message
moderator_audio_start_muted: false, // Everyone starts muted in the room
moderator_video_start_hidden: false, // Everyone starts hidden in the room

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.3.45
* @version 1.3.46
*
*/
@@ -240,9 +240,7 @@ function initClient() {
setTippy('transcriptionMinBtn', 'Minimize', 'bottom');
setTippy('transcriptionSpeechStatus', 'Status', 'bottom');
setTippy('transcriptShowOnMsg', 'Show transcript on new message comes', 'bottom');
setTippy('transcriptionGhostBtn', 'Toggle transparent background', 'bottom');
setTippy('transcriptionSaveBtn', 'Save', 'bottom');
setTippy('transcriptionCleanBtn', 'Clean', 'bottom');
setTippy('transcriptPersistentMode', 'Prevent stopping in the absence of speech', 'bottom');
setTippy('transcriptionSpeechStart', 'Start transcription', 'top');
setTippy('transcriptionSpeechStop', 'Stop transcription', 'top');
}
@@ -1873,10 +1871,17 @@ function handleSelects() {
e.target.blur();
};
// transcript
transcriptPersistentMode.onchange = (e) => {
transcription.isPersistentMode = e.currentTarget.checked;
rc.roomMessage('transcriptIsPersistentMode', transcription.isPersistentMode);
lsSettings.transcript_persistent_mode = transcription.isPersistentMode;
lS.setSettings(lsSettings);
e.target.blur();
};
transcriptShowOnMsg.onchange = (e) => {
transcription.showOnMessage = e.currentTarget.checked;
rc.roomMessage('showTranscript', transcription.showOnMessage);
lsSettings.show_transcript_on_msg = transcription.showOnMessage;
rc.roomMessage('transcriptShowOnMsg', transcription.showOnMessage);
lsSettings.transcript_show_on_msg = transcription.showOnMessage;
lS.setSettings(lsSettings);
e.target.blur();
};
@@ -2096,11 +2101,13 @@ function handleRoomEmojiPicker() {
function loadSettingsFromLocalStorage() {
rc.showChatOnMessage = lsSettings.show_chat_on_msg;
transcription.showOnMessage = lsSettings.show_transcript_on_msg;
transcription.isPersistentMode = lsSettings.transcript_persistent_mode;
transcription.showOnMessage = lsSettings.transcript_show_on_msg;
rc.speechInMessages = lsSettings.speech_in_msg;
isPitchBarEnabled = lsSettings.pitch_bar;
isSoundEnabled = lsSettings.sounds;
showChatOnMsg.checked = rc.showChatOnMessage;
transcriptPersistentMode.checked = transcription.isPersistentMode;
transcriptShowOnMsg.checked = transcription.showOnMessage;
speechIncomingMsg.checked = rc.speechInMessages;
switchPitchBar.checked = isPitchBarEnabled;
@@ -2526,11 +2533,14 @@ function isHtml(str) {
function toggleWhiteboard() {
if (!wbIsOpen) rc.sound('open');
let whiteboard = rc.getId('whiteboard');
whiteboardCenter();
whiteboard.classList.toggle('show');
wbIsOpen = !wbIsOpen;
}
function whiteboardCenter() {
whiteboard.style.top = '50%';
whiteboard.style.left = '50%';
wbIsOpen = wbIsOpen ? false : true;
}
function setupWhiteboard() {

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.3.45
* @version 1.3.46
*
*/
@@ -4848,7 +4848,10 @@ class RoomClient {
case 'speechMessages':
this.userLog('info', `${icons.speech} Speech incoming messages ${status}`, 'top-end');
break;
case 'showTranscript':
case 'transcriptIsPersistentMode':
userLog('info', `${icons.transcript} Persistent transcription mode active: ${active}`, 'top-end');
break;
case 'transcriptShowOnMsg':
active
? userLog(
'info',

عرض الملف

@@ -81,6 +81,8 @@ class Transcription {
this.isBgTransparent = false;
this.isPinned = false;
this.isHidden = true;
this.isPersistentMode = false;
this.isPersistent = false;
this.showOnMessage = true;
}
@@ -102,7 +104,9 @@ class Transcription {
hide(transcriptionSpeechStart);
show(transcriptionSpeechStop);
setColor(transcriptionSpeechStatus, 'lime');
userLog('info', 'Transcription started', 'top-end');
!transcription.isPersistentMode
? userLog('info', 'Transcription started', 'top-end')
: (transcription.isPersistent = true);
};
this.transcription.onresult = (e) => {
@@ -130,8 +134,9 @@ class Transcription {
};
this.transcription.onerror = function (event) {
userLog('error', `Transcription error ${event.error}`, 'top-end', 6000);
console.error('Transcription error', event.error);
if (!transcription.isPersistent || !transcription.isPersistentMode)
userLog('error', `Transcription error ${event.error}`, 'top-end', 6000);
};
this.transcription.onend = function () {
@@ -139,7 +144,19 @@ class Transcription {
hide(transcriptionSpeechStop);
show(transcriptionSpeechStart);
setColor(transcriptionSpeechStatus, 'white');
userLog('info', 'Transcription stopped', 'top-end');
// Prevent stopping in the absence of speech...
if (
transcription.isPersistentMode &&
transcription.isPersistent &&
transcription.transcriptionRunning
) {
setTimeout(() => {
transcription.start();
}, 2000);
} else {
transcription.isPersistent = false;
userLog('info', 'Transcription stopped', 'top-end');
}
};
this.isTranscriptionSupported = true;
@@ -398,6 +415,7 @@ class Transcription {
stop() {
this.transcriptionRunning = false;
this.isPersistent = false;
this.selectDisabled(false);
this.transcription.stop();
}
@@ -405,5 +423,6 @@ class Transcription {
selectDisabled(disabled = false) {
transcriptionLanguage.disabled = disabled;
transcriptionDialect.disabled = disabled;
transcriptPersistentMode.disabled = disabled;
}
}