Skip to content

Commit

Permalink
[mirotalksfu] - add start all transcriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Dec 17, 2024
1 parent 9c8df9b commit 0ea6038
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev dependencies: {
* @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.6.49
* @version 1.6.50
*
*/

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.6.49",
"version": "1.6.50",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down Expand Up @@ -58,7 +58,7 @@
},
"dependencies": {
"@mattermost/client": "^10.2.0",
"@sentry/node": "^8.45.0",
"@sentry/node": "^8.46.0",
"axios": "^1.7.9",
"colors": "1.4.0",
"compression": "1.7.5",
Expand All @@ -78,7 +78,7 @@
"mediasoup-client": "3.7.18",
"ngrok": "^5.0.0-beta.2",
"nodemailer": "^6.9.16",
"openai": "^4.76.3",
"openai": "^4.77.0",
"qs": "6.13.1",
"socket.io": "4.8.1",
"swagger-ui-express": "5.0.1",
Expand Down
Binary file added public/images/transcription.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.49
* @version 1.6.50
*
*/

Expand Down Expand Up @@ -1758,6 +1758,9 @@ function handleButtons() {
transcriptionMinBtn.onclick = () => {
transcription.minimize();
};
transcriptionAllBtn.onclick = () => {
transcription.startAll();
};
transcriptionGhostBtn.onclick = () => {
transcription.toggleBg();
};
Expand Down
6 changes: 5 additions & 1 deletion public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.49
* @version 1.6.50
*
*/

Expand Down Expand Up @@ -111,6 +111,7 @@ const image = {
network: '../images/network.gif',
rtmp: '../images/rtmp.png',
save: '../images/save.png',
transcription: '../images/transcription.png',
};

const mediaType = {
Expand Down Expand Up @@ -7388,6 +7389,9 @@ class RoomClient {
case 'roomEmoji':
this.handleRoomEmoji(cmd);
break;
case 'transcriptionAll':
this.transcription.handleTranscriptionAll(cmd);
break;
case 'transcript':
this.transcription.handleTranscript(cmd);
break;
Expand Down
1 change: 1 addition & 0 deletions public/js/Rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function handleRules(isPresenter) {
BUTTONS.settings.sendEmailInvitation = true;

show(editorUnlockBtn);
show(transcriptionAllLi);
//...

// ##################################
Expand Down
58 changes: 58 additions & 0 deletions public/js/Transcription.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,64 @@ class Transcription {
};
}

handleTranscriptionAll(cmd) {
const { peer_name, transcriptionLanguageIndex, transcriptionDialectIndex } = cmd.data;

if (!this.speechTranscription) {
hide(transcriptionFooter);
rc.msgPopup(
'info',
`${peer_name} wants to start transcriptions for this session, but your browser does not support it. Please use a Chromium-based browser like Google Chrome, Microsoft Edge, or Brave.`,
);
return;
}

if (this.transcriptionRunning || !BUTTONS.main.transcriptionButton) return;

Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
showDenyButton: true,
background: swalBackground,
position: 'center',
imageUrl: image.transcription,
title: 'Start Transcription',
text: `${peer_name} wants to start the transcriptions for this session. Would you like to enable them?`,
confirmButtonText: `Yes`,
denyButtonText: `No`,
showClass: { popup: 'animate__animated animate__fadeInDown' },
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
}).then((result) => {
if (result.isConfirmed) {
if (this.isHidden) {
this.toggle();
}
if (!this.transcriptionRunning) {
transcriptionLanguage.selectedIndex = transcriptionLanguageIndex;
this.updateCountry();
transcriptionDialect.selectedIndex = transcriptionDialectIndex;
transcription.start();
}
}
});
}

startAll() {
if (!this.transcriptionRunning) {
transcription.start();
}
rc.emitCmd({
type: 'transcriptionAll',
broadcast: true,
data: {
peer_id: rc.peer_id,
peer_name: rc.peer_name,
transcriptionLanguageIndex: transcriptionLanguage.selectedIndex,
transcriptionDialectIndex: transcriptionDialect.selectedIndex,
},
});
}

start() {
try {
this.transcriptionRunning = true;
Expand Down
13 changes: 9 additions & 4 deletions public/views/Room.html
Original file line number Diff line number Diff line change
Expand Up @@ -1615,22 +1615,27 @@ <h2 class="poll-h2">Polls</h2>
</li>
<li>
<button id="transcriptionGhostBtn">
<i class="fas fa-circle-half-stroke"></i> Toggle bg
<i class="fas fa-circle-half-stroke"></i>&nbsp;Toggle bg
</button>
</li>
<li id="transcriptionAllLi" class="hidden">
<button id="transcriptionAllBtn">
<i class="fas fa-play"></i>&nbsp;Start for all
</button>
</li>
<li>
<button id="transcriptionSaveBtn"><i class="fas fa-save"></i> Save</button>
<button id="transcriptionSaveBtn"><i class="fas fa-save"></i>&nbsp;Save</button>
</li>
<li>
<button id="transcriptionCleanBtn"><i class="fas fa-trash"></i> Clean</button>
<button id="transcriptionCleanBtn"><i class="fas fa-trash"></i>&nbsp;Clean</button>
</li>
</ul>
</div>
<button id="transcriptionCloseBtn" class="fas fa-times"></button>
</div>
</header>
<main id="transcriptionChat" class="transcription-chat"></main>
<div class="transcription-inputarea">
<div id="transcriptionFooter" class="transcription-inputarea">
<select id="transcriptionLanguage" class="form-select text-light bg-dark"></select>
<select id="transcriptionDialect" class="form-select text-light bg-dark"></select>
<button id="transcriptionSpeechStart" class=""><i class="fas fa-play"></i></button>
Expand Down

0 comments on commit 0ea6038

Please sign in to comment.