[mirotalksfu] - responsive transcription and fix

هذا الالتزام موجود في:
Miroslav Pejic
2023-12-20 10:18:33 +01:00
الأصل 6d89d64565
التزام a1ac4d46db
3 ملفات معدلة مع 34 إضافات و10 حذوفات

عرض الملف

@@ -3285,6 +3285,7 @@ class RoomClient {
if (!this.isMobileDevice) this.makeDraggable(chatRoom, chatHeader); if (!this.isMobileDevice) this.makeDraggable(chatRoom, chatHeader);
if (!this.isPlistOpen()) this.toggleShowParticipants(); if (!this.isPlistOpen()) this.toggleShowParticipants();
if (!chatRoom.classList.contains('container')) chatRoom.classList.add('container'); if (!chatRoom.classList.contains('container')) chatRoom.classList.add('container');
resizeChatRoom();
} }
chatCenter() { chatCenter() {

عرض الملف

@@ -80,6 +80,7 @@ class Transcription {
this.transcripts = []; this.transcripts = [];
this.isBgTransparent = false; this.isBgTransparent = false;
this.isPinned = false; this.isPinned = false;
this.isHidden = true;
this.showOnMessage = true; this.showOnMessage = true;
} }
@@ -98,8 +99,8 @@ class Transcription {
this.transcription.onstart = function () { this.transcription.onstart = function () {
console.log('Transcription started'); console.log('Transcription started');
transcriptionSpeechStart.style.display = 'none'; hide(transcriptionSpeechStart);
transcriptionSpeechStop.style.display = 'block'; show(transcriptionSpeechStop);
setColor(transcriptionSpeechStatus, 'lime'); setColor(transcriptionSpeechStatus, 'lime');
userLog('info', 'Transcription started', 'top-end'); userLog('info', 'Transcription started', 'top-end');
}; };
@@ -135,8 +136,8 @@ class Transcription {
this.transcription.onend = function () { this.transcription.onend = function () {
console.log('Transcription stopped'); console.log('Transcription stopped');
transcriptionSpeechStop.style.display = 'none'; hide(transcriptionSpeechStop);
transcriptionSpeechStart.style.display = 'block'; show(transcriptionSpeechStart);
setColor(transcriptionSpeechStatus, 'white'); setColor(transcriptionSpeechStatus, 'white');
userLog('info', 'Transcription stopped', 'top-end'); userLog('info', 'Transcription stopped', 'top-end');
}; };
@@ -167,7 +168,7 @@ class Transcription {
const time_stamp = rc.getTimeNow(); const time_stamp = rc.getTimeNow();
const avatar_image = rc.genAvatarSvg(peer_name, 32); const avatar_image = rc.genAvatarSvg(peer_name, 32);
if (this.isHidden()) { if (this.isHidden) {
if (this.showOnMessage) { if (this.showOnMessage) {
this.toggle(); this.toggle();
} else { } else {
@@ -212,19 +213,17 @@ class Transcription {
}, duration); }, duration);
} }
isHidden() {
return Boolean(transcriptionRoom.style.display === 'none' || transcriptionRoom.style.display === '');
}
toggle() { toggle() {
if (this.isHidden()) { if (this.isHidden) {
this.center(); this.center();
transcriptionRoom.style.display = 'block'; transcriptionRoom.style.display = 'block';
rc.sound('open'); rc.sound('open');
} else { } else {
transcriptionRoom.style.display = 'none'; transcriptionRoom.style.display = 'none';
} }
this.isHidden = !this.isHidden;
if (this.isPinned) this.unpinned(); if (this.isPinned) this.unpinned();
resizeTranscriptionRoom();
} }
toggleBg() { toggleBg() {
@@ -312,6 +311,7 @@ class Transcription {
this.isPinned = false; this.isPinned = false;
setColor(transcriptionTogglePinBtn, 'white'); setColor(transcriptionTogglePinBtn, 'white');
resizeVideoMedia(); resizeVideoMedia();
resizeTranscriptionRoom();
transcriptionRoom.style.resize = 'both'; transcriptionRoom.style.resize = 'both';
if (!rc.isMobileDevice) rc.makeDraggable(transcriptionRoom, transcriptionHeader); if (!rc.isMobileDevice) rc.makeDraggable(transcriptionRoom, transcriptionHeader);
} }

عرض الملف

@@ -111,6 +111,7 @@ function setWidth(Cameras, width, bigWidth, margin, maxHeight, isOneVideoElement
const MOBILE_BREAKPOINT = 500; const MOBILE_BREAKPOINT = 500;
const TABLET_BREAKPOINT = 580; const TABLET_BREAKPOINT = 580;
const DESKTOP_BREAKPOINT = 730; const DESKTOP_BREAKPOINT = 730;
const CUSTOM_BREAKPOINT = 680;
const mainButtonsBar = document.querySelectorAll('#control button'); const mainButtonsBar = document.querySelectorAll('#control button');
const mainButtonsIcon = document.querySelectorAll('#control button i'); const mainButtonsIcon = document.querySelectorAll('#control button i');
@@ -172,6 +173,27 @@ function resizeChatRoom() {
windowWidth <= DESKTOP_BREAKPOINT || windowHeight <= DESKTOP_BREAKPOINT ? rc.chatMaximize() : rc.chatMinimize(); windowWidth <= DESKTOP_BREAKPOINT || windowHeight <= DESKTOP_BREAKPOINT ? rc.chatMaximize() : rc.chatMinimize();
} }
// ####################################################
// RESPONSIVE TRANSCRIPTION
// ####################################################
function resizeTranscriptionRoom() {
if (
DetectRTC.isMobileDevice ||
!Boolean(transcription.speechTranscription) ||
transcription.isHidden ||
transcription.isPinned
)
return;
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
windowWidth <= CUSTOM_BREAKPOINT || windowHeight <= CUSTOM_BREAKPOINT
? transcription.maximize()
: transcription.minimize();
}
// #################################################### // ####################################################
// WINDOW LOAD/RESIZE EVENT // WINDOW LOAD/RESIZE EVENT
// #################################################### // ####################################################
@@ -185,6 +207,7 @@ window.addEventListener(
resizeVideoMedia(); resizeVideoMedia();
resizeMainButtons(); resizeMainButtons();
resizeChatRoom(); resizeChatRoom();
resizeTranscriptionRoom();
}; };
}, },
false, false,